From 7aacd895eec167b94303890299662418ab9f1da3 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 9 Nov 2009 10:47:12 -0600 Subject: [PATCH] [master] Fixed deprecated usages in contrib directory. --- ANNOUNCE | 2 ++ CHANGES | 2 ++ contrib/gregbook/readpng.c | 2 +- contrib/gregbook/readpng2.c | 9 ++++++--- contrib/pngminus/png2pnm.c | 2 +- contrib/visupng/PngFile.c | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index fdb4097f..0e41612c 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -147,6 +147,8 @@ version 1.2.41beta17 [November 9, 2009] Updated CMakeLists.txt to add "-DPNG_CONFIGURE_LIBPNG" to the definitions. Marked deprecated function prototypes with PNG_DEPRECATED. Marked memory allocation function prototypes with PNG_ALLOCATED. + Changed png_check_sig() to !png_sig_cmp() in contrib programs. + Corrected the png_get_IHDR() call in contrib/gregbook/readpng2.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net diff --git a/CHANGES b/CHANGES index 7202c7c5..97e50d16 100644 --- a/CHANGES +++ b/CHANGES @@ -2578,6 +2578,8 @@ version 1.2.41beta17 [November 9, 2009] Updated CMakeLists.txt to add "-DPNG_CONFIGURE_LIBPNG" to the definitions. Marked deprecated function prototypes with PNG_DEPRECATED. Marked memory allocation function prototypes with PNG_ALLOCATED. + Changed png_check_sig() to !png_sig_cmp() in contrib programs. + Corrected the png_get_IHDR() call in contrib/gregbook/readpng2.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/contrib/gregbook/readpng.c b/contrib/gregbook/readpng.c index d87f6c7e..abfc1fb4 100644 --- a/contrib/gregbook/readpng.c +++ b/contrib/gregbook/readpng.c @@ -93,7 +93,7 @@ int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight) * have used slightly more general png_sig_cmp() function instead */ fread(sig, 1, 8, infile); - if (!png_check_sig(sig, 8)) + if (png_sig_cmp(sig, 0, 8)) return 1; /* bad signature */ diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c index 92150428..2ee6b681 100644 --- a/contrib/gregbook/readpng2.c +++ b/contrib/gregbook/readpng2.c @@ -159,7 +159,7 @@ void readpng2_version_info(void) int readpng2_check_sig(uch *sig, int num) { - return png_check_sig(sig, num); + return !png_sig_cmp(sig, 0, num); } @@ -379,6 +379,7 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr) { mainprog_info *mainprog_ptr; int color_type, bit_depth; + png_uint_32 width, height; double gamma; @@ -414,8 +415,10 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr) /* this is just like in the non-progressive case */ - png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width, - &mainprog_ptr->height, &bit_depth, &color_type, NULL, NULL, NULL); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, + NULL, NULL, NULL); + mainprog_ptr->width = (ulg)width; + mainprog_ptr->height = (ulg)height; /* since we know we've read all of the PNG file's "header" (i.e., up diff --git a/contrib/pngminus/png2pnm.c b/contrib/pngminus/png2pnm.c index 010870a7..ac295aaf 100644 --- a/contrib/pngminus/png2pnm.c +++ b/contrib/pngminus/png2pnm.c @@ -211,7 +211,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a if (ret != 8) return FALSE; - ret = png_check_sig (buf, 8); + ret = !png_sig_cmp (buf, 0, 8); if (!ret) return FALSE; diff --git a/contrib/visupng/PngFile.c b/contrib/visupng/PngFile.c index 6154ce23..ff6d155e 100644 --- a/contrib/visupng/PngFile.c +++ b/contrib/visupng/PngFile.c @@ -126,7 +126,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData, // first check the eight byte PNG signature fread(pbSig, 1, 8, pfFile); - if (!png_check_sig(pbSig, 8)) + if (png_sig_cmp(pbSig, 0, 8)) { *ppbImageData = pbImageData = NULL; return FALSE;