WINTERMUTE: Fix g++ warnings listed by LordHoto

This commit is contained in:
Einar Johan Trøan Sømåen 2012-08-31 14:01:18 +02:00
parent 16b27090b1
commit 2039ea6b8d
17 changed files with 24 additions and 24 deletions

View File

@ -1200,8 +1200,8 @@ bool AdScene::displayRegionContent(AdRegion *region, bool display3DOnly) {
//////////////////////////////////////////////////////////////////////////
int AdScene::compareObjs(const void *obj1, const void *obj2) {
AdObject *object1 = *(AdObject **)obj1;
AdObject *object2 = *(AdObject **)obj2;
const AdObject *object1 = *(AdObject **)obj1;
const AdObject *object2 = *(AdObject **)obj2;
if (object1->_posY < object2->_posY) {
return -1;

View File

@ -92,7 +92,7 @@ bool BaseDynamicBuffer::init(uint32 initSize) {
//////////////////////////////////////////////////////////////////////////
bool BaseDynamicBuffer::putBytes(byte *buffer, uint32 size) {
bool BaseDynamicBuffer::putBytes(const byte *buffer, uint32 size) {
if (!_initialized) {
init();
}
@ -152,7 +152,7 @@ void BaseDynamicBuffer::putString(const char *val) {
putString("(null)");
} else {
putDWORD(strlen(val) + 1);
putBytes((byte *)val, strlen(val) + 1);
putBytes((const byte *)val, strlen(val) + 1);
}
}

View File

@ -44,7 +44,7 @@ public:
char *getString();
void putString(const char *val);
bool getBytes(byte *buffer, uint32 size);
bool putBytes(byte *buffer, uint32 size);
bool putBytes(const byte *buffer, uint32 size);
uint32 getSize();
bool init(uint32 initSize = 0);
void cleanup();

View File

@ -4356,7 +4356,7 @@ bool BaseGame::displayDebugInfo() {
_gameRef->_systemFont->drawText((byte *)str, 0, 130, _renderer->_width, TAL_RIGHT);
if (_activeObject != NULL) {
_systemFont->drawText((byte *)_activeObject->getName(), 0, 150, _renderer->_width, TAL_RIGHT);
_systemFont->drawText((const byte *)_activeObject->getName(), 0, 150, _renderer->_width, TAL_RIGHT);
}
sprintf(str, "GfxMem: %dMB", _usedMem / (1024 * 1024));

View File

@ -176,8 +176,8 @@ bool BaseSurfaceStorage::sortSurfaces() {
//////////////////////////////////////////////////////////////////////////
int BaseSurfaceStorage::surfaceSortCB(const void *arg1, const void *arg2) {
BaseSurface *s1 = *((BaseSurface **)arg1);
BaseSurface *s2 = *((BaseSurface **)arg2);
const BaseSurface *s1 = *((BaseSurface **)arg1);
const BaseSurface *s2 = *((BaseSurface **)arg2);
// sort by life time
if (s1->_lifeTime <= 0 && s2->_lifeTime > 0) {

View File

@ -52,7 +52,7 @@ BaseFont::~BaseFont() {
//////////////////////////////////////////////////////////////////////
void BaseFont::drawText(byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) {
void BaseFont::drawText(const byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) {
}

View File

@ -40,7 +40,7 @@ public:
DECLARE_PERSISTENT(BaseFont, BaseObject)
virtual int getTextWidth(byte *text, int maxLength = -1);
virtual int getTextHeight(byte *text, int width);
virtual void drawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
virtual void drawText(const byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
virtual int getLetterHeight();
virtual void initLoop() {};

View File

@ -69,7 +69,7 @@ BaseFontBitmap::~BaseFontBitmap() {
//////////////////////////////////////////////////////////////////////
void BaseFontBitmap::drawText(byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) {
void BaseFontBitmap::drawText(const byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) {
textHeightDraw(text, x, y, width, align, true, maxHeight, maxLength);
}
@ -106,7 +106,7 @@ int BaseFontBitmap::getTextWidth(byte *text, int maxLength) {
//////////////////////////////////////////////////////////////////////
int BaseFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAlign align, bool draw, int maxHeight, int maxLength) {
int BaseFontBitmap::textHeightDraw(const byte *text, int x, int y, int width, TTextAlign align, bool draw, int maxHeight, int maxLength) {
if (maxLength == 0) {
return 0;
}

View File

@ -41,7 +41,7 @@ public:
bool loadFile(const Common::String &filename);
virtual int getTextWidth(byte *text, int maxLength = -1);
virtual int getTextHeight(byte *text, int width);
virtual void drawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
virtual void drawText(const byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
virtual int getLetterHeight();
BaseFontBitmap(BaseGame *inGame);
@ -62,7 +62,7 @@ private:
int getCharWidth(byte index);
void drawChar(byte c, int x, int y);
int textHeightDraw(byte *text, int x, int y, int width, TTextAlign align, bool draw, int max_height = -1, int maxLength = -1);
int textHeightDraw(const byte *text, int x, int y, int width, TTextAlign align, bool draw, int max_height = -1, int maxLength = -1);
};

View File

@ -152,7 +152,7 @@ int BaseFontTT::getTextHeight(byte *text, int width) {
//////////////////////////////////////////////////////////////////////////
void BaseFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) {
void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) {
if (text == NULL || strcmp((char *)text, "") == 0) {
return;
}

View File

@ -101,7 +101,7 @@ public:
virtual int getTextWidth(byte *text, int maxLength = -1);
virtual int getTextHeight(byte *text, int width);
virtual void drawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
virtual void drawText(const byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
virtual int getLetterHeight();
bool loadBuffer(byte *buffer);

View File

@ -93,7 +93,7 @@ byte BaseImage::getAlphaAt(int x, int y) const {
if (!_surface) {
return 0xFF;
}
uint32 color = *(uint32 *)_surface->getBasePtr(x, y);
uint32 color = *(const uint32 *)_surface->getBasePtr(x, y);
byte r, g, b, a;
_surface->format.colorToARGB(color, a, r, g, b);
return a;

View File

@ -373,8 +373,8 @@ bool PartEmitter::sortParticlesByZ() {
//////////////////////////////////////////////////////////////////////////
int PartEmitter::compareZ(const void *obj1, const void *obj2) {
PartParticle *p1 = *(PartParticle **)obj1;
PartParticle *p2 = *(PartParticle **)obj2;
const PartParticle *p1 = *(PartParticle **)obj1;
const PartParticle *p2 = *(PartParticle **)obj2;
if (p1->_posZ < p2->_posZ) {
return -1;

View File

@ -403,7 +403,7 @@ TransparentSurface *TransparentSurface::scale(const Common::Rect &srcRect, const
for (int y = 0; y < dstH; y++) {
for (int x = 0; x < dstW; x++) {
uint32 color = READ_UINT32((byte *)getBasePtr(x * srcW / dstW + srcRect.left,
uint32 color = READ_UINT32((const byte *)getBasePtr(x * srcW / dstW + srcRect.left,
y * srcH / dstH + srcRect.top));
WRITE_UINT32((byte *)target->getBasePtr(x + dstRect.left, y + dstRect.top), color);
}

View File

@ -853,7 +853,7 @@ bool UIEdit::handleKeypress(Common::Event *event, bool printable) {
//WideString wstr = StringUtil::Utf8ToWide(event->kbd.ascii);
WideString wstr;
wstr += (char)event->kbd.ascii;
_selEnd += insertChars(_selEnd, (byte *)StringUtil::wideToAnsi(wstr).c_str(), 1);
_selEnd += insertChars(_selEnd, (const byte *)StringUtil::wideToAnsi(wstr).c_str(), 1);
if (_gameRef->_textRTL) {
_selEnd = _selStart;
@ -897,7 +897,7 @@ int UIEdit::deleteChars(int start, int end) {
//////////////////////////////////////////////////////////////////////////
int UIEdit::insertChars(int pos, byte *chars, int num) {
int UIEdit::insertChars(int pos, const byte *chars, int num) {
if ((int)strlen(_text) + num > _maxLength) {
num -= (strlen(_text) + num - _maxLength);
}

View File

@ -39,7 +39,7 @@ class UIEdit : public UIObject {
public:
DECLARE_PERSISTENT(UIEdit, UIObject)
int _maxLength;
int insertChars(int pos, byte *chars, int num);
int insertChars(int pos, const byte *chars, int num);
int deleteChars(int start, int end);
bool _cursorVisible;
uint32 _lastBlinkTime;

View File

@ -342,7 +342,7 @@ void VideoTheoraPlayer::writeAlpha() {
if (_alphaImage && _surface.w == _alphaImage->getSurface()->w && _surface.h == _alphaImage->getSurface()->h) {
assert(_alphaImage->getSurface()->format.bytesPerPixel == 4);
assert(_surface.format.bytesPerPixel == 4);
const byte *alphaData = (byte *)_alphaImage->getSurface()->getBasePtr(0, 0);
const byte *alphaData = (const byte *)_alphaImage->getSurface()->getBasePtr(0, 0);
#ifdef SCUMM_LITTLE_ENDIAN
int alphaPlace = (_alphaImage->getSurface()->format.aShift / 8);
#else