Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Global I18n Standard
提交
dce79938
G
Global I18n Standard
项目概览
OpenHarmony
/
Global I18n Standard
大约 1 年 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Global I18n Standard
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
dce79938
编写于
3月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!199 使用icu内存拷贝函数替代安全函数
Merge pull request !199 from sunyaozu/OpenHarmony-3.1-Release
上级
ca831c9a
12b4ef7c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
12 deletion
+9
-12
frameworks/intl/src/i18n_calendar.cpp
frameworks/intl/src/i18n_calendar.cpp
+1
-2
frameworks/intl/src/locale_config.cpp
frameworks/intl/src/locale_config.cpp
+8
-10
未找到文件。
frameworks/intl/src/i18n_calendar.cpp
浏览文件 @
dce79938
...
...
@@ -24,7 +24,6 @@
#include "islamcal.h"
#include "japancal.h"
#include "persncal.h"
#include "securec.h"
#include "ureslocs.h"
#include "ulocimp.h"
#include "uresimp.h"
...
...
@@ -259,7 +258,7 @@ std::string I18nCalendar::GetDisplayName(std::string &displayLocale)
if
(
status
==
U_ZERO_ERROR
)
{
len
=
(
length
<
destCapacity
)
?
length
:
destCapacity
;
if
((
len
>
0
)
&&
(
str
!=
nullptr
))
{
memcpy_s
((
void
*
)
buffer
,
(
size_t
)
destCapacity
,
(
void
*
)
str
,
(
size_t
)
len
);
u_memcpy
(
buffer
,
str
,
len
);
}
}
else
{
return
""
;
...
...
frameworks/intl/src/locale_config.cpp
浏览文件 @
dce79938
...
...
@@ -179,7 +179,7 @@ string Adjust(const string &origin)
return
origin
;
}
size
_t
GetDialectName
(
const
char
*
localeName
,
char
*
name
,
size_t
nameCapacity
,
UErrorCode
&
status
)
int32
_t
GetDialectName
(
const
char
*
localeName
,
char
*
name
,
size_t
nameCapacity
,
UErrorCode
&
status
)
{
icu
::
Locale
locale
=
icu
::
Locale
::
forLanguageTag
(
localeName
,
status
);
if
(
status
!=
U_ZERO_ERROR
)
{
...
...
@@ -209,7 +209,7 @@ size_t GetDialectName(const char *localeName, char *name, size_t nameCapacity, U
return
temp
.
size
();
}
int32_t
GetDisplayName
(
const
char
*
locale
,
const
char
*
displayLocale
,
UChar
*
dest
,
size
_t
destCapacity
,
int32_t
GetDisplayName
(
const
char
*
locale
,
const
char
*
displayLocale
,
UChar
*
dest
,
int32
_t
destCapacity
,
UErrorCode
&
status
)
{
if
(
status
!=
U_ZERO_ERROR
)
{
...
...
@@ -220,18 +220,17 @@ int32_t GetDisplayName(const char *locale, const char *displayLocale, UChar *des
return
0
;
}
char
localeBuffer
[
ULOC_FULLNAME_CAPACITY
];
size
_t
length
=
GetDialectName
(
locale
,
localeBuffer
,
sizeof
(
localeBuffer
),
status
);
int32
_t
length
=
GetDialectName
(
locale
,
localeBuffer
,
sizeof
(
localeBuffer
),
status
);
if
(
status
!=
U_ZERO_ERROR
||
!
length
)
{
status
=
U_ILLEGAL_ARGUMENT_ERROR
;
return
0
;
}
int32_t
length2
=
static_cast
<
int32_t
>
(
length
);
const
UChar
*
str
=
uloc_getTableStringWithFallback
(
U_ICUDATA_LANG
,
displayLocale
,
"Languages"
,
nullptr
,
localeBuffer
,
&
length
2
,
&
status
);
nullptr
,
localeBuffer
,
&
length
,
&
status
);
if
(
status
<=
U_ZERO_ERROR
)
{
size
_t
len
=
(
length
<
destCapacity
)
?
length
:
destCapacity
;
int32
_t
len
=
(
length
<
destCapacity
)
?
length
:
destCapacity
;
if
((
len
>
0
)
&&
(
str
!=
nullptr
))
{
memcpy_s
((
void
*
)
dest
,
destCapacity
,
(
void
*
)
str
,
len
);
u_memcpy
(
dest
,
str
,
len
);
}
}
else
{
status
=
U_USING_DEFAULT_WARNING
;
...
...
@@ -242,14 +241,13 @@ int32_t GetDisplayName(const char *locale, const char *displayLocale, UChar *des
void
GetDisplayLanguageImpl
(
const
char
*
locale
,
const
char
*
displayLocale
,
icu
::
UnicodeString
&
result
)
{
size_t
destCapacity
=
50
;
// size 50 is enough to hold language name
UChar
*
buffer
=
result
.
getBuffer
((
int32_t
)
destCapacity
);
UChar
*
buffer
=
result
.
getBuffer
(
50
);
// size 50 is enough to hold language name
if
(
!
buffer
)
{
result
.
truncate
(
0
);
return
;
}
UErrorCode
status
=
U_ZERO_ERROR
;
int32_t
length
=
GetDisplayName
(
locale
,
displayLocale
,
buffer
,
destCapacity
,
status
);
int32_t
length
=
GetDisplayName
(
locale
,
displayLocale
,
buffer
,
result
.
getCapacity
()
,
status
);
result
.
releaseBuffer
(
U_SUCCESS
(
status
)
?
length
:
0
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录