mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 13:50:30 +00:00
msvcrt: Add _mbsrev_l implementation.
This commit is contained in:
parent
f73d74c6df
commit
08c603a417
|
@ -1178,7 +1178,7 @@
|
|||
@ cdecl _mbsrchr(str long)
|
||||
@ cdecl _mbsrchr_l(str long ptr)
|
||||
@ cdecl _mbsrev(str)
|
||||
@ stub _mbsrev_l
|
||||
@ cdecl _mbsrev_l(str ptr)
|
||||
@ cdecl _mbsset(ptr long)
|
||||
@ stub _mbsset_l
|
||||
@ stub _mbsset_s
|
||||
|
|
|
@ -1535,7 +1535,7 @@
|
|||
@ cdecl _mbsrchr(str long)
|
||||
@ cdecl _mbsrchr_l(str long ptr)
|
||||
@ cdecl _mbsrev(str)
|
||||
@ stub _mbsrev_l
|
||||
@ cdecl _mbsrev_l(str ptr)
|
||||
@ cdecl _mbsset(ptr long)
|
||||
@ stub _mbsset_l
|
||||
@ stub _mbsset_s
|
||||
|
|
|
@ -1546,7 +1546,7 @@
|
|||
@ cdecl _mbsrchr(str long)
|
||||
@ cdecl _mbsrchr_l(str long ptr)
|
||||
@ cdecl _mbsrev(str)
|
||||
@ stub _mbsrev_l
|
||||
@ cdecl _mbsrev_l(str ptr)
|
||||
@ cdecl _mbsset(ptr long)
|
||||
@ stub _mbsset_l
|
||||
@ stub _mbsset_s
|
||||
|
|
|
@ -850,7 +850,7 @@
|
|||
@ cdecl _mbsrchr(str long)
|
||||
@ cdecl _mbsrchr_l(str long ptr)
|
||||
@ cdecl _mbsrev(str)
|
||||
@ stub _mbsrev_l
|
||||
@ cdecl _mbsrev_l(str ptr)
|
||||
@ cdecl _mbsset(ptr long)
|
||||
@ stub _mbsset_l
|
||||
@ stub _mbsset_s
|
||||
|
|
|
@ -828,7 +828,7 @@
|
|||
@ cdecl _mbsrchr(str long)
|
||||
@ cdecl _mbsrchr_l(str long ptr)
|
||||
@ cdecl _mbsrev(str)
|
||||
@ stub _mbsrev_l
|
||||
@ cdecl _mbsrev_l(str ptr)
|
||||
@ cdecl _mbsset(ptr long)
|
||||
@ stub _mbsset_l
|
||||
@ stub _mbsset_s
|
||||
|
|
|
@ -160,6 +160,11 @@ static inline unsigned char *u_strrchr( const unsigned char *s, unsigned char x
|
|||
return (unsigned char*) strrchr( (const char*)s, x );
|
||||
}
|
||||
|
||||
static inline unsigned char* u__strrev(unsigned char *str)
|
||||
{
|
||||
return (unsigned char*)_strrev((char *)str);
|
||||
}
|
||||
|
||||
static inline unsigned char *u__strset( unsigned char *s, unsigned char c )
|
||||
{
|
||||
return (unsigned char*) _strset( (char*)s, c);
|
||||
|
@ -2848,13 +2853,27 @@ size_t CDECL _mbscspn(const unsigned char* str, const unsigned char* cmp)
|
|||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _mbsrev (MSVCRT.@)
|
||||
* _mbsrev_l (MSVCRT.@)
|
||||
*/
|
||||
unsigned char* CDECL _mbsrev(unsigned char* str)
|
||||
unsigned char* CDECL _mbsrev_l(unsigned char* str, _locale_t locale)
|
||||
{
|
||||
int i, len = _mbslen(str);
|
||||
unsigned char *p, *temp=malloc(len*2);
|
||||
int i, len;
|
||||
unsigned char *p, *temp;
|
||||
pthreadmbcinfo mbcinfo;
|
||||
|
||||
if (!MSVCRT_CHECK_PMT(str))
|
||||
return NULL;
|
||||
|
||||
if (locale)
|
||||
mbcinfo = locale->mbcinfo;
|
||||
else
|
||||
mbcinfo = get_mbcinfo();
|
||||
|
||||
if (!mbcinfo->ismbcodepage)
|
||||
return u__strrev(str);
|
||||
|
||||
len = _mbslen_l(str, locale);
|
||||
temp = malloc(len * 2);
|
||||
if (!temp)
|
||||
return str;
|
||||
|
||||
|
@ -2862,7 +2881,7 @@ unsigned char* CDECL _mbsrev(unsigned char* str)
|
|||
p = str;
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (_ismbblead(*p))
|
||||
if (_ismbblead_l(*p, locale))
|
||||
{
|
||||
temp[i * 2] = *p++;
|
||||
temp[i * 2 + 1] = *p++;
|
||||
|
@ -2878,7 +2897,7 @@ unsigned char* CDECL _mbsrev(unsigned char* str)
|
|||
p = str;
|
||||
for (i = len - 1; i >= 0; i--)
|
||||
{
|
||||
if(_ismbblead(temp[i*2]))
|
||||
if (_ismbblead_l(temp[i * 2], locale))
|
||||
{
|
||||
*p++ = temp[i * 2];
|
||||
*p++ = temp[i * 2 + 1];
|
||||
|
@ -2890,10 +2909,17 @@ unsigned char* CDECL _mbsrev(unsigned char* str)
|
|||
}
|
||||
|
||||
free(temp);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _mbsrev (MSVCRT.@)
|
||||
*/
|
||||
unsigned char* CDECL _mbsrev(unsigned char* str)
|
||||
{
|
||||
return _mbsrev_l(str, NULL);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _mbspbrk_l (MSVCRT.@)
|
||||
*/
|
||||
|
|
|
@ -799,7 +799,7 @@
|
|||
@ cdecl _mbsrchr(str long)
|
||||
@ cdecl _mbsrchr_l(str long ptr)
|
||||
@ cdecl _mbsrev(str)
|
||||
# stub _mbsrev_l(str ptr)
|
||||
@ cdecl _mbsrev_l(str ptr)
|
||||
@ cdecl _mbsset(ptr long)
|
||||
# stub _mbsset_l(ptr long ptr)
|
||||
# stub _mbsset_s(ptr long long)
|
||||
|
|
|
@ -694,7 +694,7 @@
|
|||
@ cdecl _mbsrchr(str long)
|
||||
@ cdecl _mbsrchr_l(str long ptr)
|
||||
@ cdecl _mbsrev(str)
|
||||
@ stub _mbsrev_l
|
||||
@ cdecl _mbsrev_l(str ptr)
|
||||
@ cdecl _mbsset(ptr long)
|
||||
@ stub _mbsset_l
|
||||
@ stub _mbsset_s
|
||||
|
@ -1263,7 +1263,7 @@
|
|||
@ cdecl _o__mbsrchr(str long) _mbsrchr
|
||||
@ cdecl _o__mbsrchr_l(str long ptr) _mbsrchr_l
|
||||
@ cdecl _o__mbsrev(str) _mbsrev
|
||||
@ stub _o__mbsrev_l
|
||||
@ cdecl _o__mbsrev_l(str ptr) _mbsrev_l
|
||||
@ cdecl _o__mbsset(ptr long) _mbsset
|
||||
@ stub _o__mbsset_l
|
||||
@ stub _o__mbsset_s
|
||||
|
|
Loading…
Reference in a new issue