added hawk_copy_bcstr_to_bchars() and hawk_copy_ucstr_to_uchars()

This commit is contained in:
hyung-hwan 2020-04-16 15:29:09 +00:00
parent 756a8454b2
commit 0b9d29ba72
2 changed files with 48 additions and 0 deletions

View File

@ -479,6 +479,18 @@ HAWK_EXPORT hawk_oow_t hawk_copy_bchars_to_bcstr_unlimited (
hawk_oow_t len hawk_oow_t len
); );
HAWK_EXPORT hawk_oow_t hawk_copy_ucstr_to_uchars (
hawk_uch_t* dst,
hawk_uch_t dlen,
const hawk_uch_t* src
);
HAWK_EXPORT hawk_oow_t hawk_copy_bcstr_to_bchars (
hawk_bch_t* dst,
hawk_bch_t dlen,
const hawk_bch_t* src
);
HAWK_EXPORT hawk_oow_t hawk_copy_ucstr ( HAWK_EXPORT hawk_oow_t hawk_copy_ucstr (
hawk_uch_t* dst, hawk_uch_t* dst,
hawk_oow_t len, hawk_oow_t len,
@ -710,6 +722,7 @@ HAWK_EXPORT void hawk_unescape_bcstr (
# define hawk_copy_oochars_to_oocstr hawk_copy_uchars_to_ucstr # define hawk_copy_oochars_to_oocstr hawk_copy_uchars_to_ucstr
# define hawk_copy_oochars_to_oocstr_unlimited hawk_copy_uchars_to_ucstr_unlimited # define hawk_copy_oochars_to_oocstr_unlimited hawk_copy_uchars_to_ucstr_unlimited
# define hawk_copy_oocstr_to_oochars hawk_copy_ucstr_to_uchars
# define hawk_copy_oocstr hawk_copy_ucstr # define hawk_copy_oocstr hawk_copy_ucstr
# define hawk_copy_oocstr_unlimited hawk_copy_ucstr_unlimited # define hawk_copy_oocstr_unlimited hawk_copy_ucstr_unlimited
@ -749,6 +762,7 @@ HAWK_EXPORT void hawk_unescape_bcstr (
# define hawk_copy_oochars_to_oocstr hawk_copy_bchars_to_bcstr # define hawk_copy_oochars_to_oocstr hawk_copy_bchars_to_bcstr
# define hawk_copy_oochars_to_oocstr_unlimited hawk_copy_bchars_to_bcstr_unlimited # define hawk_copy_oochars_to_oocstr_unlimited hawk_copy_bchars_to_bcstr_unlimited
# define hawk_copy_oocstr_to_oochars hawk_copy_bcstr_to_bchars
# define hawk_copy_oocstr hawk_copy_bcstr # define hawk_copy_oocstr hawk_copy_bcstr
# define hawk_copy_oocstr_unlimited hawk_copy_bcstr_unlimited # define hawk_copy_oocstr_unlimited hawk_copy_bcstr_unlimited

View File

@ -322,6 +322,7 @@ void hawk_copy_bchars (hawk_bch_t* dst, const hawk_bch_t* src, hawk_oow_t len)
for (i = 0; i < len; i++) dst[i] = src[i]; for (i = 0; i < len; i++) dst[i] = src[i];
} }
void hawk_copy_bchars_to_uchars (hawk_uch_t* dst, const hawk_bch_t* src, hawk_oow_t len) void hawk_copy_bchars_to_uchars (hawk_uch_t* dst, const hawk_bch_t* src, hawk_oow_t len)
{ {
/* copy without conversions. /* copy without conversions.
@ -374,6 +375,39 @@ hawk_oow_t hawk_copy_bchars_to_bcstr_unlimited (hawk_bch_t* dst, const hawk_bch_
return i; return i;
} }
hawk_oow_t hawk_copy_ucstr_to_uchars (hawk_uch_t* dst, hawk_uch_t dlen, const hawk_uch_t* src)
{
/* no null termination */
hawk_uch_t* p, * p2;
p = dst; p2 = dst + dlen;
while (p < p2)
{
if (*src == '\0') break;
*p++ = *src++;
}
return p - dst;
}
hawk_oow_t hawk_copy_bcstr_to_bchars (hawk_bch_t* dst, hawk_bch_t dlen, const hawk_bch_t* src)
{
/* no null termination */
hawk_bch_t* p, * p2;
p = dst; p2 = dst + dlen;
while (p < p2)
{
if (*src == '\0') break;
*p++ = *src++;
}
return p - dst;
}
hawk_oow_t hawk_copy_ucstr (hawk_uch_t* dst, hawk_oow_t len, const hawk_uch_t* src) hawk_oow_t hawk_copy_ucstr (hawk_uch_t* dst, hawk_oow_t len, const hawk_uch_t* src)
{ {
hawk_uch_t* p, * p2; hawk_uch_t* p, * p2;