[Scummvm-cvs-logs] SF.net SVN: scummvm:[50442] scummvm/trunk/engines/sci/engine

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Jun 28 14:29:06 CEST 2010


Revision: 50442
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50442&view=rev
Author:   fingolfin
Date:     2010-06-28 12:29:06 +0000 (Mon, 28 Jun 2010)

Log Message:
-----------
SCI: Turn more warnings into errors.

If one of these is triggered for you, you can add an exception to
the error, together with a comment explaining why this exception
is necessary. Ideally after verifying that the cause is a script
bug and not a bug in our code...

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/klists.cpp
    scummvm/trunk/engines/sci/engine/kmath.cpp
    scummvm/trunk/engines/sci/engine/kmisc.cpp

Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp	2010-06-28 12:28:46 UTC (rev 50441)
+++ scummvm/trunk/engines/sci/engine/klists.cpp	2010-06-28 12:29:06 UTC (rev 50442)
@@ -37,12 +37,12 @@
 		Node *node = segMan->lookupNode(addr);
 
 		if (!node) {
-			warning("isSaneNodePointer: Node at %04x:%04x wasn't found", PRINT_REG(addr));
+			error("isSaneNodePointer: Node at %04x:%04x wasn't found", PRINT_REG(addr));
 			return false;
 		}
 
 		if (havePrev && node->pred != prev) {
-			warning("isSaneNodePointer: Node at %04x:%04x points to invalid predecessor %04x:%04x (should be %04x:%04x)",
+			error("isSaneNodePointer: Node at %04x:%04x points to invalid predecessor %04x:%04x (should be %04x:%04x)",
 					PRINT_REG(addr), PRINT_REG(node->pred), PRINT_REG(prev));
 
 			//node->pred = prev;	// fix the problem in the node
@@ -61,7 +61,7 @@
 	List *list = segMan->lookupList(addr);
 
 	if (!list) {
-		warning("isSaneListPointer (list %04x:%04x): The requested list wasn't found",
+		error("checkListPointer (list %04x:%04x): The requested list wasn't found",
 				PRINT_REG(addr));
 		return;
 	}
@@ -74,17 +74,17 @@
 		Node *node_z = segMan->lookupNode(list->last);
 
 		if (!node_a) {
-			warning("isSaneListPointer (list %04x:%04x): missing first node", PRINT_REG(addr));
+			error("checkListPointer (list %04x:%04x): missing first node", PRINT_REG(addr));
 			return;
 		}
 
 		if (!node_z) {
-			warning("isSaneListPointer (list %04x:%04x): missing last node", PRINT_REG(addr));
+			error("checkListPointer (list %04x:%04x): missing last node", PRINT_REG(addr));
 			return;
 		}
 
 		if (!node_a->pred.isNull()) {
-			warning("isSaneListPointer (list %04x:%04x): First node of the list points to a predecessor node",
+			error("checkListPointer (list %04x:%04x): First node of the list points to a predecessor node",
 					PRINT_REG(addr));
 
 			//node_a->pred = NULL_REG;	// fix the problem in the node
@@ -93,7 +93,7 @@
 		}
 
 		if (!node_z->succ.isNull()) {
-			warning("isSaneListPointer (list %04x:%04x): Last node of the list points to a successor node",
+			error("checkListPointer (list %04x:%04x): Last node of the list points to a successor node",
 					PRINT_REG(addr));
 
 			//node_z->succ = NULL_REG;	// fix the problem in the node
@@ -105,10 +105,10 @@
 	} else {
 		// Not sane list... it's missing pointers to the first or last element
 		if (list->first.isNull())
-			warning("isSaneListPointer (list %04x:%04x): missing pointer to first element",
+			error("checkListPointer (list %04x:%04x): missing pointer to first element",
 					PRINT_REG(addr));
 		if (list->last.isNull())
-			warning("isSaneListPointer (list %04x:%04x): missing pointer to last element",
+			error("checkListPointer (list %04x:%04x): missing pointer to last element",
 					PRINT_REG(addr));
 	}
 }
@@ -267,12 +267,12 @@
 	}
 
 	if (argc != 3 && argc != 4) {
-		warning("kAddAfter: Haven't got 3 or 4 arguments, aborting");
+		error("kAddAfter: Haven't got 3 or 4 arguments, aborting");
 		return NULL_REG;
 	}
 
 	if (argc == 4)	// Torin's Passage
-		warning("kAddAfter with 4 params called, 4th param is %04x:%04x", PRINT_REG(argv[3]));
+		error("kAddAfter with 4 params called, 4th param is %04x:%04x", PRINT_REG(argv[3]));
 
 	if (firstnode) { // We're really appending after
 		reg_t oldnext = firstnode->succ;
@@ -426,14 +426,14 @@
 
 reg_t kListAt(EngineState *s, int argc, reg_t *argv) {
 	if (argc != 2) {
-		warning("kListAt called with %d parameters", argc);
+		error("kListAt called with %d parameters", argc);
 		return NULL_REG;
 	}
 
 	List *list = s->_segMan->lookupList(argv[0]);
 	reg_t curAddress = list->first;
 	if (list->first.isNull()) {
-		warning("kListAt tried to reference empty list (%04x:%04x)", PRINT_REG(argv[0]));
+		error("kListAt tried to reference empty list (%04x:%04x)", PRINT_REG(argv[0]));
 		return NULL_REG;
 	}
 	Node *curNode = s->_segMan->lookupNode(curAddress);
@@ -495,7 +495,7 @@
 		if (lookupSelector(s->_segMan, curObject, slc, &address, NULL) == kSelectorVariable) {
 			// This can only happen with 3 params (list, target selector, variable)
 			if (argc != 3) {
-				warning("kListEachElementDo: Attempted to modify a variable selector with %d params", argc);
+				error("kListEachElementDo: Attempted to modify a variable selector with %d params", argc);
 			} else {
 				writeSelector(s->_segMan, curObject, slc, argv[2]);
 			}
@@ -527,7 +527,7 @@
 		// First, check if the target selector is a variable
 		if (lookupSelector(s->_segMan, curObject, slc, &address, NULL) == kSelectorVariable) {
 			// Can this happen with variable selectors?
-			warning("kListFirstTrue: Attempted to access a variable selector");
+			error("kListFirstTrue: Attempted to access a variable selector");
 		} else {
 			invokeSelector(s, curObject, slc, argc, argv, argc - 2, argv + 2);
 
@@ -561,7 +561,7 @@
 		// First, check if the target selector is a variable
 		if (lookupSelector(s->_segMan, curObject, slc, &address, NULL) == kSelectorVariable) {
 			// Can this happen with variable selectors?
-			warning("kListAllTrue: Attempted to access a variable selector");
+			error("kListAllTrue: Attempted to access a variable selector");
 		} else {
 			invokeSelector(s, curObject, slc, argc, argv, argc - 2, argv + 2);
 
@@ -604,15 +604,15 @@
 	case 11:
 		return kAddToEnd(s, argc - 1, argv + 1);
 	case 12:
-		warning("kList: unimplemented subfunction kAddBefore");
+		error("kList: unimplemented subfunction kAddBefore");
 		//return kAddBefore(s, argc - 1, argv + 1);
 		return NULL_REG;
 	case 13:
-		warning("kList: unimplemented subfunction kMoveToFront");
+		error("kList: unimplemented subfunction kMoveToFront");
 		//return kMoveToFront(s, argc - 1, argv + 1);
 		return NULL_REG;
 	case 14:
-		warning("kList: unimplemented subfunction kMoveToEnd");
+		error("kList: unimplemented subfunction kMoveToEnd");
 		//return kMoveToEnd(s, argc - 1, argv + 1);
 		return NULL_REG;
 	case 15:
@@ -632,7 +632,7 @@
 	case 22:
 		return kSort(s, argc - 1, argv + 1);
 	default:
-		warning("kList: Unhandled case %d", argv[0].toUint16());
+		error("kList: Unhandled case %d", argv[0].toUint16());
 		return NULL_REG;
 	}
 }

Modified: scummvm/trunk/engines/sci/engine/kmath.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmath.cpp	2010-06-28 12:28:46 UTC (rev 50441)
+++ scummvm/trunk/engines/sci/engine/kmath.cpp	2010-06-28 12:29:06 UTC (rev 50442)
@@ -115,7 +115,7 @@
 	double cosval = cos(angle * PI / 180.0);
 
 	if ((cosval < 0.0001) && (cosval > -0.0001)) {
-		warning("kCosDiv: Attempted division by zero");
+		error("kCosDiv: Attempted division by zero");
 		return SIGNAL_REG;
 	} else
 		return make_reg(0, (int16)(value / cosval));
@@ -127,7 +127,7 @@
 	double sinval = sin(angle * PI / 180.0);
 
 	if ((sinval < 0.0001) && (sinval > -0.0001)) {
-		warning("kSinDiv: Attempted division by zero");
+		error("kSinDiv: Attempted division by zero");
 		return SIGNAL_REG;
 	} else
 		return make_reg(0, (int16)(value / sinval));
@@ -139,7 +139,7 @@
 
 	param -= 90;
 	if ((param % 90) == 0) {
-		warning("kTimesTan: Attempted tan(pi/2)");
+		error("kTimesTan: Attempted tan(pi/2)");
 		return SIGNAL_REG;
 	} else
 		return make_reg(0, (int16) - (tan(param * PI / 180.0) * scale));
@@ -150,7 +150,7 @@
 	int scale = (argc > 1) ? argv[1].toSint16() : 1;
 
 	if ((param % 90) == 0) {
-		warning("kTimesCot: Attempted tan(pi/2)");
+		error("kTimesCot: Attempted tan(pi/2)");
 		return SIGNAL_REG;
 	} else
 		return make_reg(0, (int16)(tan(param * PI / 180.0) * scale));
@@ -165,7 +165,7 @@
 
 	// Sanity check...
 	if (!denominator) {
-		warning("kMulDiv: attempt to divide by zero (%d * %d / %d", multiplicant, multiplier, denominator);
+		error("kMulDiv: attempt to divide by zero (%d * %d / %d", multiplicant, multiplier, denominator);
 		return NULL_REG;
 	}
 

Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-06-28 12:28:46 UTC (rev 50441)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-06-28 12:29:06 UTC (rev 50442)
@@ -123,7 +123,7 @@
 		return make_reg(0, size);
 
 	default:
-		warning("Unknown MemoryInfo operation: %04x", argv[0].offset);
+		error("Unknown MemoryInfo operation: %04x", argv[0].offset);
 	}
 
 	return NULL_REG;
@@ -198,7 +198,7 @@
 	int mode = (argc > 0) ? argv[0].toUint16() : 0;
 
 	if (getSciVersion() <= SCI_VERSION_0_LATE && mode > 1)
-		warning("kGetTime called in SCI0 with mode %d (expected 0 or 1)", mode);
+		error("kGetTime called in SCI0 with mode %d (expected 0 or 1)", mode);
 
 	switch (mode) {
 	case K_NEW_GETTIME_TICKS :
@@ -218,7 +218,7 @@
 		debugC(2, kDebugLevelTime, "GetTime(date) returns %d", retval);
 		break;
 	default:
-		warning("Attempt to use unknown GetTime mode %d", mode);
+		error("Attempt to use unknown GetTime mode %d", mode);
 		break;
 	}
 
@@ -264,7 +264,7 @@
 		SegmentRef ref = s->_segMan->dereference(argv[1]);
 
 		if (!ref.isValid() || ref.maxSize < 2) {
-			warning("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1]));
+			error("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1]));
 			return s->r_acc;
 		}
 		if (ref.isRaw)
@@ -280,7 +280,7 @@
 		SegmentRef ref = s->_segMan->dereference(argv[1]);
 
 		if (!ref.isValid() || ref.maxSize < 2) {
-			warning("Attempt to poke invalid memory at %04x:%04x", PRINT_REG(argv[1]));
+			error("Attempt to poke invalid memory at %04x:%04x", PRINT_REG(argv[1]));
 			return s->r_acc;
 		}
 
@@ -375,7 +375,7 @@
 	case kPlatformIsItWindows:
 		return make_reg(0, isWindows);
 	default:
-		warning("Unsupported kPlatform operation %d", operation);
+		error("Unsupported kPlatform operation %d", operation);
 	}
 
 	return NULL_REG;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list