Improved unicode fileio support.
[reactos.git] / reactos / lib / msvcrt / wstring / wcsncmp.c
index 2119483..a3e0746 100644 (file)
@@ -1,10 +1,10 @@
-#include <msvcrti.h>
+#include <msvcrt/wchar.h>
 
+#if 0
 
-int wcsncmp(const wchar_t * cs,const wchar_t * ct,size_t count)
+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++;
@@ -12,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