From 7cdddd5ffb1501e5612a77c91aa282fc19cf2bed Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 15 Oct 2010 12:40:24 +0000 Subject: SCI: Fixed code bugs from bug #3087872 - "SCI: Code analysis warnings" svn-id: r53482 --- engines/sci/engine/kgraphics.cpp | 3 ++- engines/sci/engine/kpathing.cpp | 2 +- engines/sci/graphics/font.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 07385fd3f9..9ef2025337 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -351,7 +351,8 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) { dest[0] = dest[1] = NULL_REG; if (text.empty() || !dest) { // Empty text - dest[2] = dest[3] = make_reg(0, 0); + if (dest) + dest[2] = dest[3] = make_reg(0, 0); debugC(2, kDebugLevelStrings, "GetTextSize: Empty string"); return s->r_acc; } diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index faf966af92..4ea28ed903 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -1312,7 +1312,7 @@ static void AStar(PathfindingState *s) { } // Check if we are done - if (vertex_min == s->vertex_end) + if (vertex_min == s->vertex_end || !vertex_min) break; // Move vertex from set open to set closed diff --git a/engines/sci/graphics/font.cpp b/engines/sci/graphics/font.cpp index 852771d081..f06dbea05e 100644 --- a/engines/sci/graphics/font.cpp +++ b/engines/sci/graphics/font.cpp @@ -88,7 +88,7 @@ void GfxFontFromResource::draw(uint16 chr, int16 top, int16 left, byte color, bo byte *pIn = getCharData(chr); for (int i = 0; i < charHeight; i++, y++) { if (greyedOutput) - mask = greyedTop++ % 2 ? 0xAA : 0x55; + mask = ((greyedTop++) % 2) ? 0xAA : 0x55; for (int done = 0; done < charWidth; done++) { if ((done & 7) == 0) // fetching next data byte b = *(pIn++) & mask; -- cgit v1.2.3