mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Changed chunk handler warnings into benign errors, incrementally
load iCCP
This commit is contained in:
committed by
Glenn Randers-Pehrson
parent
51624965e2
commit
b11b31aea2
@@ -1061,6 +1061,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FILE *fp = stdout;
|
||||
const char *file_name = NULL;
|
||||
int color_type = 8; /* invalid */
|
||||
int bit_depth = 32; /* invalid */
|
||||
png_fixed_point gamma = 0; /* not set */
|
||||
@@ -1189,6 +1190,7 @@ main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
file_name = arg;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1204,5 +1206,12 @@ main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return write_png(fp, color_type, bit_depth, gamma, head_insert);
|
||||
{
|
||||
int ret = write_png(fp, color_type, bit_depth, gamma, head_insert);
|
||||
|
||||
if (ret != 0 && file_name != NULL)
|
||||
remove(file_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3099,7 +3099,7 @@ read_one_file(Image *image)
|
||||
{
|
||||
long int cb = ftell(f);
|
||||
|
||||
if (cb >= 0 && (unsigned long int)cb < (size_t)~(size_t)0)
|
||||
if (cb > 0 && (unsigned long int)cb < (size_t)~(size_t)0)
|
||||
{
|
||||
png_bytep b = voidcast(png_bytep, malloc((size_t)cb));
|
||||
|
||||
@@ -3118,17 +3118,22 @@ read_one_file(Image *image)
|
||||
{
|
||||
free(b);
|
||||
return logclose(image, f, image->file_name,
|
||||
": read failed");
|
||||
": read failed: ");
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
return logclose(image, f, image->file_name,
|
||||
": out of memory");
|
||||
": out of memory: ");
|
||||
}
|
||||
|
||||
else if (cb == 0)
|
||||
return logclose(image, f, image->file_name,
|
||||
": zero length: ");
|
||||
|
||||
else
|
||||
return logclose(image, f, image->file_name, ": tell failed");
|
||||
return logclose(image, f, image->file_name,
|
||||
": tell failed: ");
|
||||
}
|
||||
|
||||
else
|
||||
@@ -3169,7 +3174,7 @@ write_one_file(Image *output, Image *image, int convert_to_8bit)
|
||||
}
|
||||
|
||||
else
|
||||
return logclose(image, f, "tmpfile", ": flush");
|
||||
return logclose(image, f, "tmpfile", ": flush: ");
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user