[KERNEL32] Add missed type-casting
authorDmitry Chapyshev <dmitry@reactos.org>
Sun, 18 Sep 2016 20:11:05 +0000 (20:11 +0000)
committerDmitry Chapyshev <dmitry@reactos.org>
Sun, 18 Sep 2016 20:11:05 +0000 (20:11 +0000)
* Fixes 28 tests for kernel32:codepage

svn path=/trunk/; revision=72733

reactos/dll/win32/kernel32/winnls/string/nls.c

index 8ee4280..07ebeb5 100644 (file)
@@ -476,7 +476,7 @@ IntMultiByteToWideCharCP(UINT CodePage,
 
             while (TempString < MbsEnd)
             {
-                DBCSOffset = CodePageTable->DBCSOffsets[*TempString];
+                DBCSOffset = CodePageTable->DBCSOffsets[(UCHAR)*TempString];
 
                 if (DBCSOffset)
                 {
@@ -487,7 +487,7 @@ IntMultiByteToWideCharCP(UINT CodePage,
                         return 0;
                     }
 
-                    WideChar = CodePageTable->DBCSOffsets[*(TempString + 1) + DBCSOffset];
+                    WideChar = CodePageTable->DBCSOffsets[DBCSOffset + *(TempString + 1)];
 
                     if (WideChar == CodePageTable->UniDefaultChar &&
                         MAKEWORD(*(TempString + 1), *TempString) != CodePageTable->TransUniDefaultChar)
@@ -500,7 +500,7 @@ IntMultiByteToWideCharCP(UINT CodePage,
                 }
                 else
                 {
-                    USHORT WideChar = MultiByteTable[(UCHAR)*TempString];
+                    WideChar = MultiByteTable[(UCHAR)*TempString];
 
                     if ((WideChar == CodePageTable->UniDefaultChar &&
                         *TempString != CodePageTable->TransUniDefaultChar) ||
@@ -568,7 +568,7 @@ IntMultiByteToWideCharCP(UINT CodePage,
 
         return Count;
     }
-    else /* Not DBCS code page */
+    else /* SBCS code page */
     {
         /* Check for invalid characters. */
         if (Flags & MB_ERR_INVALID_CHARS)
@@ -609,7 +609,7 @@ IntMultiByteToWideCharCP(UINT CodePage,
             SetLastError(ERROR_INSUFFICIENT_BUFFER);
             return 0;
         }
-           return MultiByteCount;
+        return MultiByteCount;
     }
 }