From: "Zhang, Shenglei" <shenglei.zhang@intel.com>
To: devel@edk2.groups.io
Cc: Jian J Wang <jian.j.wang@intel.com>, Hao A Wu <hao.a.wu@intel.com>
Subject: [PATCH 2/2] MdeModulePkg: Remove code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES
Date: Wed, 5 Aug 2020 14:08:04 +0800 [thread overview]
Message-ID: <20200805060804.30476-3-shenglei.zhang@intel.com> (raw)
In-Reply-To: <20200805060804.30476-1-shenglei.zhang@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2777
Code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES is deprecated.
So remove it.
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
.../DxePrintLibPrint2Protocol/PrintLib.c | 145 ------------------
MdeModulePkg/Universal/PrintDxe/Print.c | 37 +----
MdeModulePkg/MdeModulePkg.dsc | 1 -
3 files changed, 6 insertions(+), 177 deletions(-)
diff --git a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c
index 3a051fd58003..edd6572578dd 100644
--- a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c
+++ b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c
@@ -592,79 +592,6 @@ UnicodeSPrintAsciiFormat (
return NumberOfPrinted;
}
-#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
-
-/**
- [ATTENTION] This function is deprecated for security reason.
-
- Converts a decimal value to a Null-terminated Unicode string.
-
- Converts the decimal number specified by Value to a Null-terminated Unicode
- string specified by Buffer containing at most Width characters. No padding of spaces
- is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
- The number of Unicode characters in Buffer is returned not including the Null-terminator.
- If the conversion contains more than Width characters, then only the first
- Width characters are returned, and the total number of characters
- required to perform the conversion is returned.
- Additional conversion parameters are specified in Flags.
-
- The Flags bit LEFT_JUSTIFY is always ignored.
- All conversions are left justified in Buffer.
- If Width is 0, PREFIX_ZERO is ignored in Flags.
- If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
- are inserted every 3rd digit starting from the right.
- If RADIX_HEX is set in Flags, then the output buffer will be
- formatted in hexadecimal format.
- If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
- If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
- then Buffer is padded with '0' characters so the combination of the optional '-'
- sign character, '0' characters, digit characters for Value, and the Null-terminator
- add up to Width characters.
- If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
- If Buffer is NULL, then ASSERT().
- If Buffer is not aligned on a 16-bit boundary, then ASSERT().
- If unsupported bits are set in Flags, then ASSERT().
- If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
- If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
-
- @param Buffer Pointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
- @param Value The 64-bit signed value to convert to a string.
- @param Width The maximum number of Unicode characters to place in Buffer, not including
- the Null-terminator.
-
- @return The number of Unicode characters in Buffer not including the Null-terminator.
-
-**/
-UINTN
-EFIAPI
-UnicodeValueToString (
- IN OUT CHAR16 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
- )
-{
- RETURN_STATUS Status;
- UINTN BufferSize;
-
- if (Width == 0) {
- BufferSize = (MAXIMUM_VALUE_CHARACTERS + 1) * sizeof (CHAR16);
- } else {
- BufferSize = (Width + 1) * sizeof (CHAR16);
- }
-
- Status = mPrint2SProtocol->UnicodeValueToStringS (Buffer, BufferSize, Flags, Value, Width);
- if (RETURN_ERROR (Status)) {
- return 0;
- }
-
- return StrnLenS (Buffer, BufferSize / sizeof (CHAR16));
-}
-
-#endif
-
/**
Converts a decimal value to a Null-terminated Unicode string.
@@ -1071,78 +998,6 @@ AsciiSPrintUnicodeFormat (
}
-#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
-
-/**
- [ATTENTION] This function is deprecated for security reason.
-
- Converts a decimal value to a Null-terminated ASCII string.
-
- Converts the decimal number specified by Value to a Null-terminated ASCII string
- specified by Buffer containing at most Width characters. No padding of spaces
- is ever performed.
- If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
- The number of ASCII characters in Buffer is returned not including the Null-terminator.
- If the conversion contains more than Width characters, then only the first Width
- characters are returned, and the total number of characters required to perform
- the conversion is returned.
- Additional conversion parameters are specified in Flags.
- The Flags bit LEFT_JUSTIFY is always ignored.
- All conversions are left justified in Buffer.
- If Width is 0, PREFIX_ZERO is ignored in Flags.
- If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
- are inserted every 3rd digit starting from the right.
- If RADIX_HEX is set in Flags, then the output buffer will be
- formatted in hexadecimal format.
- If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
- If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
- then Buffer is padded with '0' characters so the combination of the optional '-'
- sign character, '0' characters, digit characters for Value, and the Null-terminator
- add up to Width characters.
-
- If Buffer is NULL, then ASSERT().
- If unsupported bits are set in Flags, then ASSERT().
- If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
- If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
-
- @param Buffer Pointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
- @param Value The 64-bit signed value to convert to a string.
- @param Width The maximum number of ASCII characters to place in Buffer, not including
- the Null-terminator.
-
- @return The number of ASCII characters in Buffer not including the Null-terminator.
-
-**/
-UINTN
-EFIAPI
-AsciiValueToString (
- OUT CHAR8 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
- )
-{
- RETURN_STATUS Status;
- UINTN BufferSize;
-
- if (Width == 0) {
- BufferSize = (MAXIMUM_VALUE_CHARACTERS + 1) * sizeof (CHAR8);
- } else {
- BufferSize = (Width + 1) * sizeof (CHAR8);
- }
-
- Status = mPrint2SProtocol->AsciiValueToStringS (Buffer, BufferSize, Flags, Value, Width);
- if (RETURN_ERROR (Status)) {
- return 0;
- }
-
- return AsciiStrnLenS (Buffer, BufferSize / sizeof (CHAR8));
-}
-
-#endif
-
/**
Converts a decimal value to a Null-terminated Ascii string.
diff --git a/MdeModulePkg/Universal/PrintDxe/Print.c b/MdeModulePkg/Universal/PrintDxe/Print.c
index c417a2c811de..636aa5716228 100644
--- a/MdeModulePkg/Universal/PrintDxe/Print.c
+++ b/MdeModulePkg/Universal/PrintDxe/Print.c
@@ -17,7 +17,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
/**
Implementaion of the UnicodeValueToString service in EFI_PRINT2_PROTOCOL.
- If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then ASSERT().
@param Buffer The pointer to the output buffer for the produced
Null-terminated Unicode string.
@@ -27,9 +26,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
@param Width The maximum number of Unicode characters to place in Buffer,
not including the Null-terminator.
- @return If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, return 0.
- Otherwise, return the number of Unicode characters in Buffer not
- including the Null-terminator.
+ @return 0.
+
**/
UINTN
@@ -41,28 +39,16 @@ PrintDxeUnicodeValueToString (
IN UINTN Width
)
{
-#ifdef DISABLE_NEW_DEPRECATED_INTERFACES
- //
- // If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then the
- // PrintLib API UnicodeValueToString is already deprecated.
- // In this case, ASSERT will be triggered and zero will be returned for the
- // implementation of the UnicodeValueToString service in EFI_PRINT2_PROTOCOL
- // to indicate that the service is no longer supported.
- //
DEBUG ((DEBUG_ERROR, "PrintDxe: The UnicodeValueToString service in EFI_PRINT2_PROTOCOL is no longer supported for security reason.\n"));
DEBUG ((DEBUG_ERROR, "PrintDxe: Please consider using the UnicodeValueToStringS service in EFI_PRINT2S_PROTOCOL.\n"));
ASSERT (FALSE);
return 0;
-#else
- return UnicodeValueToString (Buffer, Flags, Value, Width);
-#endif
+
}
/**
Implementaion of the AsciiValueToString service in EFI_PRINT2_PROTOCOL.
- If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then ASSERT().
-
@param Buffer A pointer to the output buffer for the produced
Null-terminated ASCII string.
@param Flags The bitmask of flags that specify left justification, zero
@@ -71,9 +57,7 @@ PrintDxeUnicodeValueToString (
@param Width The maximum number of ASCII characters to place in Buffer,
not including the Null-terminator.
- @return If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, return 0.
- Otherwise, return the number of ASCII characters in Buffer not
- including the Null-terminator.
+ @return 0.
**/
UINTN
@@ -85,21 +69,12 @@ PrintDxeAsciiValueToString (
IN UINTN Width
)
{
-#ifdef DISABLE_NEW_DEPRECATED_INTERFACES
- //
- // If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then the
- // PrintLib API AsciiValueToString is already deprecated.
- // In this case, ASSERT will be triggered and zero will be returned for the
- // implementation of the AsciiValueToString service in EFI_PRINT2_PROTOCOL
- // to indicate that the service is no longer supported.
- //
+
DEBUG ((DEBUG_ERROR, "PrintDxe: The AsciiValueToString service in EFI_PRINT2_PROTOCOL is no longer supported for security reason.\n"));
DEBUG ((DEBUG_ERROR, "PrintDxe: Please consider using the AsciiValueToStringS service in EFI_PRINT2S_PROTOCOL.\n"));
ASSERT (FALSE);
return 0;
-#else
- return AsciiValueToString (Buffer, Flags, Value, Width);
-#endif
+
}
EFI_HANDLE mPrintThunkHandle = NULL;
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index 25aea3e2a481..fbbc9933f5e8 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -491,5 +491,4 @@ [Components.X64]
MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf
[BuildOptions]
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
--
2.18.0.windows.1
next prev parent reply other threads:[~2020-08-05 6:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-05 6:08 [PATCH 0/2] Remove code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES Zhang, Shenglei
2020-08-05 6:08 ` [PATCH 1/2] MdePkg: " Zhang, Shenglei
2020-08-05 6:08 ` Zhang, Shenglei [this message]
2020-08-14 2:09 ` [PATCH 0/2] " Liming Gao
2020-09-07 1:06 ` [edk2-devel] " gaoliming
2020-10-12 5:25 ` 回复: " gaoliming
[not found] ` <163D276172A67C0B.1945@groups.io>
2020-10-13 1:59 ` gaoliming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200805060804.30476-3-shenglei.zhang@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox