保持一致

Signed-off-by: 王剑 <wangjian546@huawei.com>
This commit is contained in:
王剑
2025-07-02 17:21:16 +08:00
parent 8579a7cfee
commit 2ce98c19c0
3 changed files with 14 additions and 9 deletions
+13 -5
View File
@@ -21,10 +21,6 @@
using namespace OHOS::I18N;
const std::set<std::string> LocaleInfo::SCRIPTS = {
"Hans", "Latn", "Hant", "Qaag", "Cyrl", "Deva", "Guru"
};
void LocaleInfo::Init(const char *newLang, const char *newScript, const char *newRegion, int &status)
{
id = nullptr;
@@ -412,7 +408,19 @@ bool LocaleInfo::IsScript(const char *start, uint8_t length)
if (length != SCRIPT_LENGTH || start == nullptr) {
return false;
}
if (SCRIPTS.find(std::string(start, length)) != SCRIPTS.end()) {
if (memcmp(start, "Hans", length) == 0) {
return true;
} else if (memcmp(start, "Latn", length) == 0) {
return true;
} else if (memcmp(start, "Hant", length) == 0) {
return true;
} else if (memcmp(start, "Qaag", length) == 0) {
return true;
} else if (memcmp(start, "Cyrl", length) == 0) {
return true;
} else if (memcmp(start, "Deva", length) == 0) {
return true;
} else if (memcmp(start, "Guru", length) == 0) {
return true;
} else {
return false;
+1 -1
View File
@@ -65,7 +65,7 @@ void NumberData::SetNumSystem(std::string *numSym, const int numSize)
return;
}
ArrayCopy(nativeNums, NUM_SIZE, numSym, numSize);
if (!(numSym[0]).empty() && (numSym[0].at(0) != '0')) {
if (!(numSym[0]).empty() && ((numSym[0]).at(0) != '0')) {
isNative = true;
}
}
@@ -44,8 +44,6 @@
*/
#include <cstdint>
#include <string>
#include <set>
#include "types.h"
namespace OHOS {
@@ -213,7 +211,6 @@ private:
void SetFail();
void Init(const char *lang, const char *script, const char *region, int &status);
const int CHAR_OFF = 48;
static const std::set<std::string> SCRIPTS;
static constexpr uint16_t OPT_LANG = 0x0001;
static constexpr uint16_t OPT_SCRIPT = 0x0002;
static constexpr uint16_t OPT_REGION = 0x0004;