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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Dec 17 21:24:28 CET 2009


Revision: 46405
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46405&view=rev
Author:   fingolfin
Date:     2009-12-17 20:24:28 +0000 (Thu, 17 Dec 2009)

Log Message:
-----------
TOOLS: Rename File::printf to print; fix Filename::setExtension

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/common/file.cpp
    tools/branches/gsoc2009-gui/common/file.h
    tools/branches/gsoc2009-gui/extract_gob_stk.cpp

Modified: tools/branches/gsoc2009-gui/common/file.cpp
===================================================================
--- tools/branches/gsoc2009-gui/common/file.cpp	2009-12-17 19:29:32 UTC (rev 46404)
+++ tools/branches/gsoc2009-gui/common/file.cpp	2009-12-17 20:24:28 UTC (rev 46405)
@@ -55,13 +55,10 @@
 }
 
 void Filename::setExtension(const std::string &ext) {
-	size_t dot = _path.rfind('.');
-	if (dot == std::string::npos) {
-		_path += ext;
-	} else {
-		_path.resize(dot);
-		_path += ext;
-	}
+	// FIXME: quick and dirty hack. But then so is this whole class...
+	std::string path = getPath();
+	std::string name = getName();
+	_path = path + name + ext;
 }
 
 bool Filename::equals(const Filename &other) const {
@@ -457,7 +454,7 @@
 	return data_read;
 }
 
-void File::printf(const char *format, ...) {
+void File::print(const char *format, ...) {
 	if (!_file) 
 		throw FileException("File is not open");
 	if ((_mode & FILEMODE_WRITE) == 0)

Modified: tools/branches/gsoc2009-gui/common/file.h
===================================================================
--- tools/branches/gsoc2009-gui/common/file.h	2009-12-17 19:29:32 UTC (rev 46404)
+++ tools/branches/gsoc2009-gui/common/file.h	2009-12-17 20:24:28 UTC (rev 46405)
@@ -340,7 +340,7 @@
 	/**
 	 * Works the same as fprintf.
 	 */
-	void printf(const char *format, ...);
+	void print(const char *format, ...);
 
 	/**
 	 * Seek to the specified position in the stream.

Modified: tools/branches/gsoc2009-gui/extract_gob_stk.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_gob_stk.cpp	2009-12-17 19:29:32 UTC (rev 46404)
+++ tools/branches/gsoc2009-gui/extract_gob_stk.cpp	2009-12-17 20:24:28 UTC (rev 46405)
@@ -83,16 +83,16 @@
 	_outputPath.setExtension(".gob");
 
 	gobConf.open(_outputPath.getFullPath(), "w");
-	gobConf.printf("%s\n", inpath.getFullName().c_str());
+	gobConf.print("%s\n", inpath.getFullName().c_str());
 
 	stk.read_throwsOnError(signature, 6);
 
 	if (strncmp(signature, "STK2.1", 6) == 0) {
 		print("Signature of new STK format (STK 2.1) detected in file \"%s\"", inpath.getFullPath().c_str());
-		gobConf.printf("%s\n", confSTK21);
+		gobConf.print("%s\n", confSTK21);
 		readChunkListV2(stk, gobConf);
 	} else {
-		gobConf.printf("%s\n", confSTK10);
+		gobConf.print("%s\n", confSTK10);
 		stk.rewind();
 		readChunkList(stk, gobConf);
 	}
@@ -129,7 +129,7 @@
 		}
 
 		// Write the chunk info in the gob Conf file
-		gobConf.printf("%s %d\n", curChunk->name, curChunk->packed ? 1 : 0);
+		gobConf.print("%s %d\n", curChunk->name, curChunk->packed ? 1 : 0);
 
 		if (numDataChunks > 0) {
 			curChunk->next = new Chunk;
@@ -248,7 +248,7 @@
 		curChunk->preGob = false;
 
 		// Write the chunk info in the gob Conf file
-		gobConf.printf("%s %d\n", curChunk->name, curChunk->packed ? 1 : 0);
+		gobConf.print("%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