From 7ccf8bc87d055be0edff13a2285894cd14b31617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Gouget?= Date: Tue, 2 Apr 2002 02:42:58 +0000 Subject: [PATCH] Implemented _mbsnbicmp. --- dlls/msvcrt/mbcs.c | 45 +++++++++++++++++++++++++++++++++++++++++ dlls/msvcrt/msvcrt.spec | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index 37572310c86..5714aa0223c 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -411,6 +411,51 @@ int _mbsnicmp(const unsigned char* str, const unsigned char* cmp, MSVCRT_size_t return strncasecmp(str, cmp, len); /* ASCII CP */ } +/********************************************************************* + * _mbsnbicmp(MSVCRT.@) + */ +int _mbsnbicmp(const unsigned char* str, const unsigned char* cmp, MSVCRT_size_t len) +{ + if (!len) + return 0; + if(MSVCRT___mb_cur_max > 1) + { + unsigned int strc, cmpc; + while (len) + { + int clen; + if(!*str) + return *cmp ? -1 : 0; + if(!*cmp) + return 1; + if (MSVCRT_isleadbyte(*str)) + { + strc=(len>=2)?_mbsnextc(str):0; + clen=2; + } + else + { + strc=*str; + clen=1; + } + if (MSVCRT_isleadbyte(*cmp)) + cmpc=(len>=2)?_mbsnextc(cmp):0; + else + cmpc=*str; + strc = _mbctolower(strc); + cmpc = _mbctolower(cmpc); + if(strc != cmpc) + return strc < cmpc ? -1 : 1; + len -= clen; + str += clen; + cmp += clen; + } + return 0; /* Matched len bytes */ + FIXME("%s %s %d\n",str,cmp,len); + } + return strncmp(str,cmp,len); +} + /********************************************************************* * _mbschr(MSVCRT.@) * diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 88663c66256..30e56e03909 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -370,7 +370,7 @@ debug_channels (msvcrt) @ cdecl _mbsnbcnt(ptr long) _mbsnbcnt @ stub _mbsnbcoll #(str str long) @ cdecl _mbsnbcpy(ptr str long) _mbsnbcpy -@ stub _mbsnbicmp #(str str long) +@ cdecl _mbsnbicmp(str str long) _mbsnbicmp @ stub _mbsnbicoll #(str str long) @ stub _mbsnbset #(str long long) @ cdecl _mbsncat(str str long) _mbsncat