aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMax Horn2009-02-15 14:46:42 +0000
committerMax Horn2009-02-15 14:46:42 +0000
commit9daed50e0165f387f597fec4d06b57805e1f717c (patch)
treeeca2f45cf9f2b90ef83be380e42d32e99ecb1862 /engines/sci/engine
parent0082a84b8d956bf25c6aaef153d401d641f0923d (diff)
downloadscummvm-rg350-9daed50e0165f387f597fec4d06b57805e1f717c.tar.gz
scummvm-rg350-9daed50e0165f387f597fec4d06b57805e1f717c.tar.bz2
scummvm-rg350-9daed50e0165f387f597fec4d06b57805e1f717c.zip
Fixed lots of warnings and errors (on my system) by backporting a patch I had sent the FreeSCI folks some time ago (but apparently it never made it, or only made it to a branch not imported?)
svn-id: r38245
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/game.cpp6
-rw-r--r--engines/sci/engine/grammar.cpp71
-rw-r--r--engines/sci/engine/kernel_compat.h2
-rw-r--r--engines/sci/engine/kfile.cpp5
-rw-r--r--engines/sci/engine/kmovement.cpp2
-rw-r--r--engines/sci/engine/scriptconsole.cpp23
6 files changed, 18 insertions, 91 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 63d3fb9e94..553298e406 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -647,7 +647,7 @@ script_free_breakpoints(state_t *s)
int
game_init(state_t *s)
{
-#ifdef __GNUC__
+#ifdef __GNUC__XX
# warning "Fixme: Use new VM instantiation code all over the place"
#endif
reg_t game_obj; /* Address of the game object */
@@ -750,7 +750,7 @@ game_exit(state_t *s)
sciprintf("Freeing miscellaneous data...\n");
-#ifdef __GNUC__
+#ifdef __GNUC__XX
#warning "Free parser segment here"
#endif
if (send_calls_allocated) {
@@ -758,7 +758,7 @@ game_exit(state_t *s)
send_calls_allocated = 0;
}
-#ifdef __GNUC__
+#ifdef __GNUC__XX
#warning "Free scripts here"
#endif
diff --git a/engines/sci/engine/grammar.cpp b/engines/sci/engine/grammar.cpp
index 265286b72d..ae96990b10 100644
--- a/engines/sci/engine/grammar.cpp
+++ b/engines/sci/engine/grammar.cpp
@@ -104,59 +104,6 @@ _vfree(parse_rule_t *rule)
rule = NULL;
}
-#if 0
-// Unreferenced - removed
-
-static parse_rule_t *
-_vbuild(int id, int argc, ...)
-{
- va_list args;
- int i;
- parse_rule_t *rule = (parse_rule_t*)sci_malloc(sizeof(int) * (argc + 4));
-
- ++_allocd_rules;
- rule->id = id;
- rule->first_special = 0;
- rule->specials_nr = 0;
- rule->length = argc;
- va_start(args, argc);
- for (i = 0; i < argc; i++) {
- int v;
- rule->data[i] = v = va_arg(args, int);
- if ((v & TOKEN_TERMINAL)
- || !(v & TOKEN_NON_NT)) {
-
- ++rule->specials_nr;
-
- if (!rule->first_special)
- rule->first_special = i;
- }
- }
- va_end(args);
- return rule;
-}
-#endif
-
-#if 0
-// Unreferenced - removed
-static parse_rule_t *
-_vcat(int id, parse_rule_t *a, parse_rule_t *b)
-{
- parse_rule_t *rule = (parse_rule_t*)sci_malloc(sizeof(int) * (a->length + b->length + 4));
-
- rule->id = id;
- rule->length = a->length + b->length;
- rule->specials_nr = a->specials_nr + b->specials_nr;
- rule->first_special = a->first_special;
- ++_allocd_rules;
-
- memcpy(rule->data, a->data, sizeof(int) * a->length);
- memcpy(&(rule->data[a->length]), b->data, sizeof(int) * b->length);
-
- return rule;
-}
-#endif
-
static parse_rule_t *
_vdup(parse_rule_t *a)
{
@@ -204,24 +151,6 @@ _vinsert(parse_rule_t *turkey, parse_rule_t *stuffing)
return rule;
}
-#if 0
-// Unreferenced - removed
-static int
-_greibach_rule_p(parse_rule_t *rule)
-{
- int pos = rule->first_special;
- while (pos < rule->length
- && (rule->data[pos] & TOKEN_NON_NT)
- && !(rule->data[pos] & TOKEN_TERMINAL))
- ++pos;
-
- if (pos == rule->length)
- return 0;
-
- return (rule->data[pos] & TOKEN_TERMINAL);
-}
-#endif
-
static parse_rule_t *
_vbuild_rule(parse_tree_branch_t *branch)
{
diff --git a/engines/sci/engine/kernel_compat.h b/engines/sci/engine/kernel_compat.h
index 0a3468282a..a021064223 100644
--- a/engines/sci/engine/kernel_compat.h
+++ b/engines/sci/engine/kernel_compat.h
@@ -29,7 +29,7 @@
#ifndef _SCI_KERNEL_COMPAT_
#define _SCI_KERNEL_COMPAT_
-#ifdef __GNUC__
+#ifdef __GNUC__XX
#warning "Old kernel compatibility crap"
#endif
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 629a1a6f00..6af5cb7b86 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -577,7 +577,6 @@ kCheckFreeSpace(state_t *s, int funct_nr, int argc, reg_t *argv)
char *path = kernel_dereference_char_pointer(s, argv[0], 0);
char *testpath = (char*)sci_malloc(strlen(path) + 15);
char buf[1024];
- int i;
int fd;
int failed = 0;
int pathlen;
@@ -616,7 +615,7 @@ kCheckFreeSpace(state_t *s, int funct_nr, int argc, reg_t *argv)
}
memset(buf, 0, sizeof(buf));
- for (i = 0; i < 1024; i++) /* Check for 1 MB */
+ for (int i = 0; i < 1024; i++) /* Check for 1 MB */
if (write(fd, buf, 1024) < 1024)
failed = 1;
@@ -711,7 +710,7 @@ _savegame_index_struct_compare(const void *a, const void *b)
}
static void
-update_savegame_indices(char *gfname)
+update_savegame_indices(const char *gfname)
{
int i;
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index 1d4ec81bfa..37ff5fb1f9 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -251,7 +251,7 @@ static enum {
UNINITIALIZED
} handle_movecnt = UNINITIALIZED;
-int parse_reg_t(state_t *s, char *str, reg_t *dest); /* In scriptconsole.c */
+int parse_reg_t(state_t *s, const char *str, reg_t *dest); /* In scriptconsole.c */
static int
checksum_bytes(byte *data, int size)
diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp
index 04aaa47b87..4d3f431a34 100644
--- a/engines/sci/engine/scriptconsole.cpp
+++ b/engines/sci/engine/scriptconsole.cpp
@@ -350,10 +350,10 @@ clone_is_used(clone_table_t *t, int idx)
}
int
-parse_reg_t(state_t *s, char *str, reg_t *dest)
+parse_reg_t(state_t *s, const char *str, reg_t *dest)
{ /* Returns 0 on success */
int rel_offsetting = 0;
- char *offsetting = NULL;
+ const char *offsetting = NULL;
/* Non-NULL: Parse end of string for relative offsets */
char *endptr;
@@ -415,26 +415,27 @@ parse_reg_t(state_t *s, char *str, reg_t *dest)
} else if (*str == '?') {
int index = -1;
int times_found = 0;
- char *str_objname;
+ char *tmp;
+ const char *str_objname;
char *str_suffix;
char suffchar = 0; /* Supress spurious -Wall warning */
int i;
/* Parse obj by name */
- str_objname = strchr(str, '+');
+ tmp = strchr(str, '+');
str_suffix = strchr(str, '-');
- if (str_objname < str_suffix)
- str_suffix = str_objname;
+ if (tmp < str_suffix)
+ str_suffix = tmp;
if (str_suffix) {
suffchar = (*str_suffix);
*str_suffix = 0;
}
- str_objname = strchr(str, '.');
+ tmp = strchr(str, '.');
- if (str_objname) {
- *str_objname = 0;
- index = strtol(str_objname+1, &endptr, 16);
+ if (tmp) {
+ *tmp = 0;
+ index = strtol(tmp+1, &endptr, 16);
if (*endptr)
return -1;
}
@@ -1053,7 +1054,6 @@ c_list (state_t * s)
else if (!strcmp("words", cmd_params[0].str))
return c_list_words(s);
else if (strcmp ("restypes", cmd_params[0].str) == 0) {
- int i;
for (i = 0; i < sci_invalid_resource; i++)
sciprintf ("%s\n", sci_resource_types[i]);
}
@@ -1062,7 +1062,6 @@ c_list (state_t * s)
if (res == -1)
sciprintf ("Unknown resource type: '%s'\n", cmd_params[0].str);
else {
- int i;
for (i = 0; i < sci_max_resource_nr[s->resmgr->sci_version]; i++)
if (scir_test_resource (s->resmgr, res, i))
sciprintf ("%s.%03d\n", sci_resource_types[res], i);