]> granicus.if.org Git - imagemagick/commitdiff
Ensure source compiles with pedantic C++ compiler
authorCristy <urban-warrior@imagemagick.org>
Sat, 10 Dec 2016 17:12:35 +0000 (12:12 -0500)
committerCristy <urban-warrior@imagemagick.org>
Sat, 10 Dec 2016 17:12:35 +0000 (12:12 -0500)
MagickCore/cache.c
MagickCore/image.c
MagickCore/string.c
coders/bmp.c
coders/histogram.c
coders/json.c
coders/meta.c
coders/ps2.c
coders/ps3.c
coders/psd.c

index 88ddbe7c430c345385d7cfc121f38f65f3578c5c..b7ac754411ded1bf4b3ff7d5377163f6e34ecf47 100644 (file)
@@ -881,7 +881,8 @@ static inline void RelinquishPixelCachePixels(CacheInfo *cache_info)
         }
 #endif
       if (cache_info->mapped == MagickFalse)
-        cache_info->pixels=RelinquishAlignedMemory(cache_info->pixels);
+        cache_info->pixels=(Quantum *) RelinquishAlignedMemory(
+          cache_info->pixels);
       else
         (void) UnmapBlob(cache_info->pixels,(size_t) cache_info->length);
       RelinquishMagickResource(MemoryResource,cache_info->length);
index ae1f3a20eb6928e63177e67fdb827a490c400010..a07421b0e37374bef4d84430226a631a032d0089 100644 (file)
@@ -3209,8 +3209,8 @@ MagickExport MagickBooleanType SetImageRegionMask(Image *image,
         pixel;
 
       pixel=0;
-      if (((x >= region->x) && (x < (region->x+region->width))) &&
-          ((y >= region->y) && (y < (region->y+region->height))))
+      if (((x >= region->x) && (x < (region->x+(ssize_t) region->width))) &&
+          ((y >= region->y) && (y < (region->y+(ssize_t) region->height))))
         pixel=QuantumRange;
       switch (type)
       {
index a26a5b203f958a4521238000f2055ae621ac4bda..56056d1e44436ee357ede5aac790127d9551f32f 100644 (file)
@@ -752,8 +752,6 @@ MagickExport size_t CopyMagickString(char *destination,const char *source,
   register size_t
     n;
 
-  if (source == (const char *) NULL)
-    return(0);
   p=source;
   q=destination;
   for (n=length; n > 4; n-=4)
index 303f6d5a7bc546983fa99dc69973f4b90b42389a..d68897cd5cbf6d45ae240f47f1987665f6786e7f 100644 (file)
@@ -1682,8 +1682,8 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,
           bmp_info.file_size+=extra_size;
           bmp_info.offset_bits+=extra_size;
         }
-    if ((image->columns != (signed int) image->columns) ||
-        (image->rows != (signed int) image->rows))
+    if (((ssize_t) image->columns != (signed int) image->columns) ||
+        ((ssize_t) image->rows != (signed int) image->rows))
       ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
     bmp_info.width=(ssize_t) image->columns;
     bmp_info.height=(ssize_t) image->rows;
index d5a40874a215a97d97dd5d326cab9429f139788c..ffce5545ff2d17ca5b851d32fa89dcfcf0130318 100644 (file)
@@ -375,10 +375,10 @@ static MagickBooleanType WriteHISTOGRAMImage(const ImageInfo *image_info,
       (LocaleCompare(write_info->magick,"HISTOGRAM") == 0))
     (void) FormatLocaleString(histogram_image->filename,MagickPathExtent,
       "miff:%s",write_info->filename);
-  histogram_image->blob=DetachBlob(histogram_image->blob);
+  histogram_image->blob=(BlobInfo *) DetachBlob(histogram_image->blob);
   histogram_image->blob=CloneBlobInfo(image->blob);
   status=WriteImage(write_info,histogram_image,exception);
-  image->blob=DetachBlob(image->blob);
+  image->blob=(BlobInfo *) DetachBlob(image->blob);
   image->blob=CloneBlobInfo(histogram_image->blob);
   histogram_image=DestroyImage(histogram_image);
   write_info=DestroyImageInfo(write_info);
index d1460b883c3089e928d4155a0b1837212ea59232..ab32137bd320a7bfe090f3b621a7860ae9183727 100644 (file)
@@ -653,7 +653,7 @@ static ssize_t PrintChannelPerceptualHash(Image *image,FILE *file,
       if (j < (MaximumNumberOfPerceptualHashes-1))
         n+=FormatLocaleFile(file,",\n");
     }
-    if (i < (GetPixelChannels(image)-1))
+    if (i < (ssize_t) (GetPixelChannels(image)-1))
       n+=FormatLocaleFile(file,"\n      },\n");
   }
   n+=FormatLocaleFile(file,"\n      }\n");
index 2a153c53e1ef40ddd562bb09f1ae7e8f855a0f4a..9dbaa5c3525f80bb80f74aa9787b3ac4fad32ecc 100644 (file)
@@ -407,7 +407,7 @@ static ssize_t parse8BIM(Image *ifile, Image *ofile)
                     *s = &token[next-1];
 
                   codes_length=convertHTMLcodes(s, strlen(s));
-                  if (codes_length > len)
+                  if ((ssize_t) codes_length > len)
                     len=0;
                   else
                     len-=codes_length;
@@ -710,7 +710,7 @@ static ssize_t parse8BIMW(Image *ifile, Image *ofile)
                     *s = &token[next-1];
 
                   codes_length=convertHTMLcodes(s, strlen(s));
-                  if (codes_length > len)
+                  if ((ssize_t) codes_length > len)
                     len=0;
                   else
                     len-=codes_length;
index 363b9c9b8c91f3e545921c19e589e7e8bb7c46b4..f4105d98125c711de9a0d341a03eb54efddc506c 100644 (file)
@@ -298,7 +298,7 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image,
       "      {",
       "        /DataSource pixel_stream %s",
       "        <<",
-      "           /K "CCITTParam,
+      "           /K " CCITTParam,
       "           /Columns columns",
       "           /Rows rows",
       "        >> /CCITTFaxDecode filter",
index 66727dfcb550288ed08cf6642a45cce6f67fbf05..fa346ee778ebf7318ed9303079fbe32f537b6075 100644 (file)
@@ -486,37 +486,42 @@ static MagickBooleanType WritePS3MaskImage(const ImageInfo *image_info,
     default:
     {
       (void) FormatLocaleString(buffer,MagickPathExtent,
-        "currentfile %.20g %.20g "PS3_NoCompression" ByteStreamDecodeFilter\n",
-        (double) image->columns,(double) image->rows);
+        "currentfile %.20g %.20g " PS3_NoCompression
+        " ByteStreamDecodeFilter\n",(double) image->columns,(double)
+        image->rows);
       break;
     }
     case FaxCompression:
     case Group4Compression:
     {
       (void) FormatLocaleString(buffer,MagickPathExtent,
-        "currentfile %.20g %.20g "PS3_FaxCompression" ByteStreamDecodeFilter\n",
-        (double) image->columns,(double) image->rows);
+        "currentfile %.20g %.20g " PS3_FaxCompression
+        " ByteStreamDecodeFilter\n",(double) image->columns,(double)
+        image->rows);
       break;
     }
     case LZWCompression:
     {
       (void) FormatLocaleString(buffer,MagickPathExtent,
-        "currentfile %.20g %.20g "PS3_LZWCompression" ByteStreamDecodeFilter\n",
-        (double) image->columns,(double) image->rows);
+        "currentfile %.20g %.20g " PS3_LZWCompression
+        " ByteStreamDecodeFilter\n",(double) image->columns,(double)
+        image->rows);
       break;
     }
     case RLECompression:
     {
       (void) FormatLocaleString(buffer,MagickPathExtent,
-        "currentfile %.20g %.20g "PS3_RLECompression" ByteStreamDecodeFilter\n",
-        (double) image->columns,(double) image->rows);
+        "currentfile %.20g %.20g " PS3_RLECompression
+        " ByteStreamDecodeFilter\n",(double) image->columns,(double)
+        image->rows);
       break;
     }
     case ZipCompression:
     {
       (void) FormatLocaleString(buffer,MagickPathExtent,
-        "currentfile %.20g %.20g "PS3_ZipCompression" ByteStreamDecodeFilter\n",
-        (double) image->columns,(double) image->rows);
+        "currentfile %.20g %.20g " PS3_ZipCompression
+        " ByteStreamDecodeFilter\n",(double) image->columns,(double)
+        image->rows);
       break;
     }
   }
@@ -623,25 +628,25 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,
       "  /z exch def",
       "  /r exch def",
       "  /c exch def",
-      "  z "PS3_NoCompression" eq { /ASCII85Decode filter } if",
-      "  z "PS3_FaxCompression" eq",
+      "  z " PS3_NoCompression " eq { /ASCII85Decode filter } if",
+      "  z " PS3_FaxCompression " eq",
       "  {",
       "    <<",
-      "      /K "CCITTParam,
+      "      /K " CCITTParam,
       "      /Columns c",
       "      /Rows r",
       "    >>",
       "    /CCITTFaxDecode filter",
       "  } if",
-      "  z "PS3_JPEGCompression" eq { /DCTDecode filter } if",
-      "  z "PS3_LZWCompression" eq { /LZWDecode filter } if",
-      "  z "PS3_RLECompression" eq { /RunLengthDecode filter } if",
-      "  z "PS3_ZipCompression" eq { /FlateDecode filter } if",
+      "  z " PS3_JPEGCompression " eq { /DCTDecode filter } if",
+      "  z " PS3_LZWCompression " eq { /LZWDecode filter } if",
+      "  z " PS3_RLECompression " eq { /RunLengthDecode filter } if",
+      "  z " PS3_ZipCompression " eq { /FlateDecode filter } if",
       "} bind def",
       "",
       "/DirectClassImageDict",
       "{",
-      "  colorspace "PS3_RGBColorspace" eq",
+      "  colorspace " PS3_RGBColorspace " eq",
       "  {",
       "    /DeviceRGB setcolorspace",
       "    <<",
@@ -666,7 +671,7 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,
       "      /MultipleDataSources false",
       "      /ImageMatrix [columns 0 0 rows neg 0 rows]",
       "      /Decode",
-      "        compression "PS3_JPEGCompression" eq",
+      "        compression " PS3_JPEGCompression " eq",
       "        { [1 0 1 0 1 0 1 0] }",
       "        { [0 1 0 1 0 1 0 1] }",
       "        ifelse",
@@ -699,7 +704,7 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,
       "  {",
       "    % RGB colormap.",
       "    /colormap colors 3 mul string def",
-      "    compression "PS3_NoCompression" eq",
+      "    compression " PS3_NoCompression " eq",
       "    { currentfile /ASCII85Decode filter colormap readstring pop pop }",
       "    { currentfile colormap readstring pop pop }",
       "    ifelse",
@@ -719,7 +724,7 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,
       "",
       "/NonMaskedImageDict",
       "{",
-      "  class "PS3_PseudoClass" eq",
+      "  class " PS3_PseudoClass " eq",
       "  { PseudoClassImageDict }",
       "  { DirectClassImageDict }",
       "  ifelse",
index 10e948254fae40702ea4d14f9837e9372744d01c..e2e3041c0f7bb6f9e61f2f511eb3f7cf6df18d55 100644 (file)
@@ -2525,7 +2525,8 @@ static size_t WritePSDChannel(const PSDInfo *psd_info,
 #ifdef MAGICKCORE_ZLIB_DELEGATE
   if (next_image->compression == ZipCompression)
     {
-      compressed_pixels=AcquireQuantumMemory(CHUNK,sizeof(*compressed_pixels));
+      compressed_pixels=(unsigned char *) AcquireQuantumMemory(CHUNK,
+        sizeof(*compressed_pixels));
       if (compressed_pixels == (unsigned char *) NULL)
         {
           quantum_info=DestroyQuantumInfo(quantum_info);
@@ -2614,7 +2615,7 @@ static unsigned char *AcquireCompactPixels(const Image *image,
   return(compact_pixels);
 }
 
-static MagickBooleanType WritePSDChannels(const PSDInfo *psd_info,
+static size_t WritePSDChannels(const PSDInfo *psd_info,
   const ImageInfo *image_info,Image *image,Image *next_image,
   MagickOffsetType size_offset,const MagickBooleanType separate,
   ExceptionInfo *exception)
@@ -2879,7 +2880,7 @@ static void RemoveICCProfileFromResourceBlock(StringInfo *bim_profile)
           quantum;
 
         quantum=PSDQuantum(count)+12;
-        if ((quantum >= 12) && (quantum < length))
+        if ((quantum >= 12) && (quantum < (ssize_t) length))
           {
             if ((q+quantum < (datum+length-16)))
               (void) CopyMagickMemory(q,q+quantum,length-quantum-(q-datum));
@@ -3383,7 +3384,8 @@ static MagickBooleanType WritePSDImage(const ImageInfo *image_info,
   else
     rounded_size=size;
   (void) WritePSDSize(&psd_info,image,rounded_size,size_offset);
-  layer_size_offsets=RelinquishMagickMemory(layer_size_offsets);
+  layer_size_offsets=(MagickOffsetType *) RelinquishMagickMemory(
+    layer_size_offsets);
   /*
     Remove the opacity mask from the registry
   */