diff options
author | Max Horn | 2009-10-09 21:47:33 +0000 |
---|---|---|
committer | Max Horn | 2009-10-09 21:47:33 +0000 |
commit | 2e964baeef9a74d45090583b52419afa3c9c47bf (patch) | |
tree | 66106bd63ae8f9d7a1120d57344987856c961b56 | |
parent | 6f1c43a7311d5e942f055087e307d6a537e159c6 (diff) | |
download | scummvm-rg350-2e964baeef9a74d45090583b52419afa3c9c47bf.tar.gz scummvm-rg350-2e964baeef9a74d45090583b52419afa3c9c47bf.tar.bz2 scummvm-rg350-2e964baeef9a74d45090583b52419afa3c9c47bf.zip |
Some const correctness changes; cleanup
svn-id: r44850
-rw-r--r-- | backends/platform/ps2/Gs2dScreen.cpp | 2 | ||||
-rw-r--r-- | backends/platform/ps2/icon.cpp | 4 | ||||
-rw-r--r-- | engines/lure/memory.cpp | 4 | ||||
-rw-r--r-- | engines/lure/memory.h | 2 | ||||
-rw-r--r-- | engines/lure/surface.cpp | 8 | ||||
-rw-r--r-- | engines/lure/surface.h | 2 | ||||
-rw-r--r-- | engines/sci/engine/kfile.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/klists.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 4 | ||||
-rw-r--r-- | engines/sci/gfx/font.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/bmv.cpp | 4 | ||||
-rw-r--r-- | engines/tinsel/polygons.cpp | 14 | ||||
-rw-r--r-- | graphics/conversion.cpp | 12 |
13 files changed, 32 insertions, 34 deletions
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index 048c122765..1da7018648 100644 --- a/backends/platform/ps2/Gs2dScreen.cpp +++ b/backends/platform/ps2/Gs2dScreen.cpp @@ -298,7 +298,7 @@ void Gs2dScreen::createAnimTextures(void) { for (int i = 0; i < 16; i++) { uint32 *destPos = (uint32*)buf; for (int ch = 15; ch >= 0; ch--) { - uint32 *src = (uint32*)(_binaryData + ((_binaryPattern[i] >> ch) & 1) * 4 * 14); + const uint32 *src = (const uint32*)(_binaryData + ((_binaryPattern[i] >> ch) & 1) * 4 * 14); for (int line = 0; line < 14; line++) destPos[line << 4] = src[line]; destPos++; diff --git a/backends/platform/ps2/icon.cpp b/backends/platform/ps2/icon.cpp index 9b88d0bb68..48afc50c42 100644 --- a/backends/platform/ps2/icon.cpp +++ b/backends/platform/ps2/icon.cpp @@ -938,9 +938,9 @@ const uint8 _rleIcoData[14018] = { uint16 PS2Icon::decompressData(uint16 **data) { uint16 inPos = 1; - uint16 *rleData = (uint16*)_rleIcoData; + const uint16 *rleData = (const uint16 *)_rleIcoData; uint16 resSize = rleData[0]; - uint16 *resData = (uint16*)malloc(resSize * sizeof(uint16)); + uint16 *resData = (uint16 *)malloc(resSize * sizeof(uint16)); uint16 outPos = 0; while (outPos < resSize) { diff --git a/engines/lure/memory.cpp b/engines/lure/memory.cpp index 814251e425..f96b5015bc 100644 --- a/engines/lure/memory.cpp +++ b/engines/lure/memory.cpp @@ -38,8 +38,8 @@ MemoryBlock *Memory::duplicate(MemoryBlock *src) { return block; } -uint8 *Memory::alloc(uint32 size) { - return (uint8 *) malloc(size); +void *Memory::alloc(uint32 size) { + return malloc(size); } void Memory::dealloc(void *block) { diff --git a/engines/lure/memory.h b/engines/lure/memory.h index 730e3656e3..f51c4fc49e 100644 --- a/engines/lure/memory.h +++ b/engines/lure/memory.h @@ -56,7 +56,7 @@ class Memory { public: static MemoryBlock *allocate(uint32 size); static MemoryBlock *duplicate(MemoryBlock *src); - static uint8 *alloc(uint32 size); + static void *alloc(uint32 size); static void dealloc(void *block); }; diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp index 54b579c557..dc0ddda432 100644 --- a/engines/lure/surface.cpp +++ b/engines/lure/surface.cpp @@ -42,11 +42,11 @@ namespace Lure { static MemoryBlock *int_font = NULL; static MemoryBlock *int_dialog_frame = NULL; static uint8 fontSize[256]; -int numFontChars; +static int numFontChars; -const byte char8A[8] = {0x40, 0x20, 0x00, 0x90, 0x90, 0x90, 0x68, 0x00}; // accented `u -const byte char8D[8] = {0x80, 0x40, 0x00, 0xc0, 0x40, 0x40, 0x60, 0x00}; // accented `i -const byte char95[8] = {0x40, 0x20, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00}; // accented `o +static const byte char8A[8] = {0x40, 0x20, 0x00, 0x90, 0x90, 0x90, 0x68, 0x00}; // accented `u +static const byte char8D[8] = {0x80, 0x40, 0x00, 0xc0, 0x40, 0x40, 0x60, 0x00}; // accented `i +static const byte char95[8] = {0x40, 0x20, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00}; // accented `o void Surface::initialise() { Disk &disk = Disk::getReference(); diff --git a/engines/lure/surface.h b/engines/lure/surface.h index 7e66f6aae9..8e5de6eaa0 100644 --- a/engines/lure/surface.h +++ b/engines/lure/surface.h @@ -150,8 +150,6 @@ public: bool show(); }; -extern int numFontChars; - } // End of namespace Lure #endif diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index a1b17d58a2..40d98a9ce6 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -440,8 +440,8 @@ struct SavegameDesc { }; static int _savegame_index_struct_compare(const void *a, const void *b) { - SavegameDesc *A = (SavegameDesc *)a; - SavegameDesc *B = (SavegameDesc *)b; + const SavegameDesc *A = (const SavegameDesc *)a; + const SavegameDesc *B = (const SavegameDesc *)b; if (B->date != A->date) return B->date - A->date; diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index 4a171eab65..17caae0e43 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -371,8 +371,8 @@ struct sort_temp_t { }; int sort_temp_cmp(const void *p1, const void *p2) { - sort_temp_t *st1 = (sort_temp_t *)p1; - sort_temp_t *st2 = (sort_temp_t *)p2; + const sort_temp_t *st1 = (const sort_temp_t *)p1; + const sort_temp_t *st2 = (const sort_temp_t *)p2; if (st1->order.segment < st1->order.segment || (st1->order.segment == st1->order.segment && st1->order.offset < st2->order.offset)) return -1; diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 2671aad6b6..1df6b086ff 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -611,8 +611,8 @@ static int vertex_compare(const void *a, const void *b) { // Returns : (int) -1 if a is smaller than b, 1 if a is larger than b, and // 0 if a and b are equal const Common::Point &p0 = s_vertex_cur->v; - const Common::Point &p1 = (*(Vertex **) a)->v; - const Common::Point &p2 = (*(Vertex **) b)->v; + const Common::Point &p1 = (*(const Vertex **) a)->v; + const Common::Point &p2 = (*(const Vertex **) b)->v; if (p1 == p2) return 0; diff --git a/engines/sci/gfx/font.cpp b/engines/sci/gfx/font.cpp index 9265cba040..d695915cb1 100644 --- a/engines/sci/gfx/font.cpp +++ b/engines/sci/gfx/font.cpp @@ -172,7 +172,7 @@ static void render_char(byte *dest, byte *src, int width, int line_width, int li } gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int characters, PaletteEntry *fg0, PaletteEntry *fg1, PaletteEntry *bg) { - unsigned char *text = (unsigned char *)stext; + const byte *text = (byte *)stext; int height = font->height; int width = 0; gfx_pixmap_t *pxm; diff --git a/engines/tinsel/bmv.cpp b/engines/tinsel/bmv.cpp index ce84f542ff..7ab51efa9c 100644 --- a/engines/tinsel/bmv.cpp +++ b/engines/tinsel/bmv.cpp @@ -391,8 +391,8 @@ void PrepAudio(const byte *sourceData, int blobCount, byte *destPtr) { uint16 dx1 = Au_Prev1; uint16 dx2 = Au_Prev2; - uint16 *destP = (uint16 *) destPtr; - int8 *srcP = (int8 *) sourceData; + uint16 *destP = (uint16 *)destPtr; + const int8 *srcP = (const int8 *)sourceData; // Blob Loop while (blobCount-- > 0) { diff --git a/engines/tinsel/polygons.cpp b/engines/tinsel/polygons.cpp index 5d9cac1a76..9b8131095a 100644 --- a/engines/tinsel/polygons.cpp +++ b/engines/tinsel/polygons.cpp @@ -162,7 +162,7 @@ public: int getNodeY(int i) const { return (int)FROM_LE_32(nlisty[i]); } // get Inter-node line structure - LINEINFO *getLineinfo(int i) const { return ((LINEINFO *)(_pStart + (int)FROM_LE_32(plinelist))) + i; } + const LINEINFO *getLineinfo(int i) const { return ((const LINEINFO *)(_pStart + (int)FROM_LE_32(plinelist))) + i; } protected: POLY_TYPE type; ///< type of polygon @@ -191,8 +191,8 @@ protected: int32 pnodelistx, pnodelisty; ///<offset in chunk to this array if present int32 plinelist; - int32 *nlistx; - int32 *nlisty; + const int32 *nlistx; + const int32 *nlisty; public: SCNHANDLE hScript; ///< handle of code segment for polygon events @@ -277,8 +277,8 @@ void Poly::nextPoly() { pnodelisty = nextLong(_pData); plinelist = nextLong(_pData); - nlistx = (int32 *)(_pStart + (int)FROM_LE_32(pnodelistx)); - nlisty = (int32 *)(_pStart + (int)FROM_LE_32(pnodelisty)); + nlistx = (const int32 *)(_pStart + (int)FROM_LE_32(pnodelistx)); + nlisty = (const int32 *)(_pStart + (int)FROM_LE_32(pnodelisty)); if (TinselV0) // Skip to the last 4 bytes of the record for the hScript value @@ -591,7 +591,7 @@ void FindBestPoint(HPOLYGON hp, int *x, int *y, int *pline) { // Look for fit of perpendicular to lines between nodes for (int i = 0; i < ptp.getNodecount() - 1; i++) { - LINEINFO *line = ptp.getLineinfo(i); + const LINEINFO *line = ptp.getLineinfo(i); const int32 a = (int)FROM_LE_32(line->a); const int32 b = (int)FROM_LE_32(line->b); @@ -677,7 +677,7 @@ void FindBestPoint(HPOLYGON hp, int *x, int *y, int *pline) { assert(nearestL != -1); // A point on a line is nearest - LINEINFO *line = ptp.getLineinfo(nearestL); + const LINEINFO *line = ptp.getLineinfo(nearestL); const int32 a = (int)FROM_LE_32(line->a); const int32 b = (int)FROM_LE_32(line->b); const int32 c = (int)FROM_LE_32(line->c); diff --git a/graphics/conversion.cpp b/graphics/conversion.cpp index b51ead1897..f262a60ef1 100644 --- a/graphics/conversion.cpp +++ b/graphics/conversion.cpp @@ -65,10 +65,10 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, uint16 color; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++, src += 2, dst += 2) { - color = *(uint16 *) src; + color = *(const uint16 *)src; srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); - *(uint16 *) dst = color; + *(uint16 *)dst = color; } src += srcDelta; dst += dstDelta; @@ -82,7 +82,7 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, if (srcFmt.bytesPerPixel == 2) { for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++, src += 2, dst += 3) { - color = *(uint16 *) src; + color = *(const uint16 *)src; srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); memcpy(dst, col, 3); @@ -110,7 +110,7 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, color = *(uint16 *) src; srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); - *(uint32 *) dst = color; + *(uint32 *)dst = color; } src += srcDelta; dst += dstDelta; @@ -125,7 +125,7 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, memcpy(col, src, 3); srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); - *(uint32 *) dst = color; + *(uint32 *)dst = color; } src += srcDelta; dst += dstDelta; @@ -136,7 +136,7 @@ bool crossBlit(byte *dst, const byte *src, int dstpitch, int srcpitch, color = *(uint32 *) src; srcFmt.colorToARGB(color, a, r, g, b); color = dstFmt.ARGBToColor(a, r, g, b); - *(uint32 *) dst = color; + *(uint32 *)dst = color; } src += srcDelta; dst += dstDelta; |