]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 13 Mar 2014 17:04:24 +0000 (17:04 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 13 Mar 2014 17:04:24 +0000 (17:04 +0000)
MagickCore/profile.c
MagickCore/resize.c

index a1c8f4d470dccb9422c02ae26daf1ebaa2ae6fcd..b7c71e53de0cc78075997bd89ca35da78862a232 100644 (file)
@@ -1119,7 +1119,7 @@ static inline const unsigned char *ReadResourceBytes(const unsigned char *p,
 }
 
 static inline const unsigned char *ReadResourceLong(const unsigned char *p,
-  size_t *quantum)
+  unsigned int *quantum)
 {
   *quantum=(size_t) (*p++ << 24);
   *quantum|=(size_t) (*p++ << 16);
@@ -1154,9 +1154,12 @@ static MagickBooleanType GetProfilesFromResourceBlock(Image *image,
   unsigned char
     length_byte;
 
-  size_t
+  ssize_t
     count;
 
+   unsigned int
+     value;
+
   unsigned short
     id;
 
@@ -1174,19 +1177,20 @@ static MagickBooleanType GetProfilesFromResourceBlock(Image *image,
       p++;
     if (p > (datum+length-4))
       break;
-    p=ReadResourceLong(p,&count);
+    p=ReadResourceLong(p,&value);
+    count=(ssize_t) value;
     if ((p > (datum+length-count)) || (count > length))
       break;
     switch (id)
     {
       case 0x03ed:
       {
-        unsigned short
-          units;
-
         unsigned int
           resolution;
 
+        unsigned short
+          units;
+
         /*
           Resolution.
         */
@@ -1195,15 +1199,17 @@ static MagickBooleanType GetProfilesFromResourceBlock(Image *image,
         p=ReadResourceShort(p,&units)+2;
         p=ReadResourceLong(p,&resolution)+4;
         image->resolution.y=((double) resolution)/65536.0;
-        // Values are always stored as pixels per inch.
-        if ((ResolutionType) units == PixelsPerCentimeterResolution)
+        /*
+          Values are always stored as pixels per inch.
+        */
+        if ((ResolutionType) units != PixelsPerCentimeterResolution)
+          image->units=PixelsPerInchResolution;
+        else
           {
             image->units=PixelsPerCentimeterResolution;
             image->resolution.x/=2.54;
             image->resolution.y/=2.54;
           }
-        else
-          image->units=PixelsPerInchResolution;
         break;
       }
       case 0x0404:
@@ -1736,4 +1742,4 @@ MagickPrivate MagickBooleanType SyncImageProfiles(Image *image)
     if (SyncExifProfile(image,profile) == MagickFalse)
       status=MagickFalse;
   return(status);
-}
\ No newline at end of file
+}
index 8c044a63511bb37f2a9c4af16098a3bd27ad5baf..dee437eec52117a5c1f5e8dc8d0cb5ae92e86522 100644 (file)
@@ -2459,6 +2459,9 @@ static MagickBooleanType HorizontalFilter(const ResizeFilter *resize_filter,
 #endif
   for (x=0; x < (ssize_t) resize_image->columns; x++)
   {
+    const int
+      id = GetOpenMPThreadId();
+
     double
       bisect,
       density;
@@ -2486,7 +2489,7 @@ static MagickBooleanType HorizontalFilter(const ResizeFilter *resize_filter,
     start=(ssize_t) MagickMax(bisect-support+0.5,0.0);
     stop=(ssize_t) MagickMin(bisect+support+0.5,(double) image->columns);
     density=0.0;
-    contribution=contributions[GetOpenMPThreadId()];
+    contribution=contributions[id];
     for (n=0; n < (stop-start); n++)
     {
       contribution[n].pixel=start+n;
@@ -2669,6 +2672,9 @@ static MagickBooleanType VerticalFilter(const ResizeFilter *resize_filter,
 #endif
   for (y=0; y < (ssize_t) resize_image->rows; y++)
   {
+    const int
+      id = GetOpenMPThreadId();
+
     double
       bisect,
       density;
@@ -2696,7 +2702,7 @@ static MagickBooleanType VerticalFilter(const ResizeFilter *resize_filter,
     start=(ssize_t) MagickMax(bisect-support+0.5,0.0);
     stop=(ssize_t) MagickMin(bisect+support+0.5,(double) image->rows);
     density=0.0;
-    contribution=contributions[GetOpenMPThreadId()];
+    contribution=contributions[id];
     for (n=0; n < (stop-start); n++)
     {
       contribution[n].pixel=start+n;