X-Git-Url: http://git.jankratochvil.net/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmsvcrt%2Fwstring%2Fwcsncmp.c;fp=lib%2Fmsvcrt%2Fwstring%2Fwcsncmp.c;h=a3e0746f0d46042d46bdf09b0f91c5f10f5d84ab;hb=e3ed2d773259cc445c7ff8181ebd934931365328;hp=e661043f2f98eb8eb0308fa1d04726c311bd5c6d;hpb=d378c68f5a9bb25c9e671dacd482d2e25d211df3;p=reactos.git diff --git a/lib/msvcrt/wstring/wcsncmp.c b/lib/msvcrt/wstring/wcsncmp.c index e661043..a3e0746 100644 --- a/lib/msvcrt/wstring/wcsncmp.c +++ b/lib/msvcrt/wstring/wcsncmp.c @@ -1,9 +1,10 @@ #include -int wcsncmp(const wchar_t * cs,const wchar_t * ct,size_t count) +#if 0 + +int wcsncmp(const wchar_t* cs, const wchar_t* ct, size_t count) { - while ((*cs) == (*ct) && count > 0) - { + while ((*cs) == (*ct) && count > 0) { if (*cs == 0) return 0; cs++; @@ -11,6 +12,22 @@ int wcsncmp(const wchar_t * cs,const wchar_t * ct,size_t count) count--; } return (*cs) - (*ct); - } +#else + +int wcsncmp(const wchar_t* cs, const wchar_t* ct, size_t count) +{ + if (count == 0) + return 0; + do { + if (*cs != *ct++) + //return *(unsigned const char *)cs - *(unsigned const char *)--ct; + return (*cs) - (*(--ct)); + if (*cs++ == 0) + break; + } while (--count != 0); + return 0; +} + +#endif