[Scummvm-cvs-logs] SF.net SVN: scummvm:[41558] tools/branches/gsoc2009-gui

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Jun 15 23:12:51 CEST 2009


Revision: 41558
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41558&view=rev
Author:   fingolfin
Date:     2009-06-15 21:12:51 +0000 (Mon, 15 Jun 2009)

Log Message:
-----------
Turned lots of printf+exit pairs into calls to error(); turned 'Can't' into 'Cannot' in messages, for consistency

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/compress.cpp
    tools/branches/gsoc2009-gui/compress_agos.cpp
    tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
    tools/branches/gsoc2009-gui/compress_scumm_san.cpp
    tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
    tools/branches/gsoc2009-gui/compress_sword2.cpp
    tools/branches/gsoc2009-gui/compress_tucker.cpp
    tools/branches/gsoc2009-gui/encode_dxa.cpp
    tools/branches/gsoc2009-gui/kyra_pak.cpp
    tools/branches/gsoc2009-gui/utils/wave.cpp

Modified: tools/branches/gsoc2009-gui/compress.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress.cpp	2009-06-15 20:52:09 UTC (rev 41557)
+++ tools/branches/gsoc2009-gui/compress.cpp	2009-06-15 21:12:51 UTC (rev 41558)
@@ -338,13 +338,11 @@
 			result = vorbis_encode_setup_managed(&vi, numChannels, samplerate, (oggparms.maxBitr > 0 ? 1000 * oggparms.maxBitr : -1), (1000 * oggparms.nominalBitr), (oggparms.minBitr > 0 ? 1000 * oggparms.minBitr : -1));
 
 			if (result == OV_EFAULT) {
-				printf("Error: Internal Logic Fault.\n\n");
 				vorbis_info_clear(&vi);
-				exit(-1);
+				error("Error: Internal Logic Fault");
 			} else if ((result == OV_EINVAL) || (result == OV_EIMPL)) {
-				printf("Error: Invalid bitrate parameters.\n\n");
 				vorbis_info_clear(&vi);
-				exit(-1);
+				error("Error: Invalid bitrate parameters");
 			}
 
 			if (!oggparms.silent) {
@@ -369,13 +367,11 @@
 			result = vorbis_encode_setup_vbr(&vi, numChannels, samplerate, oggparms.quality * 0.1f);
 
 			if (result == OV_EFAULT) {
-				printf("Error: Internal Logic Fault.\n\n");
 				vorbis_info_clear(&vi);
-				exit(-1);
+				error("Internal Logic Fault");
 			} else if ((result == OV_EINVAL) || (result == OV_EIMPL)) {
-				printf("Error: Invalid bitrate parameters.\n\n");
 				vorbis_info_clear(&vi);
-				exit(-1);
+				error("Invalid bitrate parameters");
 			}
 
 			if (!oggparms.silent) {

Modified: tools/branches/gsoc2009-gui/compress_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_agos.cpp	2009-06-15 20:52:09 UTC (rev 41557)
+++ tools/branches/gsoc2009-gui/compress_agos.cpp	2009-06-15 21:12:51 UTC (rev 41558)
@@ -136,26 +136,22 @@
 
 	input = fopen(inputPath->getFullPath(), "rb");
 	if (!input) {
-		printf("Cannot open file: %s\n", inputPath->getFullPath());
-		exit(-1);
+		error("Cannot open file: %s", inputPath->getFullPath());
 	}
 
 	output_idx = fopen(TEMP_IDX, "wb");
 	if (!output_idx) {
-		printf("Can't open file " TEMP_IDX " for write!\n" );
-		exit(-1);
+		error("Cannot open file " TEMP_IDX " for write");
 	}
 
 	output_snd = fopen(TEMP_DAT, "wb");
 	if (!output_snd) {
-		printf("Can't open file " TEMP_DAT " for write!\n" );
-		exit(-1);
+		error("Cannot open file " TEMP_DAT " for write");
 	}
 
 	num = get_offsets(filenums, offsets);
 	if (!num) {
-		printf("This does not seem to be a valid file\n");
-		exit(-1);
+		error("This does not seem to be a valid file");
 	}
 	size = num * 4;
 
@@ -183,26 +179,22 @@
 	inputPath->setFullName("voices.idx");
 	input = fopen(inputPath->getFullPath(), "rb");
 	if (!input) {
-		printf("Cannot open file: %s\n", "voices.idx");
-		exit(-1);
+		error("Cannot open file: %s", "voices.idx");
 	}
 
 	output_idx = fopen(TEMP_IDX, "wb");
 	if (!output_idx) {
-		printf("Can't open file " TEMP_IDX " for write!\n" );
-		exit(-1);
+		error("Cannot open file " TEMP_IDX " for write");
 	}
 
 	output_snd = fopen(TEMP_DAT, "wb");
 	if (!output_snd) {
-		printf("Can't open file " TEMP_DAT " for write!\n" );
-		exit(-1);
+		error("Cannot open file " TEMP_DAT " for write");
 	}
 
 	num = get_offsets_mac(filenums, offsets);
 	if (!num) {
-		printf("This does not seem to be a valid file\n");
-		exit(-1);
+		error("This does not seem to be a valid file");
 	}
 	size = num * 4;
 
@@ -226,8 +218,7 @@
 
 			input = fopen(inputPath->getFullPath(), "rb");
 			if (!input) {
-				printf("Cannot open file: %s\n", inputPath->getFullPath());
-				exit(-1);
+				error("Cannot open file: %s", inputPath->getFullPath());
 			}
 		}
 

Modified: tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_bun.cpp	2009-06-15 20:52:09 UTC (rev 41557)
+++ tools/branches/gsoc2009-gui/compress_scumm_bun.cpp	2009-06-15 21:12:51 UTC (rev 41558)
@@ -695,8 +695,7 @@
 
 	fseek(_waveTmpFile, 0, SEEK_SET);
 	if (fwrite(wav, 1, 44, _waveTmpFile) != 44) {
-		printf("error write temp wave file");
-		exit(1);
+		error("error writing temp wave file");
 	}
 	fclose(_waveTmpFile);
 	_waveTmpFile = NULL;
@@ -706,14 +705,12 @@
 	if (!_waveTmpFile) {
 		_waveTmpFile = fopen(fileName, "wb");
 		if (!_waveTmpFile) {
-			printf("error write temp wave file");
-			exit(1);
+			error("error writing temp wave file");
 		}
 		byte wav[44];
 		memset(wav, 0, 44);
 		if (fwrite(output_data, 1, 44, _waveTmpFile) != 44) {
-			printf("error write temp wave file");
-			exit(1);
+			error("error writing temp wave file");
 		}
 		_waveDataSize = 0;
 	}
@@ -723,8 +720,7 @@
 		output_data[j + 1] = tmp;
 	}
 	if (fwrite(output_data, 1, size, _waveTmpFile) != size) {
-		printf("error write temp wave file");
-		exit(1);
+		error("error writing temp wave file");
 	}
 	_waveDataSize += size;
 }
@@ -1123,8 +1119,7 @@
 
 	FILE *input = fopen(inpath.getFullPath(), "rb");
 	if (!input) {
-		printf("Cannot open file: %s\n", inpath.getFullPath());
-		exit(-1);
+		error("Cannot open file: %s", inpath.getFullPath());
 	}
 
 	if(outpath.empty()) {
@@ -1135,8 +1130,7 @@
 
 	FILE *output = fopen(outpath.getFullPath(), "wb");
 	if (!output) {
-		printf("Cannot open file: %s\n", outpath.getFullPath());
-		exit(-1);
+		error("Cannot open file: %s", outpath.getFullPath());
 	}
 
 	writeUint32BE(output, 'LB23');

Modified: tools/branches/gsoc2009-gui/compress_scumm_san.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_san.cpp	2009-06-15 20:52:09 UTC (rev 41557)
+++ tools/branches/gsoc2009-gui/compress_scumm_san.cpp	2009-06-15 21:12:51 UTC (rev 41558)
@@ -123,8 +123,7 @@
 
 	fseek(_waveTmpFile, 0, SEEK_SET);
 	if (fwrite(wav, 1, 44, _waveTmpFile) != 44) {
-		printf("error write temp wave file");
-		exit(1);
+		error("error writing temp wave file");
 	}
 	fclose(_waveTmpFile);
 	_waveTmpFile = NULL;
@@ -133,14 +132,12 @@
 	if (!_waveTmpFile) {
 		_waveTmpFile = fopen(fileName, "wb");
 		if (!_waveTmpFile) {
-			printf("error write temp wave file");
-			exit(1);
+			error("error writing temp wave file");
 		}
 		byte wav[44];
 		memset(wav, 0, 44);
 		if (fwrite(output_data, 1, 44, _waveTmpFile) != 44) {
-			printf("error write temp wave file");
-			exit(1);
+			error("error writing temp wave file");
 		}
 		_waveDataSize = 0;
 	}
@@ -151,8 +148,7 @@
 	}
 
 	if (fwrite(output_data, 1, size, _waveTmpFile) != size) {
-		printf("error write temp wave file");
-		exit(1);
+		error("error writing temp wave file");
 	}
 	_waveDataSize += size;
 }
@@ -551,8 +547,7 @@
 		sprintf(tmpPath, "%s/%s_%04d_%03d.tmp", outputDir, inputFilename, frame, trackId);
 		audioTrack->file = fopen(tmpPath, "wb");
 		if (!audioTrack->file) {
-			printf("error write temp file");
-			exit(1);
+			error("error writing temp file");
 		}
 	} else {
 		if (!iact)
@@ -614,8 +609,7 @@
 		trackId = track + 600;
 		volume = track_flags * 2 - 600;
 	} else {
-		printf("handleDigIACT() Bad track_flags: %d\n", track_flags);
-		exit(1);
+		error("handleDigIACT() Bad track_flags: %d", track_flags);
 	}
 
 	handleAudioTrack(index, trackId, frame, nbframes, input, outputDir, inputFilename, size, volume, pan, true);
@@ -685,14 +679,12 @@
 
 	FILE *input = fopen(inpath.getFullPath(), "rb");
 	if (!input) {
-		printf("Cannot open file: %s\n", inpath.getFullPath());
-		exit(-1);
+		error("Cannot open file: %s", inpath.getFullPath());
 	}
 
 	FILE *output = fopen(outpath.getFullPath(), "wb");
 	if (!output) {
-		printf("Cannot open file: %s\n", outpath.getFullPath());
-		exit(-1);
+		error("Cannot open file: %s", outpath.getFullPath());
 	}
 
 	Filename flupath(inpath);
@@ -707,8 +699,7 @@
 		flupath.setExtension(".flu");
 		flu_out = fopen(flupath.getFullPath(), "wb");
 		if (!flu_out) {
-			printf("Cannot open ancillary file: %s\n", flupath.getFullPath());
-			exit(-1);
+			error("Cannot open ancillary file: %s", flupath.getFullPath());
 		}
 	}
 

Modified: tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_sou.cpp	2009-06-15 20:52:09 UTC (rev 41557)
+++ tools/branches/gsoc2009-gui/compress_scumm_sou.cpp	2009-06-15 21:12:51 UTC (rev 41558)
@@ -189,26 +189,22 @@
 
 	input = fopen(inpath.getFullPath(), "rb");
 	if (!input) {
-		printf("Cannot open file: %s\n", inpath.getFullPath());
-		exit(-1);
+		error("Cannot open file: %s", inpath.getFullPath());
 	}
 
 	output_idx = fopen(TEMP_IDX, "wb");
 	if (!output_idx) {
-		printf("Can't open file " TEMP_IDX " for write!\n" );
-		exit(-1);
+		error("Cannot open file " TEMP_IDX " for write" );
 	}
 	output_snd = fopen(TEMP_DAT, "wb");
 	if (!output_snd) {
-		printf("Can't open file " TEMP_DAT " for write!\n");
-		exit(-1);
+		error("Cannot open file " TEMP_DAT " for write");
 	}
 
 	/* Get the 'SOU ....' header */
 	fread(buf, 1, 8, input);
 	if (strncmp(buf, f_hdr, 8)) {
-		printf("Bad SOU\n");
-		exit(-1);
+		error("Bad SOU");
 	}
 
 	while (1)

Modified: tools/branches/gsoc2009-gui/compress_sword2.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword2.cpp	2009-06-15 20:52:09 UTC (rev 41557)
+++ tools/branches/gsoc2009-gui/compress_sword2.cpp	2009-06-15 21:12:51 UTC (rev 41558)
@@ -37,8 +37,7 @@
 
 	f2 = fopen(filename, "rb");
 	if (!f2) {
-		printf("Can't open file %s for reading!\n", filename);
-		exit(-1);
+		error("Cannot open file %s for reading", filename);
 	}
 
 	orig_length = length = fileSize(f2);
@@ -110,28 +109,24 @@
 
 	input = fopen(inpath.getFullPath(), "rb");
 	if (!input) {
-		printf("Cannot open file: %s\n", inpath.getFullPath());
-		return EXIT_FAILURE;
+		error("Cannot open file: %s", inpath.getFullPath());
 	}
 
 	indexSize = readUint32LE(input);
 	totalSize = 12 * (indexSize + 1);
 
 	if (readUint32BE(input) != 0xfff0fff0) {
-		printf("This doesn't look like a cluster file\n");
-		return EXIT_FAILURE;
+		error("This doesn't look like a cluster file");
 	}
 
 	output_idx = fopen(TEMP_IDX, "wb");
 	if (!output_idx) {
-		printf("Can't open file " TEMP_IDX " for writing!\n");
-		return EXIT_FAILURE;
+		error("Cannot open file " TEMP_IDX " for writing");
 	}
 
 	output_snd = fopen(TEMP_DAT, "wb");
 	if (!output_snd) {
-		printf("Can't open file " TEMP_DAT " for writing!\n");
-		return EXIT_FAILURE;
+		error("Cannot open file " TEMP_DAT " for writing");
 	}
 
 	writeUint32LE(output_idx, indexSize);
@@ -152,8 +147,7 @@
 
 			f = fopen(TEMP_WAV, "wb");
 			if (!f) {
-				printf("Can't open file %s for writing!\n", TEMP_WAV);
-				return EXIT_FAILURE;
+				error("Cannot open file %s for writing", TEMP_WAV);
 			}
 
 			/*
@@ -228,8 +222,7 @@
 
 	output = fopen(outpath.getFullPath(), "wb");
 	if (!output) {
-		printf("Can't open file %s for writing!\n", outpath.getFullPath());
-		return EXIT_FAILURE;
+		error("Cannot open file %s for writing", outpath.getFullPath());
 	}
 
 	append_to_file(output, TEMP_IDX);

Modified: tools/branches/gsoc2009-gui/compress_tucker.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tucker.cpp	2009-06-15 20:52:09 UTC (rev 41557)
+++ tools/branches/gsoc2009-gui/compress_tucker.cpp	2009-06-15 21:12:51 UTC (rev 41558)
@@ -415,7 +415,7 @@
 			sprintf(filepath, "%s/audio/%s", inputDir, audio_wav_fileslist[i]);
 			input = fopen(filepath, "rb");
 			if (!input) {
-				error("Can't open file '%s'", filepath);
+				error("Cannot open file '%s'", filepath);
 			}
 			temp_table[i].size = compress_file_wav(input, output);
 			fclose(input);

Modified: tools/branches/gsoc2009-gui/encode_dxa.cpp
===================================================================
--- tools/branches/gsoc2009-gui/encode_dxa.cpp	2009-06-15 20:52:09 UTC (rev 41557)
+++ tools/branches/gsoc2009-gui/encode_dxa.cpp	2009-06-15 21:12:51 UTC (rev 41558)
@@ -554,8 +554,7 @@
 
 	FILE *fp = fopen(filename, "rb");
 	if (!fp) {
-		printf("read_png_file: Can't open file: %s\n", filename);
-		exit(-1);
+		error("read_png_file: Cannot open file: %s", filename);
 	}
 	fread(header, 1, 8, fp);
 	if (png_sig_cmp(header, 0, 8))
@@ -628,8 +627,7 @@
 
 	FILE *smk = fopen(filename->getFullPath(), "rb");
 	if (!smk) {
-		printf("readVideoInfo: Can't open file: %s\n", filename->getFullPath());
-		exit(-1);
+		error("readVideoInfo: Cannot open file: %s", filename->getFullPath());
 	}
 
 	scaleMode = S_NONE;

Modified: tools/branches/gsoc2009-gui/kyra_pak.cpp
===================================================================
--- tools/branches/gsoc2009-gui/kyra_pak.cpp	2009-06-15 20:52:09 UTC (rev 41557)
+++ tools/branches/gsoc2009-gui/kyra_pak.cpp	2009-06-15 21:12:51 UTC (rev 41558)
@@ -250,9 +250,9 @@
 
 bool PAKFile::linkFiles(const char *name, const char *linkTo) {
 	if (!_fileList)
-		error("Can't find file '%s' in file list", linkTo);
+		error("Cannot find file '%s' in file list", linkTo);
 	if (!_fileList->findEntry(linkTo))
-		error("Can't find file '%s' in file list", linkTo);
+		error("Cannot find file '%s' in file list", linkTo);
 	if ((_fileList && _fileList->findEntry(name)) || (_links && _links->findSrcEntry(name)))
 		error("entry '%s' already exists");
 

Modified: tools/branches/gsoc2009-gui/utils/wave.cpp
===================================================================
--- tools/branches/gsoc2009-gui/utils/wave.cpp	2009-06-15 20:52:09 UTC (rev 41557)
+++ tools/branches/gsoc2009-gui/utils/wave.cpp	2009-06-15 21:12:51 UTC (rev 41558)
@@ -160,7 +160,7 @@
 	do {
 		stream.seek(offset, SEEK_CUR);
 		if (stream.pos() >= initialPos + wavLength + 8) {
-			warning("getWavInfo: Can't find 'data' chunk");
+			warning("getWavInfo: Cannot find 'data' chunk");
 			return false;
 		}
 		stream.read(buf, 4);


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