]> granicus.if.org Git - php/commitdiff
- fixed size information for _php_sig_png array
authorHartmut Holzgraefe <hholzgra@php.net>
Sun, 5 Mar 2006 18:26:12 +0000 (18:26 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Sun, 5 Mar 2006 18:26:12 +0000 (18:26 +0000)
- removed extra memcmp step in signature comparison,
  this seemed to have been inherited from ext/standard/image.c
  but is not needed here as the provided buffer is big enough
  from the start

ext/gd/gd.c
ext/gd/php_gd.h

index 6c7958dd494107869e842bbdbdaa4a944cced59e..ab0af28e2fd44dec940cb8d94ac51897848e3933 100644 (file)
@@ -1254,10 +1254,8 @@ static int _php_image_type (char data[8])
                return PHP_GDIMG_TYPE_GD2;
        } else if (!memcmp(data, php_sig_jpg, 3)) {
                return PHP_GDIMG_TYPE_JPG;
-       } else if (!memcmp(data, php_sig_png, 3)) {
-               if (!memcmp(data, php_sig_png, 8)) {
-                       return PHP_GDIMG_TYPE_PNG;
-               }
+       } else if (!memcmp(data, php_sig_png, 8)) {
+           return PHP_GDIMG_TYPE_PNG;
        } else if (!memcmp(data, php_sig_gif, 3)) {
                return PHP_GDIMG_TYPE_GIF;
        }
index d979e2c7c141bef920a9bb64a6dd12b29ffbe61b..33f19813222e8b6e16044acb8a14ac37e57e43df 100644 (file)
@@ -56,7 +56,7 @@
 
 PHPAPI extern const char php_sig_gif[3];
 PHPAPI extern const char php_sig_jpg[3];
-PHPAPI extern const char php_sig_png[3];
+PHPAPI extern const char php_sig_png[8];
 
 extern zend_module_entry gd_module_entry;
 #define phpext_gd_ptr &gd_module_entry