代码一致性

Signed-off-by: zhangdd_ewan <zhangdongdong50@huawei.com>
This commit is contained in:
zhangdd_ewan 2024-07-17 15:41:16 +08:00
parent 7b4b3a5ce9
commit 502e11231f
6 changed files with 4 additions and 96 deletions

View File

@ -269,7 +269,6 @@ icu_common_source = [
"//third_party/icu/icu4c/source/common/servnotf.cpp",
"//third_party/icu/icu4c/source/common/emojiprops.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",
]
@ -542,9 +541,6 @@ ohos_shared_library("shared_icuuc") {
"DISTRO_TZDATA_DIR=${distro_tzdata_dir}",
"SYSTEM_TZDATA_DIR=${system_tzdata_dir}",
]
if (!is_mingw) {
defines += [ "ICU_SUPPORT_DISTRO" ]
}
sources = icu_common_source
deps = [
":ohos_icudat",
@ -648,9 +644,6 @@ if (defined(is_arkui_x) && is_arkui_x) {
"UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
"_REENTRANT",
]
if (!is_mingw) {
defines += [ "ICU_SUPPORT_DISTRO" ]
}
sources = icu_common_source
cflags_cc = [
"-W",

View File

@ -38,10 +38,9 @@ ohos_shared_library("shared_icuuc_host") {
"UPRV_BLOCK_MACRO_END=",
"UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
"_REENTRANT",
"DISTRO_TZDATA_DIR=\"/system/etc/tzdata_distro\"",
"SYSTEM_TZDATA_DIR=\"/system/etc/icu_tzdata\"",
]
if (!is_mingw) {
defines += [ "ICU_SUPPORT_DISTRO" ]
}
sources = [
"//third_party/icu/icu4c/source/common/appendable.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/uvectr64.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/stubdata/stubdata.cpp",
]

View File

@ -1309,8 +1309,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
/**** Time zone individual files override */
if (isICUData && isTimeZoneFile(name, type)) {
#ifdef DISTRO_TZDATA_DIR
const char* distroTzdataDir = DISTRO_TZDATA_DIR;
retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", distroTzdataDir, tocEntryPathSuffix,
retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", DISTRO_TZDATA_DIR, tocEntryPathSuffix,
/* path */ "", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
return retVal;
@ -1318,8 +1317,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
#endif
#ifdef SYSTEM_TZDATA_DIR
const char* systemTzdataDir = SYSTEM_TZDATA_DIR;
retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", systemTzdataDir, tocEntryPathSuffix,
retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", SYSTEM_TZDATA_DIR, tocEntryPathSuffix,
/* path */ "", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
return retVal;

View File

@ -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

View File

@ -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

View File

@ -13,7 +13,6 @@
* limitations under the License.
*/
#include "distro_tzdata_loader.h"
#include "init_data.h"
#include <cstring>
#include <mutex>
@ -34,7 +33,6 @@ void SetHwIcuDirectory( )
return;
}
u_setDataDirectory(g_hwDirectory);
OHOS::Global::I18n::DistroTZDataLoader::SetDistroTZDataPath();
status = 1;
}
@ -52,5 +50,4 @@ extern "C" void SetOhosIcuDirectory()
return;
}
u_setDataDirectory(g_hwDirectory);
OHOS::Global::I18n::DistroTZDataLoader::SetDistroTZDataPath();
}