- See if it is a multibyte code page.
authorDmitry Gorbachev <gorbachev@reactos.org>
Tue, 13 Oct 2009 18:43:42 +0000 (18:43 +0000)
committerDmitry Gorbachev <gorbachev@reactos.org>
Tue, 13 Oct 2009 18:43:42 +0000 (18:43 +0000)
- Remove check against zero.
- Fix comments, formatting.

svn path=/trunk/; revision=43439

reactos/lib/rtl/unicode.c

index bafe8c5..aa1c70e 100644 (file)
@@ -401,40 +401,52 @@ RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString)
 
 /*
  * @implemented
- * 
+ *
  * NOTES
- *  Check the oem-string to match the uincoded-string.
+ *  Check the OEM string to match the Unicode string.
  *
- *  Functions who convert unicode strings to oem strings will set a DefaultChar from 
- *  the OemCodepage when the character are unknown. So check it against the unicode string
- *  and return false when the unicode string not contain an TransDefaultChar.
+ *  Functions which convert Unicode strings to OEM strings will set a
+ *  DefaultChar from the OEM codepage when the characters are unknown.
+ *  So check it against the Unicode string and return false when the
+ *  Unicode string does not contain a TransDefaultChar.
  */
 BOOLEAN
 NTAPI
 RtlpDidUnicodeToOemWork(IN PCUNICODE_STRING UnicodeString,
                         IN POEM_STRING OemString)
 {
-   ULONG i = 0;
+    ULONG i = 0;
 
-   /* Go through all characters of a string */
-   while (i < OemString->Length)
-   {
-       /* Check if it got translated into '?', but source char
-          wasn't '?' equivalent */
-       if ((OemString->Buffer[i] != 0) &&
-           (OemString->Buffer[i] == NlsOemDefaultChar) &&
-           (UnicodeString->Buffer[i] != NlsUnicodeDefaultChar))
-       {
-           /* Yes, it means unmappable characters were found */
-           return FALSE;
-       }
-
-       /* Move to the next char */
-       i++;
-   }
+    if (NlsMbOemCodePageTag == FALSE)
+    {
+        /* single-byte code page */
+        /* Go through all characters of a string */
+        while (i < OemString->Length)
+        {
+            /* Check if it got translated into a default char,
+             * but source char wasn't a default char equivalent
+             */
+            if ((OemString->Buffer[i] == NlsOemDefaultChar) &&
+                (UnicodeString->Buffer[i] != NlsUnicodeDefaultChar))
+            {
+                /* Yes, it means unmappable characters were found */
+                return FALSE;
+            }
 
-   /* All chars were translated successfuly */
-   return TRUE;
+            /* Move to the next char */
+            i++;
+        }
+
+        /* All chars were translated successfuly */
+        return TRUE;
+    }
+    else
+    {
+        /* multibyte code page */
+
+        /* FIXME */
+        return TRUE;
+    }
 }
 
 /*