|
Added
Link Here
|
| 1 |
--- IMG_png.c.orig 2012-01-21 01:51:33 UTC |
| 2 |
+++ IMG_png.c |
| 3 |
@@ -71,33 +71,61 @@ |
| 4 |
#include <png.h> |
| 5 |
|
| 6 |
/* Check for the older version of libpng */ |
| 7 |
-#if (PNG_LIBPNG_VER_MAJOR == 1) && (PNG_LIBPNG_VER_MINOR < 4) |
| 8 |
+#if (PNG_LIBPNG_VER_MAJOR == 1) |
| 9 |
+#if (PNG_LIBPNG_VER_MINOR < 5) |
| 10 |
#define LIBPNG_VERSION_12 |
| 11 |
+typedef png_bytep png_const_bytep; |
| 12 |
+typedef png_color *png_const_colorp; |
| 13 |
+typedef png_color_16 *png_const_color_16p; |
| 14 |
#endif |
| 15 |
+#if (PNG_LIBPNG_VER_MINOR < 4) |
| 16 |
+typedef png_structp png_const_structp; |
| 17 |
+typedef png_infop png_const_infop; |
| 18 |
+#endif |
| 19 |
+#if (PNG_LIBPNG_VER_MINOR < 6) |
| 20 |
+typedef png_structp png_structrp; |
| 21 |
+typedef png_infop png_inforp; |
| 22 |
+typedef png_const_structp png_const_structrp; |
| 23 |
+typedef png_const_infop png_const_inforp; |
| 24 |
+/* noconst15: version < 1.6 doesn't have const, >= 1.6 adds it */ |
| 25 |
+/* noconst16: version < 1.6 does have const, >= 1.6 removes it */ |
| 26 |
+typedef png_structp png_noconst15_structrp; |
| 27 |
+typedef png_inforp png_noconst15_inforp; |
| 28 |
+typedef png_const_inforp png_noconst16_inforp; |
| 29 |
+#else |
| 30 |
+typedef png_const_structp png_noconst15_structrp; |
| 31 |
+typedef png_const_inforp png_noconst15_inforp; |
| 32 |
+typedef png_inforp png_noconst16_inforp; |
| 33 |
+#endif |
| 34 |
+#else |
| 35 |
+typedef png_const_structp png_noconst15_structrp; |
| 36 |
+typedef png_const_inforp png_noconst15_inforp; |
| 37 |
+typedef png_inforp png_noconst16_inforp; |
| 38 |
+#endif |
| 39 |
|
| 40 |
static struct { |
| 41 |
int loaded; |
| 42 |
void *handle; |
| 43 |
- png_infop (*png_create_info_struct) (png_structp png_ptr); |
| 44 |
+ png_infop (*png_create_info_struct) (png_noconst15_structrp png_ptr); |
| 45 |
png_structp (*png_create_read_struct) (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn); |
| 46 |
void (*png_destroy_read_struct) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr); |
| 47 |
- png_uint_32 (*png_get_IHDR) (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method); |
| 48 |
- png_voidp (*png_get_io_ptr) (png_structp png_ptr); |
| 49 |
- png_byte (*png_get_channels) (png_structp png_ptr, png_infop info_ptr); |
| 50 |
- png_uint_32 (*png_get_PLTE) (png_structp png_ptr, png_infop info_ptr, png_colorp *palette, int *num_palette); |
| 51 |
- png_uint_32 (*png_get_tRNS) (png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values); |
| 52 |
- png_uint_32 (*png_get_valid) (png_structp png_ptr, png_infop info_ptr, png_uint_32 flag); |
| 53 |
- void (*png_read_image) (png_structp png_ptr, png_bytepp image); |
| 54 |
- void (*png_read_info) (png_structp png_ptr, png_infop info_ptr); |
| 55 |
- void (*png_read_update_info) (png_structp png_ptr, png_infop info_ptr); |
| 56 |
- void (*png_set_expand) (png_structp png_ptr); |
| 57 |
- void (*png_set_gray_to_rgb) (png_structp png_ptr); |
| 58 |
- void (*png_set_packing) (png_structp png_ptr); |
| 59 |
- void (*png_set_read_fn) (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn); |
| 60 |
- void (*png_set_strip_16) (png_structp png_ptr); |
| 61 |
- int (*png_sig_cmp) (png_bytep sig, png_size_t start, png_size_t num_to_check); |
| 62 |
+ png_uint_32 (*png_get_IHDR) (png_noconst15_structrp png_ptr, png_noconst15_inforp info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method); |
| 63 |
+ png_voidp (*png_get_io_ptr) (png_noconst15_structrp png_ptr); |
| 64 |
+ png_byte (*png_get_channels) (png_const_structrp png_ptr, png_const_inforp info_ptr); |
| 65 |
+ png_uint_32 (*png_get_PLTE) (png_const_structrp png_ptr, png_noconst16_inforp info_ptr, png_colorp *palette, int *num_palette); |
| 66 |
+ png_uint_32 (*png_get_tRNS) (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values); |
| 67 |
+ png_uint_32 (*png_get_valid) (png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 flag); |
| 68 |
+ void (*png_read_image) (png_structrp png_ptr, png_bytepp image); |
| 69 |
+ void (*png_read_info) (png_structrp png_ptr, png_inforp info_ptr); |
| 70 |
+ void (*png_read_update_info) (png_structrp png_ptr, png_inforp info_ptr); |
| 71 |
+ void (*png_set_expand) (png_structrp png_ptr); |
| 72 |
+ void (*png_set_gray_to_rgb) (png_structrp png_ptr); |
| 73 |
+ void (*png_set_packing) (png_structrp png_ptr); |
| 74 |
+ void (*png_set_read_fn) (png_structrp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn); |
| 75 |
+ void (*png_set_strip_16) (png_structrp png_ptr); |
| 76 |
+ int (*png_sig_cmp) (png_const_bytep sig, png_size_t start, png_size_t num_to_check); |
| 77 |
#ifndef LIBPNG_VERSION_12 |
| 78 |
- jmp_buf* (*png_set_longjmp_fn) (png_structp, png_longjmp_ptr, size_t); |
| 79 |
+ jmp_buf* (*png_set_longjmp_fn) (png_structrp, png_longjmp_ptr, size_t); |
| 80 |
#endif |
| 81 |
} lib; |
| 82 |
|