TianoCore EDK2 master
|
#include "BaseLibInternals.h"
Go to the source code of this file.
Functions | |
UINTN EFIAPI | StrLen (IN CONST CHAR16 *String) |
UINTN EFIAPI | StrSize (IN CONST CHAR16 *String) |
INTN EFIAPI | StrCmp (IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString) |
INTN EFIAPI | StrnCmp (IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString, IN UINTN Length) |
CHAR16 *EFIAPI | StrStr (IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString) |
BOOLEAN EFIAPI | InternalIsDecimalDigitCharacter (IN CHAR16 Char) |
CHAR16 EFIAPI | CharToUpper (IN CHAR16 Char) |
UINTN EFIAPI | InternalHexCharToUintn (IN CHAR16 Char) |
BOOLEAN EFIAPI | InternalIsHexaDecimalDigitCharacter (IN CHAR16 Char) |
UINTN EFIAPI | StrDecimalToUintn (IN CONST CHAR16 *String) |
UINT64 EFIAPI | StrDecimalToUint64 (IN CONST CHAR16 *String) |
UINTN EFIAPI | StrHexToUintn (IN CONST CHAR16 *String) |
UINT64 EFIAPI | StrHexToUint64 (IN CONST CHAR16 *String) |
BOOLEAN EFIAPI | InternalAsciiIsDecimalDigitCharacter (IN CHAR8 Char) |
BOOLEAN EFIAPI | InternalAsciiIsHexaDecimalDigitCharacter (IN CHAR8 Char) |
UINTN EFIAPI | AsciiStrLen (IN CONST CHAR8 *String) |
UINTN EFIAPI | AsciiStrSize (IN CONST CHAR8 *String) |
INTN EFIAPI | AsciiStrCmp (IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString) |
CHAR8 EFIAPI | AsciiCharToUpper (IN CHAR8 Chr) |
UINTN EFIAPI | InternalAsciiHexCharToUintn (IN CHAR8 Char) |
INTN EFIAPI | AsciiStriCmp (IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString) |
INTN EFIAPI | AsciiStrnCmp (IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length) |
CHAR8 *EFIAPI | AsciiStrStr (IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString) |
UINTN EFIAPI | AsciiStrDecimalToUintn (IN CONST CHAR8 *String) |
UINT64 EFIAPI | AsciiStrDecimalToUint64 (IN CONST CHAR8 *String) |
UINTN EFIAPI | AsciiStrHexToUintn (IN CONST CHAR8 *String) |
UINT64 EFIAPI | AsciiStrHexToUint64 (IN CONST CHAR8 *String) |
RETURN_STATUS EFIAPI | Base64Encode (IN CONST UINT8 *Source, IN UINTN SourceLength, OUT CHAR8 *Destination OPTIONAL, IN OUT UINTN *DestinationSize) |
RETURN_STATUS EFIAPI | Base64Decode (IN CONST CHAR8 *Source OPTIONAL, IN UINTN SourceSize, OUT UINT8 *Destination OPTIONAL, IN OUT UINTN *DestinationSize) |
UINT8 EFIAPI | DecimalToBcd8 (IN UINT8 Value) |
UINT8 EFIAPI | BcdToDecimal8 (IN UINT8 Value) |
Variables | |
STATIC CHAR8 | EncodingTable [] |
Unicode and ASCII string primitives.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file String.c.
CHAR8 EFIAPI AsciiCharToUpper | ( | IN CHAR8 | Chr | ) |
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().
Chr | one Ascii character |
Compares two Null-terminated ASCII strings, and returns the difference between the first mismatched ASCII characters.
This function compares the Null-terminated ASCII string FirstString to the Null-terminated ASCII string SecondString. If FirstString is identical to SecondString, then 0 is returned. Otherwise, the value returned is the first mismatched ASCII character in SecondString subtracted from the first mismatched ASCII character in FirstString.
If FirstString is NULL, then ASSERT(). If SecondString is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and FirstString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and SecondString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT().
FirstString | A pointer to a Null-terminated ASCII string. |
SecondString | A pointer to a Null-terminated ASCII string. |
==0 | FirstString is identical to SecondString. |
!=0 | FirstString is not identical to SecondString. |
Convert a Null-terminated ASCII decimal string to a value of type UINT64.
This function returns a value of type UINT64 by interpreting the contents of the ASCII string String as a decimal number. The format of the input ASCII string String is:
[spaces] [decimal digits].
The valid decimal digit character is in the range [0-9]. The function will ignore the pad space, which includes spaces or tab characters, before the digits. The running zero in the beginning of [decimal digits] will be ignored. Then, the function stops at the first character that is a not a valid decimal character or Null-terminator, whichever on comes first.
If String has only pad spaces, then 0 is returned. If String has no pad spaces or valid decimal digits, then 0 is returned. If the number represented by String overflows according to the range defined by UINT64, then MAX_UINT64 is returned. If String is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and String contains more than PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated ASCII string. |
Value | translated from String. |
Convert a Null-terminated ASCII decimal string to a value of type UINTN.
This function returns a value of type UINTN by interpreting the contents of the ASCII string String as a decimal number. The format of the input ASCII string String is:
[spaces] [decimal digits].
The valid decimal digit character is in the range [0-9]. The function will ignore the pad space, which includes spaces or tab characters, before the digits. The running zero in the beginning of [decimal digits] will be ignored. Then, the function stops at the first character that is a not a valid decimal character or Null-terminator, whichever on comes first.
If String has only pad spaces, then 0 is returned. If String has no pad spaces or valid decimal digits, then 0 is returned. If the number represented by String overflows according to the range defined by UINTN, then MAX_UINTN is returned. If String is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and String contains more than PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated ASCII string. |
Value | translated from String. |
Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.
This function returns a value of type UINT64 by interpreting the contents of the ASCII string String as a hexadecimal number. The format of the input ASCII string String is:
[spaces][zeros][x][hexadecimal digits].
The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x" appears in the input string, it must be prefixed with at least one 0. The function will ignore the pad space, which includes spaces or tab characters, before [zeros], [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits] will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal digit. Then, the function stops at the first character that is a not a valid hexadecimal character or Null-terminator, whichever on comes first.
If String has only pad spaces, then 0 is returned. If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then 0 is returned.
If the number represented by String overflows according to the range defined by UINT64, then MAX_UINT64 is returned. If String is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and String contains more than PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated ASCII string. |
Value | translated from String. |
Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN.
This function returns a value of type UINTN by interpreting the contents of the ASCII string String as a hexadecimal number. The format of the input ASCII string String is:
[spaces][zeros][x][hexadecimal digits].
The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x" appears in the input string, it must be prefixed with at least one 0. The function will ignore the pad space, which includes spaces or tab characters, before [zeros], [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits] will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal digit. Then, the function stops at the first character that is a not a valid hexadecimal character or Null-terminator, whichever on comes first.
If String has only pad spaces, then 0 is returned. If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then 0 is returned.
If the number represented by String overflows according to the range defined by UINTN, then MAX_UINTN is returned. If String is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and String contains more than PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated ASCII string. |
Value | translated from String. |
Performs a case insensitive comparison of two Null-terminated ASCII strings, and returns the difference between the first mismatched ASCII characters.
This function performs a case insensitive comparison of the Null-terminated ASCII string FirstString to the Null-terminated ASCII string SecondString. If FirstString is identical to SecondString, then 0 is returned. Otherwise, the value returned is the first mismatched lower case ASCII character in SecondString subtracted from the first mismatched lower case ASCII character in FirstString.
If FirstString is NULL, then ASSERT(). If SecondString is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and FirstString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and SecondString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT().
FirstString | A pointer to a Null-terminated ASCII string. |
SecondString | A pointer to a Null-terminated ASCII string. |
==0 | FirstString is identical to SecondString using case insensitive comparisons. |
!=0 | FirstString is not identical to SecondString using case insensitive comparisons. |
Returns the length of a Null-terminated ASCII string.
This function returns the number of ASCII characters in the Null-terminated ASCII string specified by String.
If Length > 0 and Destination is NULL, then ASSERT(). If Length > 0 and Source is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and String contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated ASCII string. |
INTN EFIAPI AsciiStrnCmp | ( | IN CONST CHAR8 * | FirstString, |
IN CONST CHAR8 * | SecondString, | ||
IN UINTN | Length | ||
) |
Compares two Null-terminated ASCII strings with maximum lengths, and returns the difference between the first mismatched ASCII characters.
This function compares the Null-terminated ASCII string FirstString to the Null-terminated ASCII string SecondString. At most, Length ASCII characters will be compared. If Length is 0, then 0 is returned. If FirstString is identical to SecondString, then 0 is returned. Otherwise, the value returned is the first mismatched ASCII character in SecondString subtracted from the first mismatched ASCII character in FirstString.
If Length > 0 and FirstString is NULL, then ASSERT(). If Length > 0 and SecondString is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and Length is greater than PcdMaximumAsciiStringLength, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and FirstString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and SecondString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT().
FirstString | A pointer to a Null-terminated ASCII string. |
SecondString | A pointer to a Null-terminated ASCII string. |
Length | The maximum number of ASCII characters for compare. |
==0 | FirstString is identical to SecondString. |
!=0 | FirstString is not identical to SecondString. |
Returns the size of a Null-terminated ASCII string in bytes, including the Null terminator.
This function returns the size, in bytes, of the Null-terminated ASCII string specified by String.
If String is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and String contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated ASCII string. |
Returns the first occurrence of a Null-terminated ASCII sub-string in a Null-terminated ASCII string.
This function scans the contents of the ASCII string specified by String and returns the first occurrence of SearchString. If SearchString is not found in String, then NULL is returned. If the length of SearchString is zero, then String is returned.
If String is NULL, then ASSERT(). If SearchString is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and SearchString or String contains more than PcdMaximumAsciiStringLength Unicode characters not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated ASCII string. |
SearchString | A pointer to a Null-terminated ASCII string to search for. |
NULL | If the SearchString does not appear in String. |
others | If there is a match return the first occurrence of SearchingString. If the length of SearchString is zero,return String. |
RETURN_STATUS EFIAPI Base64Decode | ( | IN CONST CHAR8 *Source | OPTIONAL, |
IN UINTN | SourceSize, | ||
OUT UINT8 *Destination | OPTIONAL, | ||
IN OUT UINTN * | DestinationSize | ||
) |
Decode Base64 ASCII encoded data to 8-bit binary representation, based on RFC4648.
Decoding occurs according to "Table 1: The Base 64 Alphabet" in RFC4648.
Whitespace is ignored at all positions:
The minimum amount of required padding (with ASCII 0x3D, '=') is tolerated and enforced at the end of the Base64 ASCII encoded data, and only there.
Other characters outside of the encoding alphabet cause the function to reject the Base64 ASCII encoded data.
[in] | Source | Array of CHAR8 elements containing the Base64 ASCII encoding. May be NULL if SourceSize is zero. |
[in] | SourceSize | Number of CHAR8 elements in Source. |
[out] | Destination | Array of UINT8 elements receiving the decoded 8-bit binary representation. Allocated by the caller. May be NULL if DestinationSize is zero on input. If NULL, decoding is performed, but the 8-bit binary representation is not stored. If non-NULL and the function returns an error, the contents of Destination are indeterminate. |
[in,out] | DestinationSize | On input, the number of UINT8 elements that the caller allocated for Destination. On output, if the function returns RETURN_SUCCESS or RETURN_BUFFER_TOO_SMALL, the number of UINT8 elements that are required for decoding the Base64 ASCII representation. If the function returns a value different from both RETURN_SUCCESS and RETURN_BUFFER_TOO_SMALL, then DestinationSize is indeterminate on output. |
RETURN_SUCCESS | SourceSize CHAR8 elements at Source have been decoded to on-output DestinationSize UINT8 elements at Destination. Note that RETURN_SUCCESS covers the case when DestinationSize is zero on input, and Source decodes to zero bytes (due to containing at most ignored whitespace). |
RETURN_BUFFER_TOO_SMALL | The input value of DestinationSize is not large enough for decoding SourceSize CHAR8 elements at Source. The required number of UINT8 elements has been stored to DestinationSize. |
RETURN_INVALID_PARAMETER | DestinationSize is NULL. |
RETURN_INVALID_PARAMETER | Source is NULL, but SourceSize is not zero. |
RETURN_INVALID_PARAMETER | Destination is NULL, but DestinationSize is not zero on input. |
RETURN_INVALID_PARAMETER | Source is non-NULL, and (Source + SourceSize) would wrap around MAX_ADDRESS. |
RETURN_INVALID_PARAMETER | Destination is non-NULL, and (Destination + DestinationSize) would wrap around MAX_ADDRESS, as specified on input. |
RETURN_INVALID_PARAMETER | None of Source and Destination are NULL, and CHAR8[SourceSize] at Source overlaps UINT8[DestinationSize] at Destination, as specified on input. |
RETURN_INVALID_PARAMETER | Invalid CHAR8 element encountered in Source. |
RETURN_STATUS EFIAPI Base64Encode | ( | IN CONST UINT8 * | Source, |
IN UINTN | SourceLength, | ||
OUT CHAR8 *Destination | OPTIONAL, | ||
IN OUT UINTN * | DestinationSize | ||
) |
Convert binary data to a Base64 encoded ascii string based on RFC4648.
Produce a Null-terminated Ascii string in the output buffer specified by Destination and DestinationSize. The Ascii string is produced by converting the data string specified by Source and SourceLength.
Source | Input UINT8 data |
SourceLength | Number of UINT8 bytes of data |
Destination | Pointer to output string buffer |
DestinationSize | Size of ascii buffer. Set to 0 to get the size needed. Caller is responsible for passing in buffer of DestinationSize |
RETURN_SUCCESS | When ascii buffer is filled in. |
RETURN_INVALID_PARAMETER | If Source is NULL or DestinationSize is NULL. |
RETURN_INVALID_PARAMETER | If SourceLength or DestinationSize is bigger than (MAX_ADDRESS - (UINTN)Destination). |
RETURN_BUFFER_TOO_SMALL | If SourceLength is 0 and DestinationSize is <1. |
RETURN_BUFFER_TOO_SMALL | If Destination is NULL or DestinationSize is smaller than required buffersize. |
UINT8 EFIAPI BcdToDecimal8 | ( | IN UINT8 | Value | ) |
Converts an 8-bit BCD value to an 8-bit value.
Converts the 8-bit BCD value specified by Value to an 8-bit value. The 8-bit value is returned.
If Value >= 0xA0, then ASSERT(). If (Value & 0x0F) >= 0x0A, then ASSERT().
Value | The 8-bit BCD value to convert to an 8-bit value. |
CHAR16 EFIAPI CharToUpper | ( | IN CHAR16 | Char | ) |
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.
Char | The character to convert. |
LowerCharacter | If the Char is with range L'a' to L'z'. |
Unchanged | Otherwise. |
UINT8 EFIAPI DecimalToBcd8 | ( | IN UINT8 | Value | ) |
Convert a ASCII character to numerical value.
This internal function only deal with Unicode character which maps to a valid hexadecimal ASII character, i.e. '0' to '9', 'a' to 'f' or 'A' to 'F'. For other ASCII character, the value returned does not make sense.
Char | The character to convert. |
BOOLEAN EFIAPI InternalAsciiIsDecimalDigitCharacter | ( | IN CHAR8 | Char | ) |
Check if a ASCII character is a decimal character.
This internal function checks if a Unicode character is a decimal character. The valid decimal character is from '0' to '9'.
Char | The character to check against. |
TRUE | If the Char is a decmial character. |
FALSE | If the Char is not a decmial character. |
BOOLEAN EFIAPI InternalAsciiIsHexaDecimalDigitCharacter | ( | IN CHAR8 | Char | ) |
Check if a ASCII character is a hexadecimal character.
This internal function checks if a ASCII character is a decimal character. The valid hexadecimal character is L'0' to L'9', L'a' to L'f', or L'A' to L'F'.
Char | The character to check against. |
TRUE | If the Char is a hexadecmial character. |
FALSE | If the Char is not a hexadecmial character. |
Convert a Unicode character to numerical value.
This internal function only deal with Unicode character which maps to a valid hexadecimal ASII character, i.e. L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other Unicode character, the value returned does not make sense.
Char | The character to convert. |
BOOLEAN EFIAPI InternalIsDecimalDigitCharacter | ( | IN CHAR16 | Char | ) |
Check if a Unicode character is a decimal character.
This internal function checks if a Unicode character is a decimal character. The valid decimal character is from L'0' to L'9'.
Char | The character to check against. |
TRUE | If the Char is a decmial character. |
FALSE | If the Char is not a decmial character. |
BOOLEAN EFIAPI InternalIsHexaDecimalDigitCharacter | ( | IN CHAR16 | Char | ) |
Check if a Unicode character is a hexadecimal character.
This internal function checks if a Unicode character is a decimal character. The valid hexadecimal character is L'0' to L'9', L'a' to L'f', or L'A' to L'F'.
Char | The character to check against. |
TRUE | If the Char is a hexadecmial character. |
FALSE | If the Char is not a hexadecmial character. |
Compares two Null-terminated Unicode strings, and returns the difference between the first mismatched Unicode characters.
This function compares the Null-terminated Unicode string FirstString to the Null-terminated Unicode string SecondString. If FirstString is identical to SecondString, then 0 is returned. Otherwise, the value returned is the first mismatched Unicode character in SecondString subtracted from the first mismatched Unicode character in FirstString.
If FirstString is NULL, then ASSERT(). If FirstString is not aligned on a 16-bit boundary, then ASSERT(). If SecondString is NULL, then ASSERT(). If SecondString is not aligned on a 16-bit boundary, then ASSERT(). If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT(). If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT().
FirstString | A pointer to a Null-terminated Unicode string. |
SecondString | A pointer to a Null-terminated Unicode string. |
0 | FirstString is identical to SecondString. |
Convert a Null-terminated Unicode decimal string to a value of type UINT64.
This function returns a value of type UINT64 by interpreting the contents of the Unicode string specified by String as a decimal number. The format of the input Unicode string String is:
[spaces] [decimal digits].
The valid decimal digit character is in the range [0-9]. The function will ignore the pad space, which includes spaces or tab characters, before [decimal digits]. The running zero in the beginning of [decimal digits] will be ignored. Then, the function stops at the first character that is a not a valid decimal character or a Null-terminator, whichever one comes first.
If String is NULL, then ASSERT(). If String is not aligned in a 16-bit boundary, then ASSERT(). If String has only pad spaces, then 0 is returned. If String has no pad spaces or valid decimal digits, then 0 is returned. If the number represented by String overflows according to the range defined by UINT64, then MAX_UINT64 is returned.
If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated Unicode string. |
Value | translated from String. |
Convert a Null-terminated Unicode decimal string to a value of type UINTN.
This function returns a value of type UINTN by interpreting the contents of the Unicode string specified by String as a decimal number. The format of the input Unicode string String is:
[spaces] [decimal digits].
The valid decimal digit character is in the range [0-9]. The function will ignore the pad space, which includes spaces or tab characters, before [decimal digits]. The running zero in the beginning of [decimal digits] will be ignored. Then, the function stops at the first character that is a not a valid decimal character or a Null-terminator, whichever one comes first.
If String is NULL, then ASSERT(). If String is not aligned in a 16-bit boundary, then ASSERT(). If String has only pad spaces, then 0 is returned. If String has no pad spaces or valid decimal digits, then 0 is returned. If the number represented by String overflows according to the range defined by UINTN, then MAX_UINTN is returned.
If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated Unicode string. |
Value | translated from String. |
Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.
This function returns a value of type UINT64 by interpreting the contents of the Unicode string specified by String as a hexadecimal number. The format of the input Unicode string String is
[spaces][zeros][x][hexadecimal digits].
The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x" appears in the input string, it must be prefixed with at least one 0. The function will ignore the pad space, which includes spaces or tab characters, before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal digit. Then, the function stops at the first character that is a not a valid hexadecimal character or NULL, whichever one comes first.
If String is NULL, then ASSERT(). If String is not aligned in a 16-bit boundary, then ASSERT(). If String has only pad spaces, then zero is returned. If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then zero is returned. If the number represented by String overflows according to the range defined by UINT64, then MAX_UINT64 is returned.
If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated Unicode string. |
Value | translated from String. |
Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN.
This function returns a value of type UINTN by interpreting the contents of the Unicode string specified by String as a hexadecimal number. The format of the input Unicode string String is:
[spaces][zeros][x][hexadecimal digits].
The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x" appears in the input string, it must be prefixed with at least one 0. The function will ignore the pad space, which includes spaces or tab characters, before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal digit. Then, the function stops at the first character that is a not a valid hexadecimal character or NULL, whichever one comes first.
If String is NULL, then ASSERT(). If String is not aligned in a 16-bit boundary, then ASSERT(). If String has only pad spaces, then zero is returned. If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then zero is returned. If the number represented by String overflows according to the range defined by UINTN, then MAX_UINTN is returned.
If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated Unicode string. |
Value | translated from String. |
Returns the length of a Null-terminated Unicode string.
This function returns the number of Unicode characters in the Null-terminated Unicode string specified by String.
If String is NULL, then ASSERT(). If String is not aligned on a 16-bit boundary, then ASSERT(). If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated Unicode string. |
INTN EFIAPI StrnCmp | ( | IN CONST CHAR16 * | FirstString, |
IN CONST CHAR16 * | SecondString, | ||
IN UINTN | Length | ||
) |
Compares up to a specified length the contents of two Null-terminated Unicode strings, and returns the difference between the first mismatched Unicode characters.
This function compares the Null-terminated Unicode string FirstString to the Null-terminated Unicode string SecondString. At most, Length Unicode characters will be compared. If Length is 0, then 0 is returned. If FirstString is identical to SecondString, then 0 is returned. Otherwise, the value returned is the first mismatched Unicode character in SecondString subtracted from the first mismatched Unicode character in FirstString.
If Length > 0 and FirstString is NULL, then ASSERT(). If Length > 0 and FirstString is not aligned on a 16-bit boundary, then ASSERT(). If Length > 0 and SecondString is NULL, then ASSERT(). If Length > 0 and SecondString is not aligned on a 16-bit boundary, then ASSERT(). If PcdMaximumUnicodeStringLength is not zero, and Length is greater than PcdMaximumUnicodeStringLength, then ASSERT(). If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT(). If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT().
FirstString | A pointer to a Null-terminated Unicode string. |
SecondString | A pointer to a Null-terminated Unicode string. |
Length | The maximum number of Unicode characters to compare. |
0 | FirstString is identical to SecondString. |
Returns the size of a Null-terminated Unicode string in bytes, including the Null terminator.
This function returns the size, in bytes, of the Null-terminated Unicode string specified by String.
If String is NULL, then ASSERT(). If String is not aligned on a 16-bit boundary, then ASSERT(). If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated Unicode string. |
Returns the first occurrence of a Null-terminated Unicode sub-string in a Null-terminated Unicode string.
This function scans the contents of the Null-terminated Unicode string specified by String and returns the first occurrence of SearchString. If SearchString is not found in String, then NULL is returned. If the length of SearchString is zero, then String is returned.
If String is NULL, then ASSERT(). If String is not aligned on a 16-bit boundary, then ASSERT(). If SearchString is NULL, then ASSERT(). If SearchString is not aligned on a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and SearchString or String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT().
String | A pointer to a Null-terminated Unicode string. |
SearchString | A pointer to a Null-terminated Unicode string to search for. |
NULL | If the SearchString does not appear in String. |