!218 fix dump script failed

Merge pull request !218 from sunjie/fix_dump_bug
This commit is contained in:
openharmony_ci
2025-02-14 08:31:08 +00:00
committed by Gitee
+12 -3
View File
@@ -290,9 +290,17 @@ void ResourceUtil::StringReplace(string &sourceStr, const string &oldStr, const
string ResourceUtil::GetLocaleLimitkey(const KeyParam &KeyParam)
{
string str(reinterpret_cast<const char *>(&KeyParam.value));
reverse(str.begin(), str.end());
return str;
const char *rawValue = reinterpret_cast<const char *>(&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)
@@ -334,6 +342,7 @@ string ResourceUtil::GetKeyParamValue(const KeyParam &KeyParam)
val = GetResolutionLimitkey(KeyParam);
break;
case KeyType::LANGUAGE:
case KeyType::SCRIPT:
case KeyType::REGION:
val = GetLocaleLimitkey(KeyParam);
break;