MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
7c7184e201
commit
1436aea4d5
@@ -19,7 +19,7 @@
|
||||
#include <Library/SortLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
|
||||
STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
|
||||
STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
|
||||
|
||||
#define USL_FREE_NON_NULL(Pointer) \
|
||||
{ \
|
||||
@@ -50,19 +50,19 @@ STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
|
||||
VOID
|
||||
EFIAPI
|
||||
PerformQuickSort (
|
||||
IN OUT VOID *BufferToSort,
|
||||
IN CONST UINTN Count,
|
||||
IN CONST UINTN ElementSize,
|
||||
IN SORT_COMPARE CompareFunction
|
||||
IN OUT VOID *BufferToSort,
|
||||
IN CONST UINTN Count,
|
||||
IN CONST UINTN ElementSize,
|
||||
IN SORT_COMPARE CompareFunction
|
||||
)
|
||||
{
|
||||
VOID *Buffer;
|
||||
|
||||
ASSERT(BufferToSort != NULL);
|
||||
ASSERT(CompareFunction != NULL);
|
||||
ASSERT (BufferToSort != NULL);
|
||||
ASSERT (CompareFunction != NULL);
|
||||
|
||||
Buffer = AllocateZeroPool(ElementSize);
|
||||
ASSERT(Buffer != NULL);
|
||||
Buffer = AllocateZeroPool (ElementSize);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
QuickSort (
|
||||
BufferToSort,
|
||||
@@ -72,7 +72,7 @@ PerformQuickSort (
|
||||
Buffer
|
||||
);
|
||||
|
||||
FreePool(Buffer);
|
||||
FreePool (Buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ PerformQuickSort (
|
||||
INTN
|
||||
EFIAPI
|
||||
DevicePathCompare (
|
||||
IN CONST VOID *Buffer1,
|
||||
IN CONST VOID *Buffer2
|
||||
IN CONST VOID *Buffer1,
|
||||
IN CONST VOID *Buffer2
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath1;
|
||||
@@ -100,8 +100,8 @@ DevicePathCompare (
|
||||
EFI_STATUS Status;
|
||||
INTN RetVal;
|
||||
|
||||
DevicePath1 = *(EFI_DEVICE_PATH_PROTOCOL**)Buffer1;
|
||||
DevicePath2 = *(EFI_DEVICE_PATH_PROTOCOL**)Buffer2;
|
||||
DevicePath1 = *(EFI_DEVICE_PATH_PROTOCOL **)Buffer1;
|
||||
DevicePath2 = *(EFI_DEVICE_PATH_PROTOCOL **)Buffer2;
|
||||
|
||||
if (DevicePath1 == NULL) {
|
||||
if (DevicePath2 == NULL) {
|
||||
@@ -116,37 +116,41 @@ DevicePathCompare (
|
||||
}
|
||||
|
||||
if (mUnicodeCollation == NULL) {
|
||||
Status = gBS->LocateProtocol(
|
||||
&gEfiUnicodeCollation2ProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&mUnicodeCollation);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiUnicodeCollation2ProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&mUnicodeCollation
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
TextPath1 = ConvertDevicePathToText(
|
||||
DevicePath1,
|
||||
FALSE,
|
||||
FALSE);
|
||||
TextPath1 = ConvertDevicePathToText (
|
||||
DevicePath1,
|
||||
FALSE,
|
||||
FALSE
|
||||
);
|
||||
|
||||
TextPath2 = ConvertDevicePathToText(
|
||||
DevicePath2,
|
||||
FALSE,
|
||||
FALSE);
|
||||
TextPath2 = ConvertDevicePathToText (
|
||||
DevicePath2,
|
||||
FALSE,
|
||||
FALSE
|
||||
);
|
||||
|
||||
if (TextPath1 == NULL) {
|
||||
RetVal = -1;
|
||||
} else if (TextPath2 == NULL) {
|
||||
RetVal = 1;
|
||||
} else {
|
||||
RetVal = mUnicodeCollation->StriColl(
|
||||
mUnicodeCollation,
|
||||
TextPath1,
|
||||
TextPath2);
|
||||
RetVal = mUnicodeCollation->StriColl (
|
||||
mUnicodeCollation,
|
||||
TextPath1,
|
||||
TextPath2
|
||||
);
|
||||
}
|
||||
|
||||
USL_FREE_NON_NULL(TextPath1);
|
||||
USL_FREE_NON_NULL(TextPath2);
|
||||
USL_FREE_NON_NULL (TextPath1);
|
||||
USL_FREE_NON_NULL (TextPath2);
|
||||
|
||||
return (RetVal);
|
||||
}
|
||||
@@ -164,27 +168,29 @@ DevicePathCompare (
|
||||
INTN
|
||||
EFIAPI
|
||||
StringNoCaseCompare (
|
||||
IN CONST VOID *Buffer1,
|
||||
IN CONST VOID *Buffer2
|
||||
IN CONST VOID *Buffer1,
|
||||
IN CONST VOID *Buffer2
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
if (mUnicodeCollation == NULL) {
|
||||
Status = gBS->LocateProtocol(
|
||||
&gEfiUnicodeCollation2ProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&mUnicodeCollation);
|
||||
EFI_STATUS Status;
|
||||
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
if (mUnicodeCollation == NULL) {
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiUnicodeCollation2ProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&mUnicodeCollation
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
return (mUnicodeCollation->StriColl(
|
||||
mUnicodeCollation,
|
||||
*(CHAR16**)Buffer1,
|
||||
*(CHAR16**)Buffer2));
|
||||
return (mUnicodeCollation->StriColl (
|
||||
mUnicodeCollation,
|
||||
*(CHAR16 **)Buffer1,
|
||||
*(CHAR16 **)Buffer2
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Function to compare 2 strings.
|
||||
|
||||
@@ -198,11 +204,12 @@ StringNoCaseCompare (
|
||||
INTN
|
||||
EFIAPI
|
||||
StringCompare (
|
||||
IN CONST VOID *Buffer1,
|
||||
IN CONST VOID *Buffer2
|
||||
IN CONST VOID *Buffer1,
|
||||
IN CONST VOID *Buffer2
|
||||
)
|
||||
{
|
||||
return (StrCmp(
|
||||
*(CHAR16**)Buffer1,
|
||||
*(CHAR16**)Buffer2));
|
||||
return (StrCmp (
|
||||
*(CHAR16 **)Buffer1,
|
||||
*(CHAR16 **)Buffer2
|
||||
));
|
||||
}
|
||||
|
@@ -21,10 +21,10 @@
|
||||
#include <Library/UnitTestLib.h>
|
||||
#include <Library/SortLib.h>
|
||||
|
||||
#define UNIT_TEST_APP_NAME "UefiSortLib Unit Tests"
|
||||
#define UNIT_TEST_APP_VERSION "1.0"
|
||||
#define UNIT_TEST_APP_NAME "UefiSortLib Unit Tests"
|
||||
#define UNIT_TEST_APP_VERSION "1.0"
|
||||
|
||||
#define TEST_ARRAY_SIZE_9 9
|
||||
#define TEST_ARRAY_SIZE_9 9
|
||||
|
||||
/**
|
||||
The function is called by PerformQuickSort to compare int values.
|
||||
@@ -40,13 +40,13 @@
|
||||
INTN
|
||||
EFIAPI
|
||||
TestCompareFunction (
|
||||
IN CONST VOID *Left,
|
||||
IN CONST VOID *Right
|
||||
IN CONST VOID *Left,
|
||||
IN CONST VOID *Right
|
||||
)
|
||||
{
|
||||
if (*(UINT32*)Right > *(UINT32*)Left) {
|
||||
if (*(UINT32 *)Right > *(UINT32 *)Left) {
|
||||
return 1;
|
||||
} else if (*(UINT32*)Right < *(UINT32*)Left) {
|
||||
} else if (*(UINT32 *)Right < *(UINT32 *)Left) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ SortUINT32ArrayShouldSucceed (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
UINTN TestCount;
|
||||
UINT32 Index;
|
||||
UINT32 TestBuffer[TEST_ARRAY_SIZE_9];
|
||||
UINT32 TestResult[TEST_ARRAY_SIZE_9];
|
||||
UINTN TestCount;
|
||||
UINT32 Index;
|
||||
UINT32 TestBuffer[TEST_ARRAY_SIZE_9];
|
||||
UINT32 TestResult[TEST_ARRAY_SIZE_9];
|
||||
|
||||
TestCount = TEST_ARRAY_SIZE_9;
|
||||
for (Index = 0; Index < TEST_ARRAY_SIZE_9; Index++) {
|
||||
@@ -112,8 +112,8 @@ CompareSameBufferShouldSucceed (
|
||||
IN UNIT_TEST_CONTEXT Context
|
||||
)
|
||||
{
|
||||
INTN retval;
|
||||
CONST CHAR16* TestBuffer[] = { L"abcdefg" };
|
||||
INTN retval;
|
||||
CONST CHAR16 *TestBuffer[] = { L"abcdefg" };
|
||||
|
||||
retval = StringCompare (TestBuffer, TestBuffer);
|
||||
UT_ASSERT_TRUE (retval == 0);
|
||||
@@ -142,7 +142,7 @@ UnitTestingEntry (
|
||||
|
||||
Framework = NULL;
|
||||
|
||||
DEBUG(( DEBUG_INFO, "%a v%a\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION ));
|
||||
DEBUG ((DEBUG_INFO, "%a v%a\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION));
|
||||
|
||||
//
|
||||
// Start setting up the test framework for running the tests.
|
||||
@@ -166,8 +166,8 @@ UnitTestingEntry (
|
||||
//
|
||||
// --------------Suite--------Description------------Name--------------Function----------------Pre---Post---Context-----------
|
||||
//
|
||||
AddTestCase (SortTests, "Sort the Array", "Sort", SortUINT32ArrayShouldSucceed, NULL, NULL, NULL);
|
||||
AddTestCase (SortTests, "Compare the Buffer", "Compare", CompareSameBufferShouldSucceed, NULL, NULL, NULL);
|
||||
AddTestCase (SortTests, "Sort the Array", "Sort", SortUINT32ArrayShouldSucceed, NULL, NULL, NULL);
|
||||
AddTestCase (SortTests, "Compare the Buffer", "Compare", CompareSameBufferShouldSucceed, NULL, NULL, NULL);
|
||||
|
||||
//
|
||||
// Execute the tests.
|
||||
@@ -185,7 +185,7 @@ EXIT:
|
||||
///
|
||||
/// Avoid ECC error for function name that starts with lower case letter
|
||||
///
|
||||
#define UefiSortLibUnitTestMain main
|
||||
#define UefiSortLibUnitTestMain main
|
||||
|
||||
/**
|
||||
Standard POSIX C entry point for host based unit test execution.
|
||||
|
Reference in New Issue
Block a user