Ensure source compiles with pedantic C++ compiler
diff --git a/coders/bmp.c b/coders/bmp.c
index 303f6d5..d68897c 100644
--- a/coders/bmp.c
+++ b/coders/bmp.c
@@ -1682,8 +1682,8 @@
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;
diff --git a/coders/histogram.c b/coders/histogram.c
index d5a4087..ffce554 100644
--- a/coders/histogram.c
+++ b/coders/histogram.c
@@ -375,10 +375,10 @@
(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);
diff --git a/coders/json.c b/coders/json.c
index d1460b8..ab32137 100644
--- a/coders/json.c
+++ b/coders/json.c
@@ -653,7 +653,7 @@
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");
diff --git a/coders/meta.c b/coders/meta.c
index 2a153c5..9dbaa5c 100644
--- a/coders/meta.c
+++ b/coders/meta.c
@@ -407,7 +407,7 @@
*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 @@
*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;
diff --git a/coders/ps2.c b/coders/ps2.c
index 363b9c9..f4105d9 100644
--- a/coders/ps2.c
+++ b/coders/ps2.c
@@ -298,7 +298,7 @@
" {",
" /DataSource pixel_stream %s",
" <<",
- " /K "CCITTParam,
+ " /K " CCITTParam,
" /Columns columns",
" /Rows rows",
" >> /CCITTFaxDecode filter",
diff --git a/coders/ps3.c b/coders/ps3.c
index 66727df..fa346ee 100644
--- a/coders/ps3.c
+++ b/coders/ps3.c
@@ -486,37 +486,42 @@
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 @@
" /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 @@
" /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 @@
" {",
" % 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 @@
"",
"/NonMaskedImageDict",
"{",
- " class "PS3_PseudoClass" eq",
+ " class " PS3_PseudoClass " eq",
" { PseudoClassImageDict }",
" { DirectClassImageDict }",
" ifelse",
diff --git a/coders/psd.c b/coders/psd.c
index 10e9482..e2e3041 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -2525,7 +2525,8 @@
#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 @@
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 @@
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 @@
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
*/