OLD | NEW |
1 | 1 |
2 /* pngrutil.c - utilities to read a PNG file | 2 /* pngrutil.c - utilities to read a PNG file |
3 * | 3 * |
4 * Last changed in libpng 1.2.45 [July 7, 2011] | 4 * Last changed in libpng 1.2.45 [July 7, 2011] |
5 * Copyright (c) 1998-2011 Glenn Randers-Pehrson | 5 * Copyright (c) 1998-2011 Glenn Randers-Pehrson |
6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) | 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) | 7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
8 * | 8 * |
9 * This code is released under the libpng license. | 9 * This code is released under the libpng license. |
10 * For conditions of distribution and use, see the disclaimer | 10 * For conditions of distribution and use, see the disclaimer |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 ret = inflate(&png_ptr->zstream, Z_NO_FLUSH); | 240 ret = inflate(&png_ptr->zstream, Z_NO_FLUSH); |
241 avail = png_ptr->zbuf_size - png_ptr->zstream.avail_out; | 241 avail = png_ptr->zbuf_size - png_ptr->zstream.avail_out; |
242 | 242 |
243 /* First copy/count any new output - but only if we didn't | 243 /* First copy/count any new output - but only if we didn't |
244 * get an error code. | 244 * get an error code. |
245 */ | 245 */ |
246 if ((ret == Z_OK || ret == Z_STREAM_END) && avail > 0) | 246 if ((ret == Z_OK || ret == Z_STREAM_END) && avail > 0) |
247 { | 247 { |
248 if (output != 0 && output_size > count) | 248 if (output != 0 && output_size > count) |
249 { | 249 { |
250 int copy = output_size - count; | 250 png_size_t copy = output_size - count; |
251 if (avail < copy) copy = avail; | 251 if ((png_size_t) avail < copy) copy = (png_size_t) avail; |
252 png_memcpy(output + count, png_ptr->zbuf, copy); | 252 png_memcpy(output + count, png_ptr->zbuf, copy); |
253 } | 253 } |
254 count += avail; | 254 count += avail; |
255 } | 255 } |
256 | 256 |
257 if (ret == Z_OK) | 257 if (ret == Z_OK) |
258 continue; | 258 continue; |
259 | 259 |
260 /* Termination conditions - always reset the zstream, it | 260 /* Termination conditions - always reset the zstream, it |
261 * must be left in inflateInit state. | 261 * must be left in inflateInit state. |
(...skipping 3126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3388 png_debug1(3, "height = %lu,", png_ptr->height); | 3388 png_debug1(3, "height = %lu,", png_ptr->height); |
3389 png_debug1(3, "iwidth = %lu,", png_ptr->iwidth); | 3389 png_debug1(3, "iwidth = %lu,", png_ptr->iwidth); |
3390 png_debug1(3, "num_rows = %lu,", png_ptr->num_rows); | 3390 png_debug1(3, "num_rows = %lu,", png_ptr->num_rows); |
3391 png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes); | 3391 png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes); |
3392 png_debug1(3, "irowbytes = %lu", | 3392 png_debug1(3, "irowbytes = %lu", |
3393 PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1); | 3393 PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1); |
3394 | 3394 |
3395 png_ptr->flags |= PNG_FLAG_ROW_INIT; | 3395 png_ptr->flags |= PNG_FLAG_ROW_INIT; |
3396 } | 3396 } |
3397 #endif /* PNG_READ_SUPPORTED */ | 3397 #endif /* PNG_READ_SUPPORTED */ |
OLD | NEW |