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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri May 29 15:07:14 CEST 2009


Revision: 40993
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40993&view=rev
Author:   fingolfin
Date:     2009-05-29 13:07:14 +0000 (Fri, 29 May 2009)

Log Message:
-----------
SCI: Converted several fprintf(stderr) calls to warning/error (the remaining fprintf calls should probably be replaced by suitable debug/debugC/debugN invocations)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/seg_manager.cpp
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/gfx/gfx_test.cpp
    scummvm/trunk/engines/sci/gfx/operations.cpp
    scummvm/trunk/engines/sci/gfx/picfill.cpp
    scummvm/trunk/engines/sci/gfx/res_pic.cpp
    scummvm/trunk/engines/sci/sci.cpp
    scummvm/trunk/engines/sci/sfx/core.cpp
    scummvm/trunk/engines/sci/sfx/iterator.cpp
    scummvm/trunk/engines/sci/sfx/seq/gm.cpp
    scummvm/trunk/engines/sci/sfx/seq/instrument-map.cpp
    scummvm/trunk/engines/sci/sfx/test-iterator.cpp
    scummvm/trunk/engines/sci/vocabulary.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -489,7 +489,7 @@
 
 int kernel_oops(EngineState *s, const char *file, int line, const char *reason) {
 	sciprintf("Kernel Oops in file %s, line %d: %s\n", file, line, reason);
-	fprintf(stderr, "Kernel Oops in file %s, line %d: %s\n", file, line, reason);
+	warning("Kernel Oops in file %s, line %d: %s", file, line, reason);
 	script_debug_flag = script_error_flag = 1;
 	return 0;
 }

Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -1087,7 +1087,7 @@
 			warning("Request for outgoing script-object reference at %04x:%04x yielded invalid index %d", PRINT_REG(addr), idx);
 		}
 	} else {
-		/*		fprintf(stderr, "Unexpected request for outgoing script-object references at %04x:%04x\n", PRINT_REG(addr));*/
+		/*		warning("Unexpected request for outgoing script-object references at %04x:%04x", PRINT_REG(addr));*/
 		/* Happens e.g. when we're looking into strings */
 	}
 }
@@ -1109,7 +1109,7 @@
 //	assert(addr.segment == _segId);
 
 	if (!clone_table->isValidEntry(addr.offset)) {
-		fprintf(stderr, "Unexpected request for outgoing references from clone at %04x:%04x\n", PRINT_REG(addr));
+		warning("Unexpected request for outgoing references from clone at %04x:%04x", PRINT_REG(addr));
 //		BREAKPOINT();
 		return;
 	}

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -514,8 +514,7 @@
 #endif
 
 void vm_handle_fatal_error(EngineState *s, int line, const char *file) {
-	fprintf(stderr, "Fatal VM error in %s, L%d; aborting...\n", file, line);
-	error("Could not recover, exitting...\n");
+	error("Fatal VM error in %s, L%d; aborting...", file, line);
 }
 
 static Script *script_locate_by_segment(EngineState *s, SegmentId seg) {

Modified: scummvm/trunk/engines/sci/gfx/gfx_test.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_test.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/gfx/gfx_test.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -297,7 +297,7 @@
 		break;
 
 	default:
-		fprintf(stderr, "Attempt to reference invalid pic #%d\n", nr);
+		warning("Attempt to reference invalid pic #%d", nr);
 	}
 
 	printf(">> resource manager retrieved pic #%d\n", nr);
@@ -481,7 +481,7 @@
 		break;
 
 	default:
-		fprintf(stderr, "Attempt to load invalid pointer %d\n", nr);
+		warning("Attempt to load invalid pointer %d", nr);
 		gfx_free_pixmap(state->driver, cursor);
 		return NULL;
 	}
@@ -1081,7 +1081,7 @@
 		case 'x':
 			set_mode = xres = atoi(optarg);
 			if (xres < 1) {
-				fprintf(stderr, "Invalid x scale factor!\n");
+				warning("Invalid x scale factor!");
 				return 1;
 			}
 			break;
@@ -1089,7 +1089,7 @@
 		case 'y':
 			set_mode = yres = atoi(optarg);
 			if (yres < 1) {
-				fprintf(stderr, "Invalid y scale factor!\n");
+				warning("Invalid y scale factor!");
 				return 1;
 			}
 			break;
@@ -1097,13 +1097,13 @@
 		case 'c':
 			set_mode = color_mode = atoi(optarg);
 			if (color_mode < 1 || color_mode > 4) {
-				fprintf(stderr, "Invalid number of bytes per pixel!\n");
+				warning("Invalid number of bytes per pixel!");
 				return 1;
 			}
 			break;
 
 		default:
-			fprintf(stderr, "Run 'gfx_test -h' for help\n");
+			warning("Run 'gfx_test -h' for help");
 			return 1;
 		}
 
@@ -1128,17 +1128,17 @@
 		}
 
 		if (init_driver(drv)) {
-			fprintf(stderr, "Initialization failed!\n");
+			warning("Initialization failed!");
 			return 1;
 		}
 
 		do_tests(tests);
 
 		if (gfxop_exit(state)) {
-			fprintf(stderr, "Something weird happened while exitting...\n");
+			warning("Something weird happened while exitting...");
 		}
 	} else {
-		fprintf(stderr, "No graphics driver found!\n");
+		warning("No graphics driver found!");
 		return 1;
 	}
 

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -1085,7 +1085,7 @@
 		break;
 
 	default:
-		fprintf(stderr, "Invalid display map %d selected!\n", visible_map);
+		warning("Invalid display map %d selected!", visible_map);
 		return GFX_ERROR;
 	}
 

Modified: scummvm/trunk/engines/sci/gfx/picfill.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/picfill.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/gfx/picfill.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -74,10 +74,7 @@
 		if (xl > old_xr) // No fillable strip above the last one
 			return;
 
-		if ((ytotal + xl) < 0) {
-			fprintf(stderr, "AARGH-%d\n", __LINE__);
-			BREAKPOINT();
-		}
+		assert((ytotal + xl) >= 0);
 
 		xr = xl;
 		while (xr < 320 && !(pic->aux_map[ytotal + xr] & clipmask)) {
@@ -85,10 +82,7 @@
 			++xr;
 		}
 
-		if ((ytotal + xr) > 64000) {
-			fprintf(stderr, "AARGH-%d\n", __LINE__);
-			BREAKPOINT();
-		}
+		assert((ytotal + xr) <= 64000);
 
 		--xr;
 
@@ -137,14 +131,8 @@
 			}
 		}
 
-		if ((ytotal + xl) < 0) {
-			fprintf(stderr, "AARGH-%d\n", __LINE__);
-			BREAKPOINT();
-		}
-		if ((ytotal + xr + 1) > 64000) {
-			fprintf(stderr, "AARGH-%d\n", __LINE__);
-			BREAKPOINT();
-		}
+		assert((ytotal + xl) >= 0);
+		assert((ytotal + xr + 1) <= 64000);
 
 		if (control)
 			memset(pic->control_map->index_data + ytotal + xl, control, xr - xl + 1);

Modified: scummvm/trunk/engines/sci/gfx/res_pic.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/res_pic.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/gfx/res_pic.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -468,7 +468,7 @@
 				break;
 
 			default:
-				fprintf(stderr, "%s L%d: Invalid ellipse fill mode!\n", __FILE__, __LINE__);
+				warning(" to %s,%d", __FILE__, __LINE__);
 				return;
 
 			}
@@ -770,7 +770,7 @@
 	end.y = ey;
 
 	if (ex >= pic->visual_map->index_width || ey >= pic->visual_map->index_height || x < 0 || y < 0) {
-		fprintf(stderr, "While drawing pic0: INVALID LINE %d,%d,%d,%d\n",
+		warning("While drawing pic0: INVALID LINE %d,%d,%d,%d",
 		        start.x, start.y, end.x, end.y);
 		return;
 	}

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -229,7 +229,7 @@
 
 
 	if (game_init(gamestate)) { /* Initialize */
-		fprintf(stderr, "Game initialization failed: Aborting...\n");
+		warning("Game initialization failed: Aborting...");
 		// TODO: Add an "init failed" error?
 		return Common::kUnknownError;
 	}
@@ -272,17 +272,17 @@
 
 	bool isVGA = _resmgr->_sciVersion >= SCI_VERSION_01_VGA && !(getFlags() & GF_SCI1_EGA);
 	if (gfxop_init(_resmgr->_sciVersion, isVGA, &gfx_state, &gfx_options, _resmgr)) {
-		fprintf(stderr, "Graphics initialization failed. Aborting...\n");
+		warning("Graphics initialization failed. Aborting...");
 		return Common::kUnknownError;
 	}
 
 	if (game_init_graphics(gamestate)) { // Init interpreter graphics
-		fprintf(stderr, "Game initialization failed: Error in GFX subsystem. Aborting...\n");
+		warning("Game initialization failed: Error in GFX subsystem. Aborting...");
 		return Common::kUnknownError;
 	}
 
 	if (game_init_sound(gamestate, 0)) {
-		fprintf(stderr, "Game initialization failed: Error in sound subsystem. Aborting...\n");
+		warning("Game initialization failed: Error in sound subsystem. Aborting...");
 		return Common::kUnknownError;
 	}
 

Modified: scummvm/trunk/engines/sci/sfx/core.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/sfx/core.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -778,7 +778,7 @@
 	fprintf(stderr, "[sfx-core] Adding song: %08lx at %d, it=%p\n", handle, priority, it);
 #endif
 	if (!it) {
-		fprintf(stderr, "[SFX] Attempt to add empty song with handle %08lx\n", handle);
+		warning("[SFX] Attempt to add empty song with handle %08lx", handle);
 		return -1;
 	}
 

Modified: scummvm/trunk/engines/sci/sfx/iterator.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/iterator.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/sfx/iterator.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -163,7 +163,7 @@
 	}
 
 	if (cmd == 0xfe) {
-		fprintf(stderr, "song iterator subsystem: Corrupted sound resource detected.\n");
+		warning("song iterator subsystem: Corrupted sound resource detected.");
 		return SI_FINISHED;
 	}
 

Modified: scummvm/trunk/engines/sci/sfx/seq/gm.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/seq/gm.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/sfx/seq/gm.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -23,6 +23,8 @@
  *
  */
 
+#include "common/util.h"
+
 #include "sci/tools.h"
 #include "sci/sfx/sequencer.h"
 #include "sci/sfx/device.h"
@@ -36,7 +38,7 @@
 	sfx_instrument_map_t *instrument_map = sfx_instrument_map_load_sci(data, patch_len);
 
 	if (!instrument_map) {
-		fprintf(stderr, "[GM]  No GM instrument map found, trying MT-32 instrument map..\n");
+		warning("[GM]  No GM instrument map found, trying MT-32 instrument map..");
 		instrument_map = sfx_instrument_map_mt32_to_gm(data2, patch2_len);
 	}
 

Modified: scummvm/trunk/engines/sci/sfx/seq/instrument-map.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/seq/instrument-map.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/sfx/seq/instrument-map.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -151,7 +151,7 @@
 		return NULL;
 
 	if (size < PATCH_MIN_SIZE) {
-		fprintf(stderr, "[instrument-map] Instrument map too small:  %d of %d\n", (int) size, PATCH_MIN_SIZE);
+		warning("[instrument-map] Instrument map too small:  %d of %d", (int) size, PATCH_MIN_SIZE);
 		return NULL;
 	}
 
@@ -161,12 +161,12 @@
 	map->initialisation_block_size = (int16)READ_LE_UINT16(data + PATCH_INIT_DATA_SIZE_LE);
 	if (map->initialisation_block_size) {
 		if (size < PATCH_MIN_SIZE + map->initialisation_block_size) {
-			fprintf(stderr, "[instrument-map] Instrument map too small for initialisation block:  %d of %d\n", (int) size, PATCH_MIN_SIZE);
+			warning("[instrument-map] Instrument map too small for initialisation block:  %d of %d", (int) size, PATCH_MIN_SIZE);
 			return NULL;
 		}
 
 		if (size > PATCH_MIN_SIZE + map->initialisation_block_size)
-			fprintf(stderr, "[instrument-map] Instrument larger than required by initialisation block:  %d of %d\n", (int) size, PATCH_MIN_SIZE);
+			warning("[instrument-map] Instrument larger than required by initialisation block:  %d of %d", (int) size, PATCH_MIN_SIZE);
 
 		if (map->initialisation_block_size != 0) {
 			map->initialisation_block = (byte *)malloc(map->initialisation_block_size);
@@ -254,7 +254,7 @@
 static int bound_hard_127(int i, const char *descr) {
 	int r = BOUND_127(i);
 	if (r != i)
-		fprintf(stderr, "[instrument-map] Hard-clipping %02x to %02x in %s\n", i, r, descr);
+		warning("[instrument-map] Hard-clipping %02x to %02x in %s", i, r, descr);
 	return r;
 }
 
@@ -423,7 +423,7 @@
 			byte *find = (byte *) memchr(data + offset, 0xf7, len - offset);
 
 			if (!find) {
-				fprintf(stderr, "[instrument-map] Failed to find end of sysex message\n");
+				warning("[instrument-map] Failed to find end of sysex message");
 				return;
 			}
 
@@ -455,7 +455,7 @@
 		}
 
 		if (args + offset > len) {
-			fprintf(stderr, "[instrument-map] Insufficient bytes remaining for MIDI command %02x\n", op);
+			warning("[instrument-map] Insufficient bytes remaining for MIDI command %02x", op);
 			return;
 		}
 

Modified: scummvm/trunk/engines/sci/sfx/test-iterator.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/test-iterator.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/sfx/test-iterator.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -176,7 +176,7 @@
 	ASSERT_NEXT(4);
 	ASSERT_CUE(2);
 	ASSERT_SIT;
-//	fprintf(stderr, "XXX => %d\n", songit_next(&it, data, &result, IT_READER_MASK_ALL));
+//	warning("XXX => %d", songit_next(&it, data, &result, IT_READER_MASK_ALL));
 	ASSERT_NEXT(35);
 	ASSERT_NEXT(SI_FINISHED);
 	ASSERT_SIT;
@@ -418,6 +418,6 @@
 	test_iterator_sci0_loop();
 	test_iterator_sci0_mark_loop();
 	if (errors != 0)
-		fprintf(stderr, "[ERROR] %d errors total.\n", errors);
+		warning("[ERROR] %d errors total.", errors);
 	return (errors != 0);
 }

Modified: scummvm/trunk/engines/sci/vocabulary.cpp
===================================================================
--- scummvm/trunk/engines/sci/vocabulary.cpp	2009-05-29 13:04:32 UTC (rev 40992)
+++ scummvm/trunk/engines/sci/vocabulary.cpp	2009-05-29 13:07:14 UTC (rev 40993)
@@ -166,7 +166,7 @@
 		seeker = 26 * 2; // vocab.000 starts with 26 16-bit pointers which we don't use
 
 	if (resource->size < seeker) {
-		fprintf(stderr, "Invalid main vocabulary encountered: Too small\n");
+		warning("Invalid main vocabulary encountered: Too small");
 		return false;
 		// Now this ought to be critical, but it'll just cause parse() and said() not to work
 	}
@@ -291,7 +291,7 @@
 	int branches_nr = resource->size / 20;
 
 	if (branches_nr == 0) {
-		fprintf(stderr, "Parser tree data is empty!\n");
+		warning("Parser tree data is empty!");
 		return false;
 	}
 


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