Commit bf9ac906 authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

msvcrt: Add _mbsnbcpy_l implementation.

parent a6ed3d55
...@@ -1134,7 +1134,7 @@ ...@@ -1134,7 +1134,7 @@
@ cdecl _mbsnbcoll(str str long) @ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr) @ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long) @ cdecl _mbsnbcpy(ptr str long)
@ stub _mbsnbcpy_l @ cdecl _mbsnbcpy_l(ptr str long ptr)
@ cdecl _mbsnbcpy_s(ptr long str long) @ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr) @ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long) @ cdecl _mbsnbicmp(str str long)
......
...@@ -1491,7 +1491,7 @@ ...@@ -1491,7 +1491,7 @@
@ cdecl _mbsnbcoll(str str long) @ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr) @ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long) @ cdecl _mbsnbcpy(ptr str long)
@ stub _mbsnbcpy_l @ cdecl _mbsnbcpy_l(ptr str long ptr)
@ cdecl _mbsnbcpy_s(ptr long str long) @ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr) @ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long) @ cdecl _mbsnbicmp(str str long)
......
...@@ -1502,7 +1502,7 @@ ...@@ -1502,7 +1502,7 @@
@ cdecl _mbsnbcoll(str str long) @ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr) @ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long) @ cdecl _mbsnbcpy(ptr str long)
@ stub _mbsnbcpy_l @ cdecl _mbsnbcpy_l(ptr str long ptr)
@ cdecl _mbsnbcpy_s(ptr long str long) @ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr) @ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long) @ cdecl _mbsnbicmp(str str long)
......
...@@ -806,7 +806,7 @@ ...@@ -806,7 +806,7 @@
@ cdecl _mbsnbcoll(str str long) @ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr) @ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long) @ cdecl _mbsnbcpy(ptr str long)
@ stub _mbsnbcpy_l @ cdecl _mbsnbcpy_l(ptr str long ptr)
@ cdecl _mbsnbcpy_s(ptr long str long) @ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr) @ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long) @ cdecl _mbsnbicmp(str str long)
......
...@@ -784,7 +784,7 @@ ...@@ -784,7 +784,7 @@
@ cdecl _mbsnbcoll(str str long) @ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr) @ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long) @ cdecl _mbsnbcpy(ptr str long)
@ stub _mbsnbcpy_l @ cdecl _mbsnbcpy_l(ptr str long ptr)
@ cdecl _mbsnbcpy_s(ptr long str long) @ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr) @ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long) @ cdecl _mbsnbicmp(str str long)
......
...@@ -993,39 +993,58 @@ int CDECL _mbscpy_s(unsigned char *dst, size_t size, const unsigned char *src) ...@@ -993,39 +993,58 @@ int CDECL _mbscpy_s(unsigned char *dst, size_t size, const unsigned char *src)
} }
/********************************************************************* /*********************************************************************
* _mbsnbcpy(MSVCRT.@) * _mbsnbcpy_l(MSVCRT.@)
* REMARKS * REMARKS
* Like strncpy this function doesn't enforce the string to be * Like strncpy this function doesn't enforce the string to be
* NUL-terminated * NUL-terminated
*/ */
unsigned char* CDECL _mbsnbcpy(unsigned char* dst, const unsigned char* src, size_t n) unsigned char* CDECL _mbsnbcpy_l(unsigned char* dst, const unsigned char* src, size_t n, _locale_t locale)
{ {
unsigned char* ret = dst; unsigned char* ret = dst;
if(!n) pthreadmbcinfo mbcinfo;
return dst;
if(get_mbcinfo()->ismbcodepage) if (!n)
{ return dst;
BOOL is_lead = FALSE; if (!MSVCRT_CHECK_PMT(dst && src))
while (*src && n) return NULL;
if (locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
if (mbcinfo->ismbcodepage)
{ {
is_lead = (!is_lead && _ismbblead(*src)); BOOL is_lead = FALSE;
n--; while (*src && n)
*dst++ = *src++; {
} is_lead = (!is_lead && _ismbblead_l(*src, locale));
n--;
*dst++ = *src++;
}
if (is_lead) /* if string ends with a lead, remove it */ if (is_lead) /* if string ends with a lead, remove it */
*(dst - 1) = 0; *(dst - 1) = 0;
} }
else else
{
while (n)
{ {
n--; while (n)
if (!(*dst++ = *src++)) break; {
n--;
if (!(*dst++ = *src++)) break;
}
} }
} while (n--) *dst++ = 0;
while (n--) *dst++ = 0; return ret;
return ret; }
/*********************************************************************
* _mbsnbcpy(MSVCRT.@)
* REMARKS
* Like strncpy this function doesn't enforce the string to be
* NUL-terminated
*/
unsigned char* CDECL _mbsnbcpy(unsigned char* dst, const unsigned char* src, size_t n)
{
return _mbsnbcpy_l(dst, src, n, NULL);
} }
/********************************************************************* /*********************************************************************
......
...@@ -755,7 +755,7 @@ ...@@ -755,7 +755,7 @@
@ cdecl _mbsnbcoll(str str long) @ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr) @ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long) @ cdecl _mbsnbcpy(ptr str long)
# stub _mbsnbcpy_l(ptr str long ptr) @ cdecl _mbsnbcpy_l(ptr str long ptr)
@ cdecl _mbsnbcpy_s(ptr long str long) @ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr) @ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long) @ cdecl _mbsnbicmp(str str long)
......
...@@ -650,7 +650,7 @@ ...@@ -650,7 +650,7 @@
@ cdecl _mbsnbcoll(str str long) @ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr) @ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long) @ cdecl _mbsnbcpy(ptr str long)
@ stub _mbsnbcpy_l @ cdecl _mbsnbcpy_l(ptr str long ptr)
@ cdecl _mbsnbcpy_s(ptr long str long) @ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr) @ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long) @ cdecl _mbsnbicmp(str str long)
...@@ -1219,7 +1219,7 @@ ...@@ -1219,7 +1219,7 @@
@ cdecl _o__mbsnbcoll(str str long) _mbsnbcoll @ cdecl _o__mbsnbcoll(str str long) _mbsnbcoll
@ cdecl _o__mbsnbcoll_l(str str long ptr) _mbsnbcoll_l @ cdecl _o__mbsnbcoll_l(str str long ptr) _mbsnbcoll_l
@ cdecl _o__mbsnbcpy(ptr str long) _mbsnbcpy @ cdecl _o__mbsnbcpy(ptr str long) _mbsnbcpy
@ stub _o__mbsnbcpy_l @ cdecl _o__mbsnbcpy_l(ptr str long ptr) _mbsnbcpy_l
@ cdecl _o__mbsnbcpy_s(ptr long str long) _mbsnbcpy_s @ cdecl _o__mbsnbcpy_s(ptr long str long) _mbsnbcpy_s
@ cdecl _o__mbsnbcpy_s_l(ptr long str long ptr) _mbsnbcpy_s_l @ cdecl _o__mbsnbcpy_s_l(ptr long str long ptr) _mbsnbcpy_s_l
@ cdecl _o__mbsnbicmp(str str long) _mbsnbicmp @ cdecl _o__mbsnbicmp(str str long) _mbsnbicmp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment