Skip to content
Snippets Groups Projects
Commit 7b3495ac authored by Michael McCormack's avatar Michael McCormack Committed by Alexandre Julliard
Browse files

Implemented multibyte string reverse.

parent c4e40d8f
No related branches found
No related tags found
No related merge requests found
......@@ -602,3 +602,51 @@ int _ismbcspace( unsigned int c)
FIXME("%c\n",c);
return 0;
}
/*********************************************************************
* _mbsrev (MSVCRT.@)
*/
char *_mbsrev(char *str)
{
int i, len = _mbslen(str);
char *p, *temp=MSVCRT_malloc(len*2);
if(!temp)
return str;
/* unpack multibyte string to temp buffer */
p=str;
for(i=0; i<len; i++)
{
if (MSVCRT_isleadbyte(*p))
{
temp[i*2]=*p++;
temp[i*2+1]=*p++;
}
else
{
temp[i*2]=*p++;
temp[i*2+1]=0;
}
}
/* repack it in the reverse order */
p=str;
for(i=len-1; i>=0; i--)
{
if(MSVCRT_isleadbyte(temp[i*2]))
{
*p++=temp[i*2];
*p++=temp[i*2+1];
}
else
{
*p++=temp[i*2];
}
}
MSVCRT_free(temp);
return str;
}
......@@ -385,7 +385,7 @@ debug_channels (msvcrt)
@ cdecl _mbsnset(str long long) _mbsnset
@ stub _mbspbrk #(str str)
@ cdecl _mbsrchr(str long) _mbsrchr
@ stub _mbsrev #(str)
@ cdecl _mbsrev(str) _mbsrev
@ cdecl _mbsset(str long) _mbsset
@ cdecl _mbsspn(str str) _mbsspn
@ stub _mbsspnp #(str str)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment