/**\r
Function to compare 2 device paths for use as CompareFunction.\r
\r
- @param[in] Buffer1 pointer to Device Path to compare\r
- @param[in] Buffer2 pointer to second DevicePath to compare\r
+ @param[in] Buffer1 Pointer to Device Path to compare.\r
+ @param[in] Buffer2 Pointer to second DevicePath to compare.\r
\r
- @retval 0 Buffer1 equal to Buffer2\r
- @return < 0 Buffer1 is less than Buffer2\r
- @return > 0 Buffer1 is greater than Buffer2 \r
+ @retval 0 Buffer1 equal to Buffer2.\r
+ @return < 0 Buffer1 is less than Buffer2.\r
+ @return > 0 Buffer1 is greater than Buffer2. \r
**/\r
INTN\r
+EFIAPI\r
DevicePathCompare (\r
IN VOID *Buffer1,\r
IN VOID *Buffer2\r
);\r
+\r
+/**\r
+ Function to compare 2 strings without regard to case of the characters.\r
+\r
+ @param[in] Buffer1 Pointer to String to compare (CHAR16**). \r
+ @param[in] Buffer2 Pointer to second String to compare (CHAR16**).\r
+\r
+ @retval 0 Buffer1 equal to Buffer2.\r
+ @return < 0 Buffer1 is less than Buffer2.\r
+ @return > 0 Buffer1 is greater than Buffer2. \r
+**/\r
+INTN\r
+EFIAPI\r
+StringNoCaseCompare (\r
+ IN VOID *Buffer1,\r
+ IN VOID *Buffer2\r
+ );\r
+\r
#endif //__SORT_LIB_H__\r
#include <Library/MemoryAllocationLib.h>\r
#include <Library/SortLib.h> \r
\r
+STATIC EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathToText = NULL;\r
+STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;\r
+\r
+\r
/**\r
Worker function for QuickSorting. This function is identical to PerformQuickSort, \r
except that is uses the pre-allocated buffer so the in place sorting does not need to \r
EFI_STATUS Status;\r
INTN RetVal;\r
\r
- STATIC EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathToText = NULL;\r
- STATIC EFI_UNICODE_COLLATION_PROTOCOL *UnicodeCollation = NULL;\r
-\r
DevicePath1 = *(EFI_DEVICE_PATH_PROTOCOL**)Buffer1;\r
DevicePath2 = *(EFI_DEVICE_PATH_PROTOCOL**)Buffer2;\r
\r
return 1;\r
}\r
\r
- if (DevicePathToText == NULL) {\r
+ if (mDevicePathToText == NULL) {\r
Status = gBS->LocateProtocol(\r
&gEfiDevicePathToTextProtocolGuid,\r
NULL,\r
- (VOID**)&DevicePathToText);\r
+ (VOID**)&mDevicePathToText);\r
\r
ASSERT_EFI_ERROR(Status);\r
}\r
\r
- if (UnicodeCollation == NULL) {\r
+ if (mUnicodeCollation == NULL) {\r
Status = gBS->LocateProtocol(\r
&gEfiUnicodeCollation2ProtocolGuid,\r
NULL,\r
- (VOID**)&UnicodeCollation);\r
+ (VOID**)&mUnicodeCollation);\r
\r
ASSERT_EFI_ERROR(Status);\r
}\r
\r
- TextPath1 = DevicePathToText->ConvertDevicePathToText(\r
+ TextPath1 = mDevicePathToText->ConvertDevicePathToText(\r
DevicePath1,\r
FALSE,\r
FALSE);\r
\r
- TextPath2 = DevicePathToText->ConvertDevicePathToText(\r
+ TextPath2 = mDevicePathToText->ConvertDevicePathToText(\r
DevicePath2,\r
FALSE,\r
FALSE);\r
\r
- RetVal = UnicodeCollation->StriColl(\r
- UnicodeCollation,\r
+ RetVal = mUnicodeCollation->StriColl(\r
+ mUnicodeCollation,\r
TextPath1,\r
TextPath2);\r
\r
FreePool(TextPath2);\r
\r
return (RetVal);\r
-}
\ No newline at end of file
+}\r
+\r
+/**\r
+ Function to compare 2 strings without regard to case of the characters.\r
+\r
+ @param[in] Buffer1 Pointer to String to compare.\r
+ @param[in] Buffer2 Pointer to second String to compare.\r
+\r
+ @retval 0 Buffer1 equal to Buffer2.\r
+ @return < 0 Buffer1 is less than Buffer2.\r
+ @return > 0 Buffer1 is greater than Buffer2. \r
+**/\r
+INTN\r
+EFIAPI\r
+StringNoCaseCompare (\r
+ IN VOID *Buffer1,\r
+ IN VOID *Buffer2\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ if (mUnicodeCollation == NULL) {\r
+ Status = gBS->LocateProtocol(\r
+ &gEfiUnicodeCollation2ProtocolGuid,\r
+ NULL,\r
+ (VOID**)&mUnicodeCollation);\r
+\r
+ ASSERT_EFI_ERROR(Status);\r
+ }\r
+\r
+ return (mUnicodeCollation->StriColl(\r
+ mUnicodeCollation,\r
+ *(CHAR16**)Buffer1,\r
+ *(CHAR16**)Buffer2));\r
+}\r
+\r
+\r