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:
Hao Wu 2017-01-18 10:31:02 +08:00
parent 0438f5e287
commit 9f4048f7f8
15 changed files with 256 additions and 58 deletions

View File

@ -1,7 +1,7 @@
/** @file
FrontPage routines to handle the callbacks and browser calls
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
@ -408,9 +408,16 @@ ConvertProcessorToString (
DestMax = 0x20 / sizeof (CHAR16);
StringBuffer = AllocateZeroPool (0x20);
ASSERT (StringBuffer != NULL);
Index = UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 1000, 3);
UnicodeValueToStringS (StringBuffer, sizeof (CHAR16) * DestMax, LEFT_JUSTIFY, FreqMhz / 1000, 3);
Index = StrnLenS (StringBuffer, DestMax);
StrCatS (StringBuffer, DestMax, L".");
UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % 1000) / 10, 2);
UnicodeValueToStringS (
StringBuffer + Index + 1,
sizeof (CHAR16) * (DestMax - (Index + 1)),
PREFIX_ZERO,
(FreqMhz % 1000) / 10,
2
);
StrCatS (StringBuffer, DestMax, L" GHz");
*String = (CHAR16 *) StringBuffer;
return ;
@ -434,7 +441,7 @@ ConvertMemorySizeToString (
StringBuffer = AllocateZeroPool (0x24);
ASSERT (StringBuffer != NULL);
UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 10);
UnicodeValueToStringS (StringBuffer, 0x24, LEFT_JUSTIFY, MemorySize, 10);
StrCatS (StringBuffer, 0x24 / sizeof (CHAR16), L" MB RAM");
*String = (CHAR16 *) StringBuffer;

View File

@ -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);

View File

@ -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));
}
//

View File

@ -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,

View File

@ -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));
}
//

View File

@ -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));
}
//

View File

@ -1,7 +1,7 @@
/** @file
Capsule update PEIM for UEFI2.0
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
This program and the accompanying materials
@ -777,7 +777,13 @@ GetCapsuleDescriptors (
return EFI_SUCCESS;
}
} else {
UnicodeValueToString (TempVarName, 0, Index, 0);
UnicodeValueToStringS (
TempVarName,
sizeof (CapsuleVarName) - ((UINTN)TempVarName - (UINTN)CapsuleVarName),
0,
Index,
0
);
Status = PPIVariableServices->GetVariable (
PPIVariableServices,
CapsuleVarName,
@ -900,7 +906,13 @@ CapsuleCoalesce (
TempVarName = CapsuleVarName + StrLen (CapsuleVarName);
while (TRUE) {
if (Index > 0) {
UnicodeValueToString (TempVarName, 0, Index, 0);
UnicodeValueToStringS (
TempVarName,
sizeof (CapsuleVarName) - ((UINTN)TempVarName - (UINTN)CapsuleVarName),
0,
Index,
0
);
}
Status = PPIVariableServices->GetVariable (
PPIVariableServices,

View File

@ -4,7 +4,7 @@
It installs the Capsule Architectural Protocol defined in PI1.0a to signify
the capsule runtime services are ready.
Copyright (c) 2006 - 2015, 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
@ -205,7 +205,13 @@ UpdateCapsule (
StrCpyS (CapsuleVarName, sizeof(CapsuleVarName)/sizeof(CHAR16), EFI_CAPSULE_VARIABLE_NAME);
TempVarName = CapsuleVarName + StrLen (CapsuleVarName);
if (mTimes > 0) {
UnicodeValueToString (TempVarName, 0, mTimes, 0);
UnicodeValueToStringS (
TempVarName,
sizeof (CapsuleVarName) - ((UINTN)TempVarName - (UINTN)CapsuleVarName),
0,
mTimes,
0
);
}
//

View File

@ -725,12 +725,14 @@ ExtractConfig (
BackupChar = Value[ValueStrLen];
*Value++ = L'=';
Value += UnicodeValueToString (
Value,
PREFIX_ZERO | RADIX_HEX,
PrivateData->Configuration.NameValueVar0,
sizeof (PrivateData->Configuration.NameValueVar0) * 2
);
UnicodeValueToStringS (
Value,
BufferSize - ((UINTN)Value - (UINTN)*Results),
PREFIX_ZERO | RADIX_HEX,
PrivateData->Configuration.NameValueVar0,
sizeof (PrivateData->Configuration.NameValueVar0) * 2
);
Value += StrnLenS (Value, (BufferSize - ((UINTN)Value - (UINTN)*Results)) / sizeof (CHAR16));
*Value = BackupChar;
}
@ -744,12 +746,14 @@ ExtractConfig (
BackupChar = Value[ValueStrLen];
*Value++ = L'=';
Value += UnicodeValueToString (
Value,
PREFIX_ZERO | RADIX_HEX,
PrivateData->Configuration.NameValueVar1,
sizeof (PrivateData->Configuration.NameValueVar1) * 2
);
UnicodeValueToStringS (
Value,
BufferSize - ((UINTN)Value - (UINTN)*Results),
PREFIX_ZERO | RADIX_HEX,
PrivateData->Configuration.NameValueVar1,
sizeof (PrivateData->Configuration.NameValueVar1) * 2
);
Value += StrnLenS (Value, (BufferSize - ((UINTN)Value - (UINTN)*Results)) / sizeof (CHAR16));
*Value = BackupChar;
}
@ -767,7 +771,14 @@ ExtractConfig (
//
StrPointer = (CHAR16 *) PrivateData->Configuration.NameValueVar2;
for (; *StrPointer != L'\0'; StrPointer++) {
Value += UnicodeValueToString (Value, PREFIX_ZERO | RADIX_HEX, *StrPointer, 4);
UnicodeValueToStringS (
Value,
BufferSize - ((UINTN)Value - (UINTN)*Results),
PREFIX_ZERO | RADIX_HEX,
*StrPointer,
4
);
Value += StrnLenS (Value, (BufferSize - ((UINTN)Value - (UINTN)*Results)) / sizeof (CHAR16));
}
}

View File

@ -1,7 +1,7 @@
/** @file
Implementation of interfaces function for EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL.
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2015 - 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
@ -1763,7 +1763,14 @@ ConstructConfigHdr (
// 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));
}
}
@ -1778,7 +1785,14 @@ ConstructConfigHdr (
// Append Name converted to <Char>NameLength
//
for (; *Name != L'\0'; Name++) {
String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *Name, 4);
UnicodeValueToStringS (
String,
MaxLen * sizeof (CHAR16) - ((UINTN)String - (UINTN)ReturnString),
PREFIX_ZERO | RADIX_HEX,
*Name,
4
);
String += StrnLenS (String, MaxLen - ((UINTN)String - (UINTN)ReturnString) / sizeof (CHAR16));
}
}
@ -1792,7 +1806,14 @@ ConstructConfigHdr (
// 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,
MaxLen * sizeof (CHAR16) - ((UINTN)String - (UINTN)ReturnString),
PREFIX_ZERO | RADIX_HEX,
*(Buffer++),
2
);
String += StrnLenS (String, MaxLen - ((UINTN)String - (UINTN)ReturnString) / sizeof (CHAR16));
}
//

View File

@ -264,7 +264,14 @@ GenerateSubStr (
//
TemBuffer = ((UINT8 *) Buffer);
for (Index = 0; Index < BufferLen; Index ++, TemBuffer ++) {
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
UnicodeValueToStringS (
TemString,
sizeof (CHAR16) * (Length - StrnLenS (Str, Length)),
PREFIX_ZERO | RADIX_HEX,
*TemBuffer,
2
);
TemString += StrnLenS (TemString, Length - StrnLenS (Str, Length));
}
break;
case 2:
@ -277,7 +284,14 @@ GenerateSubStr (
// Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
//
for (; *TemName != L'\0'; TemName++) {
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemName, 4);
UnicodeValueToStringS (
TemString,
sizeof (CHAR16) * (Length - StrnLenS (Str, Length)),
PREFIX_ZERO | RADIX_HEX,
*TemName,
4
);
TemString += StrnLenS (TemString, Length - StrnLenS (Str, Length));
}
break;
case 3:
@ -286,7 +300,14 @@ GenerateSubStr (
//
TemBuffer = ((UINT8 *) Buffer) + BufferLen - 1;
for (Index = 0; Index < BufferLen; Index ++, TemBuffer --) {
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
UnicodeValueToStringS (
TemString,
sizeof (CHAR16) * (Length - StrnLenS (Str, Length)),
PREFIX_ZERO | RADIX_HEX,
*TemBuffer,
2
);
TemString += StrnLenS (TemString, Length - StrnLenS (Str, Length));
}
break;
default:
@ -3712,7 +3733,14 @@ GenerateAltConfigResp (
TmpBuffer = (UINT8 *) &(DefaultValueData->Value);
}
for (; Width > 0 && (TmpBuffer != NULL); Width--) {
StringPtr += UnicodeValueToString (StringPtr, PREFIX_ZERO | RADIX_HEX, TmpBuffer[Width - 1], 2);
UnicodeValueToStringS (
StringPtr,
Length * sizeof (CHAR16) - ((UINTN)StringPtr - (UINTN)*DefaultAltCfgResp),
PREFIX_ZERO | RADIX_HEX,
TmpBuffer[Width - 1],
2
);
StringPtr += StrnLenS (StringPtr, Length - ((UINTN)StringPtr - (UINTN)*DefaultAltCfgResp) / sizeof (CHAR16));
}
if (DefaultString != NULL){
FreePool(DefaultString);
@ -5403,7 +5431,14 @@ HiiBlockToConfig (
TemString = ValueStr;
TemBuffer = Value + Width - 1;
for (Index = 0; Index < Width; Index ++, TemBuffer --) {
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
UnicodeValueToStringS (
TemString,
Length * sizeof (CHAR16) - ((UINTN)TemString - (UINTN)ValueStr),
PREFIX_ZERO | RADIX_HEX,
*TemBuffer,
2
);
TemString += StrnLenS (TemString, Length - ((UINTN)TemString - (UINTN)ValueStr) / sizeof (CHAR16));
}
FreePool (Value);

View File

@ -1,7 +1,7 @@
/** @file
HII Config Access protocol implementation of VLAN configuration module.
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 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
@ -417,14 +417,22 @@ VlanUpdateForm (
//
// Pad VlanId string up to 4 characters with space
//
DigitalCount = UnicodeValueToString (VlanIdStr, 0, VlanData[Index].VlanId, 5);
UnicodeValueToStringS (VlanIdStr, sizeof (VlanIdStr), 0, VlanData[Index].VlanId, 5);
DigitalCount = StrnLenS (VlanIdStr, ARRAY_SIZE (VlanIdStr));
SetMem16 (String, (4 - DigitalCount) * sizeof (CHAR16), L' ');
StrCpyS (String + 4 - DigitalCount, (sizeof (VlanStr) /sizeof (CHAR16)) - 10 - (4 - DigitalCount), VlanIdStr);
String += 4;
StrCpyS (String, (sizeof (VlanStr) /sizeof (CHAR16)) - 10 - (4 - DigitalCount) - 4, L", Priority:");
String += 11;
String += UnicodeValueToString (String, 0, VlanData[Index].Priority, 4);
UnicodeValueToStringS (
String,
sizeof (VlanStr) - ((UINTN)String - (UINTN)VlanStr),
0,
VlanData[Index].Priority,
4
);
String += StrnLenS (String, ARRAY_SIZE (VlanStr) - ((UINTN)String - (UINTN)VlanStr) / sizeof (CHAR16));
*String = 0;
StringId = HiiSetString (PrivateData->HiiHandle, 0, VlanStr, NULL);

View File

@ -1,7 +1,7 @@
/** @file
Utility functions for expression evaluation.
Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2007 - 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
@ -3143,7 +3143,14 @@ EvaluateExpression (
TempBuffer = (UINT8 *) &Value->Value + OpCode->ValueWidth - 1;
StrPtr = NameValue;
for (Index = 0; Index < OpCode->ValueWidth; Index ++, TempBuffer --) {
StrPtr += UnicodeValueToString (StrPtr, PREFIX_ZERO | RADIX_HEX, *TempBuffer, 2);
UnicodeValueToStringS (
StrPtr,
(OpCode->ValueWidth * 2 + 1) * sizeof (CHAR16) - ((UINTN)StrPtr - (UINTN)NameValue),
PREFIX_ZERO | RADIX_HEX,
*TempBuffer,
2
);
StrPtr += StrnLenS (StrPtr, OpCode->ValueWidth * 2 + 1 - ((UINTN)StrPtr - (UINTN)NameValue) / sizeof (CHAR16));
}
Status = SetValueByName (OpCode->VarStorage, OpCode->ValueName, NameValue, GetSetValueWithEditBuffer, NULL);
FreePool (NameValue);

View File

@ -1,7 +1,7 @@
/** @file
Parser for IFR binary encoding.
Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2007 - 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
@ -116,7 +116,7 @@ UpdateCheckBoxStringToken (
ASSERT (Statement != NULL);
ASSERT (Statement->Operand == EFI_IFR_NUMERIC_OP);
UnicodeValueToString (Str, 0, Statement->VarStoreInfo.VarName, MAXIMUM_VALUE_CHARACTERS - 1);
UnicodeValueToStringS (Str, sizeof (Str), 0, Statement->VarStoreInfo.VarName, MAXIMUM_VALUE_CHARACTERS - 1);
Id = HiiSetString (FormSet->HiiHandle, 0, Str, NULL);
if (Id == 0) {

View File

@ -1,7 +1,7 @@
/** @file
Entry and initialization module for the browser.
Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2007 - 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
@ -1972,7 +1972,14 @@ SetQuestionValue (
TemName = (CHAR16 *) Src;
TemString = Value;
for (; *TemName != L'\0'; TemName++) {
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemName, 4);
UnicodeValueToStringS (
TemString,
BufferLen - ((UINTN)TemString - (UINTN)Value),
PREFIX_ZERO | RADIX_HEX,
*TemName,
4
);
TemString += StrnLenS (TemString, (BufferLen - ((UINTN)TemString - (UINTN)Value)) / sizeof (CHAR16));
}
} else {
BufferLen = StorageWidth * 2 + 1;
@ -1984,7 +1991,14 @@ SetQuestionValue (
TemBuffer = Src + StorageWidth - 1;
TemString = Value;
for (Index = 0; Index < StorageWidth; Index ++, TemBuffer --) {
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
UnicodeValueToStringS (
TemString,
BufferLen * sizeof (CHAR16) - ((UINTN)TemString - (UINTN)Value),
PREFIX_ZERO | RADIX_HEX,
*TemBuffer,
2
);
TemString += StrnLenS (TemString, BufferLen - ((UINTN)TemString - (UINTN)Value) / sizeof (CHAR16));
}
}
@ -2034,7 +2048,14 @@ SetQuestionValue (
TemName = (CHAR16 *) Src;
TemString = Value;
for (; *TemName != L'\0'; TemName++) {
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemName, 4);
UnicodeValueToStringS (
TemString,
MaxLen * sizeof (CHAR16) - ((UINTN)TemString - (UINTN)ConfigResp),
PREFIX_ZERO | RADIX_HEX,
*TemName,
4
);
TemString += StrnLenS (TemString, MaxLen - ((UINTN)TemString - (UINTN)ConfigResp) / sizeof (CHAR16));
}
} else {
//
@ -2043,7 +2064,14 @@ SetQuestionValue (
TemBuffer = Src + StorageWidth - 1;
TemString = Value;
for (Index = 0; Index < StorageWidth; Index ++, TemBuffer --) {
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
UnicodeValueToStringS (
TemString,
MaxLen * sizeof (CHAR16) - ((UINTN)TemString - (UINTN)ConfigResp),
PREFIX_ZERO | RADIX_HEX,
*TemBuffer,
2
);
TemString += StrnLenS (TemString, MaxLen - ((UINTN)TemString - (UINTN)ConfigResp) / sizeof (CHAR16));
}
}