MdeModulePkg: Replace [Ascii|Unicode]ValueToString
It is the follow up of commits 51f0ceb..9e32e97 to replace AsciiValueToString/UnicodeValueToString with AsciiValueToStringS/UnicodeValueToStringS. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Dynamically update the pages.
|
||||
|
||||
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -734,11 +734,17 @@ UpdateConModePage (
|
||||
//
|
||||
// Build mode string Column x Row
|
||||
//
|
||||
UnicodeValueToString (ModeString, 0, Col, 0);
|
||||
UnicodeValueToStringS (ModeString, sizeof (ModeString), 0, Col, 0);
|
||||
PStr = &ModeString[0];
|
||||
StrnCatS (PStr, ARRAY_SIZE (ModeString), L" x ", StrLen(L" x ") + 1);
|
||||
PStr = PStr + StrLen (PStr);
|
||||
UnicodeValueToString (PStr , 0, Row, 0);
|
||||
UnicodeValueToStringS (
|
||||
PStr,
|
||||
sizeof (ModeString) - ((UINTN)PStr - (UINTN)&ModeString[0]),
|
||||
0,
|
||||
Row,
|
||||
0
|
||||
);
|
||||
|
||||
ModeToken[Index] = HiiSetString (CallbackData->BmmHiiHandle, 0, ModeString, NULL);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
The device manager reference implementation
|
||||
|
||||
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -148,7 +148,14 @@ GetMacAddressString(
|
||||
//
|
||||
HwAddress = &MacAddressNode->MacAddress.Addr[0];
|
||||
for (Index = 0; Index < HwAddressSize; Index++) {
|
||||
String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(HwAddress++), 2);
|
||||
UnicodeValueToStringS (
|
||||
String,
|
||||
BufferLen - ((UINTN)String - (UINTN)*PBuffer),
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
*(HwAddress++),
|
||||
2
|
||||
);
|
||||
String += StrnLenS (String, (BufferLen - ((UINTN)String - (UINTN)*PBuffer)) / sizeof (CHAR16));
|
||||
if (Index < HwAddressSize - 1) {
|
||||
*String++ = L':';
|
||||
}
|
||||
@@ -168,7 +175,14 @@ GetMacAddressString(
|
||||
|
||||
if (VlanId != 0) {
|
||||
*String++ = L'\\';
|
||||
String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, VlanId, 4);
|
||||
UnicodeValueToStringS (
|
||||
String,
|
||||
BufferLen - ((UINTN)String - (UINTN)*PBuffer),
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
VlanId,
|
||||
4
|
||||
);
|
||||
String += StrnLenS (String, (BufferLen - ((UINTN)String - (UINTN)*PBuffer)) / sizeof (CHAR16));
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
DXE capsule report related function.
|
||||
|
||||
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -377,7 +377,13 @@ InitCapsuleUpdateVariable (
|
||||
Index = 0;
|
||||
while (TRUE) {
|
||||
if (Index > 0) {
|
||||
UnicodeValueToString (TempVarName, 0, Index, 0);
|
||||
UnicodeValueToStringS (
|
||||
TempVarName,
|
||||
sizeof (CapsuleVarName) - ((UINTN)TempVarName - (UINTN)CapsuleVarName),
|
||||
0,
|
||||
Index,
|
||||
0
|
||||
);
|
||||
}
|
||||
Status = gRT->SetVariable (
|
||||
CapsuleVarName,
|
||||
|
@@ -2225,6 +2225,7 @@ NetLibGetMacString (
|
||||
UINT16 VlanId;
|
||||
CHAR16 *String;
|
||||
UINTN Index;
|
||||
UINTN BufferSize;
|
||||
|
||||
ASSERT (MacString != NULL);
|
||||
|
||||
@@ -2241,7 +2242,8 @@ NetLibGetMacString (
|
||||
// If VLAN is configured, it will need extra 5 characters like "\0005".
|
||||
// Plus one unicode character for the null-terminator.
|
||||
//
|
||||
String = AllocateZeroPool ((2 * HwAddressSize + 5 + 1) * sizeof (CHAR16));
|
||||
BufferSize = (2 * HwAddressSize + 5 + 1) * sizeof (CHAR16);
|
||||
String = AllocateZeroPool (BufferSize);
|
||||
if (String == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@@ -2252,7 +2254,14 @@ NetLibGetMacString (
|
||||
//
|
||||
HwAddress = &MacAddress.Addr[0];
|
||||
for (Index = 0; Index < HwAddressSize; Index++) {
|
||||
String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(HwAddress++), 2);
|
||||
UnicodeValueToStringS (
|
||||
String,
|
||||
BufferSize - ((UINTN)String - (UINTN)*MacString),
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
*(HwAddress++),
|
||||
2
|
||||
);
|
||||
String += StrnLenS (String, (BufferSize - ((UINTN)String - (UINTN)*MacString)) / sizeof (CHAR16));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2261,7 +2270,14 @@ NetLibGetMacString (
|
||||
VlanId = NetLibGetVlanId (ServiceHandle);
|
||||
if (VlanId != 0) {
|
||||
*String++ = L'\\';
|
||||
String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, VlanId, 4);
|
||||
UnicodeValueToStringS (
|
||||
String,
|
||||
BufferSize - ((UINTN)String - (UINTN)*MacString),
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
VlanId,
|
||||
4
|
||||
);
|
||||
String += StrnLenS (String, (BufferSize - ((UINTN)String - (UINTN)*MacString)) / sizeof (CHAR16));
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
HII Library implementation that uses DXE protocols and services.
|
||||
|
||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -776,7 +776,14 @@ HiiConstructConfigHdr (
|
||||
// Append Guid converted to <HexCh>32
|
||||
//
|
||||
for (Index = 0, Buffer = (UINT8 *)Guid; Index < sizeof (EFI_GUID); Index++) {
|
||||
String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(Buffer++), 2);
|
||||
UnicodeValueToStringS (
|
||||
String,
|
||||
MaxLen * sizeof (CHAR16) - ((UINTN)String - (UINTN)ReturnString),
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
*(Buffer++),
|
||||
2
|
||||
);
|
||||
String += StrnLenS (String, MaxLen - ((UINTN)String - (UINTN)ReturnString) / sizeof (CHAR16));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,7 +798,14 @@ HiiConstructConfigHdr (
|
||||
// Append Name converted to <Char>NameLength
|
||||
//
|
||||
for (; *Name != L'\0'; Name++) {
|
||||
String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *Name, 4);
|
||||
UnicodeValueToStringS (
|
||||
String,
|
||||
sizeof (CHAR16) * MaxLen - ((UINTN)String - (UINTN)ReturnString),
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
*Name,
|
||||
4
|
||||
);
|
||||
String += StrnLenS (String, MaxLen - ((UINTN)String - (UINTN)ReturnString) / sizeof (CHAR16));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -805,7 +819,14 @@ HiiConstructConfigHdr (
|
||||
// Append the device path associated with DriverHandle converted to <HexChar>DevicePathSize
|
||||
//
|
||||
for (Index = 0, Buffer = (UINT8 *)DevicePath; Index < DevicePathSize; Index++) {
|
||||
String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(Buffer++), 2);
|
||||
UnicodeValueToStringS (
|
||||
String,
|
||||
sizeof (CHAR16) * MaxLen - ((UINTN)String - (UINTN)ReturnString),
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
*(Buffer++),
|
||||
2
|
||||
);
|
||||
String += StrnLenS (String, MaxLen - ((UINTN)String - (UINTN)ReturnString) / sizeof (CHAR16));
|
||||
}
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user