[Scummvm-cvs-logs] SF.net SVN: scummvm:[44850] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Oct 9 23:47:34 CEST 2009
Revision: 44850
http://scummvm.svn.sourceforge.net/scummvm/?rev=44850&view=rev
Author: fingolfin
Date: 2009-10-09 21:47:33 +0000 (Fri, 09 Oct 2009)
Log Message:
-----------
Some const correctness changes; cleanup
Modified Paths:
--------------
scummvm/trunk/backends/platform/ps2/Gs2dScreen.cpp
scummvm/trunk/backends/platform/ps2/icon.cpp
scummvm/trunk/engines/lure/memory.cpp
scummvm/trunk/engines/lure/memory.h
scummvm/trunk/engines/lure/surface.cpp
scummvm/trunk/engines/lure/surface.h
scummvm/trunk/engines/sci/engine/kfile.cpp
scummvm/trunk/engines/sci/engine/klists.cpp
scummvm/trunk/engines/sci/engine/kpathing.cpp
scummvm/trunk/engines/sci/gfx/font.cpp
scummvm/trunk/engines/tinsel/bmv.cpp
scummvm/trunk/engines/tinsel/polygons.cpp
scummvm/trunk/graphics/conversion.cpp
Modified: scummvm/trunk/backends/platform/ps2/Gs2dScreen.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/Gs2dScreen.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/backends/platform/ps2/Gs2dScreen.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -298,7 +298,7 @@
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++;
Modified: scummvm/trunk/backends/platform/ps2/icon.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/icon.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/backends/platform/ps2/icon.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -938,9 +938,9 @@
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) {
Modified: scummvm/trunk/engines/lure/memory.cpp
===================================================================
--- scummvm/trunk/engines/lure/memory.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/engines/lure/memory.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -38,8 +38,8 @@
return block;
}
-uint8 *Memory::alloc(uint32 size) {
- return (uint8 *) malloc(size);
+void *Memory::alloc(uint32 size) {
+ return malloc(size);
}
void Memory::dealloc(void *block) {
Modified: scummvm/trunk/engines/lure/memory.h
===================================================================
--- scummvm/trunk/engines/lure/memory.h 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/engines/lure/memory.h 2009-10-09 21:47:33 UTC (rev 44850)
@@ -56,7 +56,7 @@
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);
};
Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/engines/lure/surface.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -42,11 +42,11 @@
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();
Modified: scummvm/trunk/engines/lure/surface.h
===================================================================
--- scummvm/trunk/engines/lure/surface.h 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/engines/lure/surface.h 2009-10-09 21:47:33 UTC (rev 44850)
@@ -150,8 +150,6 @@
bool show();
};
-extern int numFontChars;
-
} // End of namespace Lure
#endif
Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -440,8 +440,8 @@
};
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;
Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/engines/sci/engine/klists.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -371,8 +371,8 @@
};
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;
Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -611,8 +611,8 @@
// 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;
Modified: scummvm/trunk/engines/sci/gfx/font.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/font.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/engines/sci/gfx/font.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -172,7 +172,7 @@
}
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;
Modified: scummvm/trunk/engines/tinsel/bmv.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/bmv.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/engines/tinsel/bmv.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -391,8 +391,8 @@
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) {
Modified: scummvm/trunk/engines/tinsel/polygons.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/polygons.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/engines/tinsel/polygons.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -162,7 +162,7 @@
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 @@
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 @@
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 @@
// 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 @@
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);
Modified: scummvm/trunk/graphics/conversion.cpp
===================================================================
--- scummvm/trunk/graphics/conversion.cpp 2009-10-09 21:42:37 UTC (rev 44849)
+++ scummvm/trunk/graphics/conversion.cpp 2009-10-09 21:47:33 UTC (rev 44850)
@@ -65,10 +65,10 @@
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 @@
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 @@
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 @@
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 @@
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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list