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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Jul 9 17:36:53 CEST 2009


Revision: 42296
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42296&view=rev
Author:   fingolfin
Date:     2009-07-09 15:36:53 +0000 (Thu, 09 Jul 2009)

Log Message:
-----------
Converted ftell/fread/fwrite/rewind to the corresponding File methods

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/compress_agos.cpp
    tools/branches/gsoc2009-gui/compress_gob.cpp
    tools/branches/gsoc2009-gui/compress_kyra.cpp
    tools/branches/gsoc2009-gui/compress_queen.cpp
    tools/branches/gsoc2009-gui/compress_saga.cpp
    tools/branches/gsoc2009-gui/compress_tinsel.cpp
    tools/branches/gsoc2009-gui/compress_touche.cpp
    tools/branches/gsoc2009-gui/compress_tucker.cpp
    tools/branches/gsoc2009-gui/extract_cine.cpp
    tools/branches/gsoc2009-gui/extract_gob_stk.cpp
    tools/branches/gsoc2009-gui/extract_loom_tg16.cpp
    tools/branches/gsoc2009-gui/extract_mm_apple.cpp
    tools/branches/gsoc2009-gui/extract_mm_c64.cpp
    tools/branches/gsoc2009-gui/extract_mm_nes.cpp
    tools/branches/gsoc2009-gui/extract_parallaction.cpp
    tools/branches/gsoc2009-gui/extract_t7g_mac.cpp
    tools/branches/gsoc2009-gui/extract_zak_c64.cpp

Modified: tools/branches/gsoc2009-gui/compress_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_agos.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/compress_agos.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -40,13 +40,13 @@
 	_output_idx.open(_outputPath, "wb");
 
 	_input.open(TEMP_IDX, "rb");
-	while ((size = fread(fbuf, 1, 2048, _input)) > 0) {
-		fwrite(fbuf, 1, size, _output_idx);
+	while ((size = _input.read(fbuf, 1, 2048)) > 0) {
+		_output_idx.write(fbuf, 1, size);
 	}
 
 	_input.open(TEMP_DAT, "rb");
-	while ((size = fread(fbuf, 1, 2048, _input)) > 0) {
-		fwrite(fbuf, 1, size, _output_idx);
+	while ((size = _input.read(fbuf, 1, 2048)) > 0) {
+		_output_idx.write(fbuf, 1, size);
 	}
 
 	_input.close();
@@ -67,7 +67,7 @@
 	char buf[8];
 
 	for (i = 0;; i++) {
-		fread(buf, 1, 8, _input);
+		_input.read(buf, 1, 8);
 		if (!memcmp(buf, "Creative", 8) || !memcmp(buf, "RIFF", 4)) {
 			return i;
 		}
@@ -99,7 +99,7 @@
 
 	fseek(_input, offset, SEEK_SET);
 
-	fread(buf, 1, 8, _input);
+	_input.read(buf, 1, 8);
 	if (!memcmp(buf, "Creative", 8)) {
 		print("VOC found (pos = %d) :\n", offset);
 		fseek(_input, 18, SEEK_CUR);
@@ -115,9 +115,9 @@
 	sprintf(outname, "%s", tempEncoded);
 	File f(outname, "rb");
 	tot_size = 0;
-	while ((size = fread(fbuf, 1, 2048, f)) > 0) {
+	while ((size = f.read(fbuf, 1, 2048)) > 0) {
 		tot_size += size;
-		fwrite(fbuf, 1, size, _output_snd);
+		_output_snd.write(fbuf, 1, size);
 	}
 
 	return(tot_size);

Modified: tools/branches/gsoc2009-gui/compress_gob.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_gob.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/compress_gob.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -137,7 +137,7 @@
 		src1.open(curChunk->name, "rb");
 		src1.seek(0, SEEK_END);
 // if file is too small, force 'Store' method
-		if ((curChunk->realSize = ftell(src1)) < 8) 
+		if ((curChunk->realSize = src1.pos()) < 8) 
 			curChunk->packed = 0;
 
 		parseChunk = chunks;
@@ -205,7 +205,7 @@
 		if (curChunk->packed == 2)
 			print("Identical file %12s\t(compressed size %d bytes)\n", curChunk->name, curChunk->replChunk->size);
 
-		curChunk->offset = ftell(stk);
+		curChunk->offset = stk.pos();
 		if (curChunk->packed == 1) {
 			print("Compressing %12s\t", curChunk->name);
 			curChunk->size = writeBodyPackFile(stk, src);
@@ -215,7 +215,7 @@
 // => Store instead
 				curChunk->packed = 0;
 				stk.seek(curChunk->offset, SEEK_SET);
-				rewind(src);
+				src.rewind();
 				print("!!!");
 			}
 			print("\n");
@@ -255,7 +255,7 @@
 	char buffer[1024];
 	Chunk *curChunk = chunks;
 
-	rewind(stk);
+	stk.rewind();
 
 	buffer[0] = chunkCount & 0xFF;
 	buffer[1] = chunkCount >> 8;
@@ -434,7 +434,7 @@
 	char buf2[4096];
 	File src2;
 
-	rewind(src1);
+	src1.rewind();
 	src2.open(compChunk->name, "rb");
 	
 	do {

Modified: tools/branches/gsoc2009-gui/compress_kyra.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_kyra.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/compress_kyra.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -134,13 +134,13 @@
 	if (size == outSize) {
 		int readSize = size;
 		while (readSize > 0) {
-			int read = fread(outputBuffer, 1, readSize, in);
+			int read = in.read(outputBuffer, 1, readSize);
 			if (read <= 0)
 				error("[1] Couldn't read data");
 			readSize -= read;
 		}
 		while (size > 0)  {
-			int written = fwrite(outputBuffer, 1, size, out);
+			int written = out.write(outputBuffer, 1, size);
 			size -= written;
 		}
 		free(outputBuffer);
@@ -152,7 +152,7 @@
 
 	int readSize = size;
 	while (readSize > 0) {
-		int read = fread(inputBuffer, 1, readSize, in);
+		int read = in.read(inputBuffer, 1, readSize);
 		if (read <= 0)
 			error("[2] Couldn't read data");
 		readSize -= read;
@@ -232,7 +232,7 @@
 	}
 
 	while (outSize > 0)  {
-		int written = fwrite(outputBuffer, 1, outSize, out);
+		int written = out.write(outputBuffer, 1, outSize);
 		if (written <= 0)
 			error("[2] Couldn't write data");
 		outSize -= written;
@@ -321,7 +321,7 @@
 				red[i].resFilename = resFilename;
 				red[i].resOffset = resOffset;
 
-				uint32 pos = (uint32)ftell(input);
+				uint32 pos = (uint32)input.pos();
 				fseek(input, resOffset + 4, SEEK_SET);
 
 				compressAUDFile(input, outname);

Modified: tools/branches/gsoc2009-gui/compress_queen.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_queen.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/compress_queen.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -115,7 +115,7 @@
 	uint32 numRead;
 
 	while (amount > 0) {
-		numRead = fread(fBuf, 1, amount > 2048 ? 2048 : amount, in);
+		numRead = in.read(fBuf, 1, amount > 2048 ? 2048 : amount);
 		if (numRead <= 0) {
 			break;
 		}
@@ -214,7 +214,7 @@
 	outputTbl.writeU16BE(_versionExtra.entries);
 
 	for (i = 0; i < _versionExtra.entries; i++) {
-		prevOffset = ftell(outputData);
+		prevOffset = outputData.pos();
 
 		/* Read entry */
 		inputTbl.read(_entry.filename, 1, 12);

Modified: tools/branches/gsoc2009-gui/compress_saga.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_saga.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/compress_saga.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -169,10 +169,10 @@
 	if (tempf == NULL)
 		error("Unable to open %s", fromFileName);
 
-	while ((size = (uint32)fread(fbuf, 1, sizeof(fbuf), tempf)) > 0) {
-		fwrite(fbuf, 1, size, outputFile);
+	while ((size = (uint32)tempf.read(fbuf, 1, sizeof(fbuf))) > 0) {
+		outputFile.write(fbuf, 1, size);
 	}
-	size = ftell(tempf);
+	size = tempf.pos();
 	return size;
 }
 
@@ -184,11 +184,11 @@
 	if (tempf == NULL)
 		error("Unable to open %s", toFileName);
 	while (inputSize > 0) {
-		size = (uint32)fread(fbuf, 1, inputSize > sizeof(fbuf) ? sizeof(fbuf) : inputSize, inputFile);
+		size = (uint32)inputFile.read(fbuf, 1, inputSize > sizeof(fbuf) ? sizeof(fbuf) : inputSize);
 		if (size == 0) {
 			error("Unable to copy file");
 		}
-		fwrite(fbuf, 1, size, tempf);
+		tempf.write(fbuf, 1, size);
 		inputSize -= size;
 	}
 }
@@ -197,7 +197,7 @@
 	File tempf(toFileName, "wb");
 	if (tempf == NULL)
 		error("Unable to open %s", toFileName);
-	fwrite(data, 1, inputSize, tempf);
+	tempf.write(data, 1, inputSize);
 }
 
 void CompressSaga::writeHeader(File &outputFile) {
@@ -372,7 +372,7 @@
 
 	for (i = 0; i < resTableCount; i++) {
 		inputFile.seek(inputTable[i].offset, SEEK_SET);
-		outputTable[i].offset = ftell(outputFile);
+		outputTable[i].offset = outputFile.pos();
 
 		if (inputTable[i].size >= 8) {
 			outputTable[i].size = encodeEntry(inputFile, inputTable[i].size, outputFile);
@@ -382,7 +382,7 @@
 	}
 	inputFile.close();
 
-	resTableOffset = ftell(outputFile);
+	resTableOffset = outputFile.pos();
 	for (i = 0; i < resTableCount; i++) {
 		outputFile.writeU32LE(outputTable[i].offset);
 		outputFile.writeU32LE(outputTable[i].size);

Modified: tools/branches/gsoc2009-gui/compress_tinsel.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tinsel.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/compress_tinsel.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -64,7 +64,7 @@
 	curFileHandle.open(TEMP_RAW, "wb");
 	copyLeft = sampleSize;
 	while (copyLeft > 0) {
-		doneRead = fread(buffer, 1, copyLeft > sizeof(buffer) ? sizeof(buffer) : copyLeft, _input_smp);
+		doneRead = _input_smp.read(buffer, 1, copyLeft > sizeof(buffer) ? sizeof(buffer) : copyLeft);
 		if (doneRead <= 0)
 			break;
 		copyLeft -= (int)doneRead;
@@ -79,13 +79,13 @@
 	// Append compressed data to output_smp
 	curFileHandle.open(TEMP_ENC, "rb");
 	fseek(curFileHandle, 0, SEEK_END);
-	copyLeft = ftell(curFileHandle);
+	copyLeft = curFileHandle.pos();
 	fseek(curFileHandle, 0, SEEK_SET);
 	// Write size of compressed data
 	_output_smp.writeU32LE(copyLeft);
 	// Write actual data
 	while (copyLeft > 0) {
-		doneRead = fread(buffer, 1, copyLeft > sizeof(buffer) ? sizeof(buffer) : copyLeft, curFileHandle);
+		doneRead = curFileHandle.read(buffer, 1, copyLeft > sizeof(buffer) ? sizeof(buffer) : copyLeft);
 		if (doneRead <= 0)
 			break;
 		copyLeft -= (int)doneRead;
@@ -226,13 +226,13 @@
 	// Append compressed data to output_smp
 	curFileHandle.open(TEMP_ENC, "rb");
 	curFileHandle.seek(0, SEEK_END);
-	copyLeft = ftell(curFileHandle);
+	copyLeft = curFileHandle.pos();
 	curFileHandle.seek(0, SEEK_SET);
 	// Write size of compressed data
 	_output_smp.writeU32LE(copyLeft);
 	// Write actual data
 	while (copyLeft > 0) {
-		doneRead = fread(buffer, 1, copyLeft > sizeof(buffer) ? sizeof(buffer) : copyLeft, curFileHandle);
+		doneRead = curFileHandle.read(buffer, 1, copyLeft > sizeof(buffer) ? sizeof(buffer) : copyLeft);
 		if (doneRead <= 0)
 			break;
 		copyLeft -= (int)doneRead;
@@ -276,7 +276,7 @@
 	_output_smp.open(TEMP_SMP, "wb");
 
 	_input_idx.seek(0, SEEK_END);
-	indexCount = ftell(_input_idx) / sizeof(uint32);
+	indexCount = _input_idx.pos() / sizeof(uint32);
 	_input_idx.seek(0, SEEK_SET);
 
 	loopCount = indexCount;
@@ -294,7 +294,7 @@
 			sampleSize = _input_smp.readU32LE();
 
 			// Write offset of new data to new index file
-			_output_idx.writeU32LE(ftell(_output_smp));
+			_output_idx.writeU32LE(_output_smp.pos());
 
 			if (sampleSize & 0x80000000) {
 				// multiple samples in ADPCM format

Modified: tools/branches/gsoc2009-gui/compress_touche.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_touche.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/compress_touche.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -77,8 +77,8 @@
 
 			size_table[i] = 0;
 
-			while ((size = fread(buf, 1, 2048, temp)) > 0) {
-				fwrite(buf, 1, size, output);
+			while ((size = temp.read(buf, 1, 2048)) > 0) {
+				output.write(buf, 1, size);
 				size_table[i] += size;
 			}
 

Modified: tools/branches/gsoc2009-gui/compress_tucker.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tucker.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/compress_tucker.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -50,8 +50,8 @@
 	int sz, compress_sz = 0;
 
 	File input_temp(tempEncoded, "rb");
-	while ((sz = fread(buf, 1, sizeof(buf), input_temp)) > 0) {
-		if ((sz = fwrite(buf, 1, sz, output)) > 0) {
+	while ((sz = input_temp.read(buf, 1, sizeof(buf))) > 0) {
+		if ((sz = output.write(buf, 1, sz)) > 0) {
 			compress_sz += sz;
 		}
 	}
@@ -61,7 +61,7 @@
 int CompressTucker::compress_file_wav(File &input, File &output) {
 	char buf[8];
 
-	if (fread(buf, 1, 8, input) == 8 && memcmp(buf, "RIFF", 4) == 0) {
+	if (input.read(buf, 1, 8) == 8 && memcmp(buf, "RIFF", 4) == 0) {
 		extractAndEncodeWAV(TEMP_WAV, input, _format);
 		return append_compress_file(output);
 	}
@@ -117,7 +117,7 @@
 	strcat(filepath, "/");
 	filename = filepath + strlen(filepath);
 
-	pos = ftell(output);
+	pos = output.pos();
 
 	/* write 0 offsets/sizes table */
 	for (i = 0; i < dir->count; ++i) {
@@ -301,7 +301,7 @@
 	uint32 current_offset;
 
 	count = ARRAYSIZE(audio_files_list);
-	pos = ftell(output);
+	pos = output.pos();
 
 	/* write 0 offsets/sizes table */
 	for (i = 0; i < count; ++i) {

Modified: tools/branches/gsoc2009-gui/extract_cine.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_cine.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/extract_cine.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -162,7 +162,7 @@
 	unsigned int entrySize = readUint16BE(fp); // How many bytes per entry?
 	assert(entrySize == 0x1e);
 	while (entryCount--) {
-		fread(fileName, 14, 1, fp);
+		fp.read(fileName, 14, 1);
 		fileName[14] = '\0';
 		sprintf(filePath, "%s/%s", outDir, fileName);
 		FILE *fpOut = fopen(filePath, "wb");
@@ -171,7 +171,7 @@
 		unsigned int packedSize = readUint32BE(fp);
 		unsigned int unpackedSize = readUint32BE(fp);
 		readUint32BE(fp);
-		unsigned int savedPos = ftell(fp);
+		unsigned int savedPos = fp.pos();
 
 		if (!fpOut) {
 			printf("ERROR: unable to open '%s' for writing\n", filePath);
@@ -185,7 +185,7 @@
 		uint8 *packedData = (uint8 *)calloc(packedSize, 1);
 		assert(data);
 		assert(packedData);
-		fread(packedData, packedSize, 1, fp);
+		fp.read(packedData, packedSize, 1);
 		bool status = true;
 		if (packedSize != unpackedSize) {
 			CineUnpacker cineUnpacker;
@@ -194,7 +194,7 @@
 			memcpy(data, packedData, packedSize);
 		}
 		free(packedData);
-		fwrite(data, unpackedSize, 1, fpOut);
+		fpOut.write(data, unpackedSize, 1);
 		fclose(fpOut);
 		free(data);
 
@@ -240,20 +240,20 @@
 	uint32 unpackedSize, packedSize;
 	{
 		char header[8];
-		fread(header, 8, 1, fp);
+		fp.read(header, 8, 1);
 		if (memcmp(header, "ABASECP", 7) == 0) {
 			unpackedSize = readUint32BE(fp);
 			packedSize = readUint32BE(fp);
 		} else {
 			fseek(fp, 0, SEEK_END);
-			unpackedSize = packedSize = ftell(fp); /* Get file size */
+			unpackedSize = packedSize = fp.pos(); /* Get file size */
 			fseek(fp, 0, SEEK_SET);
 		}
 	}
 	assert(unpackedSize >= packedSize);
 	uint8 *buf = (uint8 *)calloc(unpackedSize, 1);
 	assert(buf);
-	fread(buf, packedSize, 1, fp);
+	fp.read(buf, packedSize, 1);
 	fclose(fp);
 	if (packedSize != unpackedSize) {
 		CineUnpacker cineUnpacker;

Modified: tools/branches/gsoc2009-gui/extract_gob_stk.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_gob_stk.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/extract_gob_stk.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -82,7 +82,7 @@
 		readChunkListV2(stk, gobConf);
 	} else {
 		fprintf(gobConf, "%s\n", confSTK10);
-		rewind(stk);
+		stk.rewind();
 		readChunkList(stk, gobConf);
 	}
 
@@ -154,7 +154,7 @@
 	buffer[14] = '\0';
 	sprintf(debugStr, "File generated on %s by ", buffer);
 
-	if (fread(buffer, 1, 8, stk) < 8)
+	if (stk.read(buffer, 1, 8) < 8)
 		throw ToolException("Unexpected EOF");
 
 	buffer[8] = '\0';
@@ -196,12 +196,12 @@
 			throw ToolException("Unable to locate Misc Section");
 		filenamePos = readUint32LE(stk);
 
-		if (fread(buffer, 1, 36, stk) < 36)
+		if (stk.read(buffer, 1, 36) < 36)
 			throw ToolException("Unexpected EOF in Misc Section");
 		curChunk->size = readUint32LE(stk);
 		decompSize = readUint32LE(stk);
 
-		if (fread(buffer, 1, 5, stk) < 5)
+		if (stk.read(buffer, 1, 5) < 5)
 			throw ToolException("Unexpected EOF in Misc Section");
 
 		filePos = readUint32LE(stk);

Modified: tools/branches/gsoc2009-gui/extract_loom_tg16.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_loom_tg16.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/extract_loom_tg16.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -842,7 +842,7 @@
 			if (rtype != 0x01)
 				error("extract_resource(room) - resource tag is incorrect");
 
-			off = (uint16)ftell(output);
+			off = (uint16)output.pos();
 			rlen = 0;
 			write_clong(output, 0, &rlen);
 			write_cword(output, 'OR', &rlen); /* RO - Room */
@@ -970,7 +970,7 @@
 		output.writeU32LE((uint16)(rlen + 1));
 		output.writeU16LE('OC');	/* CO - Costume */
 		for (i = 5; i < rlen; i++)
-			output.writeByte(readByte(input));
+			output.writeByte(input.readByte());
 		break;
 	case RES_SCRIPT:
 		rlen = read_cword(input,&i);
@@ -984,7 +984,7 @@
 		output.writeU32LE((uint16)(rlen + 1));
 		output.writeU16LE('CS');	/* SC - Script */
 		for (i = 5; i < rlen; i++)
-			output.writeByte(readByte(input));
+			output.writeByte(input.readByte());
 		break;
 	case RES_UNKNOWN:
 #else
@@ -998,7 +998,7 @@
 			error("extract_resource - length mismatch while extracting resource (was %04X, expected %04X)", rlen, r_length(res));
 		output.writeUint16LE(rlen);
 		for (i = 2; i < rlen; i++)
-			output.writeByte(readByte(input));
+			output.writeByte(input.readByte());
 		break;
 #endif
 	default:
@@ -1216,10 +1216,10 @@
 	uint32 CRC = 0xFFFFFFFF;
 	uint32 i, len;
 	file.seek(0, SEEK_END);
-	len = ftell(file);
+	len = file.pos();
 	file.seek(0, SEEK_SET);
 	for (i = 0; i < len; i++)
-		CRC = (CRC >> 8) ^ CRCtable[(CRC ^ readByte(file)) & 0xFF];
+		CRC = (CRC >> 8) ^ CRCtable[(CRC ^ file.readByte()) & 0xFF];
 	return CRC ^ 0xFFFFFFFF;
 }
 
@@ -1282,19 +1282,19 @@
 			switch (entry->type) {
 			case RES_ROOM:
 				lfl_index.room_lfl[entry - res_rooms] = lfl->num;
-				lfl_index.room_addr[entry - res_rooms] = (uint16)ftell(output);
+				lfl_index.room_addr[entry - res_rooms] = (uint16)output.pos();
 				break;
 			case RES_COSTUME:
 				lfl_index.costume_lfl[entry - res_costumes] = lfl->num;
-				lfl_index.costume_addr[entry - res_costumes] = (uint16)ftell(output);
+				lfl_index.costume_addr[entry - res_costumes] = (uint16)output.pos();
 				break;
 			case RES_SCRIPT:
 				lfl_index.script_lfl[entry - res_scripts] = lfl->num;
-				lfl_index.script_addr[entry - res_scripts] = (uint16)ftell(output);
+				lfl_index.script_addr[entry - res_scripts] = (uint16)output.pos();
 				break;
 			case RES_SOUND:
 				lfl_index.sound_lfl[entry - res_sounds] = lfl->num;
-				lfl_index.sound_addr[entry - res_sounds] = (uint16)ftell(output);
+				lfl_index.sound_addr[entry - res_sounds] = (uint16)output.pos();
 				break;
 			default:
 				print("Unknown resource type %d detected in LFL index!", entry->type);

Modified: tools/branches/gsoc2009-gui/extract_mm_apple.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_apple.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/extract_mm_apple.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -146,7 +146,7 @@
 			for (len -= 2; len > 0; len--)
 				output.writeByte(input->readByte());
 		}
-		rewind(*input);
+		input->rewind();
 	}
 	print("All done!");
 }

Modified: tools/branches/gsoc2009-gui/extract_mm_c64.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_c64.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/extract_mm_c64.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -80,7 +80,7 @@
 	print("Creating 00.LFL...");
 
 	/* write signature */
-	writeUint16LE(output, signature);
+	output.writeU16LE(signature);
 
 	/* copy object flags */
 	for (i = 0; i < 256; i++)
@@ -142,7 +142,7 @@
 			}
 		}
 
-		rewind(*input);
+		input->rewind();
 	}
 
 	print("All done!");

Modified: tools/branches/gsoc2009-gui/extract_mm_nes.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_nes.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/extract_mm_nes.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -850,8 +850,8 @@
 				if ((cnt & 0x80) || (j == 0))
 					output.writeByte(input.readByte());
 		}
-		if (ftell(input) - res->offset != res->length)
-			error("extract_resource - length mismatch while extracting graphics resource (was %04X, should be %04X)", ftell(input) - res->offset, res->length);
+		if (input.pos() - res->offset != res->length)
+			error("extract_resource - length mismatch while extracting graphics resource (was %04X, should be %04X)", input.pos() - res->offset, res->length);
 		break;
 	case NES_ROOM:
 	case NES_SCRIPT:
@@ -903,8 +903,8 @@
 		} else {
 			error("extract_resource - unknown sound type %d/%d detected", val, cnt);
 		}
-		if (ftell(input) - res->offset != res->length)
-			error("extract_resource - length mismatch while extracting sound resource (was %04X, should be %04X)", ftell(input) - res->offset, res->length);
+		if (input.pos() - res->offset != res->length)
+			error("extract_resource - length mismatch while extracting sound resource (was %04X, should be %04X)", input.pos() - res->offset, res->length);
 		break;
 	case NES_COSTUME:
 	case NES_SPRPALS:
@@ -1136,7 +1136,7 @@
 			"You must input the PRG section only - see Maniac Mansion NES notes section of README.");
 	}
 
-	rewind(input);
+	input.rewind();
 
 	InitCRC();
 	CRC = CheckROM(input);
@@ -1193,55 +1193,55 @@
 			switch (entry->type->type) {
 			case NES_ROOM:
 				mm_lfl_index.room_lfl[entry->index] = lfl->num;
-				mm_lfl_index.room_addr[entry->index] = (uint16)ftell(output);
+				mm_lfl_index.room_addr[entry->index] = (uint16)output.pos();
 				break;
 			case NES_COSTUME:
 				mm_lfl_index.costume_lfl[entry->index] = lfl->num;
-				mm_lfl_index.costume_addr[entry->index] = (uint16)ftell(output);
+				mm_lfl_index.costume_addr[entry->index] = (uint16)output.pos();
 				break;
 			case NES_SPRDESC:
 				mm_lfl_index.costume_lfl[entry->index + 25] = lfl->num;
-				mm_lfl_index.costume_addr[entry->index + 25] = (uint16)ftell(output);
+				mm_lfl_index.costume_addr[entry->index + 25] = (uint16)output.pos();
 				break;
 			case NES_SPRLENS:
 				mm_lfl_index.costume_lfl[entry->index + 27] = lfl->num;
-				mm_lfl_index.costume_addr[entry->index + 27] = (uint16)ftell(output);
+				mm_lfl_index.costume_addr[entry->index + 27] = (uint16)output.pos();
 				break;
 			case NES_SPROFFS:
 				mm_lfl_index.costume_lfl[entry->index + 29] = lfl->num;
-				mm_lfl_index.costume_addr[entry->index + 29] = (uint16)ftell(output);
+				mm_lfl_index.costume_addr[entry->index + 29] = (uint16)output.pos();
 				break;
 			case NES_SPRDATA:
 				mm_lfl_index.costume_lfl[entry->index + 31] = lfl->num;
-				mm_lfl_index.costume_addr[entry->index + 31] = (uint16)ftell(output);
+				mm_lfl_index.costume_addr[entry->index + 31] = (uint16)output.pos();
 				break;
 			case NES_COSTUMEGFX:
 				mm_lfl_index.costume_lfl[entry->index + 33] = lfl->num;
-				mm_lfl_index.costume_addr[entry->index + 33] = (uint16)ftell(output);
+				mm_lfl_index.costume_addr[entry->index + 33] = (uint16)output.pos();
 				break;
 			case NES_SPRPALS:
 				mm_lfl_index.costume_lfl[entry->index + 35] = lfl->num;
-				mm_lfl_index.costume_addr[entry->index + 35] = (uint16)ftell(output);
+				mm_lfl_index.costume_addr[entry->index + 35] = (uint16)output.pos();
 				break;
 			case NES_ROOMGFX:
 				mm_lfl_index.costume_lfl[entry->index + 37] = lfl->num;
-				mm_lfl_index.costume_addr[entry->index + 37] = (uint16)ftell(output);
+				mm_lfl_index.costume_addr[entry->index + 37] = (uint16)output.pos();
 				break;
 			case NES_SCRIPT:
 				mm_lfl_index.script_lfl[entry->index] = lfl->num;
-				mm_lfl_index.script_addr[entry->index] = (uint16)ftell(output);
+				mm_lfl_index.script_addr[entry->index] = (uint16)output.pos();
 				break;
 			case NES_SOUND:
 				mm_lfl_index.sound_lfl[entry->index] = lfl->num;
-				mm_lfl_index.sound_addr[entry->index] = (uint16)ftell(output);
+				mm_lfl_index.sound_addr[entry->index] = (uint16)output.pos();
 				break;
 			case NES_CHARSET:
 				mm_lfl_index.costume_lfl[77] = lfl->num;
-				mm_lfl_index.costume_addr[77] = (uint16)ftell(output);
+				mm_lfl_index.costume_addr[77] = (uint16)output.pos();
 				break;
 			case NES_PREPLIST:
 				mm_lfl_index.costume_lfl[78] = lfl->num;
-				mm_lfl_index.costume_addr[78] = (uint16)ftell(output);
+				mm_lfl_index.costume_addr[78] = (uint16)output.pos();
 				break;
 			default:
 				error("Unindexed entry found");

Modified: tools/branches/gsoc2009-gui/extract_parallaction.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_parallaction.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/extract_parallaction.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -159,7 +159,7 @@
 		_offsets[0] = 0x4000;
 	}
 
-	ftell(_file);
+	_file.pos();
 
 	for (i = 1; i < _numSlots; i++)
 		_offsets[i] = _offsets[i-1] + _sizes[i-1];

Modified: tools/branches/gsoc2009-gui/extract_t7g_mac.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_t7g_mac.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/extract_t7g_mac.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -31,7 +31,7 @@
 char *readString(FILE *ifp) {
 	byte len = readByte(ifp);
 	char *name = new char[len + 1];
-	fread(name, len, 1, ifp);
+	ifp.read(name, len, 1);
 	name[len] = 0;
 	return name;
 }
@@ -50,8 +50,8 @@
 
 	// Dump the resource to the output file
 	FILE *ofp = fopen(name, "wb");
-	fread(buf, 1, fileSize, ifp);
-	fwrite(buf, 1, fileSize, ofp);
+	ifp.read(buf, 1, fileSize);
+	ofp.write(buf, 1, fileSize);
 	fclose(ofp);
 
 	// Free the resource memory
@@ -128,7 +128,7 @@
 		}
 
 		// Read the resource type name
-		fread(resType, 4, 1, ifp);
+		ifp.read(resType, 4, 1);
 		switch (READ_BE_UINT32(resType)) {
 			case MKID_BE('csnd'):
 			case MKID_BE('snd '):

Modified: tools/branches/gsoc2009-gui/extract_zak_c64.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_zak_c64.cpp	2009-07-09 15:35:50 UTC (rev 42295)
+++ tools/branches/gsoc2009-gui/extract_zak_c64.cpp	2009-07-09 15:36:53 UTC (rev 42296)
@@ -146,7 +146,7 @@
 			}
 		}
 
-		rewind(*input);
+		input->rewind();
 	}
 
 	print("All done!");


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