X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ShellPkg%2FLibrary%2FBaseSortLib%2FBaseSortLib.c;h=eaee544d3d61ce8a56fb7d801465d60cb08f0cbd;hp=904dece1ba1250575f4a3d5f2aeeb013a81ee187;hb=1e6e84c7afd435db6e84ad84e71ddecdc9866042;hpb=a31bd33cf8089c0b0219a41afb06cf9b462a0ee3
diff --git a/ShellPkg/Library/BaseSortLib/BaseSortLib.c b/ShellPkg/Library/BaseSortLib/BaseSortLib.c
index 904dece1ba..eaee544d3d 100644
--- a/ShellPkg/Library/BaseSortLib/BaseSortLib.c
+++ b/ShellPkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,14 +1,14 @@
/** @file
Library used for sorting routines.
-Copyright (c) 2009, Intel Corporation
-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
+ Copyright (c) 2009-2010, Intel Corporation. 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.
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -18,11 +18,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include
#include
#include
-#include
+#include
/**
- Worker function for QuickSorting. This function is identical to PerformQuickSort,
- except that is uses the pre-allocated buffer so the in place sorting does not need to
+ Worker function for QuickSorting. This function is identical to PerformQuickSort,
+ except that is uses the pre-allocated buffer so the in place sorting does not need to
allocate and free buffers constantly.
Each element must be equal sized.
@@ -38,7 +38,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
on return a buffer of sorted elements
@param[in] Count the number of elements in the buffer to sort
@param[in] ElementSize Size of an element in bytes
- @param[in] CompareFunction The function to call to perform the comparison
+ @param[in] CompareFunction The function to call to perform the comparison
of any 2 elements
@param[in] Buffer Buffer of size ElementSize for use in swapping
**/
@@ -60,7 +60,7 @@ QuickSortWorker (
ASSERT(CompareFunction != NULL);
ASSERT(Buffer != NULL);
- if ( Count < 2
+ if ( Count < 2
|| ElementSize < 1
){
return;
@@ -78,7 +78,7 @@ QuickSortWorker (
// and everything "right" are above it
//
for ( LoopCount = 0
- ; LoopCount < Count -1
+ ; LoopCount < Count -1
; LoopCount++
){
//
@@ -86,7 +86,7 @@ QuickSortWorker (
//
if (CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) <= 0){
//
- // swap
+ // swap
//
CopyMem (Buffer, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), ElementSize);
CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), (UINT8*)BufferToSort+((LoopCount)*ElementSize), ElementSize);
@@ -94,7 +94,7 @@ QuickSortWorker (
//
// increment NextSwapLocation
- //
+ //
NextSwapLocation++;
}
}
@@ -106,20 +106,20 @@ QuickSortWorker (
CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, ElementSize);
//
- // Now recurse on 2 paritial lists. neither of these will have the 'pivot' element
+ // Now recurse on 2 paritial lists. neither of these will have the 'pivot' element
// IE list is sorted left half, pivot element, sorted right half...
//
QuickSortWorker(
- BufferToSort,
- NextSwapLocation,
- ElementSize,
+ BufferToSort,
+ NextSwapLocation,
+ ElementSize,
CompareFunction,
Buffer);
QuickSortWorker(
(UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,
- Count - NextSwapLocation - 1,
- ElementSize,
+ Count - NextSwapLocation - 1,
+ ElementSize,
CompareFunction,
Buffer);
@@ -140,7 +140,7 @@ QuickSortWorker (
on return a buffer of sorted elements
@param[in] Count the number of elements in the buffer to sort
@param[in] ElementSize Size of an element in bytes
- @param[in] CompareFunction The function to call to perform the comparison
+ @param[in] CompareFunction The function to call to perform the comparison
of any 2 elements
**/
VOID
@@ -173,15 +173,38 @@ PerformQuickSort (
/**
Not supported in Base version.
-
+
ASSERT and return 0.
**/
INTN
DevicePathCompare (
- IN VOID *Buffer1,
- IN VOID *Buffer2
+ IN CONST VOID *Buffer1,
+ IN CONST VOID *Buffer2
+ )
+{
+ ASSERT(FALSE);
+ return 0;
+}
+
+/**
+ Function to compare 2 strings without regard to case of the characters.
+
+ @param[in] Buffer1 Pointer to String to compare.
+ @param[in] Buffer2 Pointer to second String to compare.
+
+ @retval 0 Buffer1 equal to Buffer2.
+ @return < 0 Buffer1 is less than Buffer2.
+ @return > 0 Buffer1 is greater than Buffer2.
+**/
+INTN
+EFIAPI
+StringNoCaseCompare (
+ IN CONST VOID *Buffer1,
+ IN CONST VOID *Buffer2
)
{
ASSERT(FALSE);
return 0;
-}
\ No newline at end of file
+}
+
+