Imported from libpng-0.99a.tar
This commit is contained in:
parent
46f61e2398
commit
b212002101
5
CHANGES
5
CHANGES
@ -200,7 +200,7 @@ version 0.98 [January, 1998]
|
|||||||
PNG_TIME_RFC1152_SUPPORTED macro to PNG_TIME_RFC1123_SUPPORTED
|
PNG_TIME_RFC1152_SUPPORTED macro to PNG_TIME_RFC1123_SUPPORTED
|
||||||
added png_invert_alpha capability (Glenn R-P -- suggestion by Jon Vincent)
|
added png_invert_alpha capability (Glenn R-P -- suggestion by Jon Vincent)
|
||||||
changed srgb_intent from png_byte to int to avoid compiler bugs
|
changed srgb_intent from png_byte to int to avoid compiler bugs
|
||||||
version 0.99 [January, 1998]
|
version 0.99 [January 30, 1998]
|
||||||
free info_ptr->text instead of end_info_ptr->text in pngread.c (John Bowler)
|
free info_ptr->text instead of end_info_ptr->text in pngread.c (John Bowler)
|
||||||
fixed a longstanding "packswap" bug in pngtrans.c
|
fixed a longstanding "packswap" bug in pngtrans.c
|
||||||
fixed some inconsistencies in pngconf.h that prevented compiling with
|
fixed some inconsistencies in pngconf.h that prevented compiling with
|
||||||
@ -213,3 +213,6 @@ version 0.99 [January, 1998]
|
|||||||
added TARGET_MACOS similar to zlib-1.0.8
|
added TARGET_MACOS similar to zlib-1.0.8
|
||||||
define PNG_ALWAYS_EXTERN when __MWERKS__ && WIN32 are defined
|
define PNG_ALWAYS_EXTERN when __MWERKS__ && WIN32 are defined
|
||||||
added type casting to all png_malloc() function calls
|
added type casting to all png_malloc() function calls
|
||||||
|
version 0.99a [January 31, 1998]
|
||||||
|
added type casts and parentheses to all returns that return a value.(Tim W.)
|
||||||
|
|
||||||
|
2
README
2
README
@ -1,4 +1,4 @@
|
|||||||
[NOTE: this is still beta version 0.99; the text below has already
|
[NOTE: this is still beta version 0.99a; the text below has already
|
||||||
been updated in anticipation of the imminent 1.0 release.]
|
been updated in anticipation of the imminent 1.0 release.]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
libpng.txt - a description on how to use and modify libpng
|
libpng.txt - a description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 0.99
|
libpng version 0.99a
|
||||||
Updated and distributed by Glenn Randers-Pehrson <randeg@alumni.rpi.edu>
|
Updated and distributed by Glenn Randers-Pehrson <randeg@alumni.rpi.edu>
|
||||||
Copyright (c) 1998, Glenn Randers-Pehrson
|
Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
January 30, 1998
|
January 31, 1998
|
||||||
|
|
||||||
based on:
|
based on:
|
||||||
|
|
||||||
|
20
png.c
20
png.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -16,7 +16,7 @@
|
|||||||
/* Version information for C files. This had better match the version
|
/* Version information for C files. This had better match the version
|
||||||
* string defined in png.h.
|
* string defined in png.h.
|
||||||
*/
|
*/
|
||||||
char png_libpng_ver[5] = "0.99";
|
char png_libpng_ver[6] = "0.99";
|
||||||
|
|
||||||
/* Place to hold the signature string for a PNG file. */
|
/* Place to hold the signature string for a PNG file. */
|
||||||
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||||
@ -103,15 +103,15 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
|
|||||||
if (num_to_check > 8)
|
if (num_to_check > 8)
|
||||||
num_to_check = 8;
|
num_to_check = 8;
|
||||||
else if (num_to_check < 1)
|
else if (num_to_check < 1)
|
||||||
return 0;
|
return (0);
|
||||||
|
|
||||||
if (start > 7)
|
if (start > 7)
|
||||||
return 0;
|
return (0);
|
||||||
|
|
||||||
if (start + num_to_check > 8)
|
if (start + num_to_check > 8)
|
||||||
num_to_check = 8 - start;
|
num_to_check = 8 - start;
|
||||||
|
|
||||||
return (png_memcmp(&sig[start], &png_sig[start], num_to_check));
|
return ((int)(png_memcmp(&sig[start], &png_sig[start], num_to_check)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (Obsolete) function to check signature bytes. It does not allow one
|
/* (Obsolete) function to check signature bytes. It does not allow one
|
||||||
@ -121,7 +121,7 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
|
|||||||
int
|
int
|
||||||
png_check_sig(png_bytep sig, int num)
|
png_check_sig(png_bytep sig, int num)
|
||||||
{
|
{
|
||||||
return !png_sig_cmp(sig, (png_size_t)0, (png_size_t)num);
|
return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function to allocate memory for zlib. */
|
/* Function to allocate memory for zlib. */
|
||||||
@ -143,7 +143,7 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
|||||||
{
|
{
|
||||||
png_memset(ptr, 0, (png_size_t)num_bytes);
|
png_memset(ptr, 0, (png_size_t)num_bytes);
|
||||||
}
|
}
|
||||||
return (voidpf)(ptr);
|
return ((voidpf)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* function to free memory for zlib */
|
/* function to free memory for zlib */
|
||||||
@ -205,7 +205,7 @@ png_create_info_struct(png_structp png_ptr)
|
|||||||
png_info_init(info_ptr);
|
png_info_init(info_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return info_ptr;
|
return (info_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function frees the memory associated with a single info struct.
|
/* This function frees the memory associated with a single info struct.
|
||||||
@ -286,7 +286,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_voidp
|
png_voidp
|
||||||
png_get_io_ptr(png_structp png_ptr)
|
png_get_io_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
return png_ptr->io_ptr;
|
return (png_ptr->io_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#if !defined(PNG_NO_STDIO)
|
||||||
|
5
png.h
5
png.h
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng 0.99 beta
|
* libpng 0.99a beta
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998 Glenn Randers-Pehrson
|
* Copyright (c) 1998 Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* Note about libpng version numbers:
|
||||||
*
|
*
|
||||||
@ -27,6 +27,7 @@
|
|||||||
* 0.97c 0.97 2.0.97
|
* 0.97c 0.97 2.0.97
|
||||||
* 0.98 0.98 2.0.98
|
* 0.98 0.98 2.0.98
|
||||||
* 0.99 0.99 2.0.99
|
* 0.99 0.99 2.0.99
|
||||||
|
* 0.99a 0.99 2.0.99
|
||||||
* 1.0 1.00 2.1.0
|
* 1.0 1.00 2.1.0
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library minor
|
* Henceforth the source version will match the shared-library minor
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngconf.c - machine configurable file for libpng
|
/* pngconf.c - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Any machine specific code is near the front of this file, so if you
|
/* Any machine specific code is near the front of this file, so if you
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all error handling. Users which
|
* This file provides a location for all error handling. Users which
|
||||||
* need special error handling are expected to write replacement functions
|
* need special error handling are expected to write replacement functions
|
||||||
@ -167,7 +167,7 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
|||||||
png_voidp
|
png_voidp
|
||||||
png_get_error_ptr(png_structp png_ptr)
|
png_get_error_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
return png_ptr->error_ptr;
|
return ((png_voidp)png_ptr->error_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
12
pngget.c
12
pngget.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -126,14 +126,14 @@ png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
|
|||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio");
|
png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio");
|
||||||
if (info_ptr->x_pixels_per_unit == 0)
|
if (info_ptr->x_pixels_per_unit == 0)
|
||||||
return NULL;
|
return (0.0);
|
||||||
else
|
else
|
||||||
return (float)info_ptr->y_pixels_per_unit
|
return ((float)info_ptr->y_pixels_per_unit
|
||||||
/(float)info_ptr->x_pixels_per_unit;
|
/(float)info_ptr->x_pixels_per_unit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32
|
||||||
|
16
pngmem.c
16
pngmem.c
@ -1,11 +1,11 @@
|
|||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all memory allocation. Users which
|
* This file provides a location for all memory allocation. Users which
|
||||||
* need special memory handling are expected to modify the code in this file
|
* need special memory handling are expected to modify the code in this file
|
||||||
@ -42,7 +42,7 @@ png_create_struct(int type)
|
|||||||
else if (type == PNG_STRUCT_PNG)
|
else if (type == PNG_STRUCT_PNG)
|
||||||
size = sizeof(png_struct);
|
size = sizeof(png_struct);
|
||||||
else
|
else
|
||||||
return (png_voidp)NULL;
|
return ((png_voidp)NULL);
|
||||||
|
|
||||||
if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
|
if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@ PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
|||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return ((voidp)NULL);
|
return ((png_voidp)NULL);
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
if (size > (png_uint_32)65536L)
|
if (size > (png_uint_32)65536L)
|
||||||
@ -177,7 +177,7 @@ PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
|||||||
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free a pointer allocated by PNG_MALLOC(). In the default
|
/* free a pointer allocated by PNG_MALLOC(). In the default
|
||||||
@ -234,7 +234,7 @@ png_create_struct(int type)
|
|||||||
else if (type == PNG_STRUCT_PNG)
|
else if (type == PNG_STRUCT_PNG)
|
||||||
size = sizeof(png_struct);
|
size = sizeof(png_struct);
|
||||||
else
|
else
|
||||||
return (png_voidp)NULL;
|
return ((png_voidp)NULL);
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
|
if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
|
||||||
@ -286,7 +286,7 @@ PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
|||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return (NULL);
|
return ((png_voidp)NULL);
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
if (size > (png_uint_32)65536L)
|
if (size > (png_uint_32)65536L)
|
||||||
@ -308,7 +308,7 @@ PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
|||||||
png_error(png_ptr, "Out of Memory");
|
png_error(png_ptr, "Out of Memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free a pointer allocated by PNG_MALLOC(). In the default
|
/* Free a pointer allocated by PNG_MALLOC(). In the default
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*
|
*
|
||||||
* This file contains routines that an application calls directly to
|
* This file contains routines that an application calls directly to
|
||||||
* read a PNG file or stream.
|
* read a PNG file or stream.
|
||||||
|
4
pngrio.c
4
pngrio.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all input. Users which need
|
* This file provides a location for all input. Users which need
|
||||||
* special handling are expected to write a function which has the same
|
* special handling are expected to write a function which has the same
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*
|
*
|
||||||
* This file contains functions optionally called by an application
|
* This file contains functions optionally called by an application
|
||||||
* in order to tell libpng how to handle data when reading a PNG.
|
* in order to tell libpng how to handle data when reading a PNG.
|
||||||
|
18
pngrutil.c
18
pngrutil.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*
|
*
|
||||||
* This file contains routines which are only called from within
|
* This file contains routines which are only called from within
|
||||||
* libpng itself during the course of reading an image.
|
* libpng itself during the course of reading an image.
|
||||||
@ -27,7 +27,7 @@ png_get_uint_32(png_bytep buf)
|
|||||||
((png_uint_32)(*(buf + 2)) << 8) +
|
((png_uint_32)(*(buf + 2)) << 8) +
|
||||||
(png_uint_32)(*(buf + 3));
|
(png_uint_32)(*(buf + 3));
|
||||||
|
|
||||||
return i;
|
return (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_pCAL_SUPPORTED)
|
#if defined(PNG_READ_pCAL_SUPPORTED)
|
||||||
@ -44,7 +44,7 @@ png_get_int_32(png_bytep buf)
|
|||||||
((png_int_32)(*(buf + 2)) << 8) +
|
((png_int_32)(*(buf + 2)) << 8) +
|
||||||
(png_int_32)(*(buf + 3));
|
(png_int_32)(*(buf + 3));
|
||||||
|
|
||||||
return i;
|
return (i);
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_pCAL_SUPPORTED */
|
#endif /* PNG_READ_pCAL_SUPPORTED */
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ png_get_uint_16(png_bytep buf)
|
|||||||
i = (png_uint_16)(((png_uint_16)(*buf) << 8) +
|
i = (png_uint_16)(((png_uint_16)(*buf) << 8) +
|
||||||
(png_uint_16)(*(buf + 1)));
|
(png_uint_16)(*(buf + 1)));
|
||||||
|
|
||||||
return i;
|
return (i);
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_BIG_ENDIAN_SUPPORTED */
|
#endif /* PNG_READ_BIG_ENDIAN_SUPPORTED */
|
||||||
|
|
||||||
@ -100,10 +100,10 @@ png_crc_finish(png_structp png_ptr, png_uint_32 skip)
|
|||||||
{
|
{
|
||||||
png_chunk_error(png_ptr, "CRC error");
|
png_chunk_error(png_ptr, "CRC error");
|
||||||
}
|
}
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compare the CRC stored in the PNG file with that calculated by libpng from
|
/* Compare the CRC stored in the PNG file with that calculated by libpng from
|
||||||
@ -132,10 +132,10 @@ png_crc_error(png_structp png_ptr)
|
|||||||
if (need_crc)
|
if (need_crc)
|
||||||
{
|
{
|
||||||
crc = png_get_uint_32(crc_bytes);
|
crc = png_get_uint_32(crc_bytes);
|
||||||
return (crc != png_ptr->crc);
|
return ((int)(crc != png_ptr->crc));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
4
pngset.c
4
pngset.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*
|
*
|
||||||
* The functions here are used during reads to store data from the file
|
* The functions here are used during reads to store data from the file
|
||||||
* into the info struct, and during writes to store application data
|
* into the info struct, and during writes to store application data
|
||||||
|
32
pngtest.c
32
pngtest.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*
|
*
|
||||||
* This program reads in a PNG image, writes it out again, and then
|
* This program reads in a PNG image, writes it out again, and then
|
||||||
* compares the two files. If the files are identical, this shows that
|
* compares the two files. If the files are identical, this shows that
|
||||||
@ -281,10 +281,10 @@ png_voidp
|
|||||||
png_malloc(png_structp png_ptr, png_uint_32 size) {
|
png_malloc(png_structp png_ptr, png_uint_32 size) {
|
||||||
if (png_ptr == NULL) {
|
if (png_ptr == NULL) {
|
||||||
fprintf(STDERR, "NULL pointer to memory allocator\n");
|
fprintf(STDERR, "NULL pointer to memory allocator\n");
|
||||||
return NULL;
|
return (NULL);
|
||||||
}
|
}
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return NULL;
|
return (NULL);
|
||||||
|
|
||||||
/* This calls the library allocator twice, once to get the requested
|
/* This calls the library allocator twice, once to get the requested
|
||||||
buffer and once to get a new free list entry. */
|
buffer and once to get a new free list entry. */
|
||||||
@ -299,7 +299,7 @@ png_malloc(png_structp png_ptr, png_uint_32 size) {
|
|||||||
pinformation = pinfo;
|
pinformation = pinfo;
|
||||||
/* Make sure the caller isn't assuming zeroed memory. */
|
/* Make sure the caller isn't assuming zeroed memory. */
|
||||||
png_memset(pinfo->pointer, 0xdd, pinfo->size);
|
png_memset(pinfo->pointer, 0xdd, pinfo->size);
|
||||||
return pinfo->pointer;
|
return ((png_voidp)pinfo->pointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,14 +369,14 @@ int test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
if ((fpin = fopen(inname, "rb")) == NULL)
|
if ((fpin = fopen(inname, "rb")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, "Could not find input file %s\n", inname);
|
fprintf(STDERR, "Could not find input file %s\n", inname);
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fpout = fopen(outname, "wb")) == NULL)
|
if ((fpout = fopen(outname, "wb")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, "Could not open output file %s\n", outname);
|
fprintf(STDERR, "Could not open output file %s\n", outname);
|
||||||
fclose(fpin);
|
fclose(fpin);
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_debug(0, "Allocating read and write structures\n");
|
png_debug(0, "Allocating read and write structures\n");
|
||||||
@ -409,7 +409,7 @@ int test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
||||||
fclose(fpin);
|
fclose(fpin);
|
||||||
fclose(fpout);
|
fclose(fpout);
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_debug(0, "Setting jmpbuf for write struct\n");
|
png_debug(0, "Setting jmpbuf for write struct\n");
|
||||||
@ -425,7 +425,7 @@ int test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
||||||
fclose(fpin);
|
fclose(fpin);
|
||||||
fclose(fpout);
|
fclose(fpout);
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
@ -621,7 +621,7 @@ int test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
||||||
fclose(fpin);
|
fclose(fpin);
|
||||||
fclose(fpout);
|
fclose(fpout);
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
num_pass = png_set_interlace_handling(read_ptr);
|
num_pass = png_set_interlace_handling(read_ptr);
|
||||||
@ -663,14 +663,14 @@ int test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
if ((fpin = fopen(inname, "rb")) == NULL)
|
if ((fpin = fopen(inname, "rb")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, "Could not find file %s\n", inname);
|
fprintf(STDERR, "Could not find file %s\n", inname);
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fpout = fopen(outname, "rb")) == NULL)
|
if ((fpout = fopen(outname, "rb")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, "Could not find file %s\n", outname);
|
fprintf(STDERR, "Could not find file %s\n", outname);
|
||||||
fclose(fpin);
|
fclose(fpin);
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
@ -686,7 +686,7 @@ int test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
inname, outname);
|
inname, outname);
|
||||||
fclose(fpin);
|
fclose(fpin);
|
||||||
fclose(fpout);
|
fclose(fpout);
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!num_in)
|
if (!num_in)
|
||||||
@ -697,14 +697,14 @@ int test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
fprintf(STDERR, "Files %s and %s are different\n", inname, outname);
|
fprintf(STDERR, "Files %s and %s are different\n", inname, outname);
|
||||||
fclose(fpin);
|
fclose(fpin);
|
||||||
fclose(fpout);
|
fclose(fpout);
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fpin);
|
fclose(fpin);
|
||||||
fclose(fpout);
|
fclose(fpout);
|
||||||
|
|
||||||
return 0;
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* input and output filenames */
|
/* input and output filenames */
|
||||||
@ -867,5 +867,5 @@ main(int argc, char *argv[])
|
|||||||
fprintf(STDERR, "libpng passes test\n");
|
fprintf(STDERR, "libpng passes test\n");
|
||||||
else
|
else
|
||||||
fprintf(STDERR, "libpng FAILS test\n");
|
fprintf(STDERR, "libpng FAILS test\n");
|
||||||
return ierror != 0;
|
return ((int)(ierror != 0));
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -77,10 +77,10 @@ png_set_interlace_handling(png_structp png_ptr)
|
|||||||
if (png_ptr->interlaced)
|
if (png_ptr->interlaced)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_INTERLACE;
|
png_ptr->transformations |= PNG_INTERLACE;
|
||||||
return 7;
|
return (7);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return (1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
4
pngwio.c
4
pngwio.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all output. Users which need
|
* This file provides a location for all output. Users which need
|
||||||
* special handling are expected to write functions which have the same
|
* special handling are expected to write functions which have the same
|
||||||
|
12
pngwrite.c
12
pngwrite.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* get internal access to png.h */
|
/* get internal access to png.h */
|
||||||
@ -249,7 +249,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
#endif
|
#endif
|
||||||
return png_ptr->time_buffer;
|
return ((png_charp)png_ptr->time_buffer);
|
||||||
}
|
}
|
||||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ png_create_write_struct(png_const_charp user_png_ver, voidp error_ptr,
|
|||||||
png_debug(1, "in png_create_write_struct\n");
|
png_debug(1, "in png_create_write_struct\n");
|
||||||
if ((png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG)) == NULL)
|
if ((png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG)) == NULL)
|
||||||
{
|
{
|
||||||
return (png_structp)NULL;
|
return ((png_structp)NULL);
|
||||||
}
|
}
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
if (setjmp(jmpbuf))
|
if (setjmp(jmpbuf))
|
||||||
@ -299,7 +299,7 @@ png_create_write_struct(png_const_charp user_png_ver, voidp error_ptr,
|
|||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->zbuf);
|
png_free(png_ptr, png_ptr->zbuf);
|
||||||
png_destroy_struct(png_ptr);
|
png_destroy_struct(png_ptr);
|
||||||
return (png_structp)NULL;
|
return ((png_structp)NULL);
|
||||||
}
|
}
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
||||||
@ -329,7 +329,7 @@ png_create_write_struct(png_const_charp user_png_ver, voidp error_ptr,
|
|||||||
1, NULL, NULL);
|
1, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (png_ptr);
|
return ((png_structp)png_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 0.99
|
* libpng 0.99a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* January 30, 1998
|
* January 31, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -599,7 +599,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||||||
if (key == NULL || (key_len = png_strlen(key)) == 0)
|
if (key == NULL || (key_len = png_strlen(key)) == 0)
|
||||||
{
|
{
|
||||||
png_chunk_warning(png_ptr, "zero length keyword");
|
png_chunk_warning(png_ptr, "zero length keyword");
|
||||||
return 0;
|
return ((png_size_t)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_debug1(2, "Keyword to be checked is '%s'\n", key);
|
png_debug1(2, "Keyword to be checked is '%s'\n", key);
|
||||||
@ -688,7 +688,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||||||
key_len = 79;
|
key_len = 79;
|
||||||
}
|
}
|
||||||
|
|
||||||
return key_len;
|
return (key_len);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user