mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.2.30beta04.tar
This commit is contained in:
46
pngerror.c
46
pngerror.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.2.30 [July 6, 2008]
|
||||
* Last changed in libpng 1.2.30 [July 10, 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)
|
||||
@@ -45,19 +45,19 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
||||
if (*error_message == '#')
|
||||
{
|
||||
int offset;
|
||||
for (offset=1; offset<15; offset++)
|
||||
if (*(error_message+offset) == ' ')
|
||||
for (offset = 1; offset<15; 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;
|
||||
error_message = msg;
|
||||
}
|
||||
else
|
||||
error_message+=offset;
|
||||
error_message += offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -110,16 +110,16 @@ 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;
|
||||
}
|
||||
}
|
||||
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
||||
(*(png_ptr->warning_fn))(png_ptr, warning_message+offset);
|
||||
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
|
||||
}
|
||||
else
|
||||
png_default_warning(png_ptr, warning_message+offset);
|
||||
png_default_warning(png_ptr, warning_message + offset);
|
||||
}
|
||||
#endif /* PNG_NO_WARNINGS */
|
||||
|
||||
@@ -167,8 +167,8 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||
{
|
||||
buffer[iout++] = ':';
|
||||
buffer[iout++] = ' ';
|
||||
png_memcpy(buffer+iout, error_message, PNG_MAX_ERROR_TEXT);
|
||||
buffer[iout+PNG_MAX_ERROR_TEXT-1] = '\0';
|
||||
png_memcpy(buffer + iout, error_message, PNG_MAX_ERROR_TEXT);
|
||||
buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,15 +220,15 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
||||
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))
|
||||
if ((offset > 1) && (offset < 15))
|
||||
{
|
||||
error_number[offset-1]='\0';
|
||||
error_number[offset - 1]='\0';
|
||||
fprintf(stderr, "libpng error no. %s: %s\n", error_number,
|
||||
error_message+offset);
|
||||
error_message + offset);
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "libpng error: %s, offset=%d\n", error_message, offset);
|
||||
@@ -276,15 +276,15 @@ 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))
|
||||
if ((offset > 1) && (offset < 15))
|
||||
{
|
||||
warning_number[offset-1]='\0';
|
||||
warning_number[offset + 1]='\0';
|
||||
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number,
|
||||
warning_message+offset);
|
||||
warning_message + offset);
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
||||
@@ -333,7 +333,7 @@ png_get_error_ptr(png_structp png_ptr)
|
||||
void PNGAPI
|
||||
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
||||
{
|
||||
if(png_ptr != NULL)
|
||||
if (png_ptr != NULL)
|
||||
{
|
||||
png_ptr->flags &=
|
||||
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
||||
|
||||
Reference in New Issue
Block a user