[magick-developers] [PATCH] [RFC] unbreak libpng in the presence of versioned symbols and libpng > 1.2.8

Nix nix at esperi.org.uk
Sun Apr 30 07:47:17 PDT 2006


(This patch is against svn #3417.)

There are two bugs here, both in the defined(PNG_USE_PNGGCCRD) &&
defined(PNG_ASSEMBLER_CODE_SUPPORTED) && (PNG_LIBPNG_VER >= 10200) block
around line 1750, both deriving from broken example code in the png.3
manpage (which I shall submit a separate patch against to the libpng
upstream):

 - The code calls png_access_version(), which doesn't exist: the
   correct name is png_access_version_number()

 - it also uses the png_ptr variable... only in this function the
   png_struct variable we want is called `ping'.

2006-04-30  Nix  <nix at esperi.org.uk>

	* coders/png.c (ReadOnePNGImage): Use png_access_version_number(),
        not png_access_version().
        Fix name of png_struct variable.

Index: coders/png.c
=================================================================== ---
coders/png.c (revision 3417)
+++ coders/png.c	(working copy)
@@ -1755,7 +1755,7 @@
 #if defined(PNG_USE_PNGGCCRD) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) \
 && (PNG_LIBPNG_VER >= 10200)
   /* Disable thread-unsafe features of pnggccrd */
-  if (png_access_version() >= 10200)
+  if (png_access_version_number() >= 10200)
   {
     png_uint_32 mmx_disable_mask=0;
     png_uint_32 asm_flags;
@@ -1764,8 +1764,8 @@
                         | PNG_ASM_FLAG_MMX_READ_FILTER_SUB   \
                         | PNG_ASM_FLAG_MMX_READ_FILTER_AVG   \
                         | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
-    asm_flags=png_get_asm_flags(png_ptr);
-    png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
+    asm_flags=png_get_asm_flags(ping);
+    png_set_asm_flags(ping, asm_flags & ~mmx_disable_mask);
   }
 #endif
 

Somehow I don't think this hunk's been tested much yet. :)


More information about the Magick-developers mailing list