From 66bba94bcf2cb20ad5b4566fe55e1a05ec1a9d39 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Tue, 5 Apr 2011 21:45:20 +0200 Subject: [PATCH] Fixed some warnings. Patch by Torbjorn Andersson. --- engines/grim/lipsync.cpp | 12 ++++++++---- engines/grim/textobject.cpp | 2 +- graphics/tinygl/api.cpp | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/engines/grim/lipsync.cpp b/engines/grim/lipsync.cpp index 2ba613dea10..0f97808f2c0 100644 --- a/engines/grim/lipsync.cpp +++ b/engines/grim/lipsync.cpp @@ -57,13 +57,17 @@ LipSync::LipSync(const char *filename, const char *data, int len) : readPhoneme = READ_LE_UINT16(data + 2); // Look for the animation corresponding to the phoneme - for (j = 0; (j < _animTableSize) && (readPhoneme != _animTable[j].phoneme); j++) { ; } + for (j = 0; j < _animTableSize; j++) { + if (readPhoneme == _animTable[j].phoneme) { + _entries[i].anim = _animTable[j].anim; + break; + } + } - if (readPhoneme != _animTable[j].phoneme) { + if (j >= _animTableSize) { warning("Unknown phoneme: 0x%X in file %s", readPhoneme, filename); _entries[i].anim = 1; - } else - _entries[i].anim = _animTable[j].anim; + } data += 4; } diff --git a/engines/grim/textobject.cpp b/engines/grim/textobject.cpp index d91d6be7e56..62bdfbe5881 100644 --- a/engines/grim/textobject.cpp +++ b/engines/grim/textobject.cpp @@ -66,7 +66,7 @@ void TextObject::setText(const char *text) { // this should be good enough to still be unique // but for debug purposes lets make this crash the program so we know about it strncpy(_textID, text, sizeof(_textID)); - _textID[sizeof(_textID)] = 0; + _textID[sizeof(_textID) - 1] = 0; } } diff --git a/graphics/tinygl/api.cpp b/graphics/tinygl/api.cpp index 68f65184782..8c98edd5b59 100644 --- a/graphics/tinygl/api.cpp +++ b/graphics/tinygl/api.cpp @@ -406,7 +406,7 @@ void tglLightModeli(int pname, int param) { p[0].op = TinyGL::OP_LightModel; p[1].i = pname; p[2].f = (float)param; - for (i = 0; i < 4; i++) + for (i = 0; i < 3; i++) p[3 + i].f = 0; TinyGL::gl_add_op(p);