From 30c84d2cff41924e6229d0cacd3d36ce1c2bf6ac Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 18 Mar 2010 15:07:48 +0000 Subject: COMMON: Move tag2str from util.h to str.h svn-id: r48281 --- common/str.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'common/str.cpp') 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 -- cgit v1.2.3