diff --git a/frameworks/resmgr_lite/include/res_config.h b/frameworks/resmgr_lite/include/res_config.h index 80a2632428e75af018715eeb66c04506e402ba72..4f9a733993fca74b3a7aa75d3db180c971151585 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 a66a833c61b74deb8c38d8a27b851f5b02f12ae5..6c2e333e8ad9327e922b041b98f7677a28371a70 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 45e99a5134df093c6c4a2735ef904a9bb89c1388..7a4a86dc55a9282b2e303d0226e539353f6910d2 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;