OpenCore
1.0.4
OpenCore Bootloader
|
#include <Base.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/DebugLib.h>
#include <Library/OcStringLib.h>
#include <Library/PrintLib.h>
#include <Library/PcdLib.h>
#include <Library/SortLib.h>
Go to the source code of this file.
Functions | |
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) |
CHAR16 *EFIAPI | OcStriStr (IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString) |
CONST CHAR16 * | OcStrStrLength (CONST CHAR16 *String, UINTN StringLength, CONST CHAR16 *SearchString, UINTN SearchStringLength) |
CHAR16 *EFIAPI | OcStrChr (IN CONST CHAR16 *String, IN CHAR16 Char) |
CHAR16 *EFIAPI | OcStrrChr (IN CONST CHAR16 *String, IN CHAR16 Char) |
VOID | UnicodeUefiSlashes (IN OUT CHAR16 *String) |
BOOLEAN | UnicodeGetParentDirectory (IN OUT CHAR16 *String) |
VOID | UnicodeFilterString (IN OUT CHAR16 *String, IN BOOLEAN SingleLine) |
BOOLEAN | UnicodeIsFilteredString (IN CONST CHAR16 *String, IN BOOLEAN SingleLine) |
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) |
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) |
Copyright (C) 2016, 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 OcUnicodeLib.c.
BOOLEAN HasValidGuidStringPrefix | ( | IN CONST CHAR16 * | String | ) |
Check if string starts with GUID.
[in] | String | String to check. |
TRUE | when string starts with GUID. |
FALSE | otherwise. |
Definition at line 473 of file OcUnicodeLib.c.
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.
[in] | FirstString | A pointer to a Null-terminated Unicode string. |
[in] | SecondString | A pointer to a Null-terminated ASCII string. |
==0 | FirstString is identical to SecondString. |
!=0 | FirstString is not identical to SecondString. |
Definition at line 503 of file OcUnicodeLib.c.
BOOLEAN OcIsSpace | ( | CHAR16 | Ch | ) |
Determine if a particular character is whitespace.
[in] | Ch | The character to check. |
Definition at line 527 of file OcUnicodeLib.c.
BOOLEAN OcIsSpaceOrNull | ( | CHAR16 | Ch | ) |
Determine if a particular character is whitespace or CHAR_NULL.
[in] | Ch | The character to check. |
Definition at line 535 of file OcUnicodeLib.c.
INTN EFIAPI OcReverseStringCompare | ( | IN CONST VOID * | Buffer1, |
IN CONST VOID * | Buffer2 ) |
Function to reverse sort when comparing by Unicode strings using UefiSortLib PerformQuickSort.
[in] | Buffer1 | The pointer to String to compare (CHAR16**). |
[in] | Buffer2 | The pointer to second String to compare (CHAR16**). |
0 | Buffer1 equal to Buffer2. |
Definition at line 518 of file OcUnicodeLib.c.
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().
[in] | String | The pointer to a Null-terminated Unicode string. |
[in] | Char | Character to be located. |
NULL | If Char cannot be found in String. |
Definition at line 200 of file OcUnicodeLib.c.
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().
[in] | FirstString | A pointer to a Null-terminated Unicode string. |
[in] | SecondString | A pointer to a Null-terminated Unicode string. |
==0 | FirstString is identical to SecondString using case insensitiv comparisons. |
!=0 | FirstString is not identical to SecondString using case insensitive comparisons. |
Definition at line 28 of file OcUnicodeLib.c.
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().
[in] | String | The pointer to a Null-terminated Unicode string. |
[in] | SearchString | The pointer to a Null-terminated Unicode string to search for. |
NULL | If the SearchString does not appear in String. |
Definition at line 95 of file OcUnicodeLib.c.
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().
[in] | FirstString | A pointer to a Null-terminated Unicode string. |
[in] | SecondString | A pointer to a Null-terminated Unicode string. |
[in] | Length | The maximum number of Unicode characters to compare. |
==0 | FirstString is identical to SecondString using case insensitive comparisons. |
others | FirstString is not identical to SecondString using case insensitive comparisons. |
Definition at line 56 of file OcUnicodeLib.c.
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().
[in] | String | The pointer to a Null-terminated Unicode string. |
[in] | Char | Character to be located. |
NULL | If Char cannot be found in String. |
Definition at line 223 of file OcUnicodeLib.c.
CONST CHAR16 * OcStrStrLength | ( | CONST CHAR16 * | String, |
UINTN | StringLength, | ||
CONST CHAR16 * | SearchString, | ||
UINTN | SearchStringLength ) |
Definition at line 140 of file OcUnicodeLib.c.
BOOLEAN EFIAPI OcUnicodeEndsWith | ( | IN CONST CHAR16 * | String, |
IN CONST CHAR16 * | SearchString, | ||
IN BOOLEAN | CaseInsensitiveMatch ) |
Check if Unicode string ends with another Unicode string.
[in] | String | A pointer to a Null-terminated Unicode string. |
[in] | SearchString | A pointer to a Null-terminated Unicode string to compare against String. |
[in] | CaseInsensitiveMatch | Perform case-insensitive comparison. |
TRUE | if String ends with SearchString. |
Definition at line 412 of file OcUnicodeLib.c.
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.
[out] | StartOfBuffer | A pointer to the output buffer for the produced Null-terminated Unicode string. |
[in] | BufferSize | The size, in bytes, of the output buffer specified by StartOfBuffer. |
[in] | FormatString | A Null-terminated Unicode format string. |
[in] | ... | Variable argument list whose contents are accessed based on the format string specified by FormatString. |
EFI_SUCCESS | When data was printed to supplied buffer. |
EFI_OUT_OF_RESOURCES | When supplied buffer cannot contain all the characters. |
Definition at line 376 of file OcUnicodeLib.c.
BOOLEAN EFIAPI OcUnicodeStartsWith | ( | IN CONST CHAR16 * | String, |
IN CONST CHAR16 * | SearchString, | ||
IN BOOLEAN | CaseInsensitiveMatch ) |
Check if Unicode string starts with another Unicode string.
[in] | String | A pointer to a Null-terminated Unicode string. |
[in] | SearchString | A pointer to a Null-terminated Unicode string to compare against String. |
[in] | CaseInsensitiveMatch | Perform case-insensitive comparison. |
TRUE | if String starts with SearchString. |
Definition at line 438 of file OcUnicodeLib.c.
VOID UnicodeFilterString | ( | IN OUT CHAR16 * | String, |
IN BOOLEAN | SingleLine ) |
Filter string from unprintable characters.
[in,out] | String | String to filter. |
[in] | SingleLine | Enforce only one line. |
Definition at line 321 of file OcUnicodeLib.c.
BOOLEAN UnicodeGetParentDirectory | ( | IN OUT CHAR16 * | String | ) |
Drop last path from string and normalise start path. Examples:
[in,out] | String | Path. |
TRUE | on success |
Definition at line 262 of file OcUnicodeLib.c.
BOOLEAN UnicodeIsFilteredString | ( | IN CONST CHAR16 * | String, |
IN BOOLEAN | SingleLine ) |
Check if string is filtered.
[in] | String | String to be checked. |
[in] | SingleLine | Enforce only one line. |
TRUE | if string is filtered. |
Definition at line 350 of file OcUnicodeLib.c.
VOID UnicodeUefiSlashes | ( | IN OUT CHAR16 * | String | ) |
Convert path with mixed slashes to UEFI slashes (\).
[in,out] | String | Path. |
Definition at line 249 of file OcUnicodeLib.c.