|
@@ -1,7 +1,7 @@
|
|
/** @file
|
|
/** @file
|
|
Unicode collation routines
|
|
Unicode collation routines
|
|
|
|
|
|
- Copyright (c) 2021 Pedro Falcato All rights reserved.
|
|
|
|
|
|
+ Copyright (c) 2021 - 2023 Pedro Falcato All rights reserved.
|
|
Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
|
|
Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
|
|
|
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
@@ -9,6 +9,7 @@
|
|
|
|
|
|
#include <Uefi.h>
|
|
#include <Uefi.h>
|
|
|
|
|
|
|
|
+#include <Library/DebugLib.h>
|
|
#include <Library/UefiLib.h>
|
|
#include <Library/UefiLib.h>
|
|
#include <Library/UefiBootServicesTableLib.h>
|
|
#include <Library/UefiBootServicesTableLib.h>
|
|
#include <Library/MemoryAllocationLib.h>
|
|
#include <Library/MemoryAllocationLib.h>
|
|
@@ -23,6 +24,21 @@ STATIC EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollationInterface = NULL;
|
|
* PS: Maybe all this code could be put in a library? It looks heavily shareable.
|
|
* PS: Maybe all this code could be put in a library? It looks heavily shareable.
|
|
**/
|
|
**/
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ Check if unicode collation is initialized
|
|
|
|
+
|
|
|
|
+ @retval TRUE if Ext4InitialiseUnicodeCollation() was already called successfully
|
|
|
|
+ @retval FALSE if Ext4InitialiseUnicodeCollation() was not yet called successfully
|
|
|
|
+**/
|
|
|
|
+STATIC
|
|
|
|
+BOOLEAN
|
|
|
|
+Ext4IsCollationInitialized (
|
|
|
|
+ VOID
|
|
|
|
+ )
|
|
|
|
+{
|
|
|
|
+ return gUnicodeCollationInterface != NULL;
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
Worker function to initialize Unicode Collation support.
|
|
Worker function to initialize Unicode Collation support.
|
|
|
|
|
|
@@ -127,6 +143,11 @@ Ext4InitialiseUnicodeCollation (
|
|
|
|
|
|
Status = EFI_UNSUPPORTED;
|
|
Status = EFI_UNSUPPORTED;
|
|
|
|
|
|
|
|
+ // If already done, just return success.
|
|
|
|
+ if (Ext4IsCollationInitialized ()) {
|
|
|
|
+ return EFI_SUCCESS;
|
|
|
|
+ }
|
|
|
|
+
|
|
//
|
|
//
|
|
// First try to use RFC 4646 Unicode Collation 2 Protocol.
|
|
// First try to use RFC 4646 Unicode Collation 2 Protocol.
|
|
//
|
|
//
|
|
@@ -169,5 +190,6 @@ Ext4StrCmpInsensitive (
|
|
IN CHAR16 *Str2
|
|
IN CHAR16 *Str2
|
|
)
|
|
)
|
|
{
|
|
{
|
|
|
|
+ ASSERT (gUnicodeCollationInterface != NULL);
|
|
return gUnicodeCollationInterface->StriColl (gUnicodeCollationInterface, Str1, Str2);
|
|
return gUnicodeCollationInterface->StriColl (gUnicodeCollationInterface, Str1, Str2);
|
|
}
|
|
}
|