[Scummvm-cvs-logs] CVS: scummvm/common timer.cpp,1.19,1.20
Max Horn
fingolfin at users.sourceforge.net
Fri Oct 17 04:15:18 CEST 2003
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv3481
Modified Files:
timer.cpp
Log Message:
COMI crashes because for some reasons we get a 0 timer interval. not sure how that is possible, but adding some asserts for now
Index: timer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/timer.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- timer.cpp 14 Oct 2003 20:52:27 -0000 1.19
+++ timer.cpp 17 Oct 2003 11:11:01 -0000 1.20
@@ -92,6 +92,7 @@
if ((_timerSlots[l].procedure) && (_timerSlots[l].interval > 0)) {
_timerSlots[l].counter -= interval;
while (_timerSlots[l].counter <= 0) {
+ assert(_timerSlots[l].interval > 0);
_timerSlots[l].counter += _timerSlots[l].interval;
_timerSlots[l].procedure(_timerSlots[l].refCon);
}
@@ -102,32 +103,27 @@
}
bool Timer::installProcedure(TimerProc procedure, int32 interval, void *refCon) {
+ assert(interval > 0);
Common::StackLock lock(_mutex);
- int32 l;
- bool found = false;
- for (l = 0; l < MAX_TIMERS; l++) {
+ for (int l = 0; l < MAX_TIMERS; l++) {
if (!_timerSlots[l].procedure) {
- _timerSlots[l].procedure = procedure;
_timerSlots[l].interval = interval;
_timerSlots[l].counter = interval;
_timerSlots[l].refCon = refCon;
- found = true;
- break;
+ _timerSlots[l].procedure = procedure;
+ return true;
}
}
- if (!found)
- warning("Couldn't find free timer slot!");
-
- return found;
+ warning("Couldn't find free timer slot!");
+ return false;
}
void Timer::releaseProcedure(TimerProc procedure) {
Common::StackLock lock(_mutex);
- int32 l;
- for (l = 0; l < MAX_TIMERS; l++) {
+ for (int l = 0; l < MAX_TIMERS; l++) {
if (_timerSlots[l].procedure == procedure) {
_timerSlots[l].procedure = 0;
_timerSlots[l].interval = 0;
More information about the Scummvm-git-logs
mailing list