]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/TerminalDxe/Vtutf8.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / Console / TerminalDxe / Vtutf8.c
index 179f718e15d52f48bf8a5266b98c1ebe253f664a..51cc093a41ad7b4ada7051e095609441e94da525 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Implementation of translation upon VT-UTF8.\r
 \r
-Copyright (c) 2006, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "Terminal.h"\r
 \r
 /**\r
-  Translate all VT-UTF8 characters in the Raw FIFI into unicode characters, \r
+  Translate all VT-UTF8 characters in the Raw FIFI into unicode characters,\r
   and insert them into Unicode FIFO.\r
 \r
   @param TerminalDevice          The terminal device.\r
@@ -55,7 +55,7 @@ VTUTF8RawDataToUnicode (
 \r
   @param  Utf8Device          The terminal device.\r
   @param  Utf8Char            Returned valid VT-UTF8 characters set.\r
-  @param  ValidBytes          The count of returned VT-VTF8 characters. \r
+  @param  ValidBytes          The count of returned VT-VTF8 characters.\r
                               If ValidBytes is zero, no valid VT-UTF8 returned.\r
 \r
 **/\r
@@ -125,6 +125,9 @@ GetOneValidUtf8Char (
       break;\r
 \r
     case 2:\r
+      //\r
+      // two-byte utf8 char go on\r
+      //\r
       if ((Temp & 0xc0) == 0x80) {\r
 \r
         Utf8Char->Utf8_2[0] = Temp;\r
@@ -138,15 +141,20 @@ GetOneValidUtf8Char (
       break;\r
 \r
     case 3:\r
+      //\r
+      // three-byte utf8 char go on\r
+      //\r
       if ((Temp & 0xc0) == 0x80) {\r
 \r
         Utf8Char->Utf8_3[2 - Index] = Temp;\r
         Index++;\r
-        if (Index == 3) {\r
+        if (Index > 2) {\r
           FetchFlag = FALSE;\r
         }\r
       } else {\r
-\r
+        //\r
+        // reset *ValidBytes and Index to zero, let valid utf8 char search restart\r
+        //\r
         *ValidBytes = 0;\r
         Index       = 0;\r
       }\r
@@ -164,7 +172,7 @@ GetOneValidUtf8Char (
   return ;\r
 }\r
 \r
-/** \r
+/**\r
   Translate VT-UTF8 characters into one Unicode character.\r
 \r
   UTF8 Encoding Table\r
@@ -176,7 +184,7 @@ GetOneValidUtf8Char (
 \r
   @param  Utf8Char         VT-UTF8 character set needs translating.\r
   @param  ValidBytes       The count of valid VT-UTF8 characters.\r
-  @param  UnicodeChar      Returned unicode character. \r
+  @param  UnicodeChar      Returned unicode character.\r
 \r
 **/\r
 VOID\r
@@ -237,7 +245,7 @@ Utf8ToUnicode (
   return ;\r
 }\r
 \r
-/** \r
+/**\r
   Translate one Unicode character into VT-UTF8 characters.\r
 \r
   UTF8 Encoding Table\r
@@ -301,8 +309,8 @@ UnicodeToUtf8 (
   Check if input string is valid VT-UTF8 string.\r
 \r
   @param  TerminalDevice          The terminal device.\r
-  @param  WString                 The input string.          \r
\r
+  @param  WString                 The input string.\r
+\r
   @retval EFI_SUCCESS             If all input characters are valid.\r
 \r
 **/\r