From 983ec160b41eb8e9a31da8672dbde55fed558fd8 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 7 Mar 1998 11:24:03 -0600 Subject: [PATCH] Imported from libpng-0.99j.tar --- pngrutil.c | 30 +++++++++++++++--------------- pngtest.c | 10 +++++----- pngwrite.c | 8 ++++---- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pngrutil.c b/pngrutil.c index 2a2bbd86..b275e7e5 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1704,7 +1704,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, case 1: { png_bytep sp, dp; - png_uint_32 sshift, dshift; + int sshift, dshift; int s_start, s_end, s_inc; png_byte v; png_uint_32 i; @@ -1715,8 +1715,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, #if defined(PNG_READ_PACKSWAP_SUPPORTED) if (transformations & PNG_PACKSWAP) { - sshift = (png_uint_32)((row_info->width + 7) & 7); - dshift = (png_uint_32)((final_width + 7) & 7); + sshift = (int)((row_info->width + 7) & 7); + dshift = (int)((final_width + 7) & 7); s_start = 7; s_end = 0; s_inc = -1; @@ -1724,8 +1724,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, else #endif { - sshift = 7 - (png_uint_32)((row_info->width + 7) & 7); - dshift = 7 - (png_uint_32)((final_width + 7) & 7); + sshift = 7 - (int)((row_info->width + 7) & 7); + dshift = 7 - (int)((final_width + 7) & 7); s_start = 0; s_end = 7; s_inc = 1; @@ -1759,7 +1759,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, case 2: { png_bytep sp, dp; - png_uint_32 sshift, dshift; + int sshift, dshift; int s_start, s_end, s_inc; png_uint_32 i; @@ -1768,8 +1768,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, #if defined(PNG_READ_PACKSWAP_SUPPORTED) if (transformations & PNG_PACKSWAP) { - sshift = (png_uint_32)(((row_info->width + 3) & 3) << 1); - dshift = (png_uint_32)(((final_width + 3) & 3) << 1); + sshift = (int)(((row_info->width + 3) & 3) << 1); + dshift = (int)(((final_width + 3) & 3) << 1); s_start = 6; s_end = 0; s_inc = -2; @@ -1777,8 +1777,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, else #endif { - sshift = (png_uint_32)((3 - ((row_info->width + 3) & 3)) << 1); - dshift = (png_uint_32)((3 - ((final_width + 3) & 3)) << 1); + sshift = (int)((3 - ((row_info->width + 3) & 3)) << 1); + dshift = (int)((3 - ((final_width + 3) & 3)) << 1); s_start = 0; s_end = 6; s_inc = 2; @@ -1815,7 +1815,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, case 4: { png_bytep sp, dp; - png_uint_32 sshift, dshift; + int sshift, dshift; int s_start, s_end, s_inc; png_uint_32 i; @@ -1824,8 +1824,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, #if defined(PNG_READ_PACKSWAP_SUPPORTED) if (transformations & PNG_PACKSWAP) { - sshift = (png_uint_32)(((row_info->width + 1) & 1) << 2); - dshift = (png_uint_32)(((final_width + 1) & 1) << 2); + sshift = (int)(((row_info->width + 1) & 1) << 2); + dshift = (int)(((final_width + 1) & 1) << 2); s_start = 4; s_end = 0; s_inc = -4; @@ -1833,8 +1833,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, else #endif { - sshift = (png_uint_32)((1 - ((row_info->width + 1) & 1)) << 2); - dshift = (png_uint_32)((1 - ((final_width + 1) & 1)) << 2); + sshift = (int)((1 - ((row_info->width + 1) & 1)) << 2); + dshift = (int)((1 - ((final_width + 1) & 1)) << 2); s_start = 0; s_end = 4; s_inc = 4; diff --git a/pngtest.c b/pngtest.c index 5983ca34..9481427e 100644 --- a/pngtest.c +++ b/pngtest.c @@ -54,7 +54,7 @@ static int status_dots=1; void read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass); void read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) { - if(png_ptr == NULL || row_number > 0x3fffffff) return; + if(png_ptr == NULL || row_number > 0x3fffffffL) return; if(status_pass != pass) { fprintf(stdout,"\n Pass %d: ",pass); @@ -72,7 +72,7 @@ void read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) void write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass); void write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) { - if(png_ptr == NULL || row_number > 0x3fffffff || pass > 7) return; + if(png_ptr == NULL || row_number > 0x3fffffffL || pass > 7) return; fprintf(stdout, "w"); } @@ -106,7 +106,7 @@ void count_black_pixels(png_structp png_ptr, png_row_infop row_info, { int pos=0; png_uint_32 n; - for (n=0; n<(int)row_info->width; n++) + for (n=0; nwidth; n++) { if(row_info->bit_depth == 1) if(((*dp << pos++ )& 0x80) == 0) black_pixels++; @@ -869,8 +869,8 @@ int test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) PNG_CONST char *inname = "pngtest/png"; PNG_CONST char *outname = "pngout/png"; #else -static char *inname = "pngtest.png"; -static char *outname = "pngout.png"; +static PNG_CONST char *inname = "pngtest.png"; +static PNG_CONST char *outname = "pngout.png"; #endif int diff --git a/pngwrite.c b/pngwrite.c index afb4b43b..e7e1fb3b 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -834,10 +834,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method, if (png_ptr->filter_weights == NULL) { - png_ptr->filter_weights = png_malloc(png_ptr, + png_ptr->filter_weights = (png_uint_16p) png_malloc(png_ptr, (png_uint_32)(sizeof(png_uint_16) * num_weights)); - png_ptr->inv_filter_weights = png_malloc(png_ptr, + png_ptr->inv_filter_weights = (png_uint_16p) png_malloc(png_ptr, (png_uint_32)(sizeof(png_uint_16) * num_weights)); for (i = 0; i < num_weights; i++) @@ -869,10 +869,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method, */ if (png_ptr->filter_costs == NULL) { - png_ptr->filter_costs = png_malloc(png_ptr, + png_ptr->filter_costs = (png_uint_16p) png_malloc(png_ptr, (png_uint_32)(sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST)); - png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr, + png_ptr->inv_filter_costs = (png_uint_16p) png_malloc(png_ptr, (png_uint_32)(sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST)); for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)