mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 04:29:31 +00:00
ICU-472 strlen is no longer called in u_uastrncpy
X-SVN-Rev: 2131
This commit is contained in:
parent
bfb09f49ac
commit
965e162a6b
1 changed files with 18 additions and 1 deletions
|
@ -246,6 +246,23 @@ UChar* u_uastrcpy(UChar *ucs1,
|
|||
return ucs1;
|
||||
}
|
||||
|
||||
/*
|
||||
returns the minimum of (the length of the null-terminated string) and n.
|
||||
*/
|
||||
int32_t u_astrnlen(const char *ucs1, int32_t n)
|
||||
{
|
||||
int32_t len = 0;
|
||||
|
||||
if (ucs1)
|
||||
{
|
||||
while (*(ucs1++) && n--)
|
||||
{
|
||||
len++;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
UChar* u_uastrncpy(UChar *ucs1,
|
||||
const char *s2 ,
|
||||
int32_t n)
|
||||
|
@ -259,7 +276,7 @@ UChar* u_uastrncpy(UChar *ucs1,
|
|||
&target,
|
||||
ucs1+n,
|
||||
&s2,
|
||||
s2+uprv_strlen(s2),
|
||||
s2+u_astrnlen(s2, n),
|
||||
NULL,
|
||||
TRUE,
|
||||
&err);
|
||||
|
|
Loading…
Add table
Reference in a new issue