aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2009-10-09 21:47:33 +0000
committerMax Horn2009-10-09 21:47:33 +0000
commit2e964baeef9a74d45090583b52419afa3c9c47bf (patch)
tree66106bd63ae8f9d7a1120d57344987856c961b56 /engines
parent6f1c43a7311d5e942f055087e307d6a537e159c6 (diff)
downloadscummvm-rg350-2e964baeef9a74d45090583b52419afa3c9c47bf.tar.gz
scummvm-rg350-2e964baeef9a74d45090583b52419afa3c9c47bf.tar.bz2
scummvm-rg350-2e964baeef9a74d45090583b52419afa3c9c47bf.zip
Some const correctness changes; cleanup
svn-id: r44850
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/memory.cpp4
-rw-r--r--engines/lure/memory.h2
-rw-r--r--engines/lure/surface.cpp8
-rw-r--r--engines/lure/surface.h2
-rw-r--r--engines/sci/engine/kfile.cpp4
-rw-r--r--engines/sci/engine/klists.cpp4
-rw-r--r--engines/sci/engine/kpathing.cpp4
-rw-r--r--engines/sci/gfx/font.cpp2
-rw-r--r--engines/tinsel/bmv.cpp4
-rw-r--r--engines/tinsel/polygons.cpp14
10 files changed, 23 insertions, 25 deletions
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);