| Index: third_party/libpng/pngrio.c
|
| ===================================================================
|
| --- third_party/libpng/pngrio.c (revision 18910)
|
| +++ third_party/libpng/pngrio.c (working copy)
|
| @@ -1,7 +1,7 @@
|
|
|
| /* pngrio.c - functions for data input
|
| *
|
| - * Last changed in libpng 1.2.36 [May 7, 2009]
|
| + * Last changed in libpng 1.2.37 [June 4, 2009]
|
| * For conditions of distribution and use, see copyright notice in png.h
|
| * Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
| * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
| @@ -20,10 +20,11 @@
|
| #if defined(PNG_READ_SUPPORTED)
|
|
|
| /* Read the data from whatever input you are using. The default routine
|
| - reads from a file pointer. Note that this routine sometimes gets called
|
| - with very small lengths, so you should implement some kind of simple
|
| - buffering if you are using unbuffered reads. This should never be asked
|
| - to read more then 64K on a 16 bit machine. */
|
| + * reads from a file pointer. Note that this routine sometimes gets called
|
| + * with very small lengths, so you should implement some kind of simple
|
| + * buffering if you are using unbuffered reads. This should never be asked
|
| + * to read more then 64K on a 16 bit machine.
|
| + */
|
| void /* PRIVATE */
|
| png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
| {
|
| @@ -36,16 +37,18 @@
|
|
|
| #if !defined(PNG_NO_STDIO)
|
| /* This is the function that does the actual reading of data. If you are
|
| - not reading from a standard C stream, you should create a replacement
|
| - read_data function and use it at run time with png_set_read_fn(), rather
|
| - than changing the library. */
|
| + * not reading from a standard C stream, you should create a replacement
|
| + * read_data function and use it at run time with png_set_read_fn(), rather
|
| + * than changing the library.
|
| + */
|
| #ifndef USE_FAR_KEYWORD
|
| void PNGAPI
|
| png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
| {
|
| png_size_t check;
|
|
|
| - if (png_ptr == NULL) return;
|
| + if (png_ptr == NULL)
|
| + return;
|
| /* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
| * instead of an int, which is what fread() actually returns.
|
| */
|
| @@ -61,7 +64,7 @@
|
| png_error(png_ptr, "Read Error");
|
| }
|
| #else
|
| -/* this is the model-independent version. Since the standard I/O library
|
| +/* This is the model-independent version. Since the standard I/O library
|
| can't handle far buffers in the medium and small models, we have to copy
|
| the data.
|
| */
|
| @@ -76,7 +79,8 @@
|
| png_byte *n_data;
|
| png_FILE_p io_ptr;
|
|
|
| - if (png_ptr == NULL) return;
|
| + if (png_ptr == NULL)
|
| + return;
|
| /* Check if data really is near. If so, use usual code. */
|
| n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
| io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
| @@ -121,25 +125,27 @@
|
| #endif
|
|
|
| /* This function allows the application to supply a new input function
|
| - for libpng if standard C streams aren't being used.
|
| -
|
| - This function takes as its arguments:
|
| - png_ptr - pointer to a png input data structure
|
| - io_ptr - pointer to user supplied structure containing info about
|
| - the input functions. May be NULL.
|
| - read_data_fn - pointer to a new input function that takes as its
|
| - arguments a pointer to a png_struct, a pointer to
|
| - a location where input data can be stored, and a 32-bit
|
| - unsigned int that is the number of bytes to be read.
|
| - To exit and output any fatal error messages the new write
|
| - function should call png_error(png_ptr, "Error msg").
|
| - May be NULL, in which case libpng's default function will
|
| - be used. */
|
| + * for libpng if standard C streams aren't being used.
|
| + *
|
| + * This function takes as its arguments:
|
| + * png_ptr - pointer to a png input data structure
|
| + * io_ptr - pointer to user supplied structure containing info about
|
| + * the input functions. May be NULL.
|
| + * read_data_fn - pointer to a new input function that takes as its
|
| + * arguments a pointer to a png_struct, a pointer to
|
| + * a location where input data can be stored, and a 32-bit
|
| + * unsigned int that is the number of bytes to be read.
|
| + * To exit and output any fatal error messages the new write
|
| + * function should call png_error(png_ptr, "Error msg").
|
| + * May be NULL, in which case libpng's default function will
|
| + * be used.
|
| + */
|
| void PNGAPI
|
| png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
| png_rw_ptr read_data_fn)
|
| {
|
| - if (png_ptr == NULL) return;
|
| + if (png_ptr == NULL)
|
| + return;
|
| png_ptr->io_ptr = io_ptr;
|
|
|
| #if !defined(PNG_NO_STDIO)
|
|
|