libpng 1.6.10 - Merge seekable png patch
Change-Id: I3aa6d8775b884f719375c5aaa458a5c27c120b38
diff --git a/pngrio.c b/pngrio.c
index d75ac5b..429dffd 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -38,8 +38,22 @@
else
png_error(png_ptr, "Call to NULL read function");
+#ifdef PNG_INDEX_SUPPORTED
+ png_ptr->total_data_read += length;
+#endif
}
+#ifdef PNG_INDEX_SUPPORTED
+void /* PRIVATE */
+png_seek_data(png_structp png_ptr, png_uint_32 offset)
+{
+ if (png_ptr->seek_data_fn != NULL)
+ (*(png_ptr->seek_data_fn))(png_ptr, offset);
+ else
+ png_error(png_ptr, "Call to NULL seek function");
+}
+#endif
+
#ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual reading of data. If you are
* not reading from a standard C stream, you should create a replacement
@@ -117,4 +131,15 @@
png_ptr->output_flush_fn = NULL;
#endif
}
+
+#ifdef PNG_INDEX_SUPPORTED
+void PNGAPI
+png_set_seek_fn(png_structp png_ptr, png_seek_ptr seek_data_fn)
+{
+ if (png_ptr == NULL)
+ return;
+ png_ptr->seek_data_fn = seek_data_fn;
+}
+#endif
+
#endif /* PNG_READ_SUPPORTED */