aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-01-03 21:12:44 +0000
committerFilippos Karapetis2010-01-03 21:12:44 +0000
commit781dd3b18369bebe4c089526be9f470c12311e48 (patch)
tree71695b1e883969090d81e144add74c9c78d1209c
parentc36caea501fe2eab3fa3d1e968d80b1d224b0523 (diff)
downloadscummvm-rg350-781dd3b18369bebe4c089526be9f470c12311e48.tar.gz
scummvm-rg350-781dd3b18369bebe4c089526be9f470c12311e48.tar.bz2
scummvm-rg350-781dd3b18369bebe4c089526be9f470c12311e48.zip
Fixed compilation with DISABLE_VALIDATIONS, and fixed a bug in kPrevNode
svn-id: r46949
-rw-r--r--engines/sci/engine/kernel.h1
-rw-r--r--engines/sci/engine/klists.cpp4
-rw-r--r--engines/sci/engine/vm.cpp4
3 files changed, 6 insertions, 3 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 520f7284a9..9e24f2f2d1 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -41,6 +41,7 @@ struct Node; // from segment.h
struct List; // from segment.h
//#define DEBUG_PARSER // enable for parser debugging
+//#define DISABLE_VALIDATIONS // enable to stop validation checks
/* Generic description: */
typedef reg_t KernelFunc(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index c5a798d86b..2b2a9b4562 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -247,8 +247,10 @@ reg_t kNextNode(EngineState *s, int argc, reg_t *argv) {
reg_t kPrevNode(EngineState *s, int argc, reg_t *argv) {
Node *n = s->_segMan->lookupNode(argv[0]);
- if (!sane_nodep(s, argv[0]))
+ if (!sane_nodep(s, argv[0])) {
warning("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0]));
+ return NULL_REG;
+ }
return n->pred;
}
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index e5fdbbb145..1b570c5dea 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -185,7 +185,7 @@ static void validate_write_var(reg_t *r, reg_t *stack_base, int type, int max, i
# define validate_arithmetic(r) ((r).offset)
# define signed_validate_arithmetic(r) ((int) ((r).offset) & 0x8000 ? (signed) ((r).offset) - 65536 : ((r).offset))
# define validate_variable(r, sb, t, m, i, l)
-# define validate_read_var(r, sb, t, m, i, l) ((r)[i])
+# define validate_read_var(r, sb, t, m, i, l, dv) ((r)[i])
# define validate_write_var(r, sb, t, m, i, l, v, sm, k) ((r)[i] = (v))
# define validate_property(o, p) ((o)->_variables[p])
@@ -492,7 +492,7 @@ ExecStack *add_exec_stack_entry(EngineState *s, reg_t pc, StackPtr sp, reg_t obj
return &(s->_executionStack.back());
}
-#ifdef DISABLE_VALIDATONS
+#ifdef DISABLE_VALIDATIONS
# define kernel_matches_signature(a, b, c, d) 1
#endif