]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 23 Feb 2013 02:28:08 +0000 (02:28 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 23 Feb 2013 02:28:08 +0000 (02:28 +0000)
coders/webp.c

index 6f57eb2393127d48e7722a51c947d383d593da85..a56317e112f6c90e0b43bf514fc68ef8a1bc8ca5 100644 (file)
@@ -137,30 +137,36 @@ static MagickBooleanType IsWEBP(const unsigned char *magick,const size_t length)
 %
 */
 
 %
 */
 
-static inline uint32_t get_le24(const unsigned char *const data)
+static inline uint32_t ReadWebPLSBWord(const unsigned char *restrict data)
 {
 {
-  return((uint32_t) (data[0] | (data[1] << 8) | (data[2] << 16)));
-}
+  register const unsigned char
+    *p;
 
 
-static inline uint32_t get_le32(const unsigned char *const data)
-{
-  return((uint32_t) (get_le24(data) | (data[3] << 24)));
+  register uint32_t
+    value;
+
+  p=data;
+  value=(uint32_t) (*p++);
+  value|=((uint32_t) (*p++)) << 8;
+  value|=((uint32_t) (*p++)) << 16;
+  value|=((uint32_t) (*p++)) << 24;
+  return(value);
 }
 
 static MagickBooleanType IsWEBPImageLossless(const unsigned char *stream,
   const size_t length)
 {
 }
 
 static MagickBooleanType IsWEBPImageLossless(const unsigned char *stream,
   const size_t length)
 {
-#define VP8_CHUNK_INDEX  15  /* file/header type */
+#define VP8_CHUNK_INDEX  15
 #define LOSSLESS_FLAG  'L'
 #define EXTENDED_HEADER  'X'
 #define VP8_CHUNK_HEADER  "VP8"
 #define VP8_CHUNK_HEADER_SIZE  3
 #define LOSSLESS_FLAG  'L'
 #define EXTENDED_HEADER  'X'
 #define VP8_CHUNK_HEADER  "VP8"
 #define VP8_CHUNK_HEADER_SIZE  3
-#define RIFF_HEADER_SIZE  12  /* size of the RIFF header ("RIFFnnnnWEBP") */
+#define RIFF_HEADER_SIZE  12
 #define VP8X_CHUNK_SIZE  10
 #define TAG_SIZE  4
 #define CHUNK_SIZE_BYTES  4
 #define CHUNK_HEADER_SIZE  8
 #define VP8X_CHUNK_SIZE  10
 #define TAG_SIZE  4
 #define CHUNK_SIZE_BYTES  4
 #define CHUNK_HEADER_SIZE  8
-#define MAX_CHUNK_PAYLOAD  (~0U-CHUNK_HEADER_SIZE-1)  /* header padding */
+#define MAX_CHUNK_PAYLOAD  (~0U-CHUNK_HEADER_SIZE-1)
 
   ssize_t
     offset;
 
   ssize_t
     offset;
@@ -180,7 +186,7 @@ static MagickBooleanType IsWEBPImageLossless(const unsigned char *stream,
       chunk_size,
       chunk_size_pad;
 
       chunk_size,
       chunk_size_pad;
 
-    chunk_size=get_le32(stream+pos+TAG_SIZE);
+    chunk_size=ReadWebPLSBWord(stream+pos+TAG_SIZE);
     if (chunk_size > MAX_CHUNK_PAYLOAD)
       break;
     chunk_size_pad=(CHUNK_HEADER_SIZE+chunk_size+1) & ~1;
     if (chunk_size > MAX_CHUNK_PAYLOAD)
       break;
     chunk_size_pad=(CHUNK_HEADER_SIZE+chunk_size+1) & ~1;
@@ -218,10 +224,10 @@ static Image *ReadWEBPImage(const ImageInfo *image_info,
     configure;
 
   WebPDecBuffer
     configure;
 
   WebPDecBuffer
-    *const webp_image = &configure.output;
+    *restrict webp_image = &configure.output;
 
   WebPBitstreamFeatures
 
   WebPBitstreamFeatures
-    *const features = &configure.input;
+    *restrict features = &configure.input;
 
   /*
     Open image file.
 
   /*
     Open image file.