OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcStringLib.h File Reference
#include <Uefi.h>

Go to the source code of this file.

Macros

#define L_STR_LEN(String)
 
#define L_STR_SIZE(String)
 
#define L_STR_SIZE_NT(String)
 

Typedefs

typedef enum _OC_STRING_FORMAT OC_STRING_FORMAT
 

Enumerations

enum  _OC_STRING_FORMAT { OcStringFormatAscii , OcStringFormatUnicode }
 

Functions

BOOLEAN IsAsciiPrint (IN CHAR8 Char)
 
INTN IsAsciiAlpha (IN CHAR8 Char)
 
INTN IsAsciiSpace (IN CHAR8 Char)
 
BOOLEAN IsAsciiNumber (IN CHAR8 Char)
 
VOID AsciiUefiSlashes (IN OUT CHAR8 *String)
 
VOID AsciiUnixSlashes (IN OUT CHAR8 *String)
 
CHAR16 * AsciiStrCopyToUnicode (IN CONST CHAR8 *String, IN UINTN Length)
 
BOOLEAN AsciiUint64ToLowerHex (OUT CHAR8 *Buffer, IN UINT32 BufferSize, IN UINT64 Value)
 
EFI_STATUS EFIAPI OcAsciiSafeSPrint (OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
 
INTN EFIAPI OcAsciiStrniCmp (IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length)
 
BOOLEAN EFIAPI OcAsciiEndsWith (IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString, IN BOOLEAN CaseInsensitiveMatch)
 
BOOLEAN EFIAPI OcAsciiStartsWith (IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString, IN BOOLEAN CaseInsensitiveMatch)
 
INTN EFIAPI OcStriCmp (IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
 
INTN EFIAPI OcStrniCmp (IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString, IN UINTN Length)
 
CHAR8 *EFIAPI OcAsciiStriStr (IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString)
 
CHAR8 *EFIAPI OcAsciiStrChr (IN CONST CHAR8 *String, IN CHAR8 Char)
 
CHAR8 *EFIAPI OcAsciiStrrChr (IN CONST CHAR8 *String, IN CHAR8 Char)
 
BOOLEAN OcAsciiStringNPrintable (IN CONST CHAR8 *String, IN UINTN Number)
 
EFI_STATUS EFIAPI OcAsciiStrToRawGuid (IN CONST CHAR8 *String, OUT GUID *Guid)
 
VOID EFIAPI OcAsciiPrintBuffer (IN OUT CHAR8 **AsciiBuffer, IN OUT UINTN *AsciiBufferSize, IN CONST CHAR8 *FormatString,...)
 
CHAR8 * OcAsciiToLower (CHAR8 *Str)
 
CHAR16 *EFIAPI OcStriStr (IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
 
CONST CHAR16 * OcStrStrLength (IN CONST CHAR16 *String, IN UINTN StringLength, IN CONST CHAR16 *SearchString, IN UINTN SearchStringLength)
 
CHAR16 *EFIAPI OcStrChr (IN CONST CHAR16 *String, IN CHAR16 Char)
 
CHAR16 *EFIAPI OcStrrChr (IN CONST CHAR16 *String, IN CHAR16 Char)
 
EFI_STATUS EFIAPI OcUnicodeSafeSPrint (OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
 
BOOLEAN EFIAPI OcUnicodeEndsWith (IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString, IN BOOLEAN CaseInsensitiveMatch)
 
BOOLEAN EFIAPI OcUnicodeStartsWith (IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString, IN BOOLEAN CaseInsensitiveMatch)
 
VOID UnicodeUefiSlashes (IN OUT CHAR16 *String)
 
BOOLEAN UnicodeGetParentDirectory (IN OUT CHAR16 *String)
 
VOID UnicodeFilterString (IN OUT CHAR16 *String, IN BOOLEAN SingleLine)
 
VOID AsciiFilterString (IN OUT CHAR8 *String, IN BOOLEAN SingleLine)
 
BOOLEAN UnicodeIsFilteredString (IN CONST CHAR16 *String, IN BOOLEAN SingleLine)
 
BOOLEAN HasValidGuidStringPrefix (IN CONST CHAR16 *String)
 
INTN MixedStrCmp (IN CONST CHAR16 *FirstString, IN CONST CHAR8 *SecondString)
 
INTN EFIAPI OcReverseStringCompare (IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
 
BOOLEAN OcIsSpace (CHAR16 Ch)
 
BOOLEAN OcIsSpaceOrNull (CHAR16 Ch)
 

Detailed Description

Copyright (C) 2016 - 2018, The HermitCrabs Lab. All rights reserved.

All rights reserved.

This program and the accompanying materials 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 http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file OcStringLib.h.

Macro Definition Documentation

◆ L_STR_LEN

#define L_STR_LEN ( String)
Value:
(ARRAY_SIZE (String) - 1)
#define ARRAY_SIZE(Array)
Definition AppleMacEfi.h:34

Returns the length of a Null-terminated string literal.

Parameters
[in]StringThe Null-terminated string literal.

Definition at line 26 of file OcStringLib.h.

◆ L_STR_SIZE

#define L_STR_SIZE ( String)
Value:
(sizeof (String))

Returns the size of a Null-terminated string literal in bytes, including the Null terminator.

Parameters
[in]StringThe Null-terminated string literal.

Definition at line 35 of file OcStringLib.h.

◆ L_STR_SIZE_NT

#define L_STR_SIZE_NT ( String)
Value:
(sizeof (String) - sizeof (*(String)))

Returns the size of a Null-terminated string literal in bytes, excluding the Null terminator.

Parameters
[in]StringThe Null-terminated string literal.

Definition at line 44 of file OcStringLib.h.

Typedef Documentation

◆ OC_STRING_FORMAT

Ascii or Unicode string format for methods which can accept either format.

Enumeration Type Documentation

◆ _OC_STRING_FORMAT

Ascii or Unicode string format for methods which can accept either format.

Enumerator
OcStringFormatAscii 
OcStringFormatUnicode 

Definition at line 49 of file OcStringLib.h.

Function Documentation

◆ AsciiFilterString()

VOID AsciiFilterString ( IN OUT CHAR8 * String,
IN BOOLEAN SingleLine )

Filter string from unprintable characters.

Parameters
[in,out]StringString to filter.
[in]SingleLineEnforce only one line.

Definition at line 480 of file OcAsciiLib.c.

◆ AsciiStrCopyToUnicode()

CHAR16 * AsciiStrCopyToUnicode ( IN CONST CHAR8 * AsciiString,
IN UINTN Length )

Convert null terminated ascii string to unicode.

Parameters
[in]StringA pointer to the ascii string to convert to unicode.
[in]LengthLength or 0 to calculate the length of the ascii string to convert.
Return values
Apointer to the converted unicode string allocated from pool.

Convert null terminated ascii string to unicode.

Parameters
[in]String1A pointer to the ascii string to convert to unicode.
[in]LengthLength or 0 to calculate the length of the ascii string to convert.
Return values
Apointer to the converted unicode string allocated from pool.

Definition at line 119 of file OcAsciiLib.c.

◆ AsciiUefiSlashes()

VOID AsciiUefiSlashes ( IN OUT CHAR8 * String)

Convert path with mixed slashes to UEFI slashes (\).

Parameters
[in,out]StringPath.

Definition at line 86 of file OcAsciiLib.c.

◆ AsciiUint64ToLowerHex()

BOOLEAN AsciiUint64ToLowerHex ( OUT CHAR8 * Buffer,
IN UINT32 BufferSize,
IN UINT64 Value )

Convert 64-bit unsigned integer to a nul-terminated hex string.

Parameters
[out]BufferDestination buffer.
[in]BufferSizeDestination buffer size in bytes.
[in]ValueValue to convert.
Return values
TRUEon fit

Definition at line 150 of file OcAsciiLib.c.

◆ AsciiUnixSlashes()

VOID AsciiUnixSlashes ( IN OUT CHAR8 * String)

Convert path with mixed slashes to Unix slashes (/).

Parameters
[in,out]StringPath.

Definition at line 99 of file OcAsciiLib.c.

◆ HasValidGuidStringPrefix()

BOOLEAN HasValidGuidStringPrefix ( IN CONST CHAR16 * String)

Check if string starts with GUID.

Parameters
[in]StringString to check.
Return values
TRUEwhen string starts with GUID.
FALSEotherwise.

Definition at line 473 of file OcUnicodeLib.c.

◆ IsAsciiAlpha()

INTN IsAsciiAlpha ( IN CHAR8 Char)

Check if character is alphabetical.

Parameters
[in]CharThe ascii character to check if is alphabetical.
Return values
TRUE,ifcharacter is alphabetical.

Definition at line 49 of file OcAsciiLib.c.

◆ IsAsciiNumber()

BOOLEAN IsAsciiNumber ( IN CHAR8 Char)

Check if character is a number.

Parameters
[in]CharThe ascii character to check if is number.
Return values
TRUE,ifcharacter is a number.

Definition at line 78 of file OcAsciiLib.c.

◆ IsAsciiPrint()

BOOLEAN IsAsciiPrint ( IN CHAR8 Char)

Check if character is printable

Parameters
[in]CharThe ascii character to check if is printable.
Return values
TRUE,ifcharacter is printable.

Definition at line 33 of file OcAsciiLib.c.

◆ IsAsciiSpace()

INTN IsAsciiSpace ( IN CHAR8 Char)

Check if character is a white space character.

Parameters
[in]CharThe ascii character to check if is white space.
Return values
TRUE,ifcharacter is a white space character.

Definition at line 65 of file OcAsciiLib.c.

◆ MixedStrCmp()

INTN MixedStrCmp ( IN CONST CHAR16 * FirstString,
IN CONST CHAR8 * SecondString )

Compares two Null-terminated Unocide and ASCII strings, and returns the difference between the first mismatched characters.

This function compares the Null-terminated Unicode 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 character in SecondString subtracted from the first mismatched character in FirstString.

Parameters
[in]FirstStringA pointer to a Null-terminated Unicode string.
[in]SecondStringA pointer to a Null-terminated ASCII string.
Return values
==0FirstString is identical to SecondString.
!=0FirstString is not identical to SecondString.

Definition at line 503 of file OcUnicodeLib.c.

◆ OcAsciiEndsWith()

BOOLEAN EFIAPI OcAsciiEndsWith ( IN CONST CHAR8 * String,
IN CONST CHAR8 * SearchString,
IN BOOLEAN CaseInsensitiveMatch )

Check if ASCII string ends with another ASCII string.

Parameters
[in]StringA pointer to a Null-terminated ASCII string.
[in]SearchStringA pointer to a Null-terminated ASCII string to compare against String.
[in]CaseInsensitiveMatchPerform case-insensitive comparison.
Return values
TRUEif String ends with SearchString.

Definition at line 265 of file OcAsciiLib.c.

◆ OcAsciiPrintBuffer()

VOID EFIAPI OcAsciiPrintBuffer ( IN OUT CHAR8 ** AsciiBuffer,
IN OUT UINTN * AsciiBufferSize,
IN CONST CHAR8 * FormatString,
... )

Write formatted ASCII strings to buffers.

Parameters
[in,out]AsciiBufferA pointer to the output buffer for the produced Null-terminated ASCII string.
[in,out]AsciiBufferSizeThe size, in bytes, of the output buffer specified by AsciiBuffer.
[in]FormatStringA Null-terminated ASCII format string.
[in]...Variable argument list whose contents are accessed based on the format string specified by FormatString.

Definition at line 510 of file OcAsciiLib.c.

◆ OcAsciiSafeSPrint()

EFI_STATUS EFIAPI OcAsciiSafeSPrint ( OUT CHAR8 * StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 * FormatString,
... )

Alternative to AsciiSPrint, which checks that the buffer can contain all the characters.

Parameters
[out]StartOfBufferA pointer to the output buffer for the produced Null-terminated ASCII string.
[in]BufferSizeThe size, in bytes, of the output buffer specified by StartOfBuffer.
[in]FormatStringA Null-terminated ASCII format string.
[in]...Variable argument list whose contents are accessed based on the format string specified by FormatString.
Return values
EFI_SUCCESSWhen data was printed to supplied buffer.
EFI_OUT_OF_RESOURCESWhen supplied buffer cannot contain all the characters.

Definition at line 190 of file OcAsciiLib.c.

◆ OcAsciiStartsWith()

BOOLEAN EFIAPI OcAsciiStartsWith ( IN CONST CHAR8 * String,
IN CONST CHAR8 * SearchString,
IN BOOLEAN CaseInsensitiveMatch )

Check if ASCII string starts with another ASCII string.

Parameters
[in]StringA pointer to a Null-terminated ASCII string.
[in]SearchStringA pointer to a Null-terminated ASCII string to compare against String.
[in]CaseInsensitiveMatchPerform case-insensitive comparison.
Return values
TRUEif String starts with SearchString.

Definition at line 291 of file OcAsciiLib.c.

◆ OcAsciiStrChr()

CHAR8 *EFIAPI OcAsciiStrChr ( IN CONST CHAR8 * String,
IN CHAR8 Char )

Returns a pointer to the first occurrence of Char in a Null-terminated ASCII 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().

Parameters
[in]StringThe pointer to a Null-terminated ASCII string.
[in]CharCharacter to be located.
Returns
A pointer to the first occurrence of Char in String.
Return values
NULLIf Char cannot be found in String.

Definition at line 369 of file OcAsciiLib.c.

◆ OcAsciiStringNPrintable()

BOOLEAN OcAsciiStringNPrintable ( IN CONST CHAR8 * String,
IN UINTN Number )

Check if a string up to N bytes is ASCII-printable.

Parameters
[in]StringString to be checked.
[in]NumberNumber of bytes to scan.
Return values
TRUEIf String within Number bytes is all ASCII-printable.

Definition at line 418 of file OcAsciiLib.c.

◆ OcAsciiStriStr()

CHAR8 *EFIAPI OcAsciiStriStr ( IN CONST CHAR8 * String,
IN CONST CHAR8 * SearchString )

Returns the first occurrence of a Null-terminated ASCII sub-string in a Null-terminated ASCII string through a case insensitive comparison.

This function scans the contents of the Null-terminated 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 ASCII characters, not including the Null-terminator, then ASSERT().

Parameters
[in]StringThe pointer to a Null-terminated ASCII string.
[in]SearchStringThe pointer to a Null-terminated ASCII string to search for.
Return values
NULLIf the SearchString does not appear in String.
Returns
others If there is a match.

Definition at line 327 of file OcAsciiLib.c.

◆ OcAsciiStrniCmp()

INTN EFIAPI OcAsciiStrniCmp ( IN CONST CHAR8 * FirstString,
IN CONST CHAR8 * SecondString,
IN UINTN Length )

Compares up to a specified length the contents of two Null-terminated ASCII strings using case insensitive comparisons, 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 using case insensitive comparisons. 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 upper case ASCII character in SecondString subtracted from the first mismatched upper case ASCII character in FirstString.

If Length > 0 and FirstString is NULL, then ASSERT(). If Length > 0 and SecondString is NULL, then ASSERT(). TODO 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().

Parameters
[in]FirstStringA pointer to a Null-terminated ASCII string.
[in]SecondStringA pointer to a Null-terminated ASCII string.
[in]LengthThe maximum number of ASCII characters to compare.
Return values
==0FirstString is identical to SecondString using case insensitive comparisons.
othersFirstString is not identical to SecondString using case insensitive comparisons.

Definition at line 226 of file OcAsciiLib.c.

◆ OcAsciiStrrChr()

CHAR8 *EFIAPI OcAsciiStrrChr ( IN CONST CHAR8 * String,
IN CHAR8 Char )

Returns a pointer to the last occurrence of Char in a Null-terminated ASCII 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().

Parameters
[in]StringThe pointer to a Null-terminated ASCII string.
[in]CharCharacter to be located.
Returns
A pointer to the last occurrence of Char in String.
Return values
NULLIf Char cannot be found in String.

Definition at line 392 of file OcAsciiLib.c.

◆ OcAsciiStrToRawGuid()

EFI_STATUS EFIAPI OcAsciiStrToRawGuid ( IN CONST CHAR8 * String,
OUT GUID * Guid )

Convert a Null-terminated ASCII GUID string to a value of type EFI_GUID with RFC 4122 (raw) encoding.

Parameters
[in]StringPointer to a Null-terminated ASCII string.
[out]GuidPointer to the converted GUID.
Return values
EFI_SUCCESSGuid is translated from String.
EFI_INVALID_PARAMETERIf String is NULL. If Data is NULL.
EFI_UNSUPPORTEDIf String is not as the above format.

Definition at line 458 of file OcAsciiLib.c.

◆ OcAsciiToLower()

CHAR8 * OcAsciiToLower ( CHAR8 * Str)

Convert a null-terminated ASCII string, in-place, to all lowercase. Then return it.

Parameters
StrThe null-terminated string to be converted to all lowercase.
Returns
The null-terminated string converted into all lowercase.

Definition at line 555 of file OcAsciiLib.c.

◆ OcIsSpace()

BOOLEAN OcIsSpace ( CHAR16 Ch)

Determine if a particular character is whitespace.

Parameters
[in]ChThe character to check.
Returns
Returns TRUE if Ch is a whitespace character.

Definition at line 527 of file OcUnicodeLib.c.

◆ OcIsSpaceOrNull()

BOOLEAN OcIsSpaceOrNull ( CHAR16 Ch)

Determine if a particular character is whitespace or CHAR_NULL.

Parameters
[in]ChThe character to check.
Returns
Returns TRUE if Ch is a whitespace character or CHAR_NULL.

Definition at line 535 of file OcUnicodeLib.c.

◆ OcReverseStringCompare()

INTN EFIAPI OcReverseStringCompare ( IN CONST VOID * Buffer1,
IN CONST VOID * Buffer2 )

Function to reverse sort when comparing by Unicode strings using UefiSortLib PerformQuickSort.

Parameters
[in]Buffer1The pointer to String to compare (CHAR16**).
[in]Buffer2The pointer to second String to compare (CHAR16**).
Return values
0Buffer1 equal to Buffer2.
Returns
< 0 Buffer1 is less than Buffer2.
> 0 Buffer1 is greater than Buffer2.

Definition at line 518 of file OcUnicodeLib.c.

◆ OcStrChr()

CHAR16 *EFIAPI OcStrChr ( IN CONST CHAR16 * String,
IN CHAR16 Char )

Returns a pointer to the first occurrence of Char in a Null-terminated Unicode string.

If String is NULL, then ASSERT().

Parameters
[in]StringThe pointer to a Null-terminated Unicode string.
[in]CharCharacter to be located.
Returns
A pointer to the first occurrence of Char in String.
Return values
NULLIf Char cannot be found in String.

Definition at line 200 of file OcUnicodeLib.c.

◆ OcStriCmp()

INTN EFIAPI OcStriCmp ( IN CONST CHAR16 * FirstString,
IN CONST CHAR16 * SecondString )

Performs a case insensitive comparison of two Null-terminated Unicode strings, and returns the difference between the first mismatched Unicode characters.

This function performs a case insensitive comparison of 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 upper case Unicode character in SecondString subtracted from the first mismatched upper case Unicode character in FirstString.

If FirstString is NULL, then ASSERT(). If SecondString is NULL, 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().

Parameters
[in]FirstStringA pointer to a Null-terminated Unicode string.
[in]SecondStringA pointer to a Null-terminated Unicode string.
Return values
==0FirstString is identical to SecondString using case insensitiv comparisons.
!=0FirstString is not identical to SecondString using case insensitive comparisons.

Definition at line 28 of file OcUnicodeLib.c.

◆ OcStriStr()

CHAR16 *EFIAPI OcStriStr ( IN CONST CHAR16 * String,
IN CONST CHAR16 * SearchString )

Returns the first occurrence of a Null-terminated Unicode sub-string in a Null-terminated Unicode string through a case insensitive comparison.

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().

Parameters
[in]StringThe pointer to a Null-terminated Unicode string.
[in]SearchStringThe pointer to a Null-terminated Unicode string to search for.
Return values
NULLIf the SearchString does not appear in String.
Returns
others If there is a match.

Definition at line 95 of file OcUnicodeLib.c.

◆ OcStrniCmp()

INTN EFIAPI OcStrniCmp ( 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 using case insensitive comparisons, 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 using case insensitive comparisons. 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 upper case Unicode character in SecondString subtracted from the first mismatched upper case 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().

Parameters
[in]FirstStringA pointer to a Null-terminated Unicode string.
[in]SecondStringA pointer to a Null-terminated Unicode string.
[in]LengthThe maximum number of Unicode characters to compare.
Return values
==0FirstString is identical to SecondString using case insensitive comparisons.
othersFirstString is not identical to SecondString using case insensitive comparisons.

Definition at line 56 of file OcUnicodeLib.c.

◆ OcStrrChr()

CHAR16 *EFIAPI OcStrrChr ( IN CONST CHAR16 * String,
IN CHAR16 Char )

Returns a pointer to the last occurrence of Char in a Null-terminated Unicode string.

If String is NULL, then ASSERT().

Parameters
[in]StringThe pointer to a Null-terminated Unicode string.
[in]CharCharacter to be located.
Returns
A pointer to the last occurrence of Char in String.
Return values
NULLIf Char cannot be found in String.

Definition at line 223 of file OcUnicodeLib.c.

◆ OcStrStrLength()

CONST CHAR16 * OcStrStrLength ( IN CONST CHAR16 * String,
IN UINTN StringLength,
IN CONST CHAR16 * SearchString,
IN UINTN SearchStringLength )

Search substring in string.

Parameters
[in]StringSearch string.
[in]StringLengthSearch string length.
[in]SearchStringString to search.
[in]SearchStringLengthString to search length.
Return values
NULLIf the SearchString does not appear in String.
othersIf there is a match.

◆ OcUnicodeEndsWith()

BOOLEAN EFIAPI OcUnicodeEndsWith ( IN CONST CHAR16 * String,
IN CONST CHAR16 * SearchString,
IN BOOLEAN CaseInsensitiveMatch )

Check if Unicode string ends with another Unicode string.

Parameters
[in]StringA pointer to a Null-terminated Unicode string.
[in]SearchStringA pointer to a Null-terminated Unicode string to compare against String.
[in]CaseInsensitiveMatchPerform case-insensitive comparison.
Return values
TRUEif String ends with SearchString.

Definition at line 412 of file OcUnicodeLib.c.

◆ OcUnicodeSafeSPrint()

EFI_STATUS EFIAPI OcUnicodeSafeSPrint ( OUT CHAR16 * StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 * FormatString,
... )

Alternative to UnicodeSPrint, which checks that the buffer can contain all the characters.

Parameters
[out]StartOfBufferA pointer to the output buffer for the produced Null-terminated Unicode string.
[in]BufferSizeThe size, in bytes, of the output buffer specified by StartOfBuffer.
[in]FormatStringA Null-terminated Unicode format string.
[in]...Variable argument list whose contents are accessed based on the format string specified by FormatString.
Return values
EFI_SUCCESSWhen data was printed to supplied buffer.
EFI_OUT_OF_RESOURCESWhen supplied buffer cannot contain all the characters.

Definition at line 376 of file OcUnicodeLib.c.

◆ OcUnicodeStartsWith()

BOOLEAN EFIAPI OcUnicodeStartsWith ( IN CONST CHAR16 * String,
IN CONST CHAR16 * SearchString,
IN BOOLEAN CaseInsensitiveMatch )

Check if Unicode string starts with another Unicode string.

Parameters
[in]StringA pointer to a Null-terminated Unicode string.
[in]SearchStringA pointer to a Null-terminated Unicode string to compare against String.
[in]CaseInsensitiveMatchPerform case-insensitive comparison.
Return values
TRUEif String starts with SearchString.

Definition at line 438 of file OcUnicodeLib.c.

◆ UnicodeFilterString()

VOID UnicodeFilterString ( IN OUT CHAR16 * String,
IN BOOLEAN SingleLine )

Filter string from unprintable characters.

Parameters
[in,out]StringString to filter.
[in]SingleLineEnforce only one line.

Definition at line 321 of file OcUnicodeLib.c.

◆ UnicodeGetParentDirectory()

BOOLEAN UnicodeGetParentDirectory ( IN OUT CHAR16 * String)

Drop last path from string and normalise start path. Examples:

  • "Path" -> ""
  • "Path/" -> ""
  • "Path1\\Path2\\" -> "Path1" - "\Path1\Path2" -> "Path1" - "\/" -> "/" & FALSE - "\" -> "" & FALSE - "" -> "" & FALSE
Parameters
[in,out]StringPath.
Return values
TRUEon success

Definition at line 262 of file OcUnicodeLib.c.

◆ UnicodeIsFilteredString()

BOOLEAN UnicodeIsFilteredString ( IN CONST CHAR16 * String,
IN BOOLEAN SingleLine )

Check if string is filtered.

Parameters
[in]StringString to be checked.
[in]SingleLineEnforce only one line.
Return values
TRUEif string is filtered.

Definition at line 350 of file OcUnicodeLib.c.

◆ UnicodeUefiSlashes()

VOID UnicodeUefiSlashes ( IN OUT CHAR16 * String)

Convert path with mixed slashes to UEFI slashes (\).

Parameters
[in,out]StringPath.

Definition at line 249 of file OcUnicodeLib.c.