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) 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 #ifdef COREAUDIO_DISABLE_REVERB

View file

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

View file

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

View file

@ -46,7 +46,7 @@ public:
virtual ~Costume(); virtual ~Costume();
const char *filename() const { return _fname.c_str(); } const char *getFilename() const { return _fname.c_str(); }
void playChore(int num); void playChore(int num);
void playChoreLooping(int num); void playChoreLooping(int num);
void setChoreLastFrame(int num) { _chores[num].setLastFrame(); } 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) { 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); tglBegin(TGL_POLYGON);
for (int i = 0; i < face->_numVertices; i++) { for (int i = 0; i < face->_numVertices; i++) {
tglNormal3fv(vertNormals + 3 * face->_vertices[i]); tglNormal3fv(vertNormals + 3 * face->_vertices[i]);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -136,7 +136,16 @@ static const char *to_string(lua_Object obj) {
} }
case LUA_T_CPROTO: 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; return buff;
} }
case LUA_T_USERDATA: case LUA_T_USERDATA:

View file

@ -81,7 +81,16 @@ static void restoreObjectValue(TObject *object, RestoreSint32 restoreSint32, Res
PointerId ptr; PointerId ptr;
ptr.low = restoreUint32(); ptr.low = restoreUint32();
ptr.hi = 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; break;
case LUA_T_CLOSURE: case LUA_T_CLOSURE:

View file

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

View file

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

View file

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

View file

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

View file

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