From 9f4048f7f8cd4b6bd5eee0f0c4bfd4eb6926a536 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Wed, 18 Jan 2017 10:31:02 +0800 Subject: 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 Reviewed-by: Star Zeng --- .../Universal/DriverSampleDxe/DriverSample.c | 37 ++++++++++++++-------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'MdeModulePkg/Universal/DriverSampleDxe') diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index 67a40b7d63..f103b9ca21 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -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)); } } -- cgit v1.2.3