]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/TerminalDxe/Vtutf8.c
Check the serial buffer empty status before performing the serial IO reading operation.
[mirror_edk2.git] / MdeModulePkg / Universal / Console / TerminalDxe / Vtutf8.c
index b5ecbe5b823e6644a7374eb2b06b2ef3206cc702..586e8ab769d982ad455fd3a508b661f966618d89 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Implementation of translation upon VT-UTF8.\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, 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
@@ -36,7 +36,7 @@ VTUTF8RawDataToUnicode (
   // and translate it into unicode, then push\r
   // the unicode into unicode fifo, until the raw fifo is empty.\r
   //\r
-  while (!IsRawFiFoEmpty (TerminalDevice)) {\r
+  while (!IsRawFiFoEmpty (TerminalDevice) && !IsUnicodeFiFoFull (TerminalDevice)) {\r
 \r
     GetOneValidUtf8Char (TerminalDevice, &Utf8Char, &ValidBytes);\r
 \r
@@ -145,10 +145,11 @@ GetOneValidUtf8Char (
       // 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 > 2) {\r
+        if (Index == 1) {\r
+          Utf8Char->Utf8_3[1] = Temp;\r
+          Index++;\r
+        } else {\r
+          Utf8Char->Utf8_3[0] = Temp;\r
           FetchFlag = FALSE;\r
         }\r
       } else {\r