[Scummvm-cvs-logs] scummvm master -> 2cbefc8bb5644847a29427272757d4a234cfdf13

fingolfin max at quendi.de
Mon Mar 7 23:22:39 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2cbefc8bb5 SCI: Constify some code


Commit: 2cbefc8bb5644847a29427272757d4a234cfdf13
    https://github.com/scummvm/scummvm/commit/2cbefc8bb5644847a29427272757d4a234cfdf13
Author: Max Horn (max at quendi.de)
Date: 2011-03-07T14:21:35-08:00

Commit Message:
SCI: Constify some code

Changed paths:
    engines/sci/console.cpp
    engines/sci/engine/gc.cpp
    engines/sci/engine/kmisc.cpp
    engines/sci/engine/workarounds.cpp



diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index de0cfe2..b5bb5aa 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -2198,7 +2198,7 @@ bool Console::cmdStack(int argc, const char **argv) {
 		return true;
 	}
 
-	ExecStack &xs = _engine->_gamestate->_executionStack.back();
+	const ExecStack &xs = _engine->_gamestate->_executionStack.back();
 	int nr = atoi(argv[1]);
 
 	for (int i = nr; i > 0; i--) {
@@ -2447,12 +2447,12 @@ bool Console::cmdScriptSteps(int argc, const char **argv) {
 
 bool Console::cmdBacktrace(int argc, const char **argv) {
 	DebugPrintf("Call stack (current base: 0x%x):\n", _engine->_gamestate->executionStackBase);
-	Common::List<ExecStack>::iterator iter;
+	Common::List<ExecStack>::const_iterator iter;
 	uint i = 0;
 
 	for (iter = _engine->_gamestate->_executionStack.begin();
 	     iter != _engine->_gamestate->_executionStack.end(); ++iter, ++i) {
-		ExecStack &call = *iter;
+		const ExecStack &call = *iter;
 		const char *objname = _engine->_gamestate->_segMan->getObjectName(call.sendp);
 		int paramc, totalparamc;
 
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp
index 85238ec..6d00c20 100644
--- a/engines/sci/engine/gc.cpp
+++ b/engines/sci/engine/gc.cpp
@@ -108,7 +108,7 @@ AddrSet *findAllActiveReferences(EngineState *s) {
 
 	// Initialize value stack
 	// We do this one by hand since the stack doesn't know the current execution stack
-	Common::List<ExecStack>::iterator iter = s->_executionStack.reverse_begin();
+	Common::List<ExecStack>::const_iterator iter = s->_executionStack.reverse_begin();
 
 	// Skip fake kernel stack frame if it's on top
 	if ((*iter).type == EXEC_STACK_TYPE_KERNEL)
@@ -116,9 +116,9 @@ AddrSet *findAllActiveReferences(EngineState *s) {
 
 	assert((iter != s->_executionStack.end()) && ((*iter).type != EXEC_STACK_TYPE_KERNEL));
 
-	ExecStack &xs = *iter;
+	const StackPtr sp = iter->sp;
 
-	for (reg_t *pos = s->stack_base; pos < xs.sp; pos++)
+	for (reg_t *pos = s->stack_base; pos < sp; pos++)
 		wm.push(*pos);
 
 	debugC(kDebugLevelGC, "[GC] -- Finished adding value stack");
@@ -126,7 +126,7 @@ AddrSet *findAllActiveReferences(EngineState *s) {
 	// Init: Execution Stack
 	for (iter = s->_executionStack.begin();
 	     iter != s->_executionStack.end(); ++iter) {
-		ExecStack &es = *iter;
+		const ExecStack &es = *iter;
 
 		if (es.type != EXEC_STACK_TYPE_KERNEL) {
 			wm.push(es.objp);
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 73c92a9..0061f3a 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -497,7 +497,7 @@ reg_t kStub(EngineState *s, int argc, reg_t *argv) {
 	Kernel *kernel = g_sci->getKernel();
 	int kernelCallNr = -1;
 
-	Common::List<ExecStack>::iterator callIterator = s->_executionStack.end();
+	Common::List<ExecStack>::const_iterator callIterator = s->_executionStack.end();
 	if (callIterator != s->_executionStack.begin()) {
 		callIterator--;
 		ExecStack lastCall = *callIterator;
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 2b60b1a..fb6c0e4 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -401,14 +401,14 @@ SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroun
 		return sci3IgnoreForNow;
 	}
 
-	EngineState *state = g_sci->getEngineState();
+	const EngineState *state = g_sci->getEngineState();
 	ExecStack *lastCall = state->xs;
-	Script *local_script = state->_segMan->getScriptIfLoaded(lastCall->local_segment);
-	int curScriptNr = local_script->getScriptNumber();
+	const Script *localScript = state->_segMan->getScriptIfLoaded(lastCall->local_segment);
+	int curScriptNr = localScript->getScriptNumber();
 
 	if (lastCall->debugLocalCallOffset != -1) {
 		// if lastcall was actually a local call search back for a real call
-		Common::List<ExecStack>::iterator callIterator = state->_executionStack.end();
+		Common::List<ExecStack>::const_iterator callIterator = state->_executionStack.end();
 		while (callIterator != state->_executionStack.begin()) {
 			callIterator--;
 			ExecStack loopCall = *callIterator;






More information about the Scummvm-git-logs mailing list