Package: pngmeta
Version: 1.11-7
Severity: normal
Tags: patch pending

Dear maintainer,

I've prepared an NMU for pngmeta (versioned as 1.11-7.1) and
uploaded it to DELAYED/5. Please feel free to tell me if I
should delay it longer.

Regards.
diff -u pngmeta-1.11/pngmeta.c pngmeta-1.11/pngmeta.c
--- pngmeta-1.11/pngmeta.c
+++ pngmeta-1.11/pngmeta.c
@@ -51,6 +51,9 @@
 /* Needed to access various internal PNG chunk routines */
 #define PNG_INTERNAL
 #include <png.h>
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+#include <zlib.h>
+#endif
 
 #ifdef __TURBOC__
 #include <mem.h>
@@ -463,7 +466,11 @@
   }
   
 
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+  if (setjmp(png_jmpbuf((png_ptr))))
+#else
   if (setjmp(png_ptr->jmpbuf))
+#endif
   {
     png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
     fprintf(STDERR, "%s: libpng read error for %s\n", progname, pngfile);
@@ -497,21 +504,33 @@
     
 */
     char value[80]; /* Sorry for the fixed-size buffer (big enough) */
-    
+       png_uint_32 height, width;
+       int bit_depth, color_type, interlace_type;
+
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+       png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, 
&color_type, &interlace_type, NULL, NULL);
+#else
+       bit_depth = info_ptr->bit_depth;
+       width = info_ptr->width;
+       height = info_ptr->height;
+       color_type = info_ptr->color_type;
+       interlace_type = info_ptr->interlace_type;
+#endif
+
     print_kv(out_fp, output_type, "image-format", "PNG");
-    
-    sprintf(value, "%d", info_ptr->bit_depth);
+
+    sprintf(value, "%d", bit_depth);
     print_kv(out_fp, output_type, "image-colors", value);
     
-    sprintf(value, "%ld", info_ptr->width);
+    sprintf(value, "%ld", width);
     print_kv(out_fp, output_type, "image-width", value);
     
-    sprintf(value, "%ld", info_ptr->height);
+    sprintf(value, "%ld", height);
     print_kv(out_fp, output_type, "image-height", value);
     
     sprintf(value, "%s, %sinterlaced",
-           (info_ptr->color_type>6) ? png_color_type[1] : 
png_color_type[info_ptr->color_type],
-           info_ptr->interlace_type ? "" : "non-");
+           (color_type>6) ? png_color_type[1] : png_color_type[color_type],
+           interlace_type ? "" : "non-");
 
     print_kv(out_fp, output_type, "image-type", value);
   }
@@ -531,15 +550,30 @@
     print_kv(out_fp, output_type, end_info->text[i].key, 
end_info->text[i].text);
     
 #endif
-  
+
+  { 
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+  int valid = png_get_valid(png_ptr, info_ptr, 0);
+  int end_valid = png_get_valid(png_ptr, end_info, 0);
+  png_timep *mod_time, *end_mod_time;
+
+  png_get_tIME(png_ptr, info_ptr, mod_time);
+  png_get_tIME(png_ptr, end_info, end_mod_time);
+#else
+  int valid = info_ptr->valid;
+  int end_valid = end_info->valid;
+  png_timep *mod_time = &info_ptr->mod_time;
+  png_timep *end_mod_time = &end_info->mod_time;
+#endif
+
   /* Print modification time (tIME chunk) if present */
-  if (info_ptr->valid & PNG_INFO_tIME)
+  if (valid & PNG_INFO_tIME)
     print_kv(out_fp, output_type, "Modification Time",
-             png_convert_to_rfc1123(png_ptr, &info_ptr->mod_time));
-  else if (end_info->valid & PNG_INFO_tIME)
+             png_convert_to_rfc1123(png_ptr, &mod_time));
+  else if (end_valid & PNG_INFO_tIME)
     print_kv(out_fp, output_type, "Modification Time",
-             png_convert_to_rfc1123(png_ptr, &end_info->mod_time));
-
+             png_convert_to_rfc1123(png_ptr, &end_mod_time));
+  }
 
   print_end_image(out_fp, output_type);
 
@@ -550,9 +584,8 @@
 
   print_finish(out_fp, output_type);
   
-  
   /* Cleanup */
-  png_read_destroy(png_ptr, info_ptr, end_info);
+  png_destroy_read_struct(png_ptr, info_ptr, end_info);
 
   fclose(in_fp);
   
diff -u pngmeta-1.11/debian/changelog pngmeta-1.11/debian/changelog
--- pngmeta-1.11/debian/changelog
+++ pngmeta-1.11/debian/changelog
@@ -1,3 +1,11 @@
+pngmeta (1.11-7.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix "FTBFS with libpng 1.5", apply patch from Nobuhiro (Closes: #636998)
+  * Replace png_read_destroy with png_read_destroy_struct (Closes: #808534)
+
+ -- Tobias Frost <t...@debian.org>  Wed, 06 Jan 2016 23:46:51 +0100
+
 pngmeta (1.11-7) unstable; urgency=low
 
   * Change of address.

Reply via email to