mirror of
https://gitee.com/openharmony/third_party_icu
synced 2024-11-23 08:10:07 +00:00
commit
70101c403f
@ -269,7 +269,6 @@ icu_common_source = [
|
|||||||
"//third_party/icu/icu4c/source/common/servnotf.cpp",
|
"//third_party/icu/icu4c/source/common/servnotf.cpp",
|
||||||
"//third_party/icu/icu4c/source/common/emojiprops.cpp",
|
"//third_party/icu/icu4c/source/common/emojiprops.cpp",
|
||||||
"//third_party/icu/icu4c/source/common/lstmbe.cpp",
|
"//third_party/icu/icu4c/source/common/lstmbe.cpp",
|
||||||
"//third_party/icu/icu4c/source/ohos/distro_tzdata_loader.cpp",
|
|
||||||
"//third_party/icu/icu4c/source/ohos/init_data.cpp",
|
"//third_party/icu/icu4c/source/ohos/init_data.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -542,9 +541,6 @@ ohos_shared_library("shared_icuuc") {
|
|||||||
"DISTRO_TZDATA_DIR=${distro_tzdata_dir}",
|
"DISTRO_TZDATA_DIR=${distro_tzdata_dir}",
|
||||||
"SYSTEM_TZDATA_DIR=${system_tzdata_dir}",
|
"SYSTEM_TZDATA_DIR=${system_tzdata_dir}",
|
||||||
]
|
]
|
||||||
if (!is_mingw) {
|
|
||||||
defines += [ "ICU_SUPPORT_DISTRO" ]
|
|
||||||
}
|
|
||||||
sources = icu_common_source
|
sources = icu_common_source
|
||||||
deps = [
|
deps = [
|
||||||
":ohos_icudat",
|
":ohos_icudat",
|
||||||
@ -648,9 +644,6 @@ if (defined(is_arkui_x) && is_arkui_x) {
|
|||||||
"UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
|
"UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
|
||||||
"_REENTRANT",
|
"_REENTRANT",
|
||||||
]
|
]
|
||||||
if (!is_mingw) {
|
|
||||||
defines += [ "ICU_SUPPORT_DISTRO" ]
|
|
||||||
}
|
|
||||||
sources = icu_common_source
|
sources = icu_common_source
|
||||||
cflags_cc = [
|
cflags_cc = [
|
||||||
"-W",
|
"-W",
|
||||||
|
@ -38,10 +38,9 @@ ohos_shared_library("shared_icuuc_host") {
|
|||||||
"UPRV_BLOCK_MACRO_END=",
|
"UPRV_BLOCK_MACRO_END=",
|
||||||
"UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
|
"UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
|
||||||
"_REENTRANT",
|
"_REENTRANT",
|
||||||
|
"DISTRO_TZDATA_DIR=\"/system/etc/tzdata_distro\"",
|
||||||
|
"SYSTEM_TZDATA_DIR=\"/system/etc/icu_tzdata\"",
|
||||||
]
|
]
|
||||||
if (!is_mingw) {
|
|
||||||
defines += [ "ICU_SUPPORT_DISTRO" ]
|
|
||||||
}
|
|
||||||
sources = [
|
sources = [
|
||||||
"//third_party/icu/icu4c/source/common/appendable.cpp",
|
"//third_party/icu/icu4c/source/common/appendable.cpp",
|
||||||
"//third_party/icu/icu4c/source/common/bmpset.cpp",
|
"//third_party/icu/icu4c/source/common/bmpset.cpp",
|
||||||
@ -241,7 +240,6 @@ ohos_shared_library("shared_icuuc_host") {
|
|||||||
"//third_party/icu/icu4c/source/common/uvectr32.cpp",
|
"//third_party/icu/icu4c/source/common/uvectr32.cpp",
|
||||||
"//third_party/icu/icu4c/source/common/uvectr64.cpp",
|
"//third_party/icu/icu4c/source/common/uvectr64.cpp",
|
||||||
"//third_party/icu/icu4c/source/common/wintz.cpp",
|
"//third_party/icu/icu4c/source/common/wintz.cpp",
|
||||||
"//third_party/icu/icu4c/source/ohos/distro_tzdata_loader.cpp",
|
|
||||||
"//third_party/icu/icu4c/source/ohos/init_data.cpp",
|
"//third_party/icu/icu4c/source/ohos/init_data.cpp",
|
||||||
"//third_party/icu/icu4c/source/stubdata/stubdata.cpp",
|
"//third_party/icu/icu4c/source/stubdata/stubdata.cpp",
|
||||||
]
|
]
|
||||||
|
@ -1309,18 +1309,16 @@ doOpenChoice(const char *path, const char *type, const char *name,
|
|||||||
/**** Time zone individual files override */
|
/**** Time zone individual files override */
|
||||||
if (isICUData && isTimeZoneFile(name, type)) {
|
if (isICUData && isTimeZoneFile(name, type)) {
|
||||||
#ifdef DISTRO_TZDATA_DIR
|
#ifdef DISTRO_TZDATA_DIR
|
||||||
const char* distroTzdataDir = DISTRO_TZDATA_DIR;
|
retVal = doLoadFromIndividualFiles("", DISTRO_TZDATA_DIR, tocEntryPathSuffix,
|
||||||
retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", distroTzdataDir, tocEntryPathSuffix,
|
"", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
|
||||||
/* path */ "", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
|
|
||||||
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
|
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SYSTEM_TZDATA_DIR
|
#ifdef SYSTEM_TZDATA_DIR
|
||||||
const char* systemTzdataDir = SYSTEM_TZDATA_DIR;
|
retVal = doLoadFromIndividualFiles("", SYSTEM_TZDATA_DIR, tocEntryPathSuffix,
|
||||||
retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", systemTzdataDir, tocEntryPathSuffix,
|
"", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
|
||||||
/* path */ "", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
|
|
||||||
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
|
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
// © 2016 and later: Unicode, Inc. and others.
|
|
||||||
// License & terms of use: http://www.unicode.org/copyright.html#License
|
|
||||||
/**
|
|
||||||
* generated alias target
|
|
||||||
*/
|
|
||||||
nb_NO{
|
|
||||||
___{""}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
// © 2016 and later: Unicode, Inc. and others.
|
|
||||||
// License & terms of use: http://www.unicode.org/copyright.html#License
|
|
||||||
nds{
|
|
||||||
Version{"37"}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
// © 2016 and later: Unicode, Inc. and others.
|
|
||||||
// License & terms of use: http://www.unicode.org/copyright.html#License
|
|
||||||
de_LU{
|
|
||||||
Languages{
|
|
||||||
be{"Belarussisch"}
|
|
||||||
}
|
|
||||||
Version{"37"}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
// © 2016 and later: Unicode, Inc. and others.
|
|
||||||
// License & terms of use: http://www.unicode.org/copyright.html#License
|
|
||||||
/**
|
|
||||||
* generated alias target
|
|
||||||
*/
|
|
||||||
nb_NO{
|
|
||||||
___{""}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
// © 2016 and later: Unicode, Inc. and others.
|
|
||||||
// License & terms of use: http://www.unicode.org/copyright.html#License
|
|
||||||
nds{
|
|
||||||
Version{"37"}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
// © 2016 and later: Unicode, Inc. and others.
|
|
||||||
// License & terms of use: http://www.unicode.org/copyright.html#License
|
|
||||||
en_MM{
|
|
||||||
%%Parent{"en_GB"}
|
|
||||||
Version{"2.1.38.69"}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef ICU_SUPPORT_DISTRO
|
|
||||||
#include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include "distro_tzdata_loader.h"
|
|
||||||
|
|
||||||
namespace OHOS {
|
|
||||||
namespace Global {
|
|
||||||
namespace I18n {
|
|
||||||
const char *DistroTZDataLoader::ICU_TZDATA_PATH = "/system/etc/tzdata_distro/icu_tzdata.dat";
|
|
||||||
const char *DistroTZDataLoader::DISTRO_TZDATA_PATH = "/system/etc/tzdata_distro";
|
|
||||||
const char *DistroTZDataLoader::TZDATA_PATH = "/system/etc/icu_tzdata";
|
|
||||||
const char *DistroTZDataLoader::ICU_TIMEZONE_FILES_DIR = "ICU_TIMEZONE_FILES_DIR";
|
|
||||||
|
|
||||||
void DistroTZDataLoader::SetDistroTZDataPath()
|
|
||||||
{
|
|
||||||
#ifdef ICU_SUPPORT_DISTRO
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DistroTZDataLoader::CheckFileExist()
|
|
||||||
{
|
|
||||||
struct stat s;
|
|
||||||
if (stat(ICU_TZDATA_PATH, &s) != 0 || !(s.st_mode & S_IFREG)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} // namespace I18n
|
|
||||||
} // namespace Global
|
|
||||||
} // namespace OHOS
|
|
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace OHOS {
|
|
||||||
namespace Global {
|
|
||||||
namespace I18n {
|
|
||||||
class DistroTZDataLoader {
|
|
||||||
public:
|
|
||||||
static void SetDistroTZDataPath();
|
|
||||||
|
|
||||||
private:
|
|
||||||
static bool CheckFileExist();
|
|
||||||
static const char *ICU_TZDATA_PATH;
|
|
||||||
static const char *DISTRO_TZDATA_PATH;
|
|
||||||
static const char *TZDATA_PATH;
|
|
||||||
static const char *ICU_TIMEZONE_FILES_DIR;
|
|
||||||
};
|
|
||||||
} // namespace I18n
|
|
||||||
} // namespace Global
|
|
||||||
} // namespace OHOS
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -13,7 +13,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "distro_tzdata_loader.h"
|
|
||||||
#include "init_data.h"
|
#include "init_data.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@ -27,14 +26,13 @@ std::mutex dataMutex;
|
|||||||
/**
|
/**
|
||||||
* set icu data files to hwDirectory
|
* set icu data files to hwDirectory
|
||||||
*/
|
*/
|
||||||
void SetHwIcuDirectory( )
|
void SetHwIcuDirectory()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(dataMutex);
|
std::lock_guard<std::mutex> lock(dataMutex);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
u_setDataDirectory(g_hwDirectory);
|
u_setDataDirectory(g_hwDirectory);
|
||||||
OHOS::Global::I18n::DistroTZDataLoader::SetDistroTZDataPath();
|
|
||||||
status = 1;
|
status = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,5 +50,4 @@ extern "C" void SetOhosIcuDirectory()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
u_setDataDirectory(g_hwDirectory);
|
u_setDataDirectory(g_hwDirectory);
|
||||||
OHOS::Global::I18n::DistroTZDataLoader::SetDistroTZDataPath();
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -22,7 +22,7 @@
|
|||||||
/**
|
/**
|
||||||
* convienient method to set icu data file directory to HW_DIRECTORY);
|
* convienient method to set icu data file directory to HW_DIRECTORY);
|
||||||
*/
|
*/
|
||||||
void SetHwIcuDirectory( );
|
void SetHwIcuDirectory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get icu version
|
* get icu version
|
||||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user