[Scummvm-cvs-logs] SF.net SVN: scummvm:[40612] tools/trunk/extract_gob_stk.cpp
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Fri May 15 19:17:12 CEST 2009
Revision: 40612
http://scummvm.svn.sourceforge.net/scummvm/?rev=40612&view=rev
Author: drmccoy
Date: 2009-05-15 17:17:12 +0000 (Fri, 15 May 2009)
Log Message:
-----------
- Create the config file in the current directory, not in the directoy of the input STK
- strcpy/strcat src strings don't need extra \0
- Style consistency changes
Modified Paths:
--------------
tools/trunk/extract_gob_stk.cpp
Modified: tools/trunk/extract_gob_stk.cpp
===================================================================
--- tools/trunk/extract_gob_stk.cpp 2009-05-15 14:23:00 UTC (rev 40611)
+++ tools/trunk/extract_gob_stk.cpp 2009-05-15 17:17:12 UTC (rev 40612)
@@ -60,17 +60,17 @@
if (!(stk = fopen(argv[1], "rb")))
error("Couldn't open file \"%s\"", argv[1]);
- outFilename = new char[strlen(argv[1])+5];
- strcpy(outFilename, argv[1]);
+ outFilename = new char[strlen(argv[1]) + 5];
+ getFilename(argv[1], outFilename);
+
tmpStr = strstr(outFilename, ".");
-
if (tmpStr != 0)
- strncpy(tmpStr, ".gob\0", 5);
+ strcpy(tmpStr, ".gob");
else
- strcat(outFilename, ".gob\0");
+ strcat(outFilename, ".gob");
if (!(gobConf = fopen(outFilename, "w")))
- error("Couldn't create conf file \"/s\"", outFilename);
+ error("Couldn't create config file \"%s\"", outFilename);
if (fread(signature, 1, 6, stk) < 6)
error("Unexpected EOF while reading signature in \"%s\"", argv[1]);
@@ -86,9 +86,12 @@
}
fclose(gobConf);
+
extractChunks(stk, chunks);
+
delete chunks;
fclose(stk);
+
return 0;
}
@@ -117,7 +120,7 @@
curChunk->packed = readByte(stk) != 0;
curChunk->preGob = false;
-// Geisha TOTs are compressed without having the flag set
+ // Geisha TOTs are compressed without having the flag set
fakeTotPtr = strstr(curChunk->name, "0OT");
if (fakeTotPtr != 0) {
strncpy(fakeTotPtr, "TOT", 3);
@@ -126,7 +129,7 @@
}
// Write the chunk info in the gob Conf file
- fprintf(gobConf, "%s %d\n", curChunk->name, curChunk->packed?1:0);
+ fprintf(gobConf, "%s %d\n", curChunk->name, curChunk->packed ? 1 : 0);
if (numDataChunks > 0) {
curChunk->next = new Chunk;
@@ -164,7 +167,7 @@
if (fread(buffer, 1, 14, stk) < 14)
extractError(stk, gobConf, chunks, "Unexpected EOF");
- buffer[14]='\0';
+ buffer[14] = '\0';
sprintf(debugStr, "File generated on %s by ", buffer);
if (fread(buffer, 1, 8, stk) < 8)
@@ -206,7 +209,7 @@
// + 04 bytes : Start position of the File Section
// + 04 bytes : Compression flag (AFAIK : 0= uncompressed, 1= compressed)
- if (fseek(stk, miscPos + (cpt * 61), SEEK_SET)!=0)
+ if (fseek(stk, miscPos + (cpt * 61), SEEK_SET) != 0)
extractError(stk, gobConf, chunks, "Unable to locate Misc Section");
filenamePos = readUint32LE(stk);
@@ -225,7 +228,9 @@
curChunk->packed = true;
} else {
if ((curChunk->size != decompSize) | (compressFlag != 0)) {
- sprintf(debugStr, "Unexpected value in compress flag : %d - Size : %d Uncompressed size : %d", compressFlag, curChunk->size, decompSize);
+ sprintf(debugStr,
+ "Unexpected value in compress flag : %d - Size : %d Uncompressed size : %d",
+ compressFlag, curChunk->size, decompSize);
extractError(stk, gobConf, chunks, debugStr);
} else {
curChunk->packed=false;
@@ -253,7 +258,7 @@
curChunk->preGob = false;
// Write the chunk info in the gob Conf file
- fprintf(gobConf, "%s %d\n", curChunk->name, curChunk->packed?1:0);
+ fprintf(gobConf, "%s %d\n", curChunk->name, curChunk->packed ? 1 : 0);
if (numDataChunks > 0) {
curChunk->next = new Chunk;
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