aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMax Horn2009-02-21 04:25:56 +0000
committerMax Horn2009-02-21 04:25:56 +0000
commit7c87b4901dd6de93511cf7995931b64e59d13fef (patch)
tree3886d975a45c3b65a540f350e91a58aabb2cf220 /engines/sci/engine
parentcb6b1fc90303cff2f7bff4533fbb2644c4373bec (diff)
downloadscummvm-rg350-7c87b4901dd6de93511cf7995931b64e59d13fef.tar.gz
scummvm-rg350-7c87b4901dd6de93511cf7995931b64e59d13fef.tar.bz2
scummvm-rg350-7c87b4901dd6de93511cf7995931b64e59d13fef.zip
SCI: Use GCC_PRINTF hint to the compiler for _SCIkprintf and sciprintf; fixed tons of bad format strings
svn-id: r38660
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kernel.cpp3
-rw-r--r--engines/sci/engine/kfile.cpp2
-rw-r--r--engines/sci/engine/scriptconsole.cpp2
-rw-r--r--engines/sci/engine/scriptdebug.cpp8
-rw-r--r--engines/sci/engine/seg_manager.cpp6
-rw-r--r--engines/sci/engine/vm.cpp4
6 files changed, 12 insertions, 13 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 33f9df7ddf..470f407ac6 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -699,8 +699,7 @@ void kernel_compile_signature(const char **s) {
v = 0;
if (ellipsis) {
- sciprintf("INTERNAL ERROR when compiling kernel function signature '%s': non-terminal ellipsis\n", *s, *src);
- exit(1);
+ error("Failed compiling kernel function signature '%s': non-terminal ellipsis '%c'\n", *s, *src);
}
do {
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 041784ee27..9ed22989bd 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -119,7 +119,7 @@ static FILE *f_open_mirrored(state_t *s, char *fname) {
int ret;
ret = write(fd, buf, fsize);
if (ret < fsize) {
- sciprintf("kfile.c: f_open_mirrored(): Warning: Could not write all %ld bytes to '%s' in '%s' (only wrote %ld)\n",
+ sciprintf("kfile.c: f_open_mirrored(): Warning: Could not write all %ld bytes to '%s' in '%s' (only wrote %d)\n",
(long)fsize, fname, s->work_dir, ret);
}
diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp
index 8b7208a8e3..286671bf8f 100644
--- a/engines/sci/engine/scriptconsole.cpp
+++ b/engines/sci/engine/scriptconsole.cpp
@@ -754,7 +754,7 @@ static void _cmd_print_command(cmd_mm_entry_t *data, int full) {
const char *paramseeker = ((cmd_command_t *)data)->param;
if (full) {
- sciprintf("SYNOPSIS\n\n %s ", data->name, paramseeker);
+ sciprintf("SYNOPSIS\n\n %s (%s) ", data->name, paramseeker);
while (*paramseeker) {
switch (*paramseeker) {
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index d3cd82a22f..c669bc8eca 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -394,7 +394,7 @@ static void _c_single_seg_info(state_t *s, mem_obj_t *mobj) {
case MEM_OBJ_SCRIPT: {
int i;
script_t *scr = &(mobj->data.script);
- sciprintf("script.%03d locked by %d, bufsize=%d (%x)\n", scr->nr, scr->lockers, scr->buf_size, scr->buf_size);
+ sciprintf("script.%03d locked by %d, bufsize=%d (%x)\n", scr->nr, scr->lockers, (uint)scr->buf_size, (uint)scr->buf_size);
if (scr->export_table)
sciprintf(" Exports: %4d at %d\n", scr->exports_nr, ((byte *)scr->export_table) - ((byte *)scr->buf));
else
@@ -629,7 +629,7 @@ static int c_vr(state_t *s) {
break;
default:
- sciprintf("unknown.\n", type);
+ sciprintf("unknown type %d.\n", type);
}
@@ -1364,7 +1364,7 @@ reg_t disassemble(state_t *s, reg_t pos, int print_bw_tag, int print_bytecode) {
param_value = 0xffff & (scr[retval.offset] | (scr[retval.offset+1] << 8));
retval.offset += 2;
}
- sciprintf(opsize ? " %02x [%04x]" : " %04x", param_value);
+ sciprintf(opsize ? " %02x" : " %04x", param_value);
break;
case Script_SRelative:
@@ -2653,7 +2653,7 @@ int c_bpe(state_t *s) {
int c_bplist(state_t *s) {
breakpoint_t *bp;
int i = 0;
- long bpdata;
+ int bpdata;
bp = s->bp_list;
while (bp) {
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index eb1b50ea41..b3bad34b42 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -1076,7 +1076,7 @@ void sm_script_initialise_locals(seg_manager_t *self, reg_t location) {
scr->locals_offset = location.offset;
if (!(location.offset + count * 2 + 1 < scr->buf_size)) {
- sciprintf("Locals extend beyond end of script: offset %04x, count %x vs size %x\n", location.offset, count, scr->buf_size);
+ sciprintf("Locals extend beyond end of script: offset %04x, count %x vs size %x\n", location.offset, count, (uint)scr->buf_size);
count = (scr->buf_size - location.offset) >> 1;
}
@@ -1329,7 +1329,7 @@ byte *sm_dereference(seg_manager_t *self, reg_t pointer, int *size) {
case MEM_OBJ_SCRIPT:
if (pointer.offset > mobj->data.script.buf_size) {
sciprintf("Error: Attempt to dereference invalid pointer "PREG" into script segment (script size=%d)\n",
- PRINT_REG(pointer), mobj->data.script.buf_size);
+ PRINT_REG(pointer), (uint)mobj->data.script.buf_size);
return NULL;
}
if (size)
@@ -1363,7 +1363,7 @@ byte *sm_dereference(seg_manager_t *self, reg_t pointer, int *size) {
}
case MEM_OBJ_RESERVED:
- sciprintf("Error: Trying to dereference pointer "PREG" to reserved segment `%s'", mobj->data.reserved);
+ sciprintf("Error: Trying to dereference pointer "PREG" to reserved segment `%s'", PRINT_REG(pointer), mobj->data.reserved);
return NULL;
break;
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index d272f68e66..6770c32cb9 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -221,7 +221,7 @@ reg_t get_class_address(state_t *s, int classnr, int lock, reg_t caller) {
if (!the_class->reg.segment) {
sciprintf("[VM] Trying to instantiate class %x by instantiating script 0x%x (%03d) failed;"
- " Entering debugger.\n", classnr, the_class->script);
+ " Entering debugger.\n", classnr, the_class->script, the_class->script);
script_error_flag = script_debug_flag = 1;
return NULL_REG;
}
@@ -1648,7 +1648,7 @@ reg_t script_lookup_export(state_t *s, int script_nr, int export_index) {
#ifndef DISABLE_VALIDATIONS
if (!seg) {
CORE_ERROR("EXPORTS", "Script invalid or not loaded");
- sciprintf("Script was script.03d (0x%x)\n",
+ sciprintf("Script was script.%03d (0x%x)\n",
script_nr, script_nr);
return NULL_REG;
}