mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.0.9beta4.tar
This commit is contained in:
20
pngwutil.c
20
pngwutil.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* libpng 1.0.9beta3 - November 23, 2000
|
||||
* libpng 1.0.9beta4 - December 1, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -1072,13 +1072,14 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
||||
png_size_t key_len;
|
||||
png_charp kp, dp;
|
||||
int kflag;
|
||||
int kwarn=0;
|
||||
|
||||
png_debug(1, "in png_check_keyword\n");
|
||||
*new_key = NULL;
|
||||
|
||||
if (key == NULL || (key_len = png_strlen(key)) == 0)
|
||||
{
|
||||
png_chunk_warning(png_ptr, "zero length keyword");
|
||||
png_warning(png_ptr, "zero length keyword");
|
||||
return ((png_size_t)0);
|
||||
}
|
||||
|
||||
@@ -1095,9 +1096,9 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
||||
char msg[40];
|
||||
|
||||
sprintf(msg, "invalid keyword character 0x%02X", *kp);
|
||||
png_chunk_warning(png_ptr, msg);
|
||||
png_warning(png_ptr, msg);
|
||||
#else
|
||||
png_chunk_warning(png_ptr, "invalid character in keyword");
|
||||
png_warning(png_ptr, "invalid character in keyword");
|
||||
#endif
|
||||
*dp = ' ';
|
||||
}
|
||||
@@ -1112,7 +1113,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
||||
kp = *new_key + key_len - 1;
|
||||
if (*kp == ' ')
|
||||
{
|
||||
png_chunk_warning(png_ptr, "trailing spaces removed from keyword");
|
||||
png_warning(png_ptr, "trailing spaces removed from keyword");
|
||||
|
||||
while (*kp == ' ')
|
||||
{
|
||||
@@ -1125,7 +1126,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
||||
kp = *new_key;
|
||||
if (*kp == ' ')
|
||||
{
|
||||
png_chunk_warning(png_ptr, "leading spaces removed from keyword");
|
||||
png_warning(png_ptr, "leading spaces removed from keyword");
|
||||
|
||||
while (*kp == ' ')
|
||||
{
|
||||
@@ -1147,6 +1148,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
||||
else if (*kp == ' ')
|
||||
{
|
||||
key_len--;
|
||||
kwarn=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1155,17 +1157,19 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
||||
}
|
||||
}
|
||||
*dp = '\0';
|
||||
if(kwarn)
|
||||
png_warning(png_ptr, "extra interior spaces removed from keyword");
|
||||
|
||||
if (key_len == 0)
|
||||
{
|
||||
png_free(png_ptr, *new_key);
|
||||
*new_key=NULL;
|
||||
png_chunk_warning(png_ptr, "Zero length keyword");
|
||||
png_warning(png_ptr, "Zero length keyword");
|
||||
}
|
||||
|
||||
if (key_len > 79)
|
||||
{
|
||||
png_chunk_warning(png_ptr, "keyword length must be 1 - 79 characters");
|
||||
png_warning(png_ptr, "keyword length must be 1 - 79 characters");
|
||||
new_key[79] = '\0';
|
||||
key_len = 79;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user