mirror of https://github.com/acidanthera/audk.git
MdePkg/BaseLib: Introduce CharToUpper and AsciiCharToUpper publicly
Introduce two public functions CharToUpper and AsciiCharToUpper. They have the same functions as InternalCharToUpper and InternalBaseLibAsciiToUpper.Considering the internal functions will be removed,so directly I change their function names to the public ones'. https://bugzilla.tianocore.org/show_bug.cgi?id=1369 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
parent
cecbecb71d
commit
5dbfa01e2e
|
@ -2,7 +2,7 @@
|
||||||
Provides string functions, linked list functions, math functions, synchronization
|
Provides string functions, linked list functions, math functions, synchronization
|
||||||
functions, file path functions, and CPU architecture-specific functions.
|
functions, file path functions, and CPU architecture-specific functions.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -2720,6 +2720,46 @@ AsciiStrnToUnicodeStrS (
|
||||||
OUT UINTN *DestinationLength
|
OUT UINTN *DestinationLength
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert a Unicode character to upper case only if
|
||||||
|
it maps to a valid small-case ASCII character.
|
||||||
|
|
||||||
|
This internal function only deal with Unicode character
|
||||||
|
which maps to a valid small-case ASCII character, i.e.
|
||||||
|
L'a' to L'z'. For other Unicode character, the input character
|
||||||
|
is returned directly.
|
||||||
|
|
||||||
|
@param Char The character to convert.
|
||||||
|
|
||||||
|
@retval LowerCharacter If the Char is with range L'a' to L'z'.
|
||||||
|
@retval Unchanged Otherwise.
|
||||||
|
|
||||||
|
**/
|
||||||
|
CHAR16
|
||||||
|
EFIAPI
|
||||||
|
CharToUpper (
|
||||||
|
IN CHAR16 Char
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts a lowercase Ascii character to upper one.
|
||||||
|
|
||||||
|
If Chr is lowercase Ascii character, then converts it to upper one.
|
||||||
|
|
||||||
|
If Value >= 0xA0, then ASSERT().
|
||||||
|
If (Value & 0x0F) >= 0x0A, then ASSERT().
|
||||||
|
|
||||||
|
@param Chr one Ascii character
|
||||||
|
|
||||||
|
@return The uppercase value of Ascii character
|
||||||
|
|
||||||
|
**/
|
||||||
|
CHAR8
|
||||||
|
EFIAPI
|
||||||
|
AsciiCharToUpper (
|
||||||
|
IN CHAR8 Chr
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts an 8-bit value to an 8-bit BCD value.
|
Converts an 8-bit value to an 8-bit BCD value.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Safe String functions.
|
Safe String functions.
|
||||||
|
|
||||||
Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -905,7 +905,7 @@ StrHexToUintnS (
|
||||||
String++;
|
String++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InternalCharToUpper (*String) == L'X') {
|
if (CharToUpper (*String) == L'X') {
|
||||||
if (*(String - 1) != L'0') {
|
if (*(String - 1) != L'0') {
|
||||||
*Data = 0;
|
*Data = 0;
|
||||||
return RETURN_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
|
@ -1036,7 +1036,7 @@ StrHexToUint64S (
|
||||||
String++;
|
String++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InternalCharToUpper (*String) == L'X') {
|
if (CharToUpper (*String) == L'X') {
|
||||||
if (*(String - 1) != L'0') {
|
if (*(String - 1) != L'0') {
|
||||||
*Data = 0;
|
*Data = 0;
|
||||||
return RETURN_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
|
@ -2459,7 +2459,7 @@ AsciiStrHexToUintnS (
|
||||||
String++;
|
String++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InternalBaseLibAsciiToUpper (*String) == 'X') {
|
if (AsciiCharToUpper (*String) == 'X') {
|
||||||
if (*(String - 1) != '0') {
|
if (*(String - 1) != '0') {
|
||||||
*Data = 0;
|
*Data = 0;
|
||||||
return RETURN_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
|
@ -2586,7 +2586,7 @@ AsciiStrHexToUint64S (
|
||||||
String++;
|
String++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InternalBaseLibAsciiToUpper (*String) == 'X') {
|
if (AsciiCharToUpper (*String) == 'X') {
|
||||||
if (*(String - 1) != '0') {
|
if (*(String - 1) != '0') {
|
||||||
*Data = 0;
|
*Data = 0;
|
||||||
return RETURN_SUCCESS;
|
return RETURN_SUCCESS;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Unicode and ASCII string primitives.
|
Unicode and ASCII string primitives.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -552,7 +552,7 @@ InternalIsDecimalDigitCharacter (
|
||||||
**/
|
**/
|
||||||
CHAR16
|
CHAR16
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalCharToUpper (
|
CharToUpper (
|
||||||
IN CHAR16 Char
|
IN CHAR16 Char
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -586,7 +586,7 @@ InternalHexCharToUintn (
|
||||||
return Char - L'0';
|
return Char - L'0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return (10 + InternalCharToUpper (Char) - L'A');
|
return (10 + CharToUpper (Char) - L'A');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1181,7 +1181,7 @@ AsciiStrCmp (
|
||||||
**/
|
**/
|
||||||
CHAR8
|
CHAR8
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalBaseLibAsciiToUpper (
|
AsciiCharToUpper (
|
||||||
IN CHAR8 Chr
|
IN CHAR8 Chr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -1211,7 +1211,7 @@ InternalAsciiHexCharToUintn (
|
||||||
return Char - '0';
|
return Char - '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return (10 + InternalBaseLibAsciiToUpper (Char) - 'A');
|
return (10 + AsciiCharToUpper (Char) - 'A');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1260,13 +1260,13 @@ AsciiStriCmp (
|
||||||
ASSERT (AsciiStrSize (FirstString));
|
ASSERT (AsciiStrSize (FirstString));
|
||||||
ASSERT (AsciiStrSize (SecondString));
|
ASSERT (AsciiStrSize (SecondString));
|
||||||
|
|
||||||
UpperFirstString = InternalBaseLibAsciiToUpper (*FirstString);
|
UpperFirstString = AsciiCharToUpper (*FirstString);
|
||||||
UpperSecondString = InternalBaseLibAsciiToUpper (*SecondString);
|
UpperSecondString = AsciiCharToUpper (*SecondString);
|
||||||
while ((*FirstString != '\0') && (*SecondString != '\0') && (UpperFirstString == UpperSecondString)) {
|
while ((*FirstString != '\0') && (*SecondString != '\0') && (UpperFirstString == UpperSecondString)) {
|
||||||
FirstString++;
|
FirstString++;
|
||||||
SecondString++;
|
SecondString++;
|
||||||
UpperFirstString = InternalBaseLibAsciiToUpper (*FirstString);
|
UpperFirstString = AsciiCharToUpper (*FirstString);
|
||||||
UpperSecondString = InternalBaseLibAsciiToUpper (*SecondString);
|
UpperSecondString = AsciiCharToUpper (*SecondString);
|
||||||
}
|
}
|
||||||
|
|
||||||
return UpperFirstString - UpperSecondString;
|
return UpperFirstString - UpperSecondString;
|
||||||
|
|
Loading…
Reference in New Issue