]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiLib/Console.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / UefiLib / Console.c
index e5b04849d8b9ca0daf956f20ceddbc787b83b795..c37e3d0f58108fdeee5e4852fdf71d1e7fa11a3f 100644 (file)
@@ -6,24 +6,22 @@
 \r
 **/\r
 \r
-\r
-\r
-\r
 #include "UefiLibInternal.h"\r
 \r
 typedef struct {\r
-  CHAR16  WChar;\r
-  UINT32  Width;\r
+  CHAR16    WChar;\r
+  UINT32    Width;\r
 } UNICODE_WIDTH_ENTRY;\r
 \r
-#define NARROW_CHAR         0xFFF0\r
-#define WIDE_CHAR           0xFFF1\r
+#define NARROW_CHAR  0xFFF0\r
+#define WIDE_CHAR    0xFFF1\r
 \r
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY  mUnicodeWidthTable[] = {\r
   //\r
   // General script area\r
   //\r
-  {(CHAR16)0x1FFF,  1},\r
+  { (CHAR16)0x1FFF, 1 },\r
+\r
   /*\r
    * Merge the blocks and replace them with the above entry as they fall to\r
    * the same category and they are all narrow glyph. This will reduce search\r
@@ -70,7 +68,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
   //\r
   // Symbol area\r
   //\r
-  {(CHAR16)0x2FFF,  1},\r
+  { (CHAR16)0x2FFF, 1 },\r
+\r
   /*\r
    * Merge the blocks and replace them with the above entry as they fall to\r
    * the same category and they are all narrow glyph. This will reduce search\r
@@ -102,7 +101,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
   //\r
   // CJK phonetics and symbol area\r
   //\r
-  {(CHAR16)0x33FF,  2},\r
+  { (CHAR16)0x33FF, 2 },\r
+\r
   /*\r
    * Merge the blocks and replace them with the above entry as they fall to\r
    * the same category and they are all wide glyph. This will reduce search\r
@@ -125,7 +125,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
   //\r
   // CJK ideograph area\r
   //\r
-  {(CHAR16)0x9FFF,  2},\r
+  { (CHAR16)0x9FFF, 2 },\r
+\r
   /*\r
    * Merge the blocks and replace them with the above entry as they fall to\r
    * the same category and they are all wide glyph. This will reduce search\r
@@ -142,12 +143,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
   //\r
   // Reserved\r
   //\r
-  {(CHAR16)0xABFF,  0},       // Reserved. 0xA000-0xA490 as Yi syllables. 0xA490-0xA4D0\r
+  { (CHAR16)0xABFF, 0 },       // Reserved. 0xA000-0xA490 as Yi syllables. 0xA490-0xA4D0\r
   // as Yi radicals in ver3.0. 0xA000-0xABFF\r
   //\r
   // Hangul syllables\r
   //\r
-  {(CHAR16)0xD7FF,  2},\r
+  { (CHAR16)0xD7FF, 2 },\r
+\r
   /*\r
    * Merge the blocks and replace them with the above entry as they fall to\r
    * the same category and they are all wide glyph. This will reduce search\r
@@ -163,26 +165,26 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
   //\r
   // Surrogates area\r
   //\r
-  {(CHAR16)0xDFFF,  0},       // Surrogates, not used now. 0xD800-0xDFFF\r
+  { (CHAR16)0xDFFF, 0 },       // Surrogates, not used now. 0xD800-0xDFFF\r
 \r
   //\r
   // Private use area\r
   //\r
-  {(CHAR16)0xF8FF,  0},       // Private use area. 0xE000-0xF8FF\r
+  { (CHAR16)0xF8FF, 0 },       // Private use area. 0xE000-0xF8FF\r
 \r
   //\r
   // Compatibility area and specials\r
   //\r
-  {(CHAR16)0xFAFF,  2},       // CJK compatibility ideographs. 0xF900-0xFAFF\r
-  {(CHAR16)0xFB4F,  1},       // Alphabetic presentation forms. 0xFB00-0xFB4F\r
-  {(CHAR16)0xFDFF,  1},       // Arabic presentation forms-A. 0xFB50-0xFDFF\r
-  {(CHAR16)0xFE1F,  0},       // Reserved. As variation selectors in ver3.0. 0xFE00-0xFE1F\r
-  {(CHAR16)0xFE2F,  1},       // Combining half marks. 0xFE20-0xFE2F\r
-  {(CHAR16)0xFE4F,  2},       // CJK compatibility forms. 0xFE30-0xFE4F\r
-  {(CHAR16)0xFE6F,  1},       // Small Form Variants. 0xFE50-0xFE6F\r
-  {(CHAR16)0xFEFF,  1},       // Arabic presentation forms-B. 0xFE70-0xFEFF\r
-  {(CHAR16)0xFFEF,  1},       // Half width and full width forms. 0xFF00-0xFFEF\r
-  {(CHAR16)0xFFFF,  0},       // Speicials. 0xFFF0-0xFFFF\r
+  { (CHAR16)0xFAFF, 2 },       // CJK compatibility ideographs. 0xF900-0xFAFF\r
+  { (CHAR16)0xFB4F, 1 },       // Alphabetic presentation forms. 0xFB00-0xFB4F\r
+  { (CHAR16)0xFDFF, 1 },       // Arabic presentation forms-A. 0xFB50-0xFDFF\r
+  { (CHAR16)0xFE1F, 0 },       // Reserved. As variation selectors in ver3.0. 0xFE00-0xFE1F\r
+  { (CHAR16)0xFE2F, 1 },       // Combining half marks. 0xFE20-0xFE2F\r
+  { (CHAR16)0xFE4F, 2 },       // CJK compatibility forms. 0xFE30-0xFE4F\r
+  { (CHAR16)0xFE6F, 1 },       // Small Form Variants. 0xFE50-0xFE6F\r
+  { (CHAR16)0xFEFF, 1 },       // Arabic presentation forms-B. 0xFE70-0xFEFF\r
+  { (CHAR16)0xFFEF, 1 },       // Half width and full width forms. 0xFF00-0xFFEF\r
+  { (CHAR16)0xFFFF, 0 },       // Speicials. 0xFFF0-0xFFFF\r
 };\r
 \r
 /**\r
@@ -204,14 +206,14 @@ GetGlyphWidth (
   IN CHAR16  UnicodeChar\r
   )\r
 {\r
-  UINTN                     Index;\r
-  UINTN                     Low;\r
-  UINTN                     High;\r
-  CONST UNICODE_WIDTH_ENTRY *Item;\r
-\r
-  Item  = NULL;\r
-  Low   = 0;\r
-  High  = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1;\r
+  UINTN                      Index;\r
+  UINTN                      Low;\r
+  UINTN                      High;\r
+  CONST UNICODE_WIDTH_ENTRY  *Item;\r
+\r
+  Item = NULL;\r
+  Low  = 0;\r
+  High = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1;\r
   while (Low <= High) {\r
     Index = (Low + High) >> 1;\r
     Item  = &(mUnicodeWidthTable[Index]);\r
@@ -264,8 +266,8 @@ UnicodeStringDisplayLength (
   IN CONST CHAR16  *String\r
   )\r
 {\r
-  UINTN      Length;\r
-  UINTN      Width;\r
+  UINTN  Length;\r
+  UINTN  Width;\r
 \r
   if (String == NULL) {\r
     return 0;\r
@@ -304,32 +306,32 @@ UnicodeStringDisplayLength (
 **/\r
 UINTN\r
 UefiLibGetStringWidth (\r
-  IN  CHAR16               *String,\r
-  IN  BOOLEAN              LimitLen,\r
-  IN  UINTN                MaxWidth,\r
-  OUT UINTN                *Offset\r
+  IN  CHAR16   *String,\r
+  IN  BOOLEAN  LimitLen,\r
+  IN  UINTN    MaxWidth,\r
+  OUT UINTN    *Offset\r
   )\r
 {\r
-  UINTN Index;\r
-  UINTN Count;\r
-  UINTN IncrementValue;\r
+  UINTN  Index;\r
+  UINTN  Count;\r
+  UINTN  IncrementValue;\r
 \r
   if (String == NULL) {\r
     return 0;\r
   }\r
 \r
-  Index           = 0;\r
-  Count           = 0;\r
-  IncrementValue  = 1;\r
+  Index          = 0;\r
+  Count          = 0;\r
+  IncrementValue = 1;\r
 \r
   do {\r
     //\r
     // Advance to the null-terminator or to the first width directive\r
     //\r
-    for (;(String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0); Index++) {\r
+    for ( ; (String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0); Index++) {\r
       Count = Count + IncrementValue;\r
 \r
-      if (LimitLen && Count > MaxWidth) {\r
+      if (LimitLen && (Count > MaxWidth)) {\r
         break;\r
       }\r
     }\r
@@ -341,7 +343,7 @@ UefiLibGetStringWidth (
       break;\r
     }\r
 \r
-    if (LimitLen && Count > MaxWidth) {\r
+    if (LimitLen && (Count > MaxWidth)) {\r
       *Offset = Index;\r
       break;\r
     }\r
@@ -415,12 +417,13 @@ CreatePopUp (
   // number of lines in the popup\r
   //\r
   VA_START (Args, Key);\r
-  MaxLength = 0;\r
+  MaxLength     = 0;\r
   NumberOfLines = 0;\r
   while ((String = VA_ARG (Args, CHAR16 *)) != NULL) {\r
     MaxLength = MAX (MaxLength, UefiLibGetStringWidth (String, FALSE, 0, NULL) / 2);\r
     NumberOfLines++;\r
   }\r
+\r
   VA_END (Args);\r
 \r
   //\r
@@ -518,8 +521,10 @@ CreatePopUp (
       ConOut->OutputString (ConOut, TmpString);\r
       FreePool (TmpString);\r
     }\r
+\r
     NumberOfLines--;\r
   }\r
+\r
   VA_END (Args);\r
 \r
   //\r
@@ -540,9 +545,9 @@ CreatePopUp (
   //\r
   // Restore the cursor visibility, position, and attributes\r
   //\r
-  ConOut->EnableCursor      (ConOut, SavedConsoleMode.CursorVisible);\r
+  ConOut->EnableCursor (ConOut, SavedConsoleMode.CursorVisible);\r
   ConOut->SetCursorPosition (ConOut, SavedConsoleMode.CursorColumn, SavedConsoleMode.CursorRow);\r
-  ConOut->SetAttribute      (ConOut, SavedConsoleMode.Attribute);\r
+  ConOut->SetAttribute (ConOut, SavedConsoleMode.Attribute);\r
 \r
   //\r
   // Wait for a keystroke\r
@@ -560,6 +565,7 @@ CreatePopUp (
       if (Status != EFI_NOT_READY) {\r
         continue;\r
       }\r
+\r
       gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
     }\r
   }\r