WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@pierregondois
Copy link
Contributor

Description

The edk2 repository contains multiple local implementations of string utilities:

  • checking a string/char uppercase/lowercase/alphanumerical/hexadecimal compliance
  • replacing uppercase string/char to lowercase (or conversely)

Add string/char utilities to BaseLib and remove some of the local implementations.
Not all implementations have been replaced, but this is a first step.

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

Add the following functions to BaseLib:
- StrCharIsLowerAlpha ()
- StrCharIsUpperAlpha ()
- StrCharIsAlpha ()
- StrCharIsNum ()
- StrCharIsHexNum ()
- StrCharIsUpperHexNum ()
- StrCharIsAlphaNum ()
- StrnIsLowerAlpha ()
- StrnIsUpperAlpha ()
- StrnIsAlpha ()
- StrnIsNum ()
- StrnIsHexNum ()
- StrnIsUpperHexNum ()
- StrnIsAlphaNum ()

Signed-off-by: Pierre Gondois <[email protected]>
Replace hard-coded string checks by the new utility
functions added to BaseLib.

Signed-off-by: Pierre Gondois <[email protected]>
Replace hard-coded string checks by the new utility
functions added to BaseLib.

Signed-off-by: Pierre Gondois <[email protected]>
Replace hard-coded string checks by the new utility
functions added to BaseLib.

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace VarCheckInternalIsHexaDecimalDigitCharacter() by
StrCharIsUpperHexNum().

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace InternalIsDecimalDigitCharacter() by StrCharIsNum().

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace InternalIsHexaDecimalDigitCharacter() by StrCharIsHexNum().

Signed-off-by: Pierre Gondois <[email protected]>
Replace hard-coded string checks by the new utility
functions added to BaseLib.

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace IsNumberLetterOnly() by StrnIsAlphaNum().

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace ShellIsHexaDecimalDigitCharacter() by StrCharIsHexNum().

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace ShellIsDecimalDigitCharacter() by StrCharIsNum().

Signed-off-by: Pierre Gondois <[email protected]>
Add the following functions to BaseLib:
- AsciiCharIsLowerAlpha ()
- AsciiCharIsUpperAlpha ()
- AsciiCharIsAlpha ()
- AsciiCharIsNum ()
- AsciiCharIsHexNum ()
- AsciiCharIsUpperHexNum ()
- AsciiCharIsAlphaNum ()
- AsciiStrnIsLowerAlpha ()
- AsciiStrnIsUpperAlpha ()
- AsciiStrnIsAlpha ()
- AsciiStrnIsNum ()
- AsciiStrnIsHexNum ()
- AsciiStrnIsUpperHexNum ()
- AsciiStrnIsAlphaNum ()

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace ToUpper() by CharToUpper().

Signed-off-by: Pierre Gondois <[email protected]>
Replace hard-coded string checks by the new utility
functions added to BaseLib.

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace the macros defined in NetLib.h by the appropriate
equivalent.

Signed-off-by: Pierre Gondois <[email protected]>
Replace hard-coded string checks by the new utility
functions added to BaseLib.

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace InternalAsciiIsDecimalDigitCharacter() by AsciiCharIsNum().

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace InternalAsciiIsHexaDecimalDigitCharacter() by AsciiCharIsHexNum().

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace IsAlnum() by AsciiCharIsAlphaNum().

Signed-off-by: Pierre Gondois <[email protected]>
Copy link
Contributor

@os-d os-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for EmulatorPkg and FatPkg.

With the newly added string function to BaseLib,
replace IsValidDigitalChar() by:
- AsciiStrnIsNum()
- AsciiCharIsHexNum()

Signed-off-by: Pierre Gondois <[email protected]>
Add the following string/char conversion functions:
- AsciiCharToUpper ()
- AsciiCharToLower ()
- CharToLower ()
- StrnCharToUpper ()
- StrnCharToLower ()

CharToUpper() and AsciiCharToUpper() are just moved
String.c.

Signed-off-by: Pierre Gondois <[email protected]>
Replace hard-coded string checks by the new utility
functions added to BaseLib.

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace UpperCaseString() by StrnCharToUpper().

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace UpperCaseString() by StrnCharToUpper().

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace LibToLowerString() by StrnCharToLower().

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace VarCheckUefiIsHexaDecimalDigitCharacter() by
StrCharIsUpperHexNum().

Signed-off-by: Pierre Gondois <[email protected]>
With the newly added string function to BaseLib,
replace ToLower() by StrnCharToLower().

Signed-off-by: Pierre Gondois <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants