ALL: Silence a ton of warnings

This commit is contained in:
Matthew Hoops 2011-03-25 07:29:35 +08:00 committed by Pawel Kolodziejski
parent c375cc30ae
commit 1554e1ab2f
17 changed files with 53 additions and 40 deletions

View File

@ -142,7 +142,7 @@ int MidiDriver_CORE::open() {
}
if (err != noErr)
warning("Failed loading custom sound font '%s' (error %ld)\n", soundfont, err);
warning("Failed loading custom sound font '%s' (error %d)\n", soundfont, err);
}
#ifdef COREAUDIO_DISABLE_REVERB

View File

@ -109,8 +109,8 @@ void MidiDriver_CoreMIDI::close() {
}
void MidiDriver_CoreMIDI::send(uint32 b) {
assert(mOutPort != NULL);
assert(mDest != NULL);
assert(mOutPort != 0);
assert(mDest != 0);
// Extract the MIDI data
byte status_byte = (b & 0x000000FF);
@ -153,8 +153,8 @@ void MidiDriver_CoreMIDI::send(uint32 b) {
}
void MidiDriver_CoreMIDI::sysEx(const byte *msg, uint16 length) {
assert(mOutPort != NULL);
assert(mDest != NULL);
assert(mOutPort != 0);
assert(mDest != 0);
byte buf[384];
MIDIPacketList *packetList = (MIDIPacketList *)buf;

View File

@ -124,7 +124,7 @@ void Actor::saveState(SaveGame *savedState) const {
if (_lipSync) {
savedState->writeLEUint32(1);
savedState->writeCharString(_lipSync->filename());
savedState->writeCharString(_lipSync->getFilename());
} else {
savedState->writeLEUint32(0);
}
@ -132,7 +132,7 @@ void Actor::saveState(SaveGame *savedState) const {
savedState->writeLESint32(_costumeStack.size());
for (Common::List<CostumePtr>::const_iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
const CostumePtr &c = *i;
savedState->writeCharString(c->filename());
savedState->writeCharString(c->getFilename());
Costume *pc = c->previousCostume();
int depth = 0;
while (pc) {
@ -142,7 +142,7 @@ void Actor::saveState(SaveGame *savedState) const {
savedState->writeLEUint32(depth);
pc = c->previousCostume();
for (int j = 0; j < depth; ++j) { //save the previousCostume hierarchy
savedState->writeCharString(pc->filename());
savedState->writeCharString(pc->getFilename());
pc = pc->previousCostume();
}
c->saveState(savedState);
@ -156,7 +156,7 @@ void Actor::saveState(SaveGame *savedState) const {
if (_restCostume) {
savedState->writeLEUint32(1);
savedState->writeCharString(_restCostume->filename());
savedState->writeCharString(_restCostume->getFilename());
} else {
savedState->writeLEUint32(0);
}
@ -164,7 +164,7 @@ void Actor::saveState(SaveGame *savedState) const {
if (_walkCostume) {
savedState->writeLEUint32(1);
savedState->writeCharString(_walkCostume->filename());
savedState->writeCharString(_walkCostume->getFilename());
} else {
savedState->writeLEUint32(0);
}
@ -174,7 +174,7 @@ void Actor::saveState(SaveGame *savedState) const {
if (_turnCostume) {
savedState->writeLEUint32(1);
savedState->writeCharString(_turnCostume->filename());
savedState->writeCharString(_turnCostume->getFilename());
} else {
savedState->writeLEUint32(0);
}
@ -186,7 +186,7 @@ void Actor::saveState(SaveGame *savedState) const {
for (int i = 0; i < 10; ++i) {
if (_talkCostume[i]) {
savedState->writeLEUint32(1);
savedState->writeCharString(_talkCostume[i]->filename());
savedState->writeCharString(_talkCostume[i]->getFilename());
} else {
savedState->writeLEUint32(0);
}
@ -196,7 +196,7 @@ void Actor::saveState(SaveGame *savedState) const {
if (_mumbleCostume) {
savedState->writeLEUint32(1);
savedState->writeCharString(_mumbleCostume->filename());
savedState->writeCharString(_mumbleCostume->getFilename());
} else {
savedState->writeLEUint32(0);
}
@ -841,7 +841,7 @@ void Actor::setHead(int joint1, int joint2, int joint3, float maxRoll, float max
Costume *Actor::findCostume(const char *n) {
for (Common::List<CostumePtr>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
if (strcasecmp((*i)->filename(), n) == 0)
if (strcasecmp((*i)->getFilename(), n) == 0)
return *i;
}

View File

@ -46,7 +46,7 @@ public:
virtual ~Costume();
const char *filename() const { return _fname.c_str(); }
const char *getFilename() const { return _fname.c_str(); }
void playChore(int num);
void playChoreLooping(int num);
void setChoreLastFrame(int num) { _chores[num].setLastFrame(); }

View File

@ -447,7 +447,7 @@ void GfxTinyGL::setShadowColor(byte r, byte g, byte b) {
}
void GfxTinyGL::drawModelFace(const Model::Face *face, float *vertices, float *vertNormals, float *textureVerts) {
tglNormal3fv((float *)face->_normal._coords);
tglNormal3fv(const_cast<float *>(face->_normal._coords));
tglBegin(TGL_POLYGON);
for (int i = 0; i < face->_numVertices; i++) {
tglNormal3fv(vertNormals + 3 * face->_vertices[i]);

View File

@ -1077,7 +1077,7 @@ void GrimEngine::restoreScenes(SaveGame *state) {
int32 size = state->readLESint32();
for (int32 i = 0; i < size; ++i) {
int32 id = state->readLEUint32();
Scene *s = scene(id);
Scene *s = _scenes[id];
if (!s) {
s = new Scene();
s->_id = id;
@ -1090,7 +1090,7 @@ void GrimEngine::restoreScenes(SaveGame *state) {
s->restoreState(state);
}
_currScene = scene(state->readLEUint32());
_currScene = _scenes[state->readLEUint32()];
state->endSection();
}
@ -1520,8 +1520,4 @@ int GrimEngine::sceneId(Scene *s) const {
return s->_id;
}
Scene *GrimEngine::scene(int id) const {
return _scenes[id];
}
} // end of namespace Grim

View File

@ -139,7 +139,6 @@ public:
void removeScene(Scene *a);
void killScenes();
int sceneId(Scene *s) const;
Scene *scene(int id) const;
void flagRefreshShadowMask(bool flag) {
_refreshShadowMask = flag;

View File

@ -102,7 +102,7 @@ int LipSync::getAnim(int pos) {
return -1;
}
const char *LipSync::filename() const {
const char *LipSync::getFilename() const {
return _fname.c_str();
}

View File

@ -43,7 +43,7 @@ public:
int getAnim(int pos);
bool isValid() { return _numEntries > 0; }
const char *filename() const;
const char *getFilename() const;
int typeId() const { return 16; }

View File

@ -110,7 +110,7 @@ Common::String Localizer::localize(const char *str) const {
LocaleEntry key, *result;
Common::String s(str + 1, slash2 - str - 1);
key.text = (char *)s.c_str();
key.text = const_cast<char *>(s.c_str());
result = (Localizer::LocaleEntry *)bsearch(&key, _entries.begin(), _entries.size(), sizeof(LocaleEntry), sortCallback);
if (!result)

View File

@ -136,7 +136,16 @@ static const char *to_string(lua_Object obj) {
}
case LUA_T_CPROTO:
{
sprintf(buff, "function: %p", (void *)o->value.f);
// WORKAROUND: C++ forbids casting from a pointer-to-function to a
// pointer-to-object. We use a union to work around that.
union {
void *objPtr;
lua_CFunction funcPtr;
} ptrUnion;
ptrUnion.funcPtr = o->value.f;
sprintf(buff, "function: %p", ptrUnion.objPtr);
return buff;
}
case LUA_T_USERDATA:

View File

@ -81,7 +81,16 @@ static void restoreObjectValue(TObject *object, RestoreSint32 restoreSint32, Res
PointerId ptr;
ptr.low = restoreUint32();
ptr.hi = restoreUint32();
object->value.f = (lua_CFunction)makePointerFromId(ptr);
// WORKAROUND: C++ forbids casting from a pointer-to-function to a
// pointer-to-object. We use a union to work around that.
union {
void *objPtr;
lua_CFunction funcPtr;
} ptrUnion;
ptrUnion.objPtr = makePointerFromId(ptr);
object->value.f = ptrUnion.funcPtr;
}
break;
case LUA_T_CLOSURE:

View File

@ -1102,7 +1102,7 @@ static void GetActorCostume() {
return;
if (costume)
lua_pushstring(const_cast<char *>(costume->filename()));
lua_pushstring(const_cast<char *>(costume->getFilename()));
else
lua_pushnil();
}
@ -1114,7 +1114,7 @@ static void PopActorCostume() {
Actor *actor = static_cast<Actor *>(lua_getuserdata(actorObj));
if (actor->currentCostume()) {
lua_pushstring(const_cast<char *>(actor->currentCostume()->filename()));
lua_pushstring(const_cast<char *>(actor->currentCostume()->getFilename()));
actor->popCostume();
} else
lua_pushnil();
@ -1350,7 +1350,7 @@ static void ActorLookAt() {
float fY;
float fZ;
float fX = lua_getnumber(xObj);
//float fX = lua_getnumber(xObj);
if (lua_isnumber(yObj))
fY = lua_getnumber(yObj);

View File

@ -47,7 +47,7 @@ public:
int numImages() const { return _numImages; }
int currentImage() const { return _currImage; }
const char *filename() { return _fname.c_str(); }
const char *getFilename() { return _fname.c_str(); }
~Material();

View File

@ -87,7 +87,7 @@ public:
addPointer(obj);
}
}
ObjectPtr(const ObjectPtr<T> &ptr) {
ObjectPtr(const ObjectPtr<T> &ptr) : Pointer() {
_obj = NULL;
*this = ptr;
}

View File

@ -121,7 +121,7 @@ ResourceLoader::ResourceCache *ResourceLoader::getEntryFromCache(const char *fil
}
ResourceCache key;
key.fname = (char *)filename;
key.fname = const_cast<char *>(filename);
return (ResourceLoader::ResourceCache *)bsearch(&key, _cache.begin(), _cache.size(), sizeof(ResourceCache), sortCallback);
}
@ -456,7 +456,7 @@ FontPtr ResourceLoader::getFont(const char *fname) {
CostumePtr ResourceLoader::getCostume(const char *fname, Costume *prev) {
for (Common::List<Costume *>::const_iterator i = _costumes.begin(); i != _costumes.end(); ++i) {
Costume *c = *i;
if (strcmp(fname, c->filename()) == 0) {
if (strcmp(fname, c->getFilename()) == 0) {
return c;
}
}
@ -467,7 +467,7 @@ CostumePtr ResourceLoader::getCostume(const char *fname, Costume *prev) {
LipSyncPtr ResourceLoader::getLipSync(const char *fname) {
for (Common::List<LipSync *>::const_iterator i = _lipsyncs.begin(); i != _lipsyncs.end(); ++i) {
LipSync *l = *i;
if (strcmp(fname, l->filename()) == 0) {
if (strcmp(fname, l->getFilename()) == 0) {
return l;
}
}

View File

@ -125,7 +125,7 @@ void glVertexPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoid
p[0].op = OP_VertexPointer;
p[1].i = size;
p[2].i = stride;
p[3].p = (void *)pointer;
p[3].p = const_cast<void *>(pointer);
gl_add_op(p);
}
@ -141,7 +141,7 @@ void glColorPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoid *
p[0].op = OP_ColorPointer;
p[1].i = size;
p[2].i = stride;
p[3].p = (void *)pointer;
p[3].p = const_cast<void *>(pointer);
gl_add_op(p);
}
@ -155,7 +155,7 @@ void glNormalPointer(TGLenum type, TGLsizei stride, const TGLvoid *pointer) {
assert(type == TGL_FLOAT);
p[0].op = OP_NormalPointer;
p[1].i = stride;
p[2].p = (void *)pointer;
p[2].p = const_cast<void *>(pointer);
}
void glopTexCoordPointer(GLContext *c, GLParam *p) {
@ -170,7 +170,7 @@ void glTexCoordPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoid
p[0].op = OP_TexCoordPointer;
p[1].i = size;
p[2].i = stride;
p[3].p = (void *)pointer;
p[3].p = const_cast<void *>(pointer);
}
} // end of namespace TinyGL