* [PATCH v4 0/7] Introduce two public functions and remove internal ones
@ 2018-12-25 8:17 Shenglei Zhang
2018-12-25 8:17 ` [PATCH v4 1/7] MdeModulePkg/EbcDebugger: Change function names Shenglei Zhang
` (8 more replies)
0 siblings, 9 replies; 16+ messages in thread
From: Shenglei Zhang @ 2018-12-25 8:17 UTC (permalink / raw)
To: edk2-devel
Cc: Michael D Kinney, Liming Gao, Leif Lindholm, Laszlo Ersek,
Jian J Wang, Hao Wu, Star Zeng, Ruiyu Ni, Jaben Carsey
Introduce public functions CharToUpper and AsciiToUpper.
Remove internal functions InternalCharToUpper and InternalBaseLibAsciiToUpper.
v2: Update the title and commit message of 1/3.
v3: 1.Add a patch to remove AsciiToUpper in EdbSupportString.c.
2.Revert the changes in Basetools.
v4: 1.Add1/7: Change function names in EdbSupportString.c.
2.Update the title of 4/7.
3.Add 5/7: Use BaseLib api AsciiToUpper in DxeHttpLib.c.
4.Add 6/7: Use BaseLib api CharToUpper in ShellManParser.c.
5.Add 7/7: Use BaseLib api CharToUpper in UefiShellLib.c.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Shenglei Zhang (7):
MdeModulePkg/EbcDebugger: Change function names
MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly
MdePkg/BaseLib: Remove InternalCharToUpper and
InternalBaseLibAsciiToUpper
MdeModulePkg/EbcDebugger: Use BaseLib apis AsciiToUpper and
CharToUpper
MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiToUpper
ShellPkg/Shell: Use BaseLib api CharToUpper
ShellPkg/UefiShellLib: Use BaseLib api CharToUpper
MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 23 +---------
.../EbcDxe/EbcDebugger/EdbSupportString.c | 39 ++---------------
MdePkg/Include/Library/BaseLib.h | 40 ++++++++++++++++++
MdePkg/Library/BaseLib/BaseLibInternals.h | 42 -------------------
MdePkg/Library/BaseLib/SafeString.c | 8 ++--
MdePkg/Library/BaseLib/String.c | 16 +++----
ShellPkg/Application/Shell/ShellManParser.c | 23 +---------
ShellPkg/Library/UefiShellLib/UefiShellLib.c | 31 +-------------
8 files changed, 60 insertions(+), 162 deletions(-)
--
2.18.0.windows.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v4 1/7] MdeModulePkg/EbcDebugger: Change function names
2018-12-25 8:17 [PATCH v4 0/7] Introduce two public functions and remove internal ones Shenglei Zhang
@ 2018-12-25 8:17 ` Shenglei Zhang
2018-12-25 8:40 ` Wu, Hao A
2018-12-25 8:17 ` [PATCH v4 2/7] MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly Shenglei Zhang
` (7 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Shenglei Zhang @ 2018-12-25 8:17 UTC (permalink / raw)
To: edk2-devel; +Cc: Jian J Wang, Hao Wu, Ruiyu Ni, Star Zeng
Change UnicodeToUpper to InternalUnicodeToUpper.
Change AsciiToUpper to InternalAsciiToUpper.
These changes are committed for bisectability, or build failure will
occur when 2/7 is applied. Because the introduced function names in
2/7 are the same as ones in EdbSupporting.c.
https://bugzilla.tianocore.org/show_bug.cgi?id=1369
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
.../Universal/EbcDxe/EbcDebugger/EdbSupportString.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
index 78a0559079..02e1876ffa 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
@@ -316,7 +316,7 @@ AsciiAtoi (
**/
STATIC
CHAR16
-UnicodeToUpper (
+InternalUnicodeToUpper (
IN CHAR16 Chr
)
{
@@ -332,7 +332,7 @@ UnicodeToUpper (
**/
STATIC
CHAR8
-AsciiToUpper (
+InternalAsciiToUpper (
IN CHAR8 Chr
)
{
@@ -390,12 +390,12 @@ StriCmp (
)
{
while ((*String != L'\0') &&
- (UnicodeToUpper (*String) == UnicodeToUpper (*String2))) {
+ (InternalUnicodeToUpper (*String) == InternalUnicodeToUpper (*String2))) {
String++;
String2++;
}
- return UnicodeToUpper (*String) - UnicodeToUpper (*String2);
+ return InternalUnicodeToUpper (*String) - InternalUnicodeToUpper (*String2);
}
/**
@@ -418,12 +418,12 @@ StriCmpUnicodeAndAscii (
)
{
while ((*String != L'\0') &&
- (UnicodeToUpper (*String) == (CHAR16)AsciiToUpper (*String2))) {
+ (InternalUnicodeToUpper (*String) == (CHAR16)InternalAsciiToUpper (*String2))) {
String++;
String2++;
}
- return UnicodeToUpper (*String) - (CHAR16)AsciiToUpper (*String2);
+ return InternalUnicodeToUpper (*String) - (CHAR16)InternalAsciiToUpper (*String2);
}
/**
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 2/7] MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly
2018-12-25 8:17 [PATCH v4 0/7] Introduce two public functions and remove internal ones Shenglei Zhang
2018-12-25 8:17 ` [PATCH v4 1/7] MdeModulePkg/EbcDebugger: Change function names Shenglei Zhang
@ 2018-12-25 8:17 ` Shenglei Zhang
2019-01-29 7:45 ` Ni, Ruiyu
2018-12-25 8:17 ` [PATCH v4 3/7] MdePkg/BaseLib: Remove definitions of two functions Shenglei Zhang
` (6 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Shenglei Zhang @ 2018-12-25 8:17 UTC (permalink / raw)
To: edk2-devel; +Cc: Leif Lindholm, Laszlo Ersek, Michael D Kinney, Liming Gao
Introduce two public functions CharToUpper and AsciiToUpper.
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: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
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>
---
MdePkg/Include/Library/BaseLib.h | 40 +++++++++++++++++++++++++++++
MdePkg/Library/BaseLib/SafeString.c | 8 +++---
MdePkg/Library/BaseLib/String.c | 16 ++++++------
3 files changed, 52 insertions(+), 12 deletions(-)
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 1eb842384e..e8cc121ddd 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -2720,6 +2720,46 @@ AsciiStrnToUnicodeStrS (
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
+AsciiToUpper (
+ IN CHAR8 Chr
+ );
+
/**
Converts an 8-bit value to an 8-bit BCD value.
diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
index 417497cbc9..17f88b46d8 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -905,7 +905,7 @@ StrHexToUintnS (
String++;
}
- if (InternalCharToUpper (*String) == L'X') {
+ if (CharToUpper (*String) == L'X') {
if (*(String - 1) != L'0') {
*Data = 0;
return RETURN_SUCCESS;
@@ -1036,7 +1036,7 @@ StrHexToUint64S (
String++;
}
- if (InternalCharToUpper (*String) == L'X') {
+ if (CharToUpper (*String) == L'X') {
if (*(String - 1) != L'0') {
*Data = 0;
return RETURN_SUCCESS;
@@ -2459,7 +2459,7 @@ AsciiStrHexToUintnS (
String++;
}
- if (InternalBaseLibAsciiToUpper (*String) == 'X') {
+ if (AsciiToUpper (*String) == 'X') {
if (*(String - 1) != '0') {
*Data = 0;
return RETURN_SUCCESS;
@@ -2586,7 +2586,7 @@ AsciiStrHexToUint64S (
String++;
}
- if (InternalBaseLibAsciiToUpper (*String) == 'X') {
+ if (AsciiToUpper (*String) == 'X') {
if (*(String - 1) != '0') {
*Data = 0;
return RETURN_SUCCESS;
diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c
index e6df12797d..dba53779c9 100644
--- a/MdePkg/Library/BaseLib/String.c
+++ b/MdePkg/Library/BaseLib/String.c
@@ -552,7 +552,7 @@ InternalIsDecimalDigitCharacter (
**/
CHAR16
EFIAPI
-InternalCharToUpper (
+CharToUpper (
IN CHAR16 Char
)
{
@@ -586,7 +586,7 @@ InternalHexCharToUintn (
return Char - L'0';
}
- return (10 + InternalCharToUpper (Char) - L'A');
+ return (10 + CharToUpper (Char) - L'A');
}
/**
@@ -1181,7 +1181,7 @@ AsciiStrCmp (
**/
CHAR8
EFIAPI
-InternalBaseLibAsciiToUpper (
+AsciiToUpper (
IN CHAR8 Chr
)
{
@@ -1211,7 +1211,7 @@ InternalAsciiHexCharToUintn (
return Char - '0';
}
- return (10 + InternalBaseLibAsciiToUpper (Char) - 'A');
+ return (10 + AsciiToUpper (Char) - 'A');
}
@@ -1260,13 +1260,13 @@ AsciiStriCmp (
ASSERT (AsciiStrSize (FirstString));
ASSERT (AsciiStrSize (SecondString));
- UpperFirstString = InternalBaseLibAsciiToUpper (*FirstString);
- UpperSecondString = InternalBaseLibAsciiToUpper (*SecondString);
+ UpperFirstString = AsciiToUpper (*FirstString);
+ UpperSecondString = AsciiToUpper (*SecondString);
while ((*FirstString != '\0') && (*SecondString != '\0') && (UpperFirstString == UpperSecondString)) {
FirstString++;
SecondString++;
- UpperFirstString = InternalBaseLibAsciiToUpper (*FirstString);
- UpperSecondString = InternalBaseLibAsciiToUpper (*SecondString);
+ UpperFirstString = AsciiToUpper (*FirstString);
+ UpperSecondString = AsciiToUpper (*SecondString);
}
return UpperFirstString - UpperSecondString;
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 3/7] MdePkg/BaseLib: Remove definitions of two functions
2018-12-25 8:17 [PATCH v4 0/7] Introduce two public functions and remove internal ones Shenglei Zhang
2018-12-25 8:17 ` [PATCH v4 1/7] MdeModulePkg/EbcDebugger: Change function names Shenglei Zhang
2018-12-25 8:17 ` [PATCH v4 2/7] MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly Shenglei Zhang
@ 2018-12-25 8:17 ` Shenglei Zhang
2018-12-25 8:17 ` [PATCH v4 4/7] MdeModulePkg/EbcDebugger: Use AsciiToUpper and CharToUpper Shenglei Zhang
` (5 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Shenglei Zhang @ 2018-12-25 8:17 UTC (permalink / raw)
To: edk2-devel; +Cc: Leif Lindholm, Laszlo Ersek, Michael D Kinney, Liming Gao
InternalCharToUpper and InternalBaseLibAsciiToUpper are internal functions
and now we will introduce public functions that have the same effects.
So I remove their definitions in BaseLibInternals.h.
https://bugzilla.tianocore.org/show_bug.cgi?id=1369
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
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>
---
MdePkg/Library/BaseLib/BaseLibInternals.h | 42 -----------------------
1 file changed, 42 deletions(-)
diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h b/MdePkg/Library/BaseLib/BaseLibInternals.h
index 8855231c1a..9db925b157 100644
--- a/MdePkg/Library/BaseLib/BaseLibInternals.h
+++ b/MdePkg/Library/BaseLib/BaseLibInternals.h
@@ -469,28 +469,6 @@ InternalIsDecimalDigitCharacter (
);
-/**
- 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
-InternalCharToUpper (
- IN CHAR16 Char
- );
-
-
/**
Convert a Unicode character to numerical value.
@@ -552,26 +530,6 @@ InternalAsciiIsDecimalDigitCharacter (
);
-/**
- 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
-InternalBaseLibAsciiToUpper (
- IN CHAR8 Chr
- );
-
-
/**
Check if a ASCII character is a hexadecimal character.
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 4/7] MdeModulePkg/EbcDebugger: Use AsciiToUpper and CharToUpper
2018-12-25 8:17 [PATCH v4 0/7] Introduce two public functions and remove internal ones Shenglei Zhang
` (2 preceding siblings ...)
2018-12-25 8:17 ` [PATCH v4 3/7] MdePkg/BaseLib: Remove definitions of two functions Shenglei Zhang
@ 2018-12-25 8:17 ` Shenglei Zhang
2018-12-25 8:43 ` Wu, Hao A
2018-12-25 8:17 ` [PATCH v4 5/7] MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiToUpper Shenglei Zhang
` (4 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Shenglei Zhang @ 2018-12-25 8:17 UTC (permalink / raw)
To: edk2-devel; +Cc: Jian J Wang, Hao Wu, Ruiyu Ni, Star Zeng
InternalUnicodeToUpper and InternalAsciiToUpper are internal functions,
so they are substituted by public functions AsciiToUpper and CharToUpper.
And their implements are removed.
https://bugzilla.tianocore.org/show_bug.cgi?id=1369
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
.../EbcDxe/EbcDebugger/EdbSupportString.c | 39 ++-----------------
1 file changed, 4 insertions(+), 35 deletions(-)
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
index 02e1876ffa..c8d9fdcb2a 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
@@ -307,37 +307,6 @@ AsciiAtoi (
return RetVal;
}
-/**
-
- Convert the character to upper case.
-
- @param Chr the character to be converted.
-
-**/
-STATIC
-CHAR16
-InternalUnicodeToUpper (
- IN CHAR16 Chr
- )
-{
- return (Chr >= L'a' && Chr <= L'z') ? Chr - (L'a' - L'A') : Chr;
-}
-
-/**
-
- Convert the character to upper case.
-
- @param Chr the character to be converted.
-
-**/
-STATIC
-CHAR8
-InternalAsciiToUpper (
- IN CHAR8 Chr
- )
-{
- return (Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr;
-}
/**
Compare the Unicode and Ascii string pointed by String to the string pointed by String2.
@@ -390,12 +359,12 @@ StriCmp (
)
{
while ((*String != L'\0') &&
- (InternalUnicodeToUpper (*String) == InternalUnicodeToUpper (*String2))) {
+ (CharToUpper (*String) == CharToUpper (*String2))) {
String++;
String2++;
}
- return InternalUnicodeToUpper (*String) - InternalUnicodeToUpper (*String2);
+ return CharToUpper (*String) - CharToUpper (*String2);
}
/**
@@ -418,12 +387,12 @@ StriCmpUnicodeAndAscii (
)
{
while ((*String != L'\0') &&
- (InternalUnicodeToUpper (*String) == (CHAR16)InternalAsciiToUpper (*String2))) {
+ (CharToUpper (*String) == (CHAR16)AsciiToUpper (*String2))) {
String++;
String2++;
}
- return InternalUnicodeToUpper (*String) - (CHAR16)InternalAsciiToUpper (*String2);
+ return CharToUpper (*String) - (CHAR16)AsciiToUpper (*String2);
}
/**
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 5/7] MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiToUpper
2018-12-25 8:17 [PATCH v4 0/7] Introduce two public functions and remove internal ones Shenglei Zhang
` (3 preceding siblings ...)
2018-12-25 8:17 ` [PATCH v4 4/7] MdeModulePkg/EbcDebugger: Use AsciiToUpper and CharToUpper Shenglei Zhang
@ 2018-12-25 8:17 ` Shenglei Zhang
2018-12-25 8:46 ` Wu, Hao A
2018-12-25 8:17 ` [PATCH v4 6/7] ShellPkg/Shell: Use BaseLib api CharToUpper Shenglei Zhang
` (3 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Shenglei Zhang @ 2018-12-25 8:17 UTC (permalink / raw)
To: edk2-devel; +Cc: Jian J Wang, Hao Wu, Ruiyu Ni, Star Zeng
Substitute HttpIoCharToUpper with AsciiToUpper which is a public function
with the same effect. And remove the implement of HttpIoCharToUpper.
https://bugzilla.tianocore.org/show_bug.cgi?id=1369
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 23 +-------------------
1 file changed, 1 insertion(+), 22 deletions(-)
diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
index 2fc3da8a2d..36f66a2708 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
@@ -898,27 +898,6 @@ typedef struct {
UINTN CurrentChunkParsedSize;
} HTTP_BODY_PARSER;
-/**
-
- Convert an Ascii char to its uppercase.
-
- @param[in] Char Ascii character.
-
- @return Uppercase value of the input Char.
-
-**/
-CHAR8
-HttpIoCharToUpper (
- IN CHAR8 Char
- )
-{
- if (Char >= 'a' && Char <= 'z') {
- return Char - ('a' - 'A');
- }
-
- return Char;
-}
-
/**
Convert an hexadecimal char to a value of type UINTN.
@@ -936,7 +915,7 @@ HttpIoHexCharToUintn (
return Char - '0';
}
- return (10 + HttpIoCharToUpper (Char) - 'A');
+ return (10 + AsciiToUpper (Char) - 'A');
}
/**
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 6/7] ShellPkg/Shell: Use BaseLib api CharToUpper
2018-12-25 8:17 [PATCH v4 0/7] Introduce two public functions and remove internal ones Shenglei Zhang
` (4 preceding siblings ...)
2018-12-25 8:17 ` [PATCH v4 5/7] MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiToUpper Shenglei Zhang
@ 2018-12-25 8:17 ` Shenglei Zhang
2018-12-31 21:22 ` Carsey, Jaben
2018-12-25 8:17 ` [PATCH v4 7/7] ShellPkg/UefiShellLib: " Shenglei Zhang
` (2 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Shenglei Zhang @ 2018-12-25 8:17 UTC (permalink / raw)
To: edk2-devel; +Cc: Ruiyu Ni, Jaben Carsey
Substitute InternalShellCharToUpper with a public function
CharToUpper which has the same function.
Remove the implement of InternalShellCharToUpper.
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
ShellPkg/Application/Shell/ShellManParser.c | 23 +--------------------
1 file changed, 1 insertion(+), 22 deletions(-)
diff --git a/ShellPkg/Application/Shell/ShellManParser.c b/ShellPkg/Application/Shell/ShellManParser.c
index b180c6c8f7..2c044dbe4a 100644
--- a/ShellPkg/Application/Shell/ShellManParser.c
+++ b/ShellPkg/Application/Shell/ShellManParser.c
@@ -46,27 +46,6 @@ SHELL_MAN_HII_VENDOR_DEVICE_PATH mShellManHiiDevicePath = {
}
};
-
-/**
- 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
-InternalShellCharToUpper (
- IN CHAR16 Char
- );
-
/**
Verifies that the filename has .EFI on the end.
@@ -416,7 +395,7 @@ IsTitleHeader(
ReturnFound = TRUE; // This is the desired command's title header line.
State = (BriefDesc == NULL) ? Final : GetBriefDescription;
}
- else if (InternalShellCharToUpper (*Line) != InternalShellCharToUpper (*(Command + CommandIndex++))) {
+ else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) {
State = Final;
}
Line++;
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 7/7] ShellPkg/UefiShellLib: Use BaseLib api CharToUpper
2018-12-25 8:17 [PATCH v4 0/7] Introduce two public functions and remove internal ones Shenglei Zhang
` (5 preceding siblings ...)
2018-12-25 8:17 ` [PATCH v4 6/7] ShellPkg/Shell: Use BaseLib api CharToUpper Shenglei Zhang
@ 2018-12-25 8:17 ` Shenglei Zhang
2018-12-31 21:22 ` Carsey, Jaben
2018-12-26 20:11 ` [PATCH v4 0/7] Introduce two public functions and remove internal ones Laszlo Ersek
2019-01-29 3:10 ` Gao, Liming
8 siblings, 1 reply; 16+ messages in thread
From: Shenglei Zhang @ 2018-12-25 8:17 UTC (permalink / raw)
To: edk2-devel; +Cc: Ruiyu Ni, Jaben Carsey
Substitute InternalShellCharToUpper with CharToUpper which is a public
function with the same effect.
Remove the implement of InternalShellCharToUpper.
https://bugzilla.tianocore.org/show_bug.cgi?id=1369
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
ShellPkg/Library/UefiShellLib/UefiShellLib.c | 31 ++------------------
1 file changed, 2 insertions(+), 29 deletions(-)
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index b17266d623..aff933dcdf 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -3740,33 +3740,6 @@ ShellFileExists(
return (EFI_SUCCESS);
}
-/**
- 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
-InternalShellCharToUpper (
- IN CHAR16 Char
- )
-{
- if (Char >= L'a' && Char <= L'z') {
- return (CHAR16) (Char - (L'a' - L'A'));
- }
-
- return Char;
-}
-
/**
Convert a Unicode character to numerical value.
@@ -3789,7 +3762,7 @@ InternalShellHexCharToUintn (
return Char - L'0';
}
- return (10 + InternalShellCharToUpper (Char) - L'A');
+ return (10 + CharToUpper (Char) - L'A');
}
/**
@@ -3849,7 +3822,7 @@ InternalShellStrHexToUint64 (
String++;
}
- if (InternalShellCharToUpper (*String) == L'X') {
+ if (CharToUpper (*String) == L'X') {
if (*(String - 1) != L'0') {
return 0;
}
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v4 1/7] MdeModulePkg/EbcDebugger: Change function names
2018-12-25 8:17 ` [PATCH v4 1/7] MdeModulePkg/EbcDebugger: Change function names Shenglei Zhang
@ 2018-12-25 8:40 ` Wu, Hao A
0 siblings, 0 replies; 16+ messages in thread
From: Wu, Hao A @ 2018-12-25 8:40 UTC (permalink / raw)
To: Zhang, Shenglei, edk2-devel@lists.01.org
Cc: Wang, Jian J, Ni, Ruiyu, Zeng, Star
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Tuesday, December 25, 2018 4:17 PM
> To: edk2-devel@lists.01.org
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ruiyu; Zeng, Star
> Subject: [PATCH v4 1/7] MdeModulePkg/EbcDebugger: Change function
> names
>
> Change UnicodeToUpper to InternalUnicodeToUpper.
> Change AsciiToUpper to InternalAsciiToUpper.
> These changes are committed for bisectability, or build failure will
> occur when 2/7 is applied. Because the introduced function names in
> 2/7 are the same as ones in EdbSupporting.c.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1369
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao Wu <hao.a.wu@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> .../Universal/EbcDxe/EbcDebugger/EdbSupportString.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git
> a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
> b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
> index 78a0559079..02e1876ffa 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
> @@ -316,7 +316,7 @@ AsciiAtoi (
> **/
> STATIC
> CHAR16
> -UnicodeToUpper (
> +InternalUnicodeToUpper (
> IN CHAR16 Chr
> )
> {
> @@ -332,7 +332,7 @@ UnicodeToUpper (
> **/
> STATIC
> CHAR8
> -AsciiToUpper (
> +InternalAsciiToUpper (
> IN CHAR8 Chr
> )
> {
> @@ -390,12 +390,12 @@ StriCmp (
> )
> {
> while ((*String != L'\0') &&
> - (UnicodeToUpper (*String) == UnicodeToUpper (*String2))) {
> + (InternalUnicodeToUpper (*String) == InternalUnicodeToUpper
> (*String2))) {
> String++;
> String2++;
> }
>
> - return UnicodeToUpper (*String) - UnicodeToUpper (*String2);
> + return InternalUnicodeToUpper (*String) - InternalUnicodeToUpper
> (*String2);
> }
>
> /**
> @@ -418,12 +418,12 @@ StriCmpUnicodeAndAscii (
> )
> {
> while ((*String != L'\0') &&
> - (UnicodeToUpper (*String) == (CHAR16)AsciiToUpper (*String2))) {
> + (InternalUnicodeToUpper (*String) == (CHAR16)InternalAsciiToUpper
> (*String2))) {
> String++;
> String2++;
> }
>
> - return UnicodeToUpper (*String) - (CHAR16)AsciiToUpper (*String2);
> + return InternalUnicodeToUpper (*String) - (CHAR16)InternalAsciiToUpper
> (*String2);
> }
>
> /**
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 4/7] MdeModulePkg/EbcDebugger: Use AsciiToUpper and CharToUpper
2018-12-25 8:17 ` [PATCH v4 4/7] MdeModulePkg/EbcDebugger: Use AsciiToUpper and CharToUpper Shenglei Zhang
@ 2018-12-25 8:43 ` Wu, Hao A
0 siblings, 0 replies; 16+ messages in thread
From: Wu, Hao A @ 2018-12-25 8:43 UTC (permalink / raw)
To: Zhang, Shenglei, edk2-devel@lists.01.org
Cc: Wang, Jian J, Ni, Ruiyu, Zeng, Star
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Tuesday, December 25, 2018 4:17 PM
> To: edk2-devel@lists.01.org
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ruiyu; Zeng, Star
> Subject: [PATCH v4 4/7] MdeModulePkg/EbcDebugger: Use AsciiToUpper
> and CharToUpper
>
> InternalUnicodeToUpper and InternalAsciiToUpper are internal functions,
> so they are substituted by public functions AsciiToUpper and CharToUpper.
> And their implements are removed.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1369
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao Wu <hao.a.wu@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> .../EbcDxe/EbcDebugger/EdbSupportString.c | 39 ++-----------------
> 1 file changed, 4 insertions(+), 35 deletions(-)
>
> diff --git
> a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
> b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
> index 02e1876ffa..c8d9fdcb2a 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
> @@ -307,37 +307,6 @@ AsciiAtoi (
> return RetVal;
> }
>
> -/**
> -
> - Convert the character to upper case.
> -
> - @param Chr the character to be converted.
> -
> -**/
> -STATIC
> -CHAR16
> -InternalUnicodeToUpper (
> - IN CHAR16 Chr
> - )
> -{
> - return (Chr >= L'a' && Chr <= L'z') ? Chr - (L'a' - L'A') : Chr;
> -}
> -
> -/**
> -
> - Convert the character to upper case.
> -
> - @param Chr the character to be converted.
> -
> -**/
> -STATIC
> -CHAR8
> -InternalAsciiToUpper (
> - IN CHAR8 Chr
> - )
> -{
> - return (Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr;
> -}
>
> /**
> Compare the Unicode and Ascii string pointed by String to the string
> pointed by String2.
> @@ -390,12 +359,12 @@ StriCmp (
> )
> {
> while ((*String != L'\0') &&
> - (InternalUnicodeToUpper (*String) == InternalUnicodeToUpper
> (*String2))) {
> + (CharToUpper (*String) == CharToUpper (*String2))) {
> String++;
> String2++;
> }
>
> - return InternalUnicodeToUpper (*String) - InternalUnicodeToUpper
> (*String2);
> + return CharToUpper (*String) - CharToUpper (*String2);
> }
>
> /**
> @@ -418,12 +387,12 @@ StriCmpUnicodeAndAscii (
> )
> {
> while ((*String != L'\0') &&
> - (InternalUnicodeToUpper (*String) == (CHAR16)InternalAsciiToUpper
> (*String2))) {
> + (CharToUpper (*String) == (CHAR16)AsciiToUpper (*String2))) {
> String++;
> String2++;
> }
>
> - return InternalUnicodeToUpper (*String) - (CHAR16)InternalAsciiToUpper
> (*String2);
> + return CharToUpper (*String) - (CHAR16)AsciiToUpper (*String2);
> }
>
> /**
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 5/7] MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiToUpper
2018-12-25 8:17 ` [PATCH v4 5/7] MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiToUpper Shenglei Zhang
@ 2018-12-25 8:46 ` Wu, Hao A
0 siblings, 0 replies; 16+ messages in thread
From: Wu, Hao A @ 2018-12-25 8:46 UTC (permalink / raw)
To: Zhang, Shenglei, edk2-devel@lists.01.org
Cc: Wang, Jian J, Ni, Ruiyu, Zeng, Star
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Tuesday, December 25, 2018 4:17 PM
> To: edk2-devel@lists.01.org
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ruiyu; Zeng, Star
> Subject: [PATCH v4 5/7] MdeModulePkg/DxeHttpLib: Use BaseLib api
> AsciiToUpper
>
> Substitute HttpIoCharToUpper with AsciiToUpper which is a public function
> with the same effect. And remove the implement of HttpIoCharToUpper.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1369
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao Wu <hao.a.wu@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 23 +-------------------
> 1 file changed, 1 insertion(+), 22 deletions(-)
>
> diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> index 2fc3da8a2d..36f66a2708 100644
> --- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> +++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> @@ -898,27 +898,6 @@ typedef struct {
> UINTN CurrentChunkParsedSize;
> } HTTP_BODY_PARSER;
>
> -/**
> -
> - Convert an Ascii char to its uppercase.
> -
> - @param[in] Char Ascii character.
> -
> - @return Uppercase value of the input Char.
> -
> -**/
> -CHAR8
> -HttpIoCharToUpper (
> - IN CHAR8 Char
> - )
> -{
> - if (Char >= 'a' && Char <= 'z') {
> - return Char - ('a' - 'A');
> - }
> -
> - return Char;
> -}
> -
> /**
> Convert an hexadecimal char to a value of type UINTN.
>
> @@ -936,7 +915,7 @@ HttpIoHexCharToUintn (
> return Char - '0';
> }
>
> - return (10 + HttpIoCharToUpper (Char) - 'A');
> + return (10 + AsciiToUpper (Char) - 'A');
> }
>
> /**
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 0/7] Introduce two public functions and remove internal ones
2018-12-25 8:17 [PATCH v4 0/7] Introduce two public functions and remove internal ones Shenglei Zhang
` (6 preceding siblings ...)
2018-12-25 8:17 ` [PATCH v4 7/7] ShellPkg/UefiShellLib: " Shenglei Zhang
@ 2018-12-26 20:11 ` Laszlo Ersek
2019-01-29 3:10 ` Gao, Liming
8 siblings, 0 replies; 16+ messages in thread
From: Laszlo Ersek @ 2018-12-26 20:11 UTC (permalink / raw)
To: Shenglei Zhang, edk2-devel
Cc: Ruiyu Ni, Hao Wu, Jaben Carsey, Liming Gao, Michael D Kinney,
Star Zeng
On 12/25/18 09:17, Shenglei Zhang wrote:
> Introduce public functions CharToUpper and AsciiToUpper.
> Remove internal functions InternalCharToUpper and InternalBaseLibAsciiToUpper.
>
> v2: Update the title and commit message of 1/3.
>
> v3: 1.Add a patch to remove AsciiToUpper in EdbSupportString.c.
> 2.Revert the changes in Basetools.
>
> v4: 1.Add1/7: Change function names in EdbSupportString.c.
> 2.Update the title of 4/7.
> 3.Add 5/7: Use BaseLib api AsciiToUpper in DxeHttpLib.c.
> 4.Add 6/7: Use BaseLib api CharToUpper in ShellManParser.c.
> 5.Add 7/7: Use BaseLib api CharToUpper in UefiShellLib.c.
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao Wu <hao.a.wu@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Shenglei Zhang (7):
> MdeModulePkg/EbcDebugger: Change function names
> MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly
> MdePkg/BaseLib: Remove InternalCharToUpper and
> InternalBaseLibAsciiToUpper
> MdeModulePkg/EbcDebugger: Use BaseLib apis AsciiToUpper and
> CharToUpper
> MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiToUpper
> ShellPkg/Shell: Use BaseLib api CharToUpper
> ShellPkg/UefiShellLib: Use BaseLib api CharToUpper
https://en.wikipedia.org/wiki/Email_bankruptcy
Please don't wait for my review of this set.
Thanks
Laszlo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 7/7] ShellPkg/UefiShellLib: Use BaseLib api CharToUpper
2018-12-25 8:17 ` [PATCH v4 7/7] ShellPkg/UefiShellLib: " Shenglei Zhang
@ 2018-12-31 21:22 ` Carsey, Jaben
0 siblings, 0 replies; 16+ messages in thread
From: Carsey, Jaben @ 2018-12-31 21:22 UTC (permalink / raw)
To: Zhang, Shenglei, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Tuesday, December 25, 2018 12:17 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>
> Subject: [PATCH v4 7/7] ShellPkg/UefiShellLib: Use BaseLib api CharToUpper
> Importance: High
>
> Substitute InternalShellCharToUpper with CharToUpper which is a public
> function with the same effect.
> Remove the implement of InternalShellCharToUpper.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1369
>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> ShellPkg/Library/UefiShellLib/UefiShellLib.c | 31 ++------------------
> 1 file changed, 2 insertions(+), 29 deletions(-)
>
> diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> index b17266d623..aff933dcdf 100644
> --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> @@ -3740,33 +3740,6 @@ ShellFileExists(
> return (EFI_SUCCESS);
> }
>
> -/**
> - 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
> -InternalShellCharToUpper (
> - IN CHAR16 Char
> - )
> -{
> - if (Char >= L'a' && Char <= L'z') {
> - return (CHAR16) (Char - (L'a' - L'A'));
> - }
> -
> - return Char;
> -}
> -
> /**
> Convert a Unicode character to numerical value.
>
> @@ -3789,7 +3762,7 @@ InternalShellHexCharToUintn (
> return Char - L'0';
> }
>
> - return (10 + InternalShellCharToUpper (Char) - L'A');
> + return (10 + CharToUpper (Char) - L'A');
> }
>
> /**
> @@ -3849,7 +3822,7 @@ InternalShellStrHexToUint64 (
> String++;
> }
>
> - if (InternalShellCharToUpper (*String) == L'X') {
> + if (CharToUpper (*String) == L'X') {
> if (*(String - 1) != L'0') {
> return 0;
> }
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 6/7] ShellPkg/Shell: Use BaseLib api CharToUpper
2018-12-25 8:17 ` [PATCH v4 6/7] ShellPkg/Shell: Use BaseLib api CharToUpper Shenglei Zhang
@ 2018-12-31 21:22 ` Carsey, Jaben
0 siblings, 0 replies; 16+ messages in thread
From: Carsey, Jaben @ 2018-12-31 21:22 UTC (permalink / raw)
To: Zhang, Shenglei, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Tuesday, December 25, 2018 12:17 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>
> Subject: [PATCH v4 6/7] ShellPkg/Shell: Use BaseLib api CharToUpper
> Importance: High
>
> Substitute InternalShellCharToUpper with a public function
> CharToUpper which has the same function.
> Remove the implement of InternalShellCharToUpper.
>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> ShellPkg/Application/Shell/ShellManParser.c | 23 +--------------------
> 1 file changed, 1 insertion(+), 22 deletions(-)
>
> diff --git a/ShellPkg/Application/Shell/ShellManParser.c
> b/ShellPkg/Application/Shell/ShellManParser.c
> index b180c6c8f7..2c044dbe4a 100644
> --- a/ShellPkg/Application/Shell/ShellManParser.c
> +++ b/ShellPkg/Application/Shell/ShellManParser.c
> @@ -46,27 +46,6 @@ SHELL_MAN_HII_VENDOR_DEVICE_PATH
> mShellManHiiDevicePath = {
> }
> };
>
> -
> -/**
> - 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
> -InternalShellCharToUpper (
> - IN CHAR16 Char
> - );
> -
> /**
> Verifies that the filename has .EFI on the end.
>
> @@ -416,7 +395,7 @@ IsTitleHeader(
> ReturnFound = TRUE; // This is the desired command's title header line.
> State = (BriefDesc == NULL) ? Final : GetBriefDescription;
> }
> - else if (InternalShellCharToUpper (*Line) != InternalShellCharToUpper
> (*(Command + CommandIndex++))) {
> + else if (CharToUpper (*Line) != CharToUpper (*(Command +
> CommandIndex++))) {
> State = Final;
> }
> Line++;
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 0/7] Introduce two public functions and remove internal ones
2018-12-25 8:17 [PATCH v4 0/7] Introduce two public functions and remove internal ones Shenglei Zhang
` (7 preceding siblings ...)
2018-12-26 20:11 ` [PATCH v4 0/7] Introduce two public functions and remove internal ones Laszlo Ersek
@ 2019-01-29 3:10 ` Gao, Liming
8 siblings, 0 replies; 16+ messages in thread
From: Gao, Liming @ 2019-01-29 3:10 UTC (permalink / raw)
To: Zhang, Shenglei, edk2-devel@lists.01.org
Cc: Kinney, Michael D, Leif Lindholm, Laszlo Ersek, Wang, Jian J,
Wu, Hao A, Zeng, Star, Ni, Ray, Carsey, Jaben
Reviewed-by: Liming Gao <liming.gao@intel.com> for this patch set.
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Tuesday, December 25, 2018 4:17 PM
> To: edk2-devel@lists.01.org
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>; Leif Lindholm <leif.lindholm@linaro.org>;
> Laszlo Ersek <lersek@redhat.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Zeng, Star
> <star.zeng@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>
> Subject: [PATCH v4 0/7] Introduce two public functions and remove internal ones
>
> Introduce public functions CharToUpper and AsciiToUpper.
> Remove internal functions InternalCharToUpper and InternalBaseLibAsciiToUpper.
>
> v2: Update the title and commit message of 1/3.
>
> v3: 1.Add a patch to remove AsciiToUpper in EdbSupportString.c.
> 2.Revert the changes in Basetools.
>
> v4: 1.Add1/7: Change function names in EdbSupportString.c.
> 2.Update the title of 4/7.
> 3.Add 5/7: Use BaseLib api AsciiToUpper in DxeHttpLib.c.
> 4.Add 6/7: Use BaseLib api CharToUpper in ShellManParser.c.
> 5.Add 7/7: Use BaseLib api CharToUpper in UefiShellLib.c.
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao Wu <hao.a.wu@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Shenglei Zhang (7):
> MdeModulePkg/EbcDebugger: Change function names
> MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly
> MdePkg/BaseLib: Remove InternalCharToUpper and
> InternalBaseLibAsciiToUpper
> MdeModulePkg/EbcDebugger: Use BaseLib apis AsciiToUpper and
> CharToUpper
> MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiToUpper
> ShellPkg/Shell: Use BaseLib api CharToUpper
> ShellPkg/UefiShellLib: Use BaseLib api CharToUpper
>
> MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 23 +---------
> .../EbcDxe/EbcDebugger/EdbSupportString.c | 39 ++---------------
> MdePkg/Include/Library/BaseLib.h | 40 ++++++++++++++++++
> MdePkg/Library/BaseLib/BaseLibInternals.h | 42 -------------------
> MdePkg/Library/BaseLib/SafeString.c | 8 ++--
> MdePkg/Library/BaseLib/String.c | 16 +++----
> ShellPkg/Application/Shell/ShellManParser.c | 23 +---------
> ShellPkg/Library/UefiShellLib/UefiShellLib.c | 31 +-------------
> 8 files changed, 60 insertions(+), 162 deletions(-)
>
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 2/7] MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly
2018-12-25 8:17 ` [PATCH v4 2/7] MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly Shenglei Zhang
@ 2019-01-29 7:45 ` Ni, Ruiyu
0 siblings, 0 replies; 16+ messages in thread
From: Ni, Ruiyu @ 2019-01-29 7:45 UTC (permalink / raw)
To: Shenglei Zhang, edk2-devel; +Cc: Michael D Kinney, Laszlo Ersek, Liming Gao
On 12/25/2018 4:17 PM, Shenglei Zhang wrote:
> Introduce two public functions CharToUpper and AsciiToUpper.
> 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: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> 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>
> ---
> MdePkg/Include/Library/BaseLib.h | 40 +++++++++++++++++++++++++++++
> MdePkg/Library/BaseLib/SafeString.c | 8 +++---
> MdePkg/Library/BaseLib/String.c | 16 ++++++------
> 3 files changed, 52 insertions(+), 12 deletions(-)
>
> diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
> index 1eb842384e..e8cc121ddd 100644
> --- a/MdePkg/Include/Library/BaseLib.h
> +++ b/MdePkg/Include/Library/BaseLib.h
> @@ -2720,6 +2720,46 @@ AsciiStrnToUnicodeStrS (
> 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
> +AsciiToUpper (
> + IN CHAR8 Chr
> + );
> +
> /**
> Converts an 8-bit value to an 8-bit BCD value.
>
> diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
> index 417497cbc9..17f88b46d8 100644
> --- a/MdePkg/Library/BaseLib/SafeString.c
> +++ b/MdePkg/Library/BaseLib/SafeString.c
> @@ -905,7 +905,7 @@ StrHexToUintnS (
> String++;
> }
>
> - if (InternalCharToUpper (*String) == L'X') {
> + if (CharToUpper (*String) == L'X') {
> if (*(String - 1) != L'0') {
> *Data = 0;
> return RETURN_SUCCESS;
> @@ -1036,7 +1036,7 @@ StrHexToUint64S (
> String++;
> }
>
> - if (InternalCharToUpper (*String) == L'X') {
> + if (CharToUpper (*String) == L'X') {
> if (*(String - 1) != L'0') {
> *Data = 0;
> return RETURN_SUCCESS;
> @@ -2459,7 +2459,7 @@ AsciiStrHexToUintnS (
> String++;
> }
>
> - if (InternalBaseLibAsciiToUpper (*String) == 'X') {
> + if (AsciiToUpper (*String) == 'X') {
> if (*(String - 1) != '0') {
> *Data = 0;
> return RETURN_SUCCESS;
> @@ -2586,7 +2586,7 @@ AsciiStrHexToUint64S (
> String++;
> }
>
> - if (InternalBaseLibAsciiToUpper (*String) == 'X') {
> + if (AsciiToUpper (*String) == 'X') {
> if (*(String - 1) != '0') {
> *Data = 0;
> return RETURN_SUCCESS;
> diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c
> index e6df12797d..dba53779c9 100644
> --- a/MdePkg/Library/BaseLib/String.c
> +++ b/MdePkg/Library/BaseLib/String.c
> @@ -552,7 +552,7 @@ InternalIsDecimalDigitCharacter (
> **/
> CHAR16
> EFIAPI
> -InternalCharToUpper (
> +CharToUpper (
> IN CHAR16 Char
> )
> {
> @@ -586,7 +586,7 @@ InternalHexCharToUintn (
> return Char - L'0';
> }
>
> - return (10 + InternalCharToUpper (Char) - L'A');
> + return (10 + CharToUpper (Char) - L'A');
> }
>
> /**
> @@ -1181,7 +1181,7 @@ AsciiStrCmp (
> **/
> CHAR8
> EFIAPI
> -InternalBaseLibAsciiToUpper (
> +AsciiToUpper (
> IN CHAR8 Chr
> )
> {
> @@ -1211,7 +1211,7 @@ InternalAsciiHexCharToUintn (
> return Char - '0';
> }
>
> - return (10 + InternalBaseLibAsciiToUpper (Char) - 'A');
> + return (10 + AsciiToUpper (Char) - 'A');
> }
>
>
> @@ -1260,13 +1260,13 @@ AsciiStriCmp (
> ASSERT (AsciiStrSize (FirstString));
> ASSERT (AsciiStrSize (SecondString));
>
> - UpperFirstString = InternalBaseLibAsciiToUpper (*FirstString);
> - UpperSecondString = InternalBaseLibAsciiToUpper (*SecondString);
> + UpperFirstString = AsciiToUpper (*FirstString);
> + UpperSecondString = AsciiToUpper (*SecondString);
> while ((*FirstString != '\0') && (*SecondString != '\0') && (UpperFirstString == UpperSecondString)) {
> FirstString++;
> SecondString++;
> - UpperFirstString = InternalBaseLibAsciiToUpper (*FirstString);
> - UpperSecondString = InternalBaseLibAsciiToUpper (*SecondString);
> + UpperFirstString = AsciiToUpper (*FirstString);
> + UpperSecondString = AsciiToUpper (*SecondString);
> }
>
> return UpperFirstString - UpperSecondString;
>
Shenglei,
Do we need to make the two API names consistent to existing string APIs
in BaseLib?
All ASCII version of string APIs have the "Ascii" prefix, for example:
StrLen, AsciiStrLen
StrHexToUintn, AsciiStrHexToUintn.
So how about to use "CharToUpper" and "AsciiCharToUpper"?
By the way, I cannot find the implementation of CharToUpper() in your patch.
--
Thanks,
Ray
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2019-01-29 7:43 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-25 8:17 [PATCH v4 0/7] Introduce two public functions and remove internal ones Shenglei Zhang
2018-12-25 8:17 ` [PATCH v4 1/7] MdeModulePkg/EbcDebugger: Change function names Shenglei Zhang
2018-12-25 8:40 ` Wu, Hao A
2018-12-25 8:17 ` [PATCH v4 2/7] MdePkg/BaseLib: Introduce CharToUpper and AsciiToUpper publicly Shenglei Zhang
2019-01-29 7:45 ` Ni, Ruiyu
2018-12-25 8:17 ` [PATCH v4 3/7] MdePkg/BaseLib: Remove definitions of two functions Shenglei Zhang
2018-12-25 8:17 ` [PATCH v4 4/7] MdeModulePkg/EbcDebugger: Use AsciiToUpper and CharToUpper Shenglei Zhang
2018-12-25 8:43 ` Wu, Hao A
2018-12-25 8:17 ` [PATCH v4 5/7] MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiToUpper Shenglei Zhang
2018-12-25 8:46 ` Wu, Hao A
2018-12-25 8:17 ` [PATCH v4 6/7] ShellPkg/Shell: Use BaseLib api CharToUpper Shenglei Zhang
2018-12-31 21:22 ` Carsey, Jaben
2018-12-25 8:17 ` [PATCH v4 7/7] ShellPkg/UefiShellLib: " Shenglei Zhang
2018-12-31 21:22 ` Carsey, Jaben
2018-12-26 20:11 ` [PATCH v4 0/7] Introduce two public functions and remove internal ones Laszlo Ersek
2019-01-29 3:10 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox