[CRT]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 25 Oct 2015 09:28:57 +0000 (09:28 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 25 Oct 2015 09:28:57 +0000 (09:28 +0000)
Fix NTDLL implementation of mbstowcs() and wcstombs() so that they return length in caracters and not in bytes.

This fixes last failing *to* CRT apitests

CORE-10390

svn path=/trunk/; revision=69683

reactos/lib/sdk/crt/string/mbstowcs_nt.c
reactos/lib/sdk/crt/string/wcstombs_nt.c

index f0d5c2c..0906391 100644 (file)
@@ -49,7 +49,7 @@ size_t mbstowcs (wchar_t *wcstr, const char *mbstr, size_t count)
                                           mbstr,
                                           Length);
 
-               return (size_t)Size;
+               return (size_t)(Size / sizeof(wchar_t));
        }
 
        Status = RtlMultiByteToUnicodeN (wcstr,
@@ -60,7 +60,7 @@ size_t mbstowcs (wchar_t *wcstr, const char *mbstr, size_t count)
        if (!NT_SUCCESS(Status))
                return -1;
 
-       return (size_t)Size;
+       return (size_t)(Size / sizeof(wchar_t));;
 }
 
 /* EOF */
index cf14feb..468955b 100644 (file)
@@ -40,7 +40,7 @@ size_t wcstombs (char *mbstr, const wchar_t *wcstr, size_t count)
                                           (wchar_t*)((size_t)wcstr),
                                           Length * sizeof(WCHAR));
 
-               return (size_t)Size;
+               return (size_t)(Size / sizeof(char));
        }
 
        Status = RtlUnicodeToMultiByteN (mbstr,
@@ -51,7 +51,7 @@ size_t wcstombs (char *mbstr, const wchar_t *wcstr, size_t count)
        if (!NT_SUCCESS(Status))
                return -1;
 
-       return (size_t)Size;
+       return (size_t)(Size / sizeof(char));
 }
 
 /* EOF */