[Scummvm-cvs-logs] SF.net SVN: scummvm:[55639] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sat Jan 29 23:50:11 CET 2011


Revision: 55639
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55639&view=rev
Author:   drmccoy
Date:     2011-01-29 22:50:11 +0000 (Sat, 29 Jan 2011)

Log Message:
-----------
GOB: Add setExtension()

Modified Paths:
--------------
    scummvm/trunk/engines/gob/util.cpp
    scummvm/trunk/engines/gob/util.h

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2011-01-29 22:49:40 UTC (rev 55638)
+++ scummvm/trunk/engines/gob/util.cpp	2011-01-29 22:50:11 UTC (rev 55639)
@@ -518,6 +518,23 @@
 	delete list;
 }
 
+char *Util::setExtension(char *str, const char *ext) {
+	char *dot = strrchr(str, '.');
+	if (dot)
+		*dot = '\0';
+
+	strcat(str, ext);
+	return str;
+}
+
+Common::String Util::setExtension(const Common::String &str, const Common::String &ext) {
+	const char *dot = strrchr(str.c_str(), '.');
+	if (dot)
+		return Common::String(str.c_str(), dot - str.c_str()) + ext;
+
+	return str + ext;
+}
+
 /* NOT IMPLEMENTED */
 void Util::checkJoystick() {
 	_vm->_global->_useJoystick = 0;

Modified: scummvm/trunk/engines/gob/util.h
===================================================================
--- scummvm/trunk/engines/gob/util.h	2011-01-29 22:49:40 UTC (rev 55638)
+++ scummvm/trunk/engines/gob/util.h	2011-01-29 22:50:11 UTC (rev 55639)
@@ -131,6 +131,9 @@
 	static void listDropFront(List *list);
 	static void deleteList(List *list);
 
+	static char *setExtension(char *str, const char *ext);
+	static Common::String setExtension(const Common::String &str, const Common::String &ext);
+
 	Util(GobEngine *vm);
 
 protected:


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