[ scummvm-Bugs-2284298 ] SAGA: Compiler warnings; possibly an engine bug
SourceForge.net
noreply at sourceforge.net
Fri Nov 14 15:34:36 CET 2008
Bugs item #2284298, was opened at 2008-11-14 15:34
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=418820&aid=2284298&group_id=37116
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Unknown Crash/Other
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Torbjörn Andersson (eriktorbjorn)
Assigned to: Nobody/Anonymous (nobody)
Summary: SAGA: Compiler warnings; possibly an engine bug
Initial Comment:
Current ScummVM SVN
While compiling ScummVM with the -O2 option, I encountered the following warning:
./engines/saga/animation.h: In member function ‘int Saga::Anim::playCutaway(int, bool)’:
./engines/saga/animation.h:173: warning: array subscript is above array bounds
./engines/saga/animation.h:173: warning: array subscript is above array bounds
Part of the problem is the validateAnimationsId() function in animation.h, which does
if (animId >= MAX_ANIMATIONS) {
... animId is a cutaway animation id
}
if (_animations[animId] == NULL) {
error( ... );
}
Changing that to "} else if (_animations[animId] == NULL) {" brings up the next set of warnings:
./engines/saga/animation.h: In member function ‘int Saga::Anim::playCutaway(int, bool)’:
./engines/saga/animation.h:188: warning: array subscript is above array bounds
./engines/saga/animation.h:188: warning: array subscript is above array bounds
This time, it's the getAnimation() function that's the culprit. It says:
if (animId > MAX_ANIMATIONS)
return _cutawayAnimations[animId - MAX_ANIMATIONS];
return _animations[animId];
Shouldn't that be "if (animId >= MAX_ANIMATIONS)" instead?
Changing that still leaves me with a warning:
./engines/saga/animation.h: In member function ‘int Saga::Anim::playCutaway(int, bool)’:
./engines/saga/animation.h:172: warning: array subscript is above array bounds
And this time I'm at a complete loss. Because now the validateAnimationId() function reads:
if (animId >= MAX_ANIMATIONS) {
...
} else if (_animations[animId] == NULL) {
...
}
It's the "else if" it complains about, but I can't see why. It's the call to setFrameTime() in playCutaway() that seems to trigger it.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=418820&aid=2284298&group_id=37116
More information about the Scummvm-tracker
mailing list