OvmfPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the OvmfPkg 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: Andrew Fish <afish@apple.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:09 -08:00
committed by mergify[bot]
parent d1050b9dff
commit ac0a286f4d
445 changed files with 30894 additions and 26369 deletions

View File

@@ -20,20 +20,20 @@
// Size of the longest valid BOOL string (see the "mTrueString" and
// "mFalseString" arrays below), including the terminating NUL.
//
#define BOOL_STRING_MAX_SIZE (sizeof "disabled")
#define BOOL_STRING_MAX_SIZE (sizeof "disabled")
//
// Length of "\r\n", not including the terminating NUL.
//
#define CRLF_LENGTH (sizeof "\r\n" - 1)
#define CRLF_LENGTH (sizeof "\r\n" - 1)
//
// Words recognized as representing TRUE or FALSE.
//
STATIC CONST CHAR8 * CONST mTrueString[] = {
STATIC CONST CHAR8 *CONST mTrueString[] = {
"true", "yes", "y", "enable", "enabled", "1"
};
STATIC CONST CHAR8 * CONST mFalseString[] = {
STATIC CONST CHAR8 *CONST mFalseString[] = {
"false", "no", "n", "disable", "disabled", "0"
};
@@ -85,14 +85,14 @@ STATIC CONST CHAR8 * CONST mFalseString[] = {
STATIC
RETURN_STATUS
QemuFwCfgGetAsString (
IN CONST CHAR8 *FileName,
IN OUT UINTN *BufferSize,
OUT CHAR8 *Buffer
IN CONST CHAR8 *FileName,
IN OUT UINTN *BufferSize,
OUT CHAR8 *Buffer
)
{
RETURN_STATUS Status;
FIRMWARE_CONFIG_ITEM FwCfgItem;
UINTN FwCfgSize;
RETURN_STATUS Status;
FIRMWARE_CONFIG_ITEM FwCfgItem;
UINTN FwCfgSize;
if (!QemuFwCfgIsAvailable ()) {
return RETURN_UNSUPPORTED;
@@ -102,6 +102,7 @@ QemuFwCfgGetAsString (
if (RETURN_ERROR (Status)) {
return Status;
}
if (FwCfgSize > *BufferSize) {
return RETURN_PROTOCOL_ERROR;
}
@@ -112,18 +113,20 @@ QemuFwCfgGetAsString (
//
// If Buffer is already NUL-terminated due to fw_cfg contents, we're done.
//
if (FwCfgSize > 0 && Buffer[FwCfgSize - 1] == '\0') {
if ((FwCfgSize > 0) && (Buffer[FwCfgSize - 1] == '\0')) {
*BufferSize = FwCfgSize;
return RETURN_SUCCESS;
}
//
// Otherwise, append a NUL byte to Buffer (if we have room for it).
//
if (FwCfgSize == *BufferSize) {
return RETURN_PROTOCOL_ERROR;
}
Buffer[FwCfgSize] = '\0';
*BufferSize = FwCfgSize + 1;
*BufferSize = FwCfgSize + 1;
return RETURN_SUCCESS;
}
@@ -142,25 +145,26 @@ QemuFwCfgGetAsString (
STATIC
VOID
StripNewline (
IN OUT UINTN *BufferSize,
IN OUT CHAR8 *Buffer
IN OUT UINTN *BufferSize,
IN OUT CHAR8 *Buffer
)
{
UINTN InSize, OutSize;
UINTN InSize, OutSize;
InSize = *BufferSize;
InSize = *BufferSize;
OutSize = InSize;
if (InSize >= 3 &&
Buffer[InSize - 3] == '\r' && Buffer[InSize - 2] == '\n') {
if ((InSize >= 3) &&
(Buffer[InSize - 3] == '\r') && (Buffer[InSize - 2] == '\n'))
{
OutSize = InSize - 2;
} else if (InSize >= 2 && Buffer[InSize - 2] == '\n') {
} else if ((InSize >= 2) && (Buffer[InSize - 2] == '\n')) {
OutSize = InSize - 1;
}
if (OutSize < InSize) {
Buffer[OutSize - 1] = '\0';
*BufferSize = OutSize;
*BufferSize = OutSize;
}
}
@@ -203,20 +207,20 @@ StripNewline (
STATIC
RETURN_STATUS
QemuFwCfgParseUint64WithLimit (
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
IN UINT64 Limit,
OUT UINT64 *Value
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
IN UINT64 Limit,
OUT UINT64 *Value
)
{
UINTN Uint64StringSize;
CHAR8 Uint64String[UINT64_STRING_MAX_SIZE + CRLF_LENGTH];
RETURN_STATUS Status;
CHAR8 *EndPointer;
UINT64 Uint64;
UINTN Uint64StringSize;
CHAR8 Uint64String[UINT64_STRING_MAX_SIZE + CRLF_LENGTH];
RETURN_STATUS Status;
CHAR8 *EndPointer;
UINT64 Uint64;
Uint64StringSize = sizeof Uint64String;
Status = QemuFwCfgGetAsString (FileName, &Uint64StringSize, Uint64String);
Status = QemuFwCfgGetAsString (FileName, &Uint64StringSize, Uint64String);
if (RETURN_ERROR (Status)) {
return Status;
}
@@ -228,6 +232,7 @@ QemuFwCfgParseUint64WithLimit (
} else {
Status = AsciiStrDecimalToUint64S (Uint64String, &EndPointer, &Uint64);
}
if (RETURN_ERROR (Status)) {
return Status;
}
@@ -236,7 +241,7 @@ QemuFwCfgParseUint64WithLimit (
// Report a wire protocol error if the subject sequence is empty, or trailing
// garbage is present, or Limit is not honored.
//
if (EndPointer == Uint64String || *EndPointer != '\0' || Uint64 > Limit) {
if ((EndPointer == Uint64String) || (*EndPointer != '\0') || (Uint64 > Limit)) {
return RETURN_PROTOCOL_ERROR;
}
@@ -263,17 +268,17 @@ QemuFwCfgSimpleParserInit (
RETURN_STATUS
EFIAPI
QemuFwCfgParseBool (
IN CONST CHAR8 *FileName,
OUT BOOLEAN *Value
IN CONST CHAR8 *FileName,
OUT BOOLEAN *Value
)
{
UINTN BoolStringSize;
CHAR8 BoolString[BOOL_STRING_MAX_SIZE + CRLF_LENGTH];
RETURN_STATUS Status;
UINTN Idx;
UINTN BoolStringSize;
CHAR8 BoolString[BOOL_STRING_MAX_SIZE + CRLF_LENGTH];
RETURN_STATUS Status;
UINTN Idx;
BoolStringSize = sizeof BoolString;
Status = QemuFwCfgGetAsString (FileName, &BoolStringSize, BoolString);
Status = QemuFwCfgGetAsString (FileName, &BoolStringSize, BoolString);
if (RETURN_ERROR (Status)) {
return Status;
}
@@ -300,19 +305,24 @@ QemuFwCfgParseBool (
RETURN_STATUS
EFIAPI
QemuFwCfgParseUint8 (
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
OUT UINT8 *Value
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
OUT UINT8 *Value
)
{
RETURN_STATUS Status;
UINT64 Uint64;
RETURN_STATUS Status;
UINT64 Uint64;
Status = QemuFwCfgParseUint64WithLimit (FileName, ParseAsHex, MAX_UINT8,
&Uint64);
Status = QemuFwCfgParseUint64WithLimit (
FileName,
ParseAsHex,
MAX_UINT8,
&Uint64
);
if (RETURN_ERROR (Status)) {
return Status;
}
*Value = (UINT8)Uint64;
return RETURN_SUCCESS;
}
@@ -320,19 +330,24 @@ QemuFwCfgParseUint8 (
RETURN_STATUS
EFIAPI
QemuFwCfgParseUint16 (
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
OUT UINT16 *Value
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
OUT UINT16 *Value
)
{
RETURN_STATUS Status;
UINT64 Uint64;
RETURN_STATUS Status;
UINT64 Uint64;
Status = QemuFwCfgParseUint64WithLimit (FileName, ParseAsHex, MAX_UINT16,
&Uint64);
Status = QemuFwCfgParseUint64WithLimit (
FileName,
ParseAsHex,
MAX_UINT16,
&Uint64
);
if (RETURN_ERROR (Status)) {
return Status;
}
*Value = (UINT16)Uint64;
return RETURN_SUCCESS;
}
@@ -340,19 +355,24 @@ QemuFwCfgParseUint16 (
RETURN_STATUS
EFIAPI
QemuFwCfgParseUint32 (
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
OUT UINT32 *Value
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
OUT UINT32 *Value
)
{
RETURN_STATUS Status;
UINT64 Uint64;
RETURN_STATUS Status;
UINT64 Uint64;
Status = QemuFwCfgParseUint64WithLimit (FileName, ParseAsHex, MAX_UINT32,
&Uint64);
Status = QemuFwCfgParseUint64WithLimit (
FileName,
ParseAsHex,
MAX_UINT32,
&Uint64
);
if (RETURN_ERROR (Status)) {
return Status;
}
*Value = (UINT32)Uint64;
return RETURN_SUCCESS;
}
@@ -360,19 +380,24 @@ QemuFwCfgParseUint32 (
RETURN_STATUS
EFIAPI
QemuFwCfgParseUint64 (
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
OUT UINT64 *Value
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
OUT UINT64 *Value
)
{
RETURN_STATUS Status;
UINT64 Uint64;
RETURN_STATUS Status;
UINT64 Uint64;
Status = QemuFwCfgParseUint64WithLimit (FileName, ParseAsHex, MAX_UINT64,
&Uint64);
Status = QemuFwCfgParseUint64WithLimit (
FileName,
ParseAsHex,
MAX_UINT64,
&Uint64
);
if (RETURN_ERROR (Status)) {
return Status;
}
*Value = Uint64;
return RETURN_SUCCESS;
}
@@ -380,19 +405,24 @@ QemuFwCfgParseUint64 (
RETURN_STATUS
EFIAPI
QemuFwCfgParseUintn (
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
OUT UINTN *Value
IN CONST CHAR8 *FileName,
IN BOOLEAN ParseAsHex,
OUT UINTN *Value
)
{
RETURN_STATUS Status;
UINT64 Uint64;
RETURN_STATUS Status;
UINT64 Uint64;
Status = QemuFwCfgParseUint64WithLimit (FileName, ParseAsHex, MAX_UINTN,
&Uint64);
Status = QemuFwCfgParseUint64WithLimit (
FileName,
ParseAsHex,
MAX_UINTN,
&Uint64
);
if (RETURN_ERROR (Status)) {
return Status;
}
*Value = (UINTN)Uint64;
return RETURN_SUCCESS;
}