summaryrefslogtreecommitdiff
path: root/pngread.c
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2010-11-20 21:48:29 -0600
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2010-11-20 21:48:29 -0600
commita581556b177f43e215b528e26c7a5ff2b6a5b6e2 (patch)
tree0d4661cbd6028a694fb2e6ff978cd86c5f235472 /pngread.c
parentd801b3882c01be94e0292f736a4243a334d41571 (diff)
downloadlibpng-a581556b177f43e215b528e26c7a5ff2b6a5b6e2.tar.gz
[master] Revised png_get_uint_32, png_get_int_32, png_get_uint_16 (Cosmin)
Moved reading of file signature into png_read_sig (Cosmin) Fixed atomicity of chunk header serialization (Cosmin) Added test for io_state in pngtest.c (Cosmin) Added "#!/bin/sh" at the top of contrib/pngminim/*/gather.sh scripts.
Diffstat (limited to 'pngread.c')
-rw-r--r--pngread.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/pngread.c b/pngread.c
index d334a8e86..fe180fdfd 100644
--- a/pngread.c
+++ b/pngread.c
@@ -232,32 +232,8 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
if (png_ptr == NULL || info_ptr == NULL)
return;
- /* If we haven't checked all of the PNG signature bytes, do so now. */
- if (png_ptr->sig_bytes < 8)
- {
- png_size_t num_checked = png_ptr->sig_bytes,
- num_to_check = 8 - num_checked;
-
-#ifdef PNG_IO_STATE_SUPPORTED
- png_ptr->io_state = PNG_IO_READING | PNG_IO_SIGNATURE;
-#endif
-
- png_read_data(png_ptr, &(info_ptr->signature[num_checked]), num_to_check);
- png_ptr->sig_bytes = 8;
-
- if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
- {
- if (num_checked < 4 &&
- png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
- png_error(png_ptr, "Not a PNG file");
-
- else
- png_error(png_ptr, "PNG file corrupted by ASCII conversion");
- }
-
- if (num_checked < 3)
- png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
- }
+ /* Read and check the PNG file signature. */
+ png_read_sig(png_ptr, info_ptr);
for (;;)
{