aboutsummaryrefslogtreecommitdiff
path: root/common/str.cpp
diff options
context:
space:
mode:
authorMax Horn2010-03-18 15:07:48 +0000
committerMax Horn2010-03-18 15:07:48 +0000
commit30c84d2cff41924e6229d0cacd3d36ce1c2bf6ac (patch)
treece3e0d505397e350e7fc87be8337b1c696991fcd /common/str.cpp
parent3e63df54152c278ea28b430875c82b00d2109967 (diff)
downloadscummvm-rg350-30c84d2cff41924e6229d0cacd3d36ce1c2bf6ac.tar.gz
scummvm-rg350-30c84d2cff41924e6229d0cacd3d36ce1c2bf6ac.tar.bz2
scummvm-rg350-30c84d2cff41924e6229d0cacd3d36ce1c2bf6ac.zip
COMMON: Move tag2str from util.h to str.h
svn-id: r48281
Diffstat (limited to 'common/str.cpp')
-rw-r--r--common/str.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp
index 3517315e95..56ef39cb82 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -724,4 +724,19 @@ bool matchString(const char *str, const char *pat, bool ignoreCase, bool pathMod
}
}
+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