]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Library/SortLib.h
Refine comments and two code style.
[mirror_edk2.git] / ShellPkg / Include / Library / SortLib.h
index e213b7a40e569f10e188ac13f3230eb4007d0ade..a3e0fd9bec877f10eb09c0c5169936561d06850c 100644 (file)
@@ -1,35 +1,35 @@
 /** @file\r
   Library used for sorting and comparison routines.\r
 \r
-Copyright (c) 2009, Intel Corporation<BR>\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved. <BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
-#if !defined(__SORT_LIB_H__)\r
+#ifndef __SORT_LIB_H__\r
 #define __SORT_LIB_H__\r
 \r
 /**\r
-  Prototype for comparison function for any 2 element types.\r
+  Prototype for comparison function for any two element types.\r
 \r
-  @param[in] Buffer1                  Pointer to first buffer.\r
-  @param[in] Buffer2                  Pointer to second buffer.\r
+  @param[in] Buffer1                  The pointer to first buffer.\r
+  @param[in] Buffer2                  The pointer to second buffer.\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
+  @return <                         Buffer1 is less than Buffer2.\r
+  @return >                         Buffer1 is greater than Buffer2.\r
 **/\r
 typedef\r
 INTN\r
 (EFIAPI *SORT_COMPARE)(\r
-  IN VOID           *Buffer1,\r
-  IN VOID           *Buffer2\r
+  IN CONST VOID                 *Buffer1,\r
+  IN CONST VOID                 *Buffer2\r
   );\r
 \r
 /**\r
@@ -40,58 +40,75 @@ INTN
   If BufferToSort is NULL, then ASSERT.\r
   If CompareFunction is NULL, then ASSERT.\r
 \r
-  If Count is < 2 then perform no action.\r
-  If Size is < 1 then perform no action.\r
+  If Count is < 2 then perform no action.\r
+  If Size is < 1 then perform no action.\r
 \r
-  @param[in,out] BufferToSort   On call a Buffer of (possibly sorted) elements\r
-                                on return a buffer of sorted elements.\r
-  @param[in] Count              The number of elements in the buffer to sort\r
-  @param[in] ElementSize        Size of an element in bytes.\r
-  @param[in] CompareFunction    The function to call to perform the comparison \r
-                                of any 2 elements.\r
+  @param[in, out] BufferToSort   On call, a Buffer of (possibly sorted) elements;\r
+                                 on return, a buffer of sorted elements.\r
+  @param[in]  Count              The number of elements in the buffer to sort.\r
+  @param[in]  ElementSize        The size of an element in bytes.\r
+  @param[in]  CompareFunction    The function to call to perform the comparison\r
+                                 of any two elements.\r
 **/\r
 VOID\r
 EFIAPI\r
 PerformQuickSort (\r
-  IN OUT VOID                           *BufferToSort,\r
-  IN CONST UINTN                        Count,\r
-  IN CONST UINTN                        ElementSize,\r
-  IN       SORT_COMPARE                 CompareFunction\r
+  IN OUT VOID                   *BufferToSort,\r
+  IN CONST UINTN                Count,\r
+  IN CONST UINTN                ElementSize,\r
+  IN       SORT_COMPARE         CompareFunction\r
   );\r
 \r
 \r
 /**\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            The pointer to Device Path to compare.\r
+  @param[in] Buffer2            The 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
+  @return > 0                   Buffer1 is greater than Buffer2.\r
 **/\r
 INTN\r
 EFIAPI\r
 DevicePathCompare (\r
-  IN  VOID             *Buffer1,\r
-  IN  VOID             *Buffer2\r
+  IN  CONST VOID                *Buffer1,\r
+  IN  CONST 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
+  @param[in] Buffer1            The pointer to String to compare (CHAR16**).\r
+  @param[in] Buffer2            The 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
+  @return > 0                   Buffer1 is greater than Buffer2.\r
 **/\r
 INTN\r
 EFIAPI\r
 StringNoCaseCompare (\r
-  IN  VOID             *Buffer1,\r
-  IN  VOID             *Buffer2\r
+  IN  CONST VOID                *Buffer1,\r
+  IN  CONST VOID                *Buffer2\r
+  );\r
+\r
+/**\r
+  Function to compare 2 strings.\r
+\r
+  @param[in] Buffer1            The pointer to String to compare (CHAR16**).\r
+  @param[in] Buffer2            The 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
+StringCompare (\r
+  IN  CONST VOID                *Buffer1,\r
+  IN  CONST VOID                *Buffer2\r
   );\r
 \r
 #endif //__SORT_LIB_H__\r