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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Feb 21 05:25:57 CET 2009


Revision: 38660
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38660&view=rev
Author:   fingolfin
Date:     2009-02-21 04:25:56 +0000 (Sat, 21 Feb 2009)

Log Message:
-----------
SCI: Use GCC_PRINTF hint to the compiler for _SCIkprintf and sciprintf; fixed tons of bad format strings

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kfile.cpp
    scummvm/trunk/engines/sci/engine/scriptconsole.cpp
    scummvm/trunk/engines/sci/engine/scriptdebug.cpp
    scummvm/trunk/engines/sci/engine/seg_manager.cpp
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/gfx/resource/sci_pic_0.cpp
    scummvm/trunk/engines/sci/gfx/resource/sci_view_1.cpp
    scummvm/trunk/engines/sci/gfx/widgets.cpp
    scummvm/trunk/engines/sci/include/kernel.h
    scummvm/trunk/engines/sci/include/resource.h

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2009-02-21 04:25:56 UTC (rev 38660)
@@ -699,8 +699,7 @@
 		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 {

Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp	2009-02-21 04:25:56 UTC (rev 38660)
@@ -119,7 +119,7 @@
 		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);
 		}
 

Modified: scummvm/trunk/engines/sci/engine/scriptconsole.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptconsole.cpp	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/engine/scriptconsole.cpp	2009-02-21 04:25:56 UTC (rev 38660)
@@ -754,7 +754,7 @@
 	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) {

Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-02-21 04:25:56 UTC (rev 38660)
@@ -394,7 +394,7 @@
 	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 @@
 			break;
 
 		default:
-			sciprintf("unknown.\n", type);
+			sciprintf("unknown type %d.\n", type);
 
 		}
 
@@ -1364,7 +1364,7 @@
 				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_bplist(state_t *s) {
 	breakpoint_t *bp;
 	int i = 0;
-	long bpdata;
+	int bpdata;
 
 	bp = s->bp_list;
 	while (bp) {

Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-02-21 04:25:56 UTC (rev 38660)
@@ -1076,7 +1076,7 @@
 	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 @@
 	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 @@
 		}
 
 	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;
 

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-02-21 04:25:56 UTC (rev 38660)
@@ -221,7 +221,7 @@
 
 			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 @@
 #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;
 	}

Modified: scummvm/trunk/engines/sci/gfx/resource/sci_pic_0.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/resource/sci_pic_0.cpp	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/gfx/resource/sci_pic_0.cpp	2009-02-21 04:25:56 UTC (rev 38660)
@@ -1832,7 +1832,7 @@
 				if (!pic->internal) {
 					pic->internal = sci_malloc(16 * sizeof(int));
 				} else {
-					GFXERROR("pic->internal is not NULL (%08x); this only occurs with overlaid pics, otherwise it's a bug", pic->internal);
+					GFXERROR("pic->internal is not NULL (%p); this only occurs with overlaid pics, otherwise it's a bug", pic->internal);
 				}
 
 				pri_table = (int*)pic->internal;
@@ -1854,7 +1854,7 @@
 				if (!pic->internal) {
 					pic->internal = sci_malloc(16 * sizeof(int));
 				} else {
-					GFXERROR("pic->internal is not NULL (%08x); possible memory corruption", pic->internal);
+					GFXERROR("pic->internal is not NULL (%p); possible memory corruption", pic->internal);
 				}
 
 				pri_table = (int*)pic->internal;

Modified: scummvm/trunk/engines/sci/gfx/resource/sci_view_1.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/resource/sci_view_1.cpp	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/gfx/resource/sci_view_1.cpp	2009-02-21 04:25:56 UTC (rev 38660)
@@ -388,7 +388,7 @@
 		int loop_offset = get_uint_16(resource + V1_FIRST_LOOP_OFFSET + (i << 1));
 
 		if (loop_offset >= size) {
-			GFXERROR("View %04x:(%d) supposed to be at illegal offset 0x%04x\n", id, i);
+			GFXERROR("View %04x:(%d) supposed to be at illegal offset 0x%04x\n", id, i, loop_offset);
 			error_token = 1;
 		}
 

Modified: scummvm/trunk/engines/sci/gfx/widgets.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/widgets.cpp	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/gfx/widgets.cpp	2009-02-21 04:25:56 UTC (rev 38660)
@@ -889,7 +889,7 @@
 	_gfxw_print_widget(widget, indentation);
 
 	sciprintf(type_string);
-	sciprintf(" SORT=%d z=%d seq=%d (%d/%d/%d)@(%d,%d)[p:%d,c:%d]; sig[%04x@%04x]", view->force_precedence, view->z,
+	sciprintf(" SORT=%d z=%d seq=%d (%d/%d/%d)@(%d,%d)[p:%d,c:%d]; sig[%04x@%p]", view->force_precedence, view->z,
 	          view->sequence, view->view, view->loop, view->cel, view->pos.x, view->pos.y,
 	          (view->color.mask & GFX_MASK_PRIORITY) ? view->color.priority : -1,
 	          (view->color.mask & GFX_MASK_CONTROL) ? view->color.control : -1,
@@ -1973,7 +1973,7 @@
 
 		if (visual->port_refs[ID] != port) {
 			GFXWARN("While freeing port %d: Port is at %p, but port list indicates %p",
-			        ID, port, visual->port_refs[ID]);
+			        ID, (void *)port, (void *)visual->port_refs[ID]);
 		} else visual->port_refs[ID] = NULL;
 
 	}

Modified: scummvm/trunk/engines/sci/include/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/include/kernel.h	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/include/kernel.h	2009-02-21 04:25:56 UTC (rev 38660)
@@ -154,7 +154,7 @@
 void
 _SCIkvprintf(FILE *file, const char *format, va_list args);
 void
-_SCIkprintf(FILE *file, const char *format, ...);
+_SCIkprintf(FILE *file, const char *format, ...)  GCC_PRINTF(2, 3);
 
 
 

Modified: scummvm/trunk/engines/sci/include/resource.h
===================================================================
--- scummvm/trunk/engines/sci/include/resource.h	2009-02-21 04:23:43 UTC (rev 38659)
+++ scummvm/trunk/engines/sci/include/resource.h	2009-02-21 04:25:56 UTC (rev 38660)
@@ -214,7 +214,7 @@
 
 
 int
-sciprintf(const char *fmt, ...);
+sciprintf(const char *fmt, ...) GCC_PRINTF(1, 2);
 #define gfxprintf sciprintf
 /* Prints a string to the console stack
 ** Parameters: fmt: a printf-style format string


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