[Scummvm-cvs-logs] SF.net SVN: scummvm:[45338] tools/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Oct 22 21:27:09 CEST 2009


Revision: 45338
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45338&view=rev
Author:   fingolfin
Date:     2009-10-22 19:27:09 +0000 (Thu, 22 Oct 2009)

Log Message:
-----------
Formatting cleanup; use error() instead of exit(-1)

Modified Paths:
--------------
    tools/trunk/compress.cpp
    tools/trunk/compress_tinsel.cpp

Modified: tools/trunk/compress.cpp
===================================================================
--- tools/trunk/compress.cpp	2009-10-22 15:12:54 UTC (rev 45337)
+++ tools/trunk/compress.cpp	2009-10-22 19:27:09 UTC (rev 45338)
@@ -400,7 +400,8 @@
 					}
 				}
 			} else {
-				sprintf(outputString + strlen(outputString), "\n");
+				if (!oggparms.silent)
+					sprintf(outputString + strlen(outputString), "\n");
 			}
 		}
 
@@ -445,17 +446,17 @@
 							buffer[j][i] = ((int)(rawDataUnsigned[i * numChannels + j]) - 128) / 128.0f;
 						}
 					}
-				} else if(rawAudioType.bitsPerSample == 16) {
-					if(rawAudioType.isLittleEndian) {
-						for(i = 0; i < numSamples; i++) {
-							for(j = 0; j < numChannels; j++) {
+				} else if (rawAudioType.bitsPerSample == 16) {
+					if (rawAudioType.isLittleEndian) {
+						for (i = 0; i < numSamples; i++) {
+							for (j = 0; j < numChannels; j++) {
 								buffer[j][i] = ((rawData[(i * 2 * numChannels) + (2 * j) + 1] << 8) | (rawData[(i * 2 * numChannels) + (2 * j)] & 0xff)) / 32768.0f;
 							}
 						}
 					}
 					else {
-						for(i = 0; i < numSamples; i++) {
-							for(j = 0; j < numChannels; j++) {
+						for (i = 0; i < numSamples; i++) {
+							for (j = 0; j < numChannels; j++) {
 								buffer[j][i] = ((rawData[(i * 2 * numChannels) + (2 * j)] << 8) | (rawData[(i * 2 * numChannels) + (2 * j) + 1] & 0xff)) / 32768.0f;
 							}
 						}
@@ -475,14 +476,14 @@
 					while (!eos) {
 						int result = ogg_stream_pageout(&os, &og);
 
-						if(result == 0) {
+						if (result == 0) {
 							break;
 						}
 
 						totalBytes += fwrite(og.header, 1, og.header_len, outputOgg);
 						totalBytes += fwrite(og.body, 1, og.body_len, outputOgg);
 
-						if(ogg_page_eos(&og)) {
+						if (ogg_page_eos(&og)) {
 							eos = 1;
 						}
 					}
@@ -725,11 +726,11 @@
 		} else if (strcmp(argv[i], "-V") == 0) {
 			encparms.vbrqual = atoi(argv[i + 1]);
 
-			if(encparms.vbrqual < 0) {
+			if (encparms.vbrqual < 0) {
 				encparms.vbrqual = 0;
 			}
 
-			if(encparms.vbrqual > 9) {
+			if (encparms.vbrqual > 9) {
 				encparms.vbrqual = 9;
 			}
 

Modified: tools/trunk/compress_tinsel.cpp
===================================================================
--- tools/trunk/compress_tinsel.cpp	2009-10-22 15:12:54 UTC (rev 45337)
+++ tools/trunk/compress_tinsel.cpp	2009-10-22 19:27:09 UTC (rev 45338)
@@ -54,7 +54,7 @@
 	uint32 copyLeft = 0;
 	uint32 doneRead = 0;
 	char buffer[2048];
-    FILE *curFileHandle;
+	FILE *curFileHandle;
 
 	printf("Assuming DW1 sample being 8-bit raw...\n");
 
@@ -78,7 +78,7 @@
 	curFileHandle = fopen(TEMP_ENC, "rb");
 	fseek(curFileHandle, 0, SEEK_END);
 	copyLeft = ftell(curFileHandle);
-    fseek(curFileHandle, 0, SEEK_SET);
+	fseek(curFileHandle, 0, SEEK_SET);
 	// Write size of compressed data
 	writeUint32LE(output_smp, copyLeft);
 	// Write actual data
@@ -122,7 +122,7 @@
 	uint32 copyLeft = 0;
 	uint32 doneRead = 0;
 	char buffer[2048];
-    FILE *curFileHandle;
+	FILE *curFileHandle;
 
 	printf("Assuming DW2 sample using ADPCM 6-bit, decoding to 16-bit raw...\n");
 
@@ -148,7 +148,7 @@
 	blockPos = blockAlign; // To make sure first header is read
 
 	inPos = inBuffer; outPos = outBuffer;
-    decodeLeft = sampleSize;
+	decodeLeft = sampleSize;
 	while (decodeLeft > 0) {
 		if (blockPos == blockAlign) {
 			// read Tinsel header
@@ -198,7 +198,7 @@
 		sample += (d0 * k0) + (d1 * k1);
 		d1 = d0;
 		d0 = sample;
-        *outPos = (int16) CLIP<double>(sample, -32768.0, 32767.0); outPos++;
+		*outPos = (int16) CLIP<double>(sample, -32768.0, 32767.0); outPos++;
 		decodedCount++;
 		chunkPos = (chunkPos + 1) % 4;
 	}
@@ -218,7 +218,7 @@
 	curFileHandle = fopen(TEMP_ENC, "rb");
 	fseek(curFileHandle, 0, SEEK_END);
 	copyLeft = ftell(curFileHandle);
-    fseek(curFileHandle, 0, SEEK_SET);
+	fseek(curFileHandle, 0, SEEK_SET);
 	// Write size of compressed data
 	writeUint32LE(output_smp, copyLeft);
 	// Write actual data
@@ -258,12 +258,12 @@
 	printf(" --silent     the output of oggenc is hidden (default:disabled)\n");
 
 	printf("\nFlac mode params:\n");
- 	printf(" --fast       FLAC uses compression level 0\n");
- 	printf(" --best       FLAC uses compression level 8\n");
- 	printf(" -<value>     specifies the value (0 - 8) of compression (8=best)(default:%d)\n", flacCompressDef);
- 	printf(" -b <value>   specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef);
+	printf(" --fast       FLAC uses compression level 0\n");
+	printf(" --best       FLAC uses compression level 8\n");
+	printf(" -<value>     specifies the value (0 - 8) of compression (8=best)(default:%d)\n", flacCompressDef);
+	printf(" -b <value>   specifies a blocksize of <value> samples (default:%d)\n", flacBlocksizeDef);
 	printf(" --verify     files are encoded and then decoded to check accuracy\n");
- 	printf(" --silent     the output of FLAC is hidden (default:disabled)\n");
+	printf(" --silent     the output of FLAC is hidden (default:disabled)\n");
 
 	printf("\n --help     this help message\n");
 
@@ -323,32 +323,28 @@
 
 	input_idx = fopen(INPUT_IDX, "rb");
 	if (!input_idx) {
-		printf("Cannot open file: %s\n", INPUT_IDX);
-		exit(-1);
+		error("Cannot open file: %s", INPUT_IDX);
 	}
 
 	input_smp = fopen(INPUT_SMP, "rb");
 	if (!input_smp) {
-		printf("Cannot open file: %s\n", INPUT_SMP);
-		exit(-1);
+		error("Cannot open file: %s", INPUT_SMP);
 	}
 
 	unlink(TEMP_IDX);
 	output_idx = fopen(TEMP_IDX, "wb");
 	if (!output_idx) {
-		printf("Can't open file " TEMP_IDX " for write!\n" );
-		exit(-1);
+		error("Can't open file " TEMP_IDX " for write" );
 	}
 	unlink(TEMP_SMP);
 	output_smp = fopen(TEMP_SMP, "wb");
 	if (!output_smp) {
-		printf("Can't open file " TEMP_SMP " for write!\n");
-		exit(-1);
+		error("Can't open file " TEMP_SMP " for write");
 	}
 
 	fseek(input_idx, 0, SEEK_END);
 	indexCount = ftell(input_idx) / sizeof(uint32);
-    fseek(input_idx, 0, SEEK_SET);
+	fseek(input_idx, 0, SEEK_SET);
 
 	loopCount = indexCount;
 	while (loopCount>0) {


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