[PATCH] don't use deprecated ->io_str

nick black <[email protected]> Wed, 14 Nov 2012 23:40:32 -0500
Newsgroups gmane.comp.printing.ghostscript.jbig2dec.devel
Message-ID <[email protected]>
  ----------------------------------------------
howdy! this patch was developed for the sprezzos build of jbig2dec, where
we need build againt libpng15. i haven't tested to ensure this works with
libpng12, but it ought be simple enough. please apply if deemed appropriate.
thanks! this patch is also available at:
 https://github.com/dankamongmen/jbig2dec/commit/76e51e58266cc8a2aa58e79eb1582c1c842118b5
  ----------------------------------------------

recent libpng has deprecated and finally removed external access to the
io_str member of pngstructs. instead, use the function png_get_io_ptr(),
which accepts an opaque pngstruct. we also eliminate several casts.
---
 jbig2_image_png.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/jbig2_image_png.c b/jbig2_image_png.c
index cbef68c..0a01e66 100644
--- a/jbig2_image_png.c
+++ b/jbig2_image_png.c
@@ -38,7 +38,7 @@ jbig2_png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
 {
     png_size_t check;
 
-    check = fwrite(data, 1, length, (png_FILE_p)png_ptr->io_ptr);
+    check = fwrite(data, 1, length, png_get_io_ptr(png_ptr));
     if (check != length) {
       png_error(png_ptr, "Write Error");
     }
@@ -47,8 +47,9 @@ jbig2_png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
 static void
 jbig2_png_flush(png_structp png_ptr)
 {
-    png_FILE_p io_ptr;
-    io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
+    png_voidp io_ptr;
+
+    io_ptr = png_get_io_ptr(png_ptr);
     if (io_ptr != NULL)
         fflush(io_ptr);
 }
-- 
nick black     http://www.sprezzatech.com -- unix and hpc consulting
to make an apple pie from scratch, you need first invent a universe.