Imported from libpng-1.2.30rc05.tar

This commit is contained in:
Glenn Randers-Pehrson
2008-07-25 08:38:43 -05:00
parent 9c8717e42f
commit 84d5d968a6
62 changed files with 270 additions and 229 deletions

View File

@@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.2.30 [July 22, 2008]
* Last changed in libpng 1.2.30 [July 25, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -44,14 +44,21 @@ png_error(png_structp png_ptr, png_const_charp error_message)
{
if (*error_message == '#')
{
/*
* 012345678901234567890
* error_message: #nnnn text\0
* error_number: nnnn\0
* offset points to the first blank after nnnn
* In this example, offset is 5.
*/
int offset;
for (offset = 1; offset<15; offset++)
if (*(error_message + offset) == ' ')
if (error_message[offset] == ' ')
break;
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{
int i;
for (i = 0; i<offset - 1; i++)
for (i = 0; i < offset - 1; i++)
msg[i] = error_message[i + 1];
msg[i] = '\0';
error_message = msg;
@@ -110,8 +117,8 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
{
if (*warning_message == '#')
{
for (offset = 1; offset<15; offset++)
if (*(warning_message + offset) == ' ')
for (offset = 1; offset < 15; offset++)
if (warning_message[offset] == ' ')
break;
}
}
@@ -216,17 +223,26 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*error_message == '#')
{
/*
* 012345678901234567890
* error_message: #nnnn text\0
* error_number: nnnn\0
* offset points to the first blank after nnnn
* In this example, offset is 5, and we want to
* insert a terminating NULL at error_number[4].
*/
int offset;
char error_number[16];
for (offset = 0; offset<15; offset++)
{
error_number[offset] = *(error_message + offset + 1);
if (*(error_message + offset) == ' ')
error_number[offset] = error_message[offset + 1];
if (error_message[offset] == ' ')
break;
}
if ((offset > 1) && (offset < 15))
{
error_number[offset - 1] = '\0';
error_number[offset - 1] = '\0'; /* should this be [offset + 1]? */
/* should we update "offset" to point to the beginning of the text? */
fprintf(stderr, "libpng error no. %s: %s\n", error_number,
error_message + offset);
}
@@ -276,8 +292,8 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
char warning_number[16];
for (offset = 0; offset < 15; offset++)
{
warning_number[offset]=*(warning_message + offset + 1);
if (*(warning_message + offset) == ' ')
warning_number[offset] = warning_message[offset + 1];
if (warning_message[offset] == ' ')
break;
}
if ((offset > 1) && (offset < 15))