]> granicus.if.org Git - imagemagick/blobdiff - coders/png.c
(no commit message)
[imagemagick] / coders / png.c
index 63d9c9967fd99662e3ae04eb862f575ba5b7a14d..26380352b1beb92b6d2849f26c07ed52e5aa4e81 100644 (file)
@@ -7822,14 +7822,16 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
               else
                 {
                   SetRedPixelComponent(r,ScaleCharToQuantum(
-                    ScaleQuantumToChar(GetRedPixelComponent(r) & 0xf0) |
-                    ScaleQuantumToChar(GetRedPixelComponent(r) & 0xf0) >> 4));
+                    (ScaleQuantumToChar(GetRedPixelComponent(r)) & 0xf0) |
+                    (ScaleQuantumToChar(GetRedPixelComponent(r)) & 0xf0) >> 4));
                   SetGreenPixelComponent(r,ScaleCharToQuantum(
-                    ScaleQuantumToChar(GetGreenPixelComponent(r) & 0xf0) |
-                    ScaleQuantumToChar(GetGreenPixelComponent(r) & 0xf0) >> 4));
+                    (ScaleQuantumToChar(GetGreenPixelComponent(r)) & 0xf0) |
+                    (ScaleQuantumToChar(GetGreenPixelComponent(r)) & 0xf0) >>
+                    4));
                   SetBluePixelComponent(r,ScaleCharToQuantum(
-                    ScaleQuantumToChar(GetBluePixelComponent(r) & 0xf0) |
-                    ScaleQuantumToChar(GetBluePixelComponent(r) & 0xf0) >> 4));
+                    (ScaleQuantumToChar(GetBluePixelComponent(r)) & 0xf0) |
+                    (ScaleQuantumToChar(GetBluePixelComponent(r)) & 0xf0) >>
+                    4));
                 }
               r++;
             }
@@ -7908,17 +7910,21 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
               else
                 {
                   SetRedPixelComponent(r,ScaleCharToQuantum(
-                    ScaleQuantumToChar(GetRedPixelComponent(r) & 0xe0) |
-                    ScaleQuantumToChar(GetRedPixelComponent(r) & 0xe0) >> 3 |
-                    ScaleQuantumToChar(GetRedPixelComponent(r) & 0xc0) >> 6));
+                    (ScaleQuantumToChar(GetRedPixelComponent(r)) & 0xe0) |
+                    (ScaleQuantumToChar(GetRedPixelComponent(r)) & 0xe0) >> 3 |
+                    (ScaleQuantumToChar(GetRedPixelComponent(r)) & 0xc0) >>
+                    6));
                   SetGreenPixelComponent(r,ScaleCharToQuantum(
-                    ScaleQuantumToChar(GetGreenPixelComponent(r) & 0xe0) |
-                    ScaleQuantumToChar(GetGreenPixelComponent(r) & 0xe0) >> 3 |
-                    ScaleQuantumToChar(GetGreenPixelComponent(r) & 0xc0) >> 6));
+                    (ScaleQuantumToChar(GetGreenPixelComponent(r)) & 0xe0) |
+                    (ScaleQuantumToChar(GetGreenPixelComponent(r)) & 0xe0) >>
+                    3 |
+                    (ScaleQuantumToChar(GetGreenPixelComponent(r)) & 0xc0) >>
+                    6));
                   SetBluePixelComponent(r,ScaleCharToQuantum(
-                    ScaleQuantumToChar(GetBluePixelComponent(r) & 0xe0) |
-                    ScaleQuantumToChar(GetBluePixelComponent(r) & 0xe0) >> 3 |
-                    ScaleQuantumToChar(GetBluePixelComponent(r) & 0xc0) >> 6));
+                    (ScaleQuantumToChar(GetBluePixelComponent(r)) & 0xe0) |
+                    (ScaleQuantumToChar(GetBluePixelComponent(r)) & 0xe0) >> 3 |
+                    (ScaleQuantumToChar(GetBluePixelComponent(r)) & 0xc0) >>
+                    6));
                 }
               r++;
             }
@@ -7992,10 +7998,11 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
               else
                 {
                   SetBluePixelComponent(r,ScaleCharToQuantum(
-                    ScaleQuantumToChar(GetBluePixelComponent(r) & 0xc0) |
-                    ScaleQuantumToChar(GetBluePixelComponent(r) & 0xc0) >> 2 |
-                    ScaleQuantumToChar(GetBluePixelComponent(r) & 0xc0) >> 4 |
-                    ScaleQuantumToChar(GetBluePixelComponent(r) & 0xc0) >> 6));
+                    (ScaleQuantumToChar(GetBluePixelComponent(r)) & 0xc0) |
+                    (ScaleQuantumToChar(GetBluePixelComponent(r)) & 0xc0) >> 2 |
+                    (ScaleQuantumToChar(GetBluePixelComponent(r)) & 0xc0) >> 4 |
+                    (ScaleQuantumToChar(GetBluePixelComponent(r)) & 0xc0) >>
+                    6));
                 }
               r++;
             }
@@ -8033,7 +8040,7 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
   if (mng_info->ping_exclude_tRNS != MagickFalse &&
      (number_transparent != 0 || number_semitransparent != 0))
     {
-      int colortype=mng_info->write_png_colortype;
+      unsigned int colortype=mng_info->write_png_colortype;
 
       if (ping_have_color == MagickFalse)
         mng_info->write_png_colortype = 5;
@@ -8042,7 +8049,7 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
         mng_info->write_png_colortype = 7;
 
       if (colortype != 0 &&
-         mng_info->write_png_colortype != (ssize_t) colortype)
+         mng_info->write_png_colortype != colortype)
         ping_need_colortype_warning=MagickTrue;
 
     }
@@ -8733,7 +8740,7 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
           image_depth=MAGICKCORE_QUANTUM_DEPTH;
 
         if ((image_colors == 0) ||
-             ((ssize_t) (image_colors-1) > MaxColormapSize))
+             ((ssize_t) (image_colors-1) > (ssize_t) MaxColormapSize))
           image_colors=(int) (one << image_depth);
 
         if (image_depth > 8)
@@ -8842,7 +8849,7 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
                 ping_bit_depth=1;
                 one=1;
 
-                while ((one << ping_bit_depth) < number_colors)
+                while ((one << ping_bit_depth) < (ssize_t) number_colors)
                   ping_bit_depth <<= 1;
               }