/** @file\r
This module provide help function for displaying unicode string.\r
\r
- Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2013, 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
//\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);\r
- Index++, Count = Count + IncrementValue) {\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
break;\r
}\r
}\r
\r
if (LimitLen && Count > MaxWidth) {\r
- *Offset = Index - 1;\r
+ *Offset = Index;\r
break;\r
}\r
\r
}\r
} while (String[Index] != 0);\r
\r
- //\r
- // Increment by one to include the null-terminator in the size\r
- //\r
- if (!LimitLen) {\r
- Count++;\r
- }\r
-\r
return Count * sizeof (CHAR16);\r
}\r
\r
UINTN Length;\r
CHAR16 *Line;\r
UINTN EventIndex;\r
+ CHAR16 *TmpString;\r
\r
//\r
// Determine the length of the longest line in the popup and the the total \r
// Length > MaxLength\r
//\r
UefiLibGetStringWidth (String, TRUE, MaxLength, &Length);\r
- String[Length] = L'\0';\r
+ TmpString = AllocateZeroPool ((Length + 1) * sizeof (CHAR16));\r
+ ASSERT (TmpString != NULL);\r
+ StrnCpy(TmpString, String, Length - 3);\r
+ StrCat (TmpString, L"...");\r
\r
ConOut->SetCursorPosition (ConOut, Column + 1, Row++);\r
- ConOut->OutputString (ConOut, String);\r
+ ConOut->OutputString (ConOut, TmpString);\r
+ FreePool (TmpString);\r
}\r
NumberOfLines--;\r
}\r