[Scummvm-devel] Two new bugs :-)

Lionel Ulmer lionel.ulmer at free.fr
Sun Dec 2 11:27:03 CET 2001


Hello all,

While making the latest CVS ScummVM run on my iPAQ, I found one small and
one big bug :-)

Let's start with the small bug (file script.cpp) :

void Scumm::push(int a) {
    assert(_scummStackPos >=0 && _scummStackPos < sizeof(_scummStack)-1);
    _scummStack[_scummStackPos++] = a;
}

In this code, sizeof(_scummStack) is twice the number of elements as it's an
array of int16. So the proper check should be compared to
sizeof(_scummStack) / sizeof(_scummStack[0]).

The other one is more tricky. If we look at the following line (file
script_v2.cpp, function Scumm::o6_resourceRoutines) :

   case 119:/* load fl object */
         loadFlObject(pop(), (_features & GF_HAS_ROOMTABLE) ? -1 : pop());
         break;

What we have here are two function calls with 'side effects' (pop) on the
same line in a function call.. And as the C++ (or even C) specification
seems not to say in which order these function will be called (at least this
is my understanding of the specs and what GCC seems to do :-) ), it is
highly unportable... And on my iPAQ (ARM GCC), it fails as it seems to first
run the left 'pop' and then the right one.

So I fixed this like that :

   case 119:/* load fl object */
           {
   		int arg2 = (_features & GF_HAS_ROOMTABLE) ? -1 : pop();
    	        int arg1 = pop();
		loadFlObject(arg1, arg2);
	   }
	   break;

In that case, we are sure of the popping order :-)

Now I just need to find out why I get this :

SoundEngine::findTag failed finding sound 77

On my iPAQ and not on my desktop on the same Day of the Tentacle version...

Back to some bug hunting :-)

                              Lionel

-- 
		 Lionel Ulmer - http://www.bbrox.org/




More information about the Scummvm-devel mailing list