Some const correctness changes; cleanup
svn-id: r44850
This commit is contained in:
parent
6f1c43a731
commit
2e964baeef
13 changed files with 32 additions and 34 deletions
|
@ -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++;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -150,8 +150,6 @@ public:
|
|||
bool show();
|
||||
};
|
||||
|
||||
extern int numFontChars;
|
||||
|
||||
} // End of namespace Lure
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue