summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2010-09-06 20:23:50 +0000
committercorvid <corvid@lavabit.com>2010-09-06 20:23:50 +0000
commit9a91b07ff2728cf71c3e9e6c5fc4204b3f4eeebc (patch)
tree2fe8cc608e048f114a4d60955c1df738976d67f1 /src
parent7212d9a447c7849cdb2730b645182b4037355e94 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/png.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/png.c b/src/png.c
index 15f26e3b..b82046b9 100644
--- a/src/png.c
+++ b/src/png.c
@@ -65,8 +65,8 @@ struct _DilloPng {
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 @@ Png_datainfo_callback(png_structp png_ptr, png_infop info_ptr)
&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 @@ Png_datainfo_callback(png_structp png_ptr, png_infop info_ptr)
/* 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 *));