branch update for HEAD-2003021201
[reactos.git] / lib / msvcrt / wstring / wcsncmp.c
index e661043..a3e0746 100644 (file)
@@ -1,9 +1,10 @@
 #include <msvcrt/wchar.h>
 
-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