From 1895cc5bdc74192c17e10a3dccfdf9722f717e62 Mon Sep 17 00:00:00 2001 From: huangjie Date: Mon, 7 Nov 2022 15:45:26 +0800 Subject: [PATCH] =?UTF-8?q?fixed=204c867d9=20from=20https://gitee.com/maoz?= =?UTF-8?q?iduanl/global=5Fresmgr=5Flite/pulls/111=20=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huangjie --- frameworks/resmgr_lite/include/res_config.h | 2 +- frameworks/resmgr_lite/src/global.cpp | 7 ++++--- frameworks/resmgr_lite/src/res_locale.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frameworks/resmgr_lite/include/res_config.h b/frameworks/resmgr_lite/include/res_config.h index 80a2632..4f9a733 100644 --- a/frameworks/resmgr_lite/include/res_config.h +++ b/frameworks/resmgr_lite/include/res_config.h @@ -59,7 +59,7 @@ LocaleInfo *BuildFromString(const char *str, char sep, RState &rState); LocaleInfo *BuildFromParts(const char *language, const char *script, const char *region, RState &rState); -void FindAndSort(std::string localeStr, std::vector &candidateLocale, std::vector &outValue); +void FindAndSort(const std::string localeStr, std::vector &candidateLocale, std::vector &outValue); } // namespace Resource } // namespace Global } // namespace OHOS diff --git a/frameworks/resmgr_lite/src/global.cpp b/frameworks/resmgr_lite/src/global.cpp index a66a833..6c2e333 100644 --- a/frameworks/resmgr_lite/src/global.cpp +++ b/frameworks/resmgr_lite/src/global.cpp @@ -55,8 +55,7 @@ void GLOBAL_ConfigLanguage(const char *appLanguage) } InitResConfig(); - std::string lan(appLanguage); - std::string language, script, region; + std::string lan(appLanguage); auto index1 = lan.find("-"); auto index2 = lan.find("_"); auto indexStart = std::string::npos; @@ -68,7 +67,9 @@ void GLOBAL_ConfigLanguage(const char *appLanguage) indexStart = index2; indexEnd = lan.find("_", index2 + 1); } - + std::string language; + std::string script; + std::string region; if (indexStart != std::string::npos) { if (indexEnd != std::string::npos) { language.assign(appLanguage, indexStart); diff --git a/frameworks/resmgr_lite/src/res_locale.cpp b/frameworks/resmgr_lite/src/res_locale.cpp index 45e99a5..7a4a86d 100644 --- a/frameworks/resmgr_lite/src/res_locale.cpp +++ b/frameworks/resmgr_lite/src/res_locale.cpp @@ -422,7 +422,7 @@ void UpdateSysDefault(const LocaleInfo &localeInfo, bool needNotify) ResLocale::UpdateDefault(localeInfo, needNotify); } -void FindAndSort(std::string localeStr, std::vector &candidateLocale, std::vector &outValue) +void FindAndSort(const std::string localeStr, std::vector &candidateLocale, std::vector &outValue) { if (candidateLocale.size() == 0) { return; -- Gitee