aboutsummaryrefslogtreecommitdiff
path: root/common/str.cpp
diff options
context:
space:
mode:
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