Mercurial > dillo_port1.3
changeset 1702:341debc7a62c
use png_uint_32 for png width and height
For libpng-1.2, png_uint_32 is an unsigned long. For libpng-1.4, it's
normally an unsigned int.
With 1.4, gcc complained because png_get_IHDR() wants a ptr to whatever a
png_uint_32 is, and dillo gave a ptr to an unsigned long.
author | corvid <corvid@lavabit.com> |
---|---|
date | Mon, 06 Sep 2010 20:23:50 +0000 |
parents | dbd67f965e5e |
children | d91812cc9d4b |
files | src/png.c |
diffstat | 1 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/png.c Mon Sep 06 21:41:00 2010 +0200 +++ b/src/png.c Mon Sep 06 20:23:50 2010 +0000 @@ -65,8 +65,8 @@ int version; /* Secondary Key for the dicache */ double display_exponent; /* gamma correction */ - ulong_t width; /* png image width */ - ulong_t height; /* png image height */ + png_uint_32 width; /* png image width */ + png_uint_32 height; /* png image height */ png_structp png_ptr; /* libpng private data */ png_infop info_ptr; /* libpng private info */ uchar_t *image_data; /* decoded image data */ @@ -135,17 +135,17 @@ &bit_depth, &color_type, &interlace_type, NULL, NULL); /* check max image size */ - if (png->width <= 0 || png->height <= 0 || + if (png->width == 0 || png->height == 0 || png->width > IMAGE_MAX_AREA / png->height) { - MSG("Png_datainfo_callback: suspicious image size request %ldx%ld\n", - png->width, png->height); + MSG("Png_datainfo_callback: suspicious image size request %lux%lu\n", + (ulong_t) png->width, (ulong_t) png->height); Png_error_handling(png_ptr, "Aborting..."); return; /* not reached */ } - _MSG("Png_datainfo_callback: png->width = %ld\n" - "Png_datainfo_callback: png->height = %ld\n", - png->width, png->height); + _MSG("Png_datainfo_callback: png->width = %lu\n" + "Png_datainfo_callback: png->height = %lu\n", + (ulong_t) png->width, (ulong_t) png->height); /* we need RGB/RGBA in the end */ if (color_type == PNG_COLOR_TYPE_PALETTE && bit_depth <= 8) { @@ -193,9 +193,9 @@ /* init Dillo specifics */ _MSG("Png_datainfo_callback: rowbytes = %d\n" - "Png_datainfo_callback: width = %ld\n" - "Png_datainfo_callback: height = %ld\n", - png->rowbytes, png->width, png->height); + "Png_datainfo_callback: width = %lu\n" + "Png_datainfo_callback: height = %lu\n", + png->rowbytes, (ulong_t) png->width, (ulong_t) png->height); png->image_data = (uchar_t *) dMalloc(png->rowbytes * png->height); png->row_pointers = (uchar_t **) dMalloc(png->height * sizeof(uchar_t *));