Make some structures immutable
diff --git a/coders/dcm.c b/coders/dcm.c
index 13d878e..88dc4cf 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -76,7 +76,7 @@
typedef struct _DicomInfo
{
- unsigned short
+ const unsigned short
group,
element;
@@ -86,7 +86,7 @@
} DicomInfo;
static const DicomInfo
- dicom_info[] =
+ const dicom_info[] =
{
{ 0x0000, 0x0000, "UL", "Group Length" },
{ 0x0000, 0x0001, "UL", "Command Length to End" },
diff --git a/coders/mat.c b/coders/mat.c
index b5a3f1f..f2de924 100644
--- a/coders/mat.c
+++ b/coders/mat.c
@@ -116,8 +116,8 @@
}
MATHeader;
-static const char *MonthsTab[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
-static const char *DayOfWTab[7]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
+static const char *const MonthsTab[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
+static const char *const DayOfWTab[7]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
static const char *OsDesc=
#ifdef __WIN32__
"PCWIN";
diff --git a/coders/meta.c b/coders/meta.c
index 8dd5913..971dbba 100644
--- a/coders/meta.c
+++ b/coders/meta.c
@@ -143,14 +143,15 @@
typedef struct _html_code
{
- short
+ const short
len;
+
const char
*code,
val;
} html_code;
-static html_code html_codes[] = {
+static const html_code html_codes[] = {
#ifdef HANDLE_GT_LT
{ 4,"<",'<' },
{ 4,">",'>' },
@@ -1757,7 +1758,7 @@
typedef struct _tag_spec
{
- short
+ const short
id;
const char
diff --git a/coders/palm.c b/coders/palm.c
index f616771..e5a56f2 100644
--- a/coders/palm.c
+++ b/coders/palm.c
@@ -89,7 +89,7 @@
/*
The 256 color system palette for Palm Computing Devices.
*/
-static unsigned char
+static const unsigned char
PalmPalette[256][3] =
{
{255, 255,255}, {255, 204,255}, {255, 153,255}, {255, 102,255},
diff --git a/coders/png.c b/coders/png.c
index c492460..9099145 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -525,59 +525,59 @@
portable, we use ASCII numbers like this, not characters.
*/
-static png_byte mng_MHDR[5]={ 77, 72, 68, 82, (png_byte) '\0'};
-static png_byte mng_BACK[5]={ 66, 65, 67, 75, (png_byte) '\0'};
-static png_byte mng_BASI[5]={ 66, 65, 83, 73, (png_byte) '\0'};
-static png_byte mng_CLIP[5]={ 67, 76, 73, 80, (png_byte) '\0'};
-static png_byte mng_CLON[5]={ 67, 76, 79, 78, (png_byte) '\0'};
-static png_byte mng_DEFI[5]={ 68, 69, 70, 73, (png_byte) '\0'};
-static png_byte mng_DHDR[5]={ 68, 72, 68, 82, (png_byte) '\0'};
-static png_byte mng_DISC[5]={ 68, 73, 83, 67, (png_byte) '\0'};
-static png_byte mng_ENDL[5]={ 69, 78, 68, 76, (png_byte) '\0'};
-static png_byte mng_FRAM[5]={ 70, 82, 65, 77, (png_byte) '\0'};
-static png_byte mng_IEND[5]={ 73, 69, 78, 68, (png_byte) '\0'};
-static png_byte mng_IHDR[5]={ 73, 72, 68, 82, (png_byte) '\0'};
-static png_byte mng_JHDR[5]={ 74, 72, 68, 82, (png_byte) '\0'};
-static png_byte mng_LOOP[5]={ 76, 79, 79, 80, (png_byte) '\0'};
-static png_byte mng_MAGN[5]={ 77, 65, 71, 78, (png_byte) '\0'};
-static png_byte mng_MEND[5]={ 77, 69, 78, 68, (png_byte) '\0'};
-static png_byte mng_MOVE[5]={ 77, 79, 86, 69, (png_byte) '\0'};
-static png_byte mng_PAST[5]={ 80, 65, 83, 84, (png_byte) '\0'};
-static png_byte mng_PLTE[5]={ 80, 76, 84, 69, (png_byte) '\0'};
-static png_byte mng_SAVE[5]={ 83, 65, 86, 69, (png_byte) '\0'};
-static png_byte mng_SEEK[5]={ 83, 69, 69, 75, (png_byte) '\0'};
-static png_byte mng_SHOW[5]={ 83, 72, 79, 87, (png_byte) '\0'};
-static png_byte mng_TERM[5]={ 84, 69, 82, 77, (png_byte) '\0'};
-static png_byte mng_bKGD[5]={ 98, 75, 71, 68, (png_byte) '\0'};
-static png_byte mng_cHRM[5]={ 99, 72, 82, 77, (png_byte) '\0'};
-static png_byte mng_gAMA[5]={103, 65, 77, 65, (png_byte) '\0'};
-static png_byte mng_iCCP[5]={105, 67, 67, 80, (png_byte) '\0'};
-static png_byte mng_nEED[5]={110, 69, 69, 68, (png_byte) '\0'};
-static png_byte mng_pHYg[5]={112, 72, 89, 103, (png_byte) '\0'};
-static png_byte mng_vpAg[5]={118, 112, 65, 103, (png_byte) '\0'};
-static png_byte mng_pHYs[5]={112, 72, 89, 115, (png_byte) '\0'};
-static png_byte mng_sBIT[5]={115, 66, 73, 84, (png_byte) '\0'};
-static png_byte mng_sRGB[5]={115, 82, 71, 66, (png_byte) '\0'};
-static png_byte mng_tRNS[5]={116, 82, 78, 83, (png_byte) '\0'};
+static const png_byte mng_MHDR[5]={ 77, 72, 68, 82, (png_byte) '\0'};
+static const png_byte mng_BACK[5]={ 66, 65, 67, 75, (png_byte) '\0'};
+static const png_byte mng_BASI[5]={ 66, 65, 83, 73, (png_byte) '\0'};
+static const png_byte mng_CLIP[5]={ 67, 76, 73, 80, (png_byte) '\0'};
+static const png_byte mng_CLON[5]={ 67, 76, 79, 78, (png_byte) '\0'};
+static const png_byte mng_DEFI[5]={ 68, 69, 70, 73, (png_byte) '\0'};
+static const png_byte mng_DHDR[5]={ 68, 72, 68, 82, (png_byte) '\0'};
+static const png_byte mng_DISC[5]={ 68, 73, 83, 67, (png_byte) '\0'};
+static const png_byte mng_ENDL[5]={ 69, 78, 68, 76, (png_byte) '\0'};
+static const png_byte mng_FRAM[5]={ 70, 82, 65, 77, (png_byte) '\0'};
+static const png_byte mng_IEND[5]={ 73, 69, 78, 68, (png_byte) '\0'};
+static const png_byte mng_IHDR[5]={ 73, 72, 68, 82, (png_byte) '\0'};
+static const png_byte mng_JHDR[5]={ 74, 72, 68, 82, (png_byte) '\0'};
+static const png_byte mng_LOOP[5]={ 76, 79, 79, 80, (png_byte) '\0'};
+static const png_byte mng_MAGN[5]={ 77, 65, 71, 78, (png_byte) '\0'};
+static const png_byte mng_MEND[5]={ 77, 69, 78, 68, (png_byte) '\0'};
+static const png_byte mng_MOVE[5]={ 77, 79, 86, 69, (png_byte) '\0'};
+static const png_byte mng_PAST[5]={ 80, 65, 83, 84, (png_byte) '\0'};
+static const png_byte mng_PLTE[5]={ 80, 76, 84, 69, (png_byte) '\0'};
+static const png_byte mng_SAVE[5]={ 83, 65, 86, 69, (png_byte) '\0'};
+static const png_byte mng_SEEK[5]={ 83, 69, 69, 75, (png_byte) '\0'};
+static const png_byte mng_SHOW[5]={ 83, 72, 79, 87, (png_byte) '\0'};
+static const png_byte mng_TERM[5]={ 84, 69, 82, 77, (png_byte) '\0'};
+static const png_byte mng_bKGD[5]={ 98, 75, 71, 68, (png_byte) '\0'};
+static const png_byte mng_cHRM[5]={ 99, 72, 82, 77, (png_byte) '\0'};
+static const png_byte mng_gAMA[5]={103, 65, 77, 65, (png_byte) '\0'};
+static const png_byte mng_iCCP[5]={105, 67, 67, 80, (png_byte) '\0'};
+static const png_byte mng_nEED[5]={110, 69, 69, 68, (png_byte) '\0'};
+static const png_byte mng_pHYg[5]={112, 72, 89, 103, (png_byte) '\0'};
+static const png_byte mng_vpAg[5]={118, 112, 65, 103, (png_byte) '\0'};
+static const png_byte mng_pHYs[5]={112, 72, 89, 115, (png_byte) '\0'};
+static const png_byte mng_sBIT[5]={115, 66, 73, 84, (png_byte) '\0'};
+static const png_byte mng_sRGB[5]={115, 82, 71, 66, (png_byte) '\0'};
+static const png_byte mng_tRNS[5]={116, 82, 78, 83, (png_byte) '\0'};
#if defined(JNG_SUPPORTED)
-static png_byte mng_IDAT[5]={ 73, 68, 65, 84, (png_byte) '\0'};
-static png_byte mng_JDAT[5]={ 74, 68, 65, 84, (png_byte) '\0'};
-static png_byte mng_JDAA[5]={ 74, 68, 65, 65, (png_byte) '\0'};
-static png_byte mng_JdAA[5]={ 74, 100, 65, 65, (png_byte) '\0'};
-static png_byte mng_JSEP[5]={ 74, 83, 69, 80, (png_byte) '\0'};
-static png_byte mng_oFFs[5]={111, 70, 70, 115, (png_byte) '\0'};
+static const png_byte mng_IDAT[5]={ 73, 68, 65, 84, (png_byte) '\0'};
+static const png_byte mng_JDAT[5]={ 74, 68, 65, 84, (png_byte) '\0'};
+static const png_byte mng_JDAA[5]={ 74, 68, 65, 65, (png_byte) '\0'};
+static const png_byte mng_JdAA[5]={ 74, 100, 65, 65, (png_byte) '\0'};
+static const png_byte mng_JSEP[5]={ 74, 83, 69, 80, (png_byte) '\0'};
+static const png_byte mng_oFFs[5]={111, 70, 70, 115, (png_byte) '\0'};
#endif
#if 0
/* Other known chunks that are not yet supported by ImageMagick: */
-static png_byte mng_hIST[5]={104, 73, 83, 84, (png_byte) '\0'};
-static png_byte mng_iTXt[5]={105, 84, 88, 116, (png_byte) '\0'};
-static png_byte mng_sPLT[5]={115, 80, 76, 84, (png_byte) '\0'};
-static png_byte mng_sTER[5]={115, 84, 69, 82, (png_byte) '\0'};
-static png_byte mng_tEXt[5]={116, 69, 88, 116, (png_byte) '\0'};
-static png_byte mng_tIME[5]={116, 73, 77, 69, (png_byte) '\0'};
-static png_byte mng_zTXt[5]={122, 84, 88, 116, (png_byte) '\0'};
+static const png_byte mng_hIST[5]={104, 73, 83, 84, (png_byte) '\0'};
+static const png_byte mng_iTXt[5]={105, 84, 88, 116, (png_byte) '\0'};
+static const png_byte mng_sPLT[5]={115, 80, 76, 84, (png_byte) '\0'};
+static const png_byte mng_sTER[5]={115, 84, 69, 82, (png_byte) '\0'};
+static const png_byte mng_tEXt[5]={116, 69, 88, 116, (png_byte) '\0'};
+static const png_byte mng_tIME[5]={116, 73, 77, 69, (png_byte) '\0'};
+static const png_byte mng_zTXt[5]={122, 84, 88, 116, (png_byte) '\0'};
#endif
typedef struct _MngBox
@@ -1220,12 +1220,12 @@
*p++=(png_byte) (value & 0xff);
}
-static void PNGType(png_bytep p,png_bytep type)
+static void PNGType(png_bytep p,png_const_bytep type)
{
(void) CopyMagickMemory(p,type,4*sizeof(png_byte));
}
-static void LogPNGChunk(MagickBooleanType logging, png_bytep type,
+static void LogPNGChunk(MagickBooleanType logging, png_const_bytep type,
size_t length)
{
if (logging != MagickFalse)
diff --git a/coders/ps.c b/coders/ps.c
index 3657d73..6810c5e 100644
--- a/coders/ps.c
+++ b/coders/ps.c
@@ -1145,7 +1145,7 @@
%
*/
-static inline unsigned char *PopHexPixel(const char **hex_digits,
+static inline unsigned char *PopHexPixel(const char *const *hex_digits,
const size_t pixel,unsigned char *pixels)
{
register const char
@@ -1179,7 +1179,7 @@
}
static const char
- *hex_digits[] =
+ *const hex_digits[] =
{
"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0A", "0B",
"0C", "0D", "0E", "0F", "10", "11", "12", "13", "14", "15", "16", "17",
@@ -1202,9 +1202,9 @@
"D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF", "E0", "E1", "E2", "E3",
"E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF",
"F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "FA", "FB",
- "FC", "FD", "FE", "FF", (char *) NULL
+ "FC", "FD", "FE", "FF", (const char *) NULL
},
- *PostscriptProlog[]=
+ *const PostscriptProlog[]=
{
"%%BeginProlog",
"%",
@@ -1444,9 +1444,9 @@
" currentfile buffer readline pop",
" token pop /pointsize exch def pop",
" /Times-Roman findfont pointsize scalefont setfont",
- (char *) NULL
+ (const char *) NULL
},
- *PostscriptEpilog[]=
+ *const PostscriptEpilog[]=
{
" x y scale",
" currentfile buffer readline pop",
@@ -1458,7 +1458,7 @@
" token pop /compression exch def pop",
" class 0 gt { PseudoClassImage } { DirectClassImage } ifelse",
" grestore",
- (char *) NULL
+ (const char *) NULL
};
char
@@ -1471,7 +1471,7 @@
compression;
const char
- **s,
+ *const *s,
*value;
const StringInfo
diff --git a/coders/ps2.c b/coders/ps2.c
index 4f68a19..bdd0c71 100644
--- a/coders/ps2.c
+++ b/coders/ps2.c
@@ -224,7 +224,7 @@
ExceptionInfo *exception)
{
static const char
- *PostscriptProlog[]=
+ *const PostscriptProlog[]=
{
"%%%%BeginProlog",
"%%",
@@ -358,9 +358,9 @@
" currentfile buffer readline pop",
" token pop /pointsize exch def pop",
" /Helvetica findfont pointsize scalefont setfont",
- (char *) NULL
+ (const char *) NULL
},
- *PostscriptEpilog[]=
+ *const PostscriptEpilog[]=
{
" x y scale",
" currentfile buffer readline pop",
@@ -374,7 +374,7 @@
" token pop /compression exch def pop",
" class 0 gt { PseudoClassImage } { DirectClassImage } ifelse",
" grestore",
- (char *) NULL
+ (const char *) NULL
};
char
@@ -387,7 +387,7 @@
compression;
const char
- **q,
+ *const *q,
*value;
double
diff --git a/coders/ps3.c b/coders/ps3.c
index ae8c24d..0d4c318 100644
--- a/coders/ps3.c
+++ b/coders/ps3.c
@@ -616,7 +616,7 @@
ExceptionInfo *exception)
{
static const char
- *PostscriptProlog[]=
+ *const PostscriptProlog[]=
{
"/ByteStreamDecodeFilter",
"{",
@@ -763,9 +763,9 @@
" token pop /y exch def pop",
" currentfile buffer readline pop",
" token pop /pointsize exch def pop",
- (char *) NULL
+ (const char *) NULL
},
- *PostscriptEpilog[]=
+ *const PostscriptEpilog[]=
{
" x y scale",
" % Clipping path.",
@@ -804,7 +804,7 @@
" grestore",
" sp { showpage } if",
"} bind def",
- (char *) NULL
+ (const char *) NULL
};
char
@@ -818,7 +818,7 @@
const char
*option,
- **q,
+ *const *q,
*value;
double
diff --git a/coders/xpm.c b/coders/xpm.c
index 6736d82..6db958b 100644
--- a/coders/xpm.c
+++ b/coders/xpm.c
@@ -188,7 +188,7 @@
i;
static const char
- *targets[NumberTargets] = { "c ", "g ", "g4 ", "m ", "b ", "s " };
+ *const targets[NumberTargets] = { "c ", "g ", "g4 ", "m ", "b ", "s " };
if (search_start != MagickFalse)
{