changeset 516:6f141f760c54

Constify.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Nov 2012 17:24:08 +0200
parents a896c1153e4e
children e2a76bb59888
files gfxconv.c lib64gfx.c lib64gfx.h view64.c
diffstat 4 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/gfxconv.c	Mon Nov 19 16:58:22 2012 +0200
+++ b/gfxconv.c	Mon Nov 19 17:24:08 2012 +0200
@@ -181,7 +181,7 @@
     printf("\nAvailable bitmap formats:\n");
     for (i = 0; i < ndmC64ImageFormats; i++)
     {
-        DMC64ImageFormat *fmt = &dmC64ImageFormats[i];
+        const DMC64ImageFormat *fmt = &dmC64ImageFormats[i];
         printf("%3d | %-5s | %-15s | %s\n",
             i, fmt->extension,
             dmC64ImageTypeNames[fmt->type],
@@ -1361,7 +1361,7 @@
 int main(int argc, char *argv[])
 {
     FILE *inFile;
-    DMC64ImageFormat *cfmt;
+    const DMC64ImageFormat *cfmt;
     DMC64Image cimage;
     Uint8 *dataBuf = NULL;
     size_t dataSize;
@@ -1422,7 +1422,7 @@
     if (optInFormat == FFMT_AUTO || optInFormat == FFMT_BITMAP)
     {
         // Probe for format
-        DMC64ImageFormat *forced = NULL;
+        const DMC64ImageFormat *forced = NULL;
         int res;
 
         if (optForcedFormat >= 0)
--- a/lib64gfx.c	Mon Nov 19 16:58:22 2012 +0200
+++ b/lib64gfx.c	Mon Nov 19 17:24:08 2012 +0200
@@ -272,7 +272,7 @@
 }
 
 
-DMC64ImageFormat dmC64ImageFormats[] =
+const DMC64ImageFormat dmC64ImageFormats[] =
 {
     {
         DM_C64IFMT_MC, ".drp", "DrazPaint 2.0 (packed)", 0x5800, -1,
@@ -377,13 +377,13 @@
 const int ndmC64ImageFormats = sizeof(dmC64ImageFormats) / sizeof(dmC64ImageFormats[0]);
 
 
-int dmC64ProbeGeneric(const Uint8 *buf, const size_t len, DMC64ImageFormat **pfmt)
+int dmC64ProbeGeneric(const Uint8 *buf, const size_t len, const DMC64ImageFormat **pfmt)
 {
     int i, scoreMax = DM_PROBE_SCORE_FALSE, scoreIndex = -1;
 
     for (i = 0; i < ndmC64ImageFormats; i++)
     {
-        DMC64ImageFormat *fmt = &dmC64ImageFormats[i];
+        const DMC64ImageFormat *fmt = &dmC64ImageFormats[i];
         int score = DM_PROBE_SCORE_FALSE;
         if (fmt->probe == NULL && fmt->size > 0 && fmt->addr > 0)
         {
@@ -710,7 +710,7 @@
 
 int dmC64DecodeBMP(DMC64Image *img, const Uint8 *buf, const size_t len,
     const size_t probeOffs, const size_t loadOffs,
-    DMC64ImageFormat **fmt, DMC64ImageFormat *forced)
+    const DMC64ImageFormat **fmt, const DMC64ImageFormat *forced)
 {
     // Check for forced format
     if (forced != NULL)
--- a/lib64gfx.h	Mon Nov 19 16:58:22 2012 +0200
+++ b/lib64gfx.h	Mon Nov 19 17:24:08 2012 +0200
@@ -166,16 +166,16 @@
 
 extern const size_t      dmC64DefaultSizes[DT_LAST];
 extern DMColor           dmC64Palette[C64_NCOLORS];
-extern DMC64ImageFormat  dmC64ImageFormats[];
+extern const DMC64ImageFormat  dmC64ImageFormats[];
 extern const int         ndmC64ImageFormats;
 extern const char *      dmC64ImageTypeNames[];
 
 
 int       dmC64ConvertCSData(DMImage *img, int xoffs, int yoffs, const Uint8 *inBuf, int width, int height, BOOL multicolor, int *colors);
-int       dmC64ProbeGeneric(const Uint8 *buf, const size_t len, DMC64ImageFormat **fmt);
+int       dmC64ProbeGeneric(const Uint8 *buf, const size_t len, const DMC64ImageFormat **fmt);
 int       dmC64DecodeGenericBMP(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt);
 int       dmC64ConvertGenericBMP2Image(DMImage *screen, const DMC64Image *img);
-int       dmC64DecodeBMP(DMC64Image *img, const Uint8 *buf, const size_t len, const size_t probeOffs, const size_t loadOffs, DMC64ImageFormat **fmt, DMC64ImageFormat *forced);
+int       dmC64DecodeBMP(DMC64Image *img, const Uint8 *buf, const size_t len, const size_t probeOffs, const size_t loadOffs, const DMC64ImageFormat **fmt, const DMC64ImageFormat *forced);
 
 int       dmReadDataFile(FILE *inFile, const char *filename, Uint8 **buf, size_t *size);
 
--- a/view64.c	Mon Nov 19 16:58:22 2012 +0200
+++ b/view64.c	Mon Nov 19 17:24:08 2012 +0200
@@ -47,7 +47,7 @@
     printf("\nAvailable bitmap formats:\n");
     for (i = 0; i < ndmC64ImageFormats; i++)
     {
-        DMC64ImageFormat *fmt = &dmC64ImageFormats[i];
+        const DMC64ImageFormat *fmt = &dmC64ImageFormats[i];
         printf("%3d | %-5s | %-15s | %s\n",
             i, fmt->extension,
             dmC64ImageTypeNames[fmt->type],
@@ -155,7 +155,7 @@
     SDL_Surface *screen = NULL, *surf = NULL;
     DMImage bmap;
     BOOL initSDL = FALSE, exitFlag, needRedraw;
-    DMC64ImageFormat *fmt, *forced;
+    const DMC64ImageFormat *fmt = NULL, *forced;
     DMC64Image image;
     char *windowTitle;
     Uint8 *dataBuf = NULL;