MdePkg: Remove code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2777 Code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES is deprecated. So remove it. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
cc942105ed
commit
9c1f455f5f
@@ -8,135 +8,6 @@
|
||||
|
||||
#include "BaseLibInternals.h"
|
||||
|
||||
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
/**
|
||||
[ATTENTION] This function will be deprecated for security reason.
|
||||
|
||||
Copies one Null-terminated Unicode string to another Null-terminated Unicode
|
||||
string and returns the new Unicode string.
|
||||
|
||||
This function copies the contents of the Unicode string Source to the Unicode
|
||||
string Destination, and returns Destination. If Source and Destination
|
||||
overlap, then the results are undefined.
|
||||
|
||||
If Destination is NULL, then ASSERT().
|
||||
If Destination is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Source is NULL, then ASSERT().
|
||||
If Source is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Source and Destination overlap, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters, not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param Destination A pointer to a Null-terminated Unicode string.
|
||||
@param Source A pointer to a Null-terminated Unicode string.
|
||||
|
||||
@return Destination.
|
||||
|
||||
**/
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
StrCpy (
|
||||
OUT CHAR16 *Destination,
|
||||
IN CONST CHAR16 *Source
|
||||
)
|
||||
{
|
||||
CHAR16 *ReturnValue;
|
||||
|
||||
//
|
||||
// Destination cannot be NULL
|
||||
//
|
||||
ASSERT (Destination != NULL);
|
||||
ASSERT (((UINTN) Destination & BIT0) == 0);
|
||||
|
||||
//
|
||||
// Destination and source cannot overlap
|
||||
//
|
||||
ASSERT ((UINTN)(Destination - Source) > StrLen (Source));
|
||||
ASSERT ((UINTN)(Source - Destination) > StrLen (Source));
|
||||
|
||||
ReturnValue = Destination;
|
||||
while (*Source != 0) {
|
||||
*(Destination++) = *(Source++);
|
||||
}
|
||||
*Destination = 0;
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
[ATTENTION] This function will be deprecated for security reason.
|
||||
|
||||
Copies up to a specified length from one Null-terminated Unicode string to
|
||||
another Null-terminated Unicode string and returns the new Unicode string.
|
||||
|
||||
This function copies the contents of the Unicode string Source to the Unicode
|
||||
string Destination, and returns Destination. At most, Length Unicode
|
||||
characters are copied from Source to Destination. If Length is 0, then
|
||||
Destination is returned unmodified. If Length is greater that the number of
|
||||
Unicode characters in Source, then Destination is padded with Null Unicode
|
||||
characters. If Source and Destination overlap, then the results are
|
||||
undefined.
|
||||
|
||||
If Length > 0 and Destination is NULL, then ASSERT().
|
||||
If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length > 0 and Source is NULL, then ASSERT().
|
||||
If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Source and Destination overlap, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
|
||||
PcdMaximumUnicodeStringLength, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
|
||||
then ASSERT().
|
||||
|
||||
@param Destination A pointer to a Null-terminated Unicode string.
|
||||
@param Source A pointer to a Null-terminated Unicode string.
|
||||
@param Length The maximum number of Unicode characters to copy.
|
||||
|
||||
@return Destination.
|
||||
|
||||
**/
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
StrnCpy (
|
||||
OUT CHAR16 *Destination,
|
||||
IN CONST CHAR16 *Source,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
CHAR16 *ReturnValue;
|
||||
|
||||
if (Length == 0) {
|
||||
return Destination;
|
||||
}
|
||||
|
||||
//
|
||||
// Destination cannot be NULL if Length is not zero
|
||||
//
|
||||
ASSERT (Destination != NULL);
|
||||
ASSERT (((UINTN) Destination & BIT0) == 0);
|
||||
|
||||
//
|
||||
// Destination and source cannot overlap
|
||||
//
|
||||
ASSERT ((UINTN)(Destination - Source) > StrLen (Source));
|
||||
ASSERT ((UINTN)(Source - Destination) >= Length);
|
||||
|
||||
if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) {
|
||||
ASSERT (Length <= PcdGet32 (PcdMaximumUnicodeStringLength));
|
||||
}
|
||||
|
||||
ReturnValue = Destination;
|
||||
|
||||
while ((*Source != L'\0') && (Length > 0)) {
|
||||
*(Destination++) = *(Source++);
|
||||
Length--;
|
||||
}
|
||||
|
||||
ZeroMem (Destination, Length * sizeof (*Destination));
|
||||
return ReturnValue;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
Returns the length of a Null-terminated Unicode string.
|
||||
@@ -320,121 +191,6 @@ StrnCmp (
|
||||
return *FirstString - *SecondString;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
/**
|
||||
[ATTENTION] This function will be deprecated for security reason.
|
||||
|
||||
Concatenates one Null-terminated Unicode string to another Null-terminated
|
||||
Unicode string, and returns the concatenated Unicode string.
|
||||
|
||||
This function concatenates two Null-terminated Unicode strings. The contents
|
||||
of Null-terminated Unicode string Source are concatenated to the end of
|
||||
Null-terminated Unicode string Destination. The Null-terminated concatenated
|
||||
Unicode String is returned. If Source and Destination overlap, then the
|
||||
results are undefined.
|
||||
|
||||
If Destination is NULL, then ASSERT().
|
||||
If Destination is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Source is NULL, then ASSERT().
|
||||
If Source is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Source and Destination overlap, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
|
||||
than PcdMaximumUnicodeStringLength Unicode characters, not including the
|
||||
Null-terminator, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters, not including the
|
||||
Null-terminator, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
|
||||
and Source results in a Unicode string with more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters, not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param Destination A pointer to a Null-terminated Unicode string.
|
||||
@param Source A pointer to a Null-terminated Unicode string.
|
||||
|
||||
@return Destination.
|
||||
|
||||
**/
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
StrCat (
|
||||
IN OUT CHAR16 *Destination,
|
||||
IN CONST CHAR16 *Source
|
||||
)
|
||||
{
|
||||
StrCpy (Destination + StrLen (Destination), Source);
|
||||
|
||||
//
|
||||
// Size of the resulting string should never be zero.
|
||||
// PcdMaximumUnicodeStringLength is tested inside StrLen().
|
||||
//
|
||||
ASSERT (StrSize (Destination) != 0);
|
||||
return Destination;
|
||||
}
|
||||
|
||||
/**
|
||||
[ATTENTION] This function will be deprecated for security reason.
|
||||
|
||||
Concatenates up to a specified length one Null-terminated Unicode to the end
|
||||
of another Null-terminated Unicode string, and returns the concatenated
|
||||
Unicode string.
|
||||
|
||||
This function concatenates two Null-terminated Unicode strings. The contents
|
||||
of Null-terminated Unicode string Source are concatenated to the end of
|
||||
Null-terminated Unicode string Destination, and Destination is returned. At
|
||||
most, Length Unicode characters are concatenated from Source to the end of
|
||||
Destination, and Destination is always Null-terminated. If Length is 0, then
|
||||
Destination is returned unmodified. If Source and Destination overlap, then
|
||||
the results are undefined.
|
||||
|
||||
If Destination is NULL, then ASSERT().
|
||||
If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Length > 0 and Source is NULL, then ASSERT().
|
||||
If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Source and Destination overlap, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
|
||||
PcdMaximumUnicodeStringLength, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
|
||||
than PcdMaximumUnicodeStringLength Unicode characters, not including the
|
||||
Null-terminator, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
|
||||
PcdMaximumUnicodeStringLength Unicode characters, not including the
|
||||
Null-terminator, then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
|
||||
and Source results in a Unicode string with more than PcdMaximumUnicodeStringLength
|
||||
Unicode characters, not including the Null-terminator, then ASSERT().
|
||||
|
||||
@param Destination A pointer to a Null-terminated Unicode string.
|
||||
@param Source A pointer to a Null-terminated Unicode string.
|
||||
@param Length The maximum number of Unicode characters to concatenate from
|
||||
Source.
|
||||
|
||||
@return Destination.
|
||||
|
||||
**/
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
StrnCat (
|
||||
IN OUT CHAR16 *Destination,
|
||||
IN CONST CHAR16 *Source,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
UINTN DestinationLen;
|
||||
|
||||
DestinationLen = StrLen (Destination);
|
||||
StrnCpy (Destination + DestinationLen, Source, Length);
|
||||
Destination[DestinationLen + Length] = L'\0';
|
||||
|
||||
//
|
||||
// Size of the resulting string should never be zero.
|
||||
// PcdMaximumUnicodeStringLength is tested inside StrLen().
|
||||
//
|
||||
ASSERT (StrSize (Destination) != 0);
|
||||
return Destination;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
Returns the first occurrence of a Null-terminated Unicode sub-string
|
||||
@@ -845,208 +601,6 @@ InternalAsciiIsHexaDecimalDigitCharacter (
|
||||
(Char >= 'a' && Char <= 'f'));
|
||||
}
|
||||
|
||||
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
/**
|
||||
[ATTENTION] This function is deprecated for security reason.
|
||||
|
||||
Convert a Null-terminated Unicode string to a Null-terminated
|
||||
ASCII string and returns the ASCII string.
|
||||
|
||||
This function converts the content of the Unicode string Source
|
||||
to the ASCII string Destination by copying the lower 8 bits of
|
||||
each Unicode character. It returns Destination.
|
||||
|
||||
The caller is responsible to make sure Destination points to a buffer with size
|
||||
equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.
|
||||
|
||||
If any Unicode characters in Source contain non-zero value in
|
||||
the upper 8 bits, then ASSERT().
|
||||
|
||||
If Destination is NULL, then ASSERT().
|
||||
If Source is NULL, then ASSERT().
|
||||
If Source is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Source and Destination overlap, then ASSERT().
|
||||
|
||||
If PcdMaximumUnicodeStringLength is not zero, and Source contains
|
||||
more than PcdMaximumUnicodeStringLength Unicode characters, not including
|
||||
the Null-terminator, then ASSERT().
|
||||
|
||||
If PcdMaximumAsciiStringLength is not zero, and Source contains more
|
||||
than PcdMaximumAsciiStringLength Unicode characters, not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param Source A pointer to a Null-terminated Unicode string.
|
||||
@param Destination A pointer to a Null-terminated ASCII string.
|
||||
|
||||
@return Destination.
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
EFIAPI
|
||||
UnicodeStrToAsciiStr (
|
||||
IN CONST CHAR16 *Source,
|
||||
OUT CHAR8 *Destination
|
||||
)
|
||||
{
|
||||
CHAR8 *ReturnValue;
|
||||
|
||||
ASSERT (Destination != NULL);
|
||||
|
||||
//
|
||||
// ASSERT if Source is long than PcdMaximumUnicodeStringLength.
|
||||
// Length tests are performed inside StrLen().
|
||||
//
|
||||
ASSERT (StrSize (Source) != 0);
|
||||
|
||||
//
|
||||
// Source and Destination should not overlap
|
||||
//
|
||||
ASSERT ((UINTN) (Destination - (CHAR8 *) Source) >= StrSize (Source));
|
||||
ASSERT ((UINTN) ((CHAR8 *) Source - Destination) > StrLen (Source));
|
||||
|
||||
|
||||
ReturnValue = Destination;
|
||||
while (*Source != '\0') {
|
||||
//
|
||||
// If any Unicode characters in Source contain
|
||||
// non-zero value in the upper 8 bits, then ASSERT().
|
||||
//
|
||||
ASSERT (*Source < 0x100);
|
||||
*(Destination++) = (CHAR8) *(Source++);
|
||||
}
|
||||
|
||||
*Destination = '\0';
|
||||
|
||||
//
|
||||
// ASSERT Original Destination is less long than PcdMaximumAsciiStringLength.
|
||||
// Length tests are performed inside AsciiStrLen().
|
||||
//
|
||||
ASSERT (AsciiStrSize (ReturnValue) != 0);
|
||||
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
[ATTENTION] This function will be deprecated for security reason.
|
||||
|
||||
Copies one Null-terminated ASCII string to another Null-terminated ASCII
|
||||
string and returns the new ASCII string.
|
||||
|
||||
This function copies the contents of the ASCII string Source to the ASCII
|
||||
string Destination, and returns Destination. If Source and Destination
|
||||
overlap, then the results are undefined.
|
||||
|
||||
If Destination is NULL, then ASSERT().
|
||||
If Source is NULL, then ASSERT().
|
||||
If Source and Destination overlap, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero and Source contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
|
||||
then ASSERT().
|
||||
|
||||
@param Destination A pointer to a Null-terminated ASCII string.
|
||||
@param Source A pointer to a Null-terminated ASCII string.
|
||||
|
||||
@return Destination
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
EFIAPI
|
||||
AsciiStrCpy (
|
||||
OUT CHAR8 *Destination,
|
||||
IN CONST CHAR8 *Source
|
||||
)
|
||||
{
|
||||
CHAR8 *ReturnValue;
|
||||
|
||||
//
|
||||
// Destination cannot be NULL
|
||||
//
|
||||
ASSERT (Destination != NULL);
|
||||
|
||||
//
|
||||
// Destination and source cannot overlap
|
||||
//
|
||||
ASSERT ((UINTN)(Destination - Source) > AsciiStrLen (Source));
|
||||
ASSERT ((UINTN)(Source - Destination) > AsciiStrLen (Source));
|
||||
|
||||
ReturnValue = Destination;
|
||||
while (*Source != 0) {
|
||||
*(Destination++) = *(Source++);
|
||||
}
|
||||
*Destination = 0;
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
[ATTENTION] This function will be deprecated for security reason.
|
||||
|
||||
Copies up to a specified length one Null-terminated ASCII string to another
|
||||
Null-terminated ASCII string and returns the new ASCII string.
|
||||
|
||||
This function copies the contents of the ASCII string Source to the ASCII
|
||||
string Destination, and returns Destination. At most, Length ASCII characters
|
||||
are copied from Source to Destination. If Length is 0, then Destination is
|
||||
returned unmodified. If Length is greater that the number of ASCII characters
|
||||
in Source, then Destination is padded with Null ASCII characters. If Source
|
||||
and Destination overlap, then the results are undefined.
|
||||
|
||||
If Destination is NULL, then ASSERT().
|
||||
If Source is NULL, then ASSERT().
|
||||
If Source and Destination overlap, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and Length is greater than
|
||||
PcdMaximumAsciiStringLength, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and Source contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
|
||||
then ASSERT().
|
||||
|
||||
@param Destination A pointer to a Null-terminated ASCII string.
|
||||
@param Source A pointer to a Null-terminated ASCII string.
|
||||
@param Length The maximum number of ASCII characters to copy.
|
||||
|
||||
@return Destination
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
EFIAPI
|
||||
AsciiStrnCpy (
|
||||
OUT CHAR8 *Destination,
|
||||
IN CONST CHAR8 *Source,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
CHAR8 *ReturnValue;
|
||||
|
||||
if (Length == 0) {
|
||||
return Destination;
|
||||
}
|
||||
|
||||
//
|
||||
// Destination cannot be NULL
|
||||
//
|
||||
ASSERT (Destination != NULL);
|
||||
|
||||
//
|
||||
// Destination and source cannot overlap
|
||||
//
|
||||
ASSERT ((UINTN)(Destination - Source) > AsciiStrLen (Source));
|
||||
ASSERT ((UINTN)(Source - Destination) >= Length);
|
||||
|
||||
if (PcdGet32 (PcdMaximumAsciiStringLength) != 0) {
|
||||
ASSERT (Length <= PcdGet32 (PcdMaximumAsciiStringLength));
|
||||
}
|
||||
|
||||
ReturnValue = Destination;
|
||||
|
||||
while (*Source != 0 && Length > 0) {
|
||||
*(Destination++) = *(Source++);
|
||||
Length--;
|
||||
}
|
||||
|
||||
ZeroMem (Destination, Length * sizeof (*Destination));
|
||||
return ReturnValue;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
Returns the length of a Null-terminated ASCII string.
|
||||
@@ -1329,114 +883,6 @@ AsciiStrnCmp (
|
||||
return *FirstString - *SecondString;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
/**
|
||||
[ATTENTION] This function will be deprecated for security reason.
|
||||
|
||||
Concatenates one Null-terminated ASCII string to another Null-terminated
|
||||
ASCII string, and returns the concatenated ASCII string.
|
||||
|
||||
This function concatenates two Null-terminated ASCII strings. The contents of
|
||||
Null-terminated ASCII string Source are concatenated to the end of Null-
|
||||
terminated ASCII string Destination. The Null-terminated concatenated ASCII
|
||||
String is returned.
|
||||
|
||||
If Destination is NULL, then ASSERT().
|
||||
If Source is NULL, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero and Destination contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
|
||||
then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero and Source contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
|
||||
then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero and concatenating Destination and
|
||||
Source results in a ASCII string with more than PcdMaximumAsciiStringLength
|
||||
ASCII characters, then ASSERT().
|
||||
|
||||
@param Destination A pointer to a Null-terminated ASCII string.
|
||||
@param Source A pointer to a Null-terminated ASCII string.
|
||||
|
||||
@return Destination
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
EFIAPI
|
||||
AsciiStrCat (
|
||||
IN OUT CHAR8 *Destination,
|
||||
IN CONST CHAR8 *Source
|
||||
)
|
||||
{
|
||||
AsciiStrCpy (Destination + AsciiStrLen (Destination), Source);
|
||||
|
||||
//
|
||||
// Size of the resulting string should never be zero.
|
||||
// PcdMaximumUnicodeStringLength is tested inside StrLen().
|
||||
//
|
||||
ASSERT (AsciiStrSize (Destination) != 0);
|
||||
return Destination;
|
||||
}
|
||||
|
||||
/**
|
||||
[ATTENTION] This function will be deprecated for security reason.
|
||||
|
||||
Concatenates up to a specified length one Null-terminated ASCII string to
|
||||
the end of another Null-terminated ASCII string, and returns the
|
||||
concatenated ASCII string.
|
||||
|
||||
This function concatenates two Null-terminated ASCII strings. The contents
|
||||
of Null-terminated ASCII string Source are concatenated to the end of Null-
|
||||
terminated ASCII string Destination, and Destination is returned. At most,
|
||||
Length ASCII characters are concatenated from Source to the end of
|
||||
Destination, and Destination is always Null-terminated. If Length is 0, then
|
||||
Destination is returned unmodified. If Source and Destination overlap, then
|
||||
the results are undefined.
|
||||
|
||||
If Length > 0 and Destination is NULL, then ASSERT().
|
||||
If Length > 0 and Source is NULL, then ASSERT().
|
||||
If Source and Destination overlap, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and Length is greater than
|
||||
PcdMaximumAsciiStringLength, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and Destination contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
|
||||
then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and Source contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
|
||||
then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and concatenating Destination and
|
||||
Source results in a ASCII string with more than PcdMaximumAsciiStringLength
|
||||
ASCII characters, not including the Null-terminator, then ASSERT().
|
||||
|
||||
@param Destination A pointer to a Null-terminated ASCII string.
|
||||
@param Source A pointer to a Null-terminated ASCII string.
|
||||
@param Length The maximum number of ASCII characters to concatenate from
|
||||
Source.
|
||||
|
||||
@return Destination
|
||||
|
||||
**/
|
||||
CHAR8 *
|
||||
EFIAPI
|
||||
AsciiStrnCat (
|
||||
IN OUT CHAR8 *Destination,
|
||||
IN CONST CHAR8 *Source,
|
||||
IN UINTN Length
|
||||
)
|
||||
{
|
||||
UINTN DestinationLen;
|
||||
|
||||
DestinationLen = AsciiStrLen (Destination);
|
||||
AsciiStrnCpy (Destination + DestinationLen, Source, Length);
|
||||
Destination[DestinationLen + Length] = '\0';
|
||||
|
||||
//
|
||||
// Size of the resulting string should never be zero.
|
||||
// PcdMaximumUnicodeStringLength is tested inside StrLen().
|
||||
//
|
||||
ASSERT (AsciiStrSize (Destination) != 0);
|
||||
return Destination;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
Returns the first occurrence of a Null-terminated ASCII sub-string
|
||||
@@ -1684,78 +1130,6 @@ AsciiStrHexToUint64 (
|
||||
return Result;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
/**
|
||||
[ATTENTION] This function is deprecated for security reason.
|
||||
|
||||
Convert one Null-terminated ASCII string to a Null-terminated
|
||||
Unicode string and returns the Unicode string.
|
||||
|
||||
This function converts the contents of the ASCII string Source to the Unicode
|
||||
string Destination, and returns Destination. The function terminates the
|
||||
Unicode string Destination by appending a Null-terminator character at the end.
|
||||
The caller is responsible to make sure Destination points to a buffer with size
|
||||
equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.
|
||||
|
||||
If Destination is NULL, then ASSERT().
|
||||
If Destination is not aligned on a 16-bit boundary, then ASSERT().
|
||||
If Source is NULL, then ASSERT().
|
||||
If Source and Destination overlap, then ASSERT().
|
||||
If PcdMaximumAsciiStringLength is not zero, and Source contains more than
|
||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
|
||||
then ASSERT().
|
||||
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
|
||||
PcdMaximumUnicodeStringLength ASCII characters not including the
|
||||
Null-terminator, then ASSERT().
|
||||
|
||||
@param Source A pointer to a Null-terminated ASCII string.
|
||||
@param Destination A pointer to a Null-terminated Unicode string.
|
||||
|
||||
@return Destination.
|
||||
|
||||
**/
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
AsciiStrToUnicodeStr (
|
||||
IN CONST CHAR8 *Source,
|
||||
OUT CHAR16 *Destination
|
||||
)
|
||||
{
|
||||
CHAR16 *ReturnValue;
|
||||
|
||||
ASSERT (Destination != NULL);
|
||||
|
||||
//
|
||||
// ASSERT Source is less long than PcdMaximumAsciiStringLength
|
||||
//
|
||||
ASSERT (AsciiStrSize (Source) != 0);
|
||||
|
||||
//
|
||||
// Source and Destination should not overlap
|
||||
//
|
||||
ASSERT ((UINTN) ((CHAR8 *) Destination - Source) > AsciiStrLen (Source));
|
||||
ASSERT ((UINTN) (Source - (CHAR8 *) Destination) >= (AsciiStrSize (Source) * sizeof (CHAR16)));
|
||||
|
||||
|
||||
ReturnValue = Destination;
|
||||
while (*Source != '\0') {
|
||||
*(Destination++) = (CHAR16)(UINT8) *(Source++);
|
||||
}
|
||||
//
|
||||
// End the Destination with a NULL.
|
||||
//
|
||||
*Destination = '\0';
|
||||
|
||||
//
|
||||
// ASSERT Original Destination is less long than PcdMaximumUnicodeStringLength
|
||||
//
|
||||
ASSERT (StrSize (ReturnValue) != 0);
|
||||
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
STATIC CHAR8 EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
|
Reference in New Issue
Block a user