[Scummvm-cvs-logs] SF.net SVN: scummvm:[48281] scummvm/trunk/common

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Mar 18 16:07:48 CET 2010


Revision: 48281
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48281&view=rev
Author:   fingolfin
Date:     2010-03-18 15:07:48 +0000 (Thu, 18 Mar 2010)

Log Message:
-----------
COMMON: Move tag2str from util.h to str.h

Modified Paths:
--------------
    scummvm/trunk/common/str.cpp
    scummvm/trunk/common/str.h
    scummvm/trunk/common/util.cpp
    scummvm/trunk/common/util.h

Modified: scummvm/trunk/common/str.cpp
===================================================================
--- scummvm/trunk/common/str.cpp	2010-03-18 15:07:30 UTC (rev 48280)
+++ scummvm/trunk/common/str.cpp	2010-03-18 15:07:48 UTC (rev 48281)
@@ -724,4 +724,19 @@
 	}
 }
 
+String tag2string(uint32 tag) {
+	char str[5];
+	str[0] = (char)(tag >> 24);
+	str[1] = (char)(tag >> 16);
+	str[2] = (char)(tag >> 8);
+	str[3] = (char)tag;
+	str[4] = '\0';
+	// Replace non-printable chars by dot
+	for (int i = 0; i < 4; ++i) {
+		if (!isprint((unsigned char)str[i]))
+			str[i] = '.';
+	}
+	return Common::String(str);
+}
+
 }	// End of namespace Common

Modified: scummvm/trunk/common/str.h
===================================================================
--- scummvm/trunk/common/str.h	2010-03-18 15:07:30 UTC (rev 48280)
+++ scummvm/trunk/common/str.h	2010-03-18 15:07:48 UTC (rev 48281)
@@ -319,8 +319,28 @@
 bool matchString(const char *str, const char *pat, bool ignoreCase = false, bool pathMode = false);
 
 
+/**
+ * A 'list' of strings. Actually, this is nowadays an array, and hence misnamed.
+ */
 typedef Array<String> StringList;
 
+
+
+/**
+ * Take a 32 bit value and turn it into a four character string, where each of
+ * the four bytes is turned into one character. Most significant byte is printed
+ * first.
+ */
+String tag2string(uint32 tag);
+
+/**
+ * Convenience wrapper for tag2string which "returns" a C string.
+ * Note: It is *NOT* safe to do anything with the return value other than directly
+ * copying or printing it.
+ */
+#define tag2str(x)	Common::tag2string(x).c_str()
+
+
 } // End of namespace Common
 
 #endif

Modified: scummvm/trunk/common/util.cpp
===================================================================
--- scummvm/trunk/common/util.cpp	2010-03-18 15:07:30 UTC (rev 48280)
+++ scummvm/trunk/common/util.cpp	2010-03-18 15:07:48 UTC (rev 48281)
@@ -59,6 +59,10 @@
 	return String(_str.c_str() + _tokenBegin, _tokenEnd - _tokenBegin);
 }
 
+
+#pragma mark -
+
+
 //
 // Print hexdump of the data passed in
 //
@@ -111,22 +115,7 @@
 	printf("|\n");
 }
 
-String tag2string(uint32 tag) {
-	char str[5];
-	str[0] = (char)(tag >> 24);
-	str[1] = (char)(tag >> 16);
-	str[2] = (char)(tag >> 8);
-	str[3] = (char)tag;
-	str[4] = '\0';
-	// Replace non-printable chars by dot
-	for (int i = 0; i < 4; ++i) {
-		if (!isprint((unsigned char)str[i]))
-			str[i] = '.';
-	}
-	return Common::String(str);
-}
 
-
 #pragma mark -
 
 

Modified: scummvm/trunk/common/util.h
===================================================================
--- scummvm/trunk/common/util.h	2010-03-18 15:07:30 UTC (rev 48280)
+++ scummvm/trunk/common/util.h	2010-03-18 15:07:48 UTC (rev 48281)
@@ -103,15 +103,6 @@
 
 
 /**
- * Take a 32 bit value and turn it into a four character string, where each of
- * the four bytes is turned into one character. Most significant byte is printed
- * first.
- */
-String tag2string(uint32 tag);
-#define tag2str(x)	Common::tag2string(x).c_str()
-
-
-/**
  * List of game language.
  */
 enum Language {


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