diff --git a/src/resource_util.cpp b/src/resource_util.cpp index c67c77e2e49c579655b50eeb32dc3c91166705a4..1058fd9fe313036b8be7ddafa80d6aad0ecbf9f3 100644 --- a/src/resource_util.cpp +++ b/src/resource_util.cpp @@ -15,6 +15,7 @@ #include "resource_util.h" #include +#include #include #include #include @@ -288,9 +289,17 @@ void ResourceUtil::StringReplace(string &sourceStr, const string &oldStr, const string ResourceUtil::GetLocaleLimitkey(const KeyParam &KeyParam) { - string str(reinterpret_cast(&KeyParam.value)); - reverse(str.begin(), str.end()); - return str; + const char *rawValue = reinterpret_cast(&KeyParam.value); + size_t len = sizeof(KeyParam.value); + char tmp[len + 1]; + int j = 0; + for (size_t i = 1; i <= len; i++) { + if (*(rawValue + len - i)) { + tmp[j++] = *(rawValue + len - i); + } + } + tmp[j] = '\0'; + return string(tmp); } string ResourceUtil::GetDeviceTypeLimitkey(const KeyParam &KeyParam) @@ -332,6 +341,7 @@ string ResourceUtil::GetKeyParamValue(const KeyParam &KeyParam) val = GetResolutionLimitkey(KeyParam); break; case KeyType::LANGUAGE: + case KeyType::SCRIPT: case KeyType::REGION: val = GetLocaleLimitkey(KeyParam); break;