[ros-diffs] [mjmartin] 39301: - Change MultiByteToWideChar to match windows behavior. Fix part 1 of ? for bug #3740.

mjmartin at svn.reactos.org mjmartin at svn.reactos.org
Tue Feb 3 10:09:07 CET 2009


Author: mjmartin
Date: Tue Feb  3 03:09:06 2009
New Revision: 39301

URL: http://svn.reactos.org/svn/reactos?rev=39301&view=rev
Log:
- Change MultiByteToWideChar to match windows behavior. Fix part 1 of ? for bug #3740.

Modified:
    trunk/reactos/dll/win32/kernel32/misc/nls.c

Modified: trunk/reactos/dll/win32/kernel32/misc/nls.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/nls.c?rev=39301&r1=39300&r2=39301&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/nls.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/nls.c [iso-8859-1] Tue Feb  3 03:09:06 2009
@@ -523,6 +523,14 @@
         if (WideCharCount == 0)
             return MultiByteCount;
 
+        /* Fill the WideCharString buffer with what will fit: Verified on WinXP */
+        for (TempLength = (WideCharCount < MultiByteCount) ? WideCharCount : MultiByteCount;
+            TempLength > 0;
+            MultiByteString++, TempLength--)
+        {
+            *WideCharString++ = CodePageTable->MultiByteTable[(UCHAR)*MultiByteString];
+        }
+
         /* Adjust buffer size. Wine trick ;-) */
         if (WideCharCount < MultiByteCount)
         {
@@ -530,15 +538,7 @@
             SetLastError(ERROR_INSUFFICIENT_BUFFER);
             return 0;
         }
-
-        for (TempLength = MultiByteCount;
-            TempLength > 0;
-            MultiByteString++, TempLength--)
-        {
-            *WideCharString++ = CodePageTable->MultiByteTable[(UCHAR)*MultiByteString];
-        }
-
-        return MultiByteCount;
+	    return MultiByteCount;
     }
 }
 



More information about the Ros-diffs mailing list