From 7b3495ac9316c1cd85480c6c1e5f18850fa6a894 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Thu, 9 Aug 2001 21:37:19 +0000 Subject: [PATCH] Implemented multibyte string reverse. --- dlls/msvcrt/mbcs.c | 48 +++++++++++++++++++++++++++++++++++++++++ dlls/msvcrt/msvcrt.spec | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index 024b701422c..f144e9fa11f 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -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=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; +} + diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index d8b4a676742..3994add2fda 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -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)