From 2e964baeef9a74d45090583b52419afa3c9c47bf Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 9 Oct 2009 21:47:33 +0000 Subject: Some const correctness changes; cleanup svn-id: r44850 --- engines/lure/memory.cpp | 4 ++-- engines/lure/memory.h | 2 +- engines/lure/surface.cpp | 8 ++++---- engines/lure/surface.h | 2 -- engines/sci/engine/kfile.cpp | 4 ++-- engines/sci/engine/klists.cpp | 4 ++-- engines/sci/engine/kpathing.cpp | 4 ++-- engines/sci/gfx/font.cpp | 2 +- engines/tinsel/bmv.cpp | 4 ++-- engines/tinsel/polygons.cpp | 14 +++++++------- 10 files changed, 23 insertions(+), 25 deletions(-) (limited to 'engines') 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; ///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); -- cgit v1.2.3