RedfishPkg: Apply uncrustify changes

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

Apply uncrustify changes to .c/.h files in the RedfishPkg 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: Abner Chang <abner.chang@hpe.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:11 -08:00
committed by mergify[bot]
parent 5220bd211d
commit 39de741e2d
56 changed files with 6067 additions and 4616 deletions

View File

@@ -26,17 +26,16 @@
**/
UINT8
GetUTF8SizeForUCS2 (
IN CHAR8 *Utf8Buffer
IN CHAR8 *Utf8Buffer
)
{
CHAR8 TempChar;
UINT8 Utf8Size;
CHAR8 TempChar;
UINT8 Utf8Size;
ASSERT (Utf8Buffer != NULL);
TempChar = *Utf8Buffer;
if ((TempChar & 0xF0) == 0xF0) {
//
// This format is not for UCS2.
//
@@ -46,11 +45,9 @@ GetUTF8SizeForUCS2 (
Utf8Size = 1;
if ((TempChar & 0x80) == 0x80) {
if ((TempChar & 0xC0) == 0xC0) {
Utf8Size ++;
Utf8Size++;
if ((TempChar & 0xE0) == 0xE0) {
Utf8Size ++;
Utf8Size++;
}
}
}
@@ -74,16 +71,16 @@ GetUTF8SizeForUCS2 (
**/
EFI_STATUS
GetUCS2CharByFormat (
IN CHAR8 *Utf8Buffer,
OUT CHAR16 *Ucs2Char
IN CHAR8 *Utf8Buffer,
OUT CHAR16 *Ucs2Char
)
{
UINT8 Num1;
UINT8 Num2;
UINT8 Index;
CHAR8 Ucs2CharFormat[UNICODE_FORMAT_CHAR_SIZE]; /// two Hexadecimal digits Ascii string, like "3F"
UINT8 Num1;
UINT8 Num2;
UINT8 Index;
CHAR8 Ucs2CharFormat[UNICODE_FORMAT_CHAR_SIZE]; /// two Hexadecimal digits Ascii string, like "3F"
for (Index = 0; Index < 4; Index ++) {
for (Index = 0; Index < 4; Index++) {
if ((*(Utf8Buffer + 2 + Index) & 0x80) != 0x00) {
return EFI_INVALID_PARAMETER;
}
@@ -95,19 +92,19 @@ GetUCS2CharByFormat (
// Get the First Number, Offset is 2
//
CopyMem (Ucs2CharFormat, Utf8Buffer + 2, UNICODE_FORMAT_CHAR_LEN);
Num1 = (UINT8) AsciiStrHexToUintn (Ucs2CharFormat);
Num1 = (UINT8)AsciiStrHexToUintn (Ucs2CharFormat);
//
// Get the Second Number, Offset is 4
//
CopyMem (Ucs2CharFormat, Utf8Buffer + 4, UNICODE_FORMAT_CHAR_LEN);
Num2 = (UINT8) AsciiStrHexToUintn (Ucs2CharFormat);
Num2 = (UINT8)AsciiStrHexToUintn (Ucs2CharFormat);
//
// Ucs2Char is Little-Endian
//
*((CHAR8 *) Ucs2Char) = Num2;
*(((CHAR8 *) Ucs2Char) + 1) = Num1;
*((CHAR8 *)Ucs2Char) = Num2;
*(((CHAR8 *)Ucs2Char) + 1) = Num1;
return EFI_SUCCESS;
}
@@ -123,33 +120,30 @@ GetUCS2CharByFormat (
**/
UINT8
UCS2CharToUTF8 (
IN CHAR16 Ucs2Char,
OUT CHAR8 *Utf8Buffer
IN CHAR16 Ucs2Char,
OUT CHAR8 *Utf8Buffer
)
{
UINT16 Ucs2Number;
UINT16 Ucs2Number;
ASSERT (Utf8Buffer != NULL);
Ucs2Number = (UINT16) Ucs2Char;
Ucs2Number = (UINT16)Ucs2Char;
if (Ucs2Number <= 0x007F) {
//
// UTF8 format: 0xxxxxxx
//
*Utf8Buffer = Ucs2Char & 0x7F;
return 1;
} else if (Ucs2Number >= 0x0080 && Ucs2Number <= 0x07FF) {
} else if ((Ucs2Number >= 0x0080) && (Ucs2Number <= 0x07FF)) {
//
// UTF8 format: 110xxxxx 10xxxxxx
//
*(Utf8Buffer + 1) = (Ucs2Char & 0x3F) | 0x80;
*Utf8Buffer = ((Ucs2Char >> 6) & 0x1F) | 0xC0;
return 2;
} else { /// Ucs2Number >= 0x0800 && Ucs2Number <= 0xFFFF
} else {
/// Ucs2Number >= 0x0800 && Ucs2Number <= 0xFFFF
//
// UTF8 format: 1110xxxx 10xxxxxx 10xxxxxx
@@ -174,23 +168,22 @@ UCS2CharToUTF8 (
**/
EFI_STATUS
UTF8ToUCS2Char (
IN CHAR8 *Utf8Buffer,
OUT CHAR16 *Ucs2Char
IN CHAR8 *Utf8Buffer,
OUT CHAR16 *Ucs2Char
)
{
UINT8 Utf8Size;
CHAR8 *Ucs2Buffer;
CHAR8 TempChar1;
CHAR8 TempChar2;
CHAR8 TempChar3;
UINT8 Utf8Size;
CHAR8 *Ucs2Buffer;
CHAR8 TempChar1;
CHAR8 TempChar2;
CHAR8 TempChar3;
ASSERT (Utf8Buffer != NULL && Ucs2Char != NULL);
ZeroMem (Ucs2Char, sizeof (CHAR16));
Ucs2Buffer = (CHAR8 *) Ucs2Char;
Ucs2Buffer = (CHAR8 *)Ucs2Char;
Utf8Size = GetUTF8SizeForUCS2 (Utf8Buffer);
switch (Utf8Size) {
case 1:
//
@@ -271,27 +264,26 @@ UTF8ToUCS2Char (
**/
EFI_STATUS
UCS2StrToUTF8 (
IN CHAR16 *Ucs2Str,
OUT CHAR8 **Utf8StrAddr
IN CHAR16 *Ucs2Str,
OUT CHAR8 **Utf8StrAddr
)
{
UINTN Ucs2StrIndex;
UINTN Ucs2StrLength;
CHAR8 *Utf8Str;
UINTN Utf8StrLength;
UINTN Utf8StrIndex;
CHAR8 Utf8Buffer[UTF8_BUFFER_FOR_UCS2_MAX_SIZE];
UINT8 Utf8BufferSize;
UINTN Ucs2StrIndex;
UINTN Ucs2StrLength;
CHAR8 *Utf8Str;
UINTN Utf8StrLength;
UINTN Utf8StrIndex;
CHAR8 Utf8Buffer[UTF8_BUFFER_FOR_UCS2_MAX_SIZE];
UINT8 Utf8BufferSize;
if (Ucs2Str == NULL || Utf8StrAddr == NULL) {
if ((Ucs2Str == NULL) || (Utf8StrAddr == NULL)) {
return EFI_INVALID_PARAMETER;
}
Ucs2StrLength = StrLen (Ucs2Str);
Utf8StrLength = 0;
for (Ucs2StrIndex = 0; Ucs2StrIndex < Ucs2StrLength; Ucs2StrIndex ++) {
for (Ucs2StrIndex = 0; Ucs2StrIndex < Ucs2StrLength; Ucs2StrIndex++) {
ZeroMem (Utf8Buffer, sizeof (Utf8Buffer));
Utf8BufferSize = UCS2CharToUTF8 (Ucs2Str[Ucs2StrIndex], Utf8Buffer);
Utf8StrLength += Utf8BufferSize;
@@ -303,8 +295,7 @@ UCS2StrToUTF8 (
}
Utf8StrIndex = 0;
for (Ucs2StrIndex = 0; Ucs2StrIndex < Ucs2StrLength; Ucs2StrIndex ++) {
for (Ucs2StrIndex = 0; Ucs2StrIndex < Ucs2StrLength; Ucs2StrIndex++) {
ZeroMem (Utf8Buffer, sizeof (Utf8Buffer));
Utf8BufferSize = UCS2CharToUTF8 (Ucs2Str[Ucs2StrIndex], Utf8Buffer);
@@ -313,7 +304,7 @@ UCS2StrToUTF8 (
}
Utf8Str[Utf8StrIndex] = '\0';
*Utf8StrAddr = Utf8Str;
*Utf8StrAddr = Utf8Str;
return EFI_SUCCESS;
}
@@ -334,18 +325,18 @@ UCS2StrToUTF8 (
**/
EFI_STATUS
UTF8StrToUCS2 (
IN CHAR8 *Utf8Str,
OUT CHAR16 **Ucs2StrAddr
IN CHAR8 *Utf8Str,
OUT CHAR16 **Ucs2StrAddr
)
{
EFI_STATUS Status;
UINTN Utf8StrIndex;
UINTN Utf8StrLength;
UINTN Ucs2StrIndex;
UINT8 Utf8BufferSize;
CHAR16 *Ucs2StrTemp;
EFI_STATUS Status;
UINTN Utf8StrIndex;
UINTN Utf8StrLength;
UINTN Ucs2StrIndex;
UINT8 Utf8BufferSize;
CHAR16 *Ucs2StrTemp;
if (Utf8Str == NULL || Ucs2StrAddr == NULL) {
if ((Utf8Str == NULL) || (Ucs2StrAddr == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -354,7 +345,7 @@ UTF8StrToUCS2 (
//
Utf8StrLength = 0;
while (*(Utf8Str + Utf8StrLength) != '\0') {
Utf8StrLength ++;
Utf8StrLength++;
}
//
@@ -368,46 +359,39 @@ UTF8StrToUCS2 (
Utf8StrIndex = 0;
Ucs2StrIndex = 0;
while (Utf8Str[Utf8StrIndex] != '\0') {
if (CompareMem (Utf8Str + Utf8StrIndex, "\\u", 2) == 0 &&
Utf8StrLength - Utf8StrIndex >= UNICODE_FORMAT_LEN) {
if ((CompareMem (Utf8Str + Utf8StrIndex, "\\u", 2) == 0) &&
(Utf8StrLength - Utf8StrIndex >= UNICODE_FORMAT_LEN))
{
Status = GetUCS2CharByFormat (Utf8Str + Utf8StrIndex, Ucs2StrTemp + Ucs2StrIndex);
if (!EFI_ERROR (Status)) {
Utf8StrIndex += UNICODE_FORMAT_LEN;
Ucs2StrIndex ++;
Ucs2StrIndex++;
} else {
StrCpyS (Ucs2StrTemp + Ucs2StrIndex, 3, L"\\u");
Ucs2StrIndex += 2;
Utf8StrIndex += 2;
}
} else {
Utf8BufferSize = GetUTF8SizeForUCS2 (Utf8Str + Utf8StrIndex);
if (Utf8BufferSize == 0 || Utf8StrLength - Utf8StrIndex < Utf8BufferSize) {
if ((Utf8BufferSize == 0) || (Utf8StrLength - Utf8StrIndex < Utf8BufferSize)) {
FreePool (Ucs2StrTemp);
return EFI_INVALID_PARAMETER;
}
Status = UTF8ToUCS2Char (Utf8Str + Utf8StrIndex, Ucs2StrTemp + Ucs2StrIndex);
if (EFI_ERROR (Status)) {
FreePool (Ucs2StrTemp);
return EFI_INVALID_PARAMETER;
}
Ucs2StrIndex ++;
Ucs2StrIndex++;
Utf8StrIndex += Utf8BufferSize;
}
}
*Ucs2StrAddr = AllocateZeroPool ((Ucs2StrIndex + 1) * sizeof (CHAR16));
if (*Ucs2StrAddr == NULL) {
FreePool (Ucs2StrTemp);
return EFI_OUT_OF_RESOURCES;
}
@@ -418,4 +402,3 @@ UTF8StrToUCS2 (
return EFI_SUCCESS;
}

View File

@@ -15,7 +15,7 @@
#include <Protocol/Http.h>
#include <Protocol/RestEx.h>
#define REST_EX_CONFIG_DATA_LEN_UNKNOWN 0xff
#define REST_EX_CONFIG_DATA_LEN_UNKNOWN 0xff
/**
This function allows the caller to create child handle for specific
@@ -33,27 +33,28 @@
**/
EFI_STATUS
RestExLibCreateChild (
IN EFI_HANDLE Image,
IN EFI_HANDLE Image,
IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode,
IN EFI_REST_EX_CONFIG_TYPE ConfigType,
IN EFI_REST_EX_SERVICE_TYPE ServiceType,
OUT EFI_HANDLE *ChildInstanceHandle
)
IN EFI_REST_EX_CONFIG_TYPE ConfigType,
IN EFI_REST_EX_SERVICE_TYPE ServiceType,
OUT EFI_HANDLE *ChildInstanceHandle
)
{
EFI_STATUS Status;
UINTN NoBuffer;
EFI_HANDLE *Handle;
EFI_HANDLE ChildHandle;
EFI_REST_EX_PROTOCOL *RestEx;
EFI_REST_EX_SERVICE_INFO *RestExServiceInfo;
UINT8 LenOfConfig;
EFI_STATUS Status;
UINTN NoBuffer;
EFI_HANDLE *Handle;
EFI_HANDLE ChildHandle;
EFI_REST_EX_PROTOCOL *RestEx;
EFI_REST_EX_SERVICE_INFO *RestExServiceInfo;
UINT8 LenOfConfig;
if (Image == NULL ||
AccessMode >= EfiRestExServiceModeMax ||
ConfigType >= EfiRestExConfigTypeMax ||
ServiceType >= EfiRestExServiceTypeMax ||
ChildInstanceHandle == NULL
) {
if ((Image == NULL) ||
(AccessMode >= EfiRestExServiceModeMax) ||
(ConfigType >= EfiRestExConfigTypeMax) ||
(ServiceType >= EfiRestExServiceTypeMax) ||
(ChildInstanceHandle == NULL)
)
{
return EFI_INVALID_PARAMETER;
}
@@ -61,29 +62,31 @@ RestExLibCreateChild (
//
// Locate all REST EX binding service.
//
Handle = NULL;
Handle = NULL;
NoBuffer = 0;
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiRestExServiceBindingProtocolGuid,
NULL,
&NoBuffer,
&Handle
);
if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiRestExServiceBindingProtocolGuid,
NULL,
&NoBuffer,
&Handle
);
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
return Status;
}
Handle = (EFI_HANDLE *)AllocateZeroPool (sizeof(EFI_HANDLE) * NoBuffer);
Handle = (EFI_HANDLE *)AllocateZeroPool (sizeof (EFI_HANDLE) * NoBuffer);
if (Handle == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiRestExServiceBindingProtocolGuid,
NULL,
&NoBuffer,
&Handle
);
ByProtocol,
&gEfiRestExServiceBindingProtocolGuid,
NULL,
&NoBuffer,
&Handle
);
if (EFI_ERROR (Status)) {
FreePool (Handle);
return Status;
@@ -94,21 +97,21 @@ RestExLibCreateChild (
//
while (NoBuffer != 0) {
ChildHandle = NULL;
Status = NetLibCreateServiceChild (
*(Handle + (NoBuffer - 1)),
Image,
&gEfiRestExServiceBindingProtocolGuid,
&ChildHandle
);
Status = NetLibCreateServiceChild (
*(Handle + (NoBuffer - 1)),
Image,
&gEfiRestExServiceBindingProtocolGuid,
&ChildHandle
);
if (!EFI_ERROR (Status)) {
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiRestExProtocolGuid,
(VOID **)&RestEx,
Image,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
ChildHandle,
&gEfiRestExProtocolGuid,
(VOID **)&RestEx,
Image,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
@@ -117,12 +120,13 @@ RestExLibCreateChild (
// Get the information of REST service provided by this EFI REST EX driver
//
Status = RestEx->GetService (
RestEx,
&RestExServiceInfo
);
RestEx,
&RestExServiceInfo
);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
//
// Check REST EX property.
//
@@ -138,13 +142,16 @@ RestExLibCreateChild (
default:
goto ON_ERROR;
}
if (RestExServiceInfo->EfiRestExServiceInfoV10.RestServiceAccessMode != AccessMode ||
RestExServiceInfo->EfiRestExServiceInfoV10.RestServiceType != ServiceType ||
RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigType != ConfigType ||
((LenOfConfig != REST_EX_CONFIG_DATA_LEN_UNKNOWN) && (RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigDataLength != LenOfConfig))) {
if ((RestExServiceInfo->EfiRestExServiceInfoV10.RestServiceAccessMode != AccessMode) ||
(RestExServiceInfo->EfiRestExServiceInfoV10.RestServiceType != ServiceType) ||
(RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigType != ConfigType) ||
((LenOfConfig != REST_EX_CONFIG_DATA_LEN_UNKNOWN) && (RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigDataLength != LenOfConfig)))
{
goto ON_ERROR;
}
}
//
// This is proper REST EX instance.
//
@@ -159,8 +166,9 @@ ON_ERROR:;
&gEfiRestExServiceBindingProtocolGuid,
ChildHandle
);
NoBuffer --;
};
NoBuffer--;
}
FreePool (Handle);
return EFI_NOT_FOUND;
}

View File

@@ -36,7 +36,7 @@ JsonValueInitArray (
VOID
)
{
return (EDKII_JSON_VALUE)json_array();
return (EDKII_JSON_VALUE)json_array ();
}
/**
@@ -58,7 +58,7 @@ JsonValueInitObject (
VOID
)
{
return (EDKII_JSON_VALUE)json_object();
return (EDKII_JSON_VALUE)json_object ();
}
/**
@@ -83,10 +83,10 @@ JsonValueInitObject (
EDKII_JSON_VALUE
EFIAPI
JsonValueInitAsciiString (
IN CONST CHAR8 *String
IN CONST CHAR8 *String
)
{
UINTN Index;
UINTN Index;
if (String == NULL) {
return NULL;
@@ -124,11 +124,11 @@ JsonValueInitAsciiString (
EDKII_JSON_VALUE
EFIAPI
JsonValueInitUnicodeString (
IN CHAR16 *String
IN CHAR16 *String
)
{
EFI_STATUS Status;
CHAR8 *Utf8Str;
EFI_STATUS Status;
CHAR8 *Utf8Str;
if (String == NULL) {
return NULL;
@@ -160,7 +160,7 @@ JsonValueInitUnicodeString (
EDKII_JSON_VALUE
EFIAPI
JsonValueInitInteger (
IN INT64 Value
IN INT64 Value
)
{
return (EDKII_JSON_VALUE)json_integer (Value);
@@ -180,7 +180,7 @@ JsonValueInitInteger (
EDKII_JSON_VALUE
EFIAPI
JsonValueInitBoolean (
IN BOOLEAN Value
IN BOOLEAN Value
)
{
return (EDKII_JSON_VALUE)json_boolean (Value);
@@ -201,7 +201,7 @@ JsonValueInitTrue (
VOID
)
{
return (EDKII_JSON_VALUE)json_true();
return (EDKII_JSON_VALUE)json_true ();
}
/**
@@ -219,7 +219,7 @@ JsonValueInitFalse (
VOID
)
{
return (EDKII_JSON_VALUE)json_false();
return (EDKII_JSON_VALUE)json_false ();
}
/**
@@ -237,7 +237,7 @@ JsonValueInitNull (
VOID
)
{
return (EDKII_JSON_VALUE)json_null();
return (EDKII_JSON_VALUE)json_null ();
}
/**
@@ -263,10 +263,10 @@ JsonValueInitNull (
VOID
EFIAPI
JsonValueFree (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
json_decref((json_t *)Json);
json_decref ((json_t *)Json);
}
/**
@@ -289,10 +289,10 @@ JsonValueFree (
EDKII_JSON_VALUE
EFIAPI
JsonValueClone (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
return (EDKII_JSON_VALUE)json_deep_copy ((json_t *) Json);
return (EDKII_JSON_VALUE)json_deep_copy ((json_t *)Json);
}
/**
@@ -307,10 +307,10 @@ JsonValueClone (
BOOLEAN
EFIAPI
JsonValueIsArray (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
return json_is_array ((json_t *) Json);
return json_is_array ((json_t *)Json);
}
/**
@@ -325,10 +325,10 @@ JsonValueIsArray (
BOOLEAN
EFIAPI
JsonValueIsObject (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
return json_is_object ((json_t *) Json);
return json_is_object ((json_t *)Json);
}
/**
@@ -344,10 +344,10 @@ JsonValueIsObject (
BOOLEAN
EFIAPI
JsonValueIsString (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
return json_is_string ((json_t *) Json);
return json_is_string ((json_t *)Json);
}
/**
@@ -362,10 +362,10 @@ JsonValueIsString (
BOOLEAN
EFIAPI
JsonValueIsInteger (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
return json_is_integer ((json_t *) Json);
return json_is_integer ((json_t *)Json);
}
/**
@@ -380,10 +380,10 @@ JsonValueIsInteger (
BOOLEAN
EFIAPI
JsonValueIsNumber (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
return json_is_number ((json_t *) Json);
return json_is_number ((json_t *)Json);
}
/**
@@ -398,10 +398,10 @@ JsonValueIsNumber (
BOOLEAN
EFIAPI
JsonValueIsBoolean (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
return json_is_boolean ((json_t *) Json);
return json_is_boolean ((json_t *)Json);
}
/**
@@ -416,12 +416,13 @@ JsonValueIsBoolean (
BOOLEAN
EFIAPI
JsonValueIsTrue (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
if (json_is_true ((json_t *)Json)) {
return TRUE;
}
return FALSE;
}
@@ -437,14 +438,16 @@ JsonValueIsTrue (
BOOLEAN
EFIAPI
JsonValueIsFalse (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
if (json_is_false ((json_t *)Json)) {
return TRUE;
}
return FALSE;
}
/**
The function is used to return if the provided JSON value contains a JSON NULL.
@@ -457,10 +460,10 @@ JsonValueIsFalse (
BOOLEAN
EFIAPI
JsonValueIsNull (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
return json_is_null ((json_t *) Json);
return json_is_null ((json_t *)Json);
}
/**
@@ -476,10 +479,10 @@ JsonValueIsNull (
EDKII_JSON_ARRAY
EFIAPI
JsonValueGetArray (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
if (Json == NULL || !JsonValueIsArray (Json)) {
if ((Json == NULL) || !JsonValueIsArray (Json)) {
return NULL;
}
@@ -499,10 +502,10 @@ JsonValueGetArray (
EDKII_JSON_OBJECT
EFIAPI
JsonValueGetObject (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
if (Json == NULL || !JsonValueIsObject (Json)) {
if ((Json == NULL) || !JsonValueIsObject (Json)) {
return NULL;
}
@@ -522,13 +525,13 @@ JsonValueGetObject (
CONST CHAR8 *
EFIAPI
JsonValueGetAsciiString (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
CONST CHAR8 *AsciiStr;
UINTN Index;
CONST CHAR8 *AsciiStr;
UINTN Index;
AsciiStr = json_string_value ((json_t *) Json);
AsciiStr = json_string_value ((json_t *)Json);
if (AsciiStr == NULL) {
return NULL;
}
@@ -556,22 +559,22 @@ JsonValueGetAsciiString (
@retval Return the associated Unicode string in JSON value or NULL.
**/
CHAR16*
CHAR16 *
EFIAPI
JsonValueGetUnicodeString (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
EFI_STATUS Status;
CONST CHAR8 *Utf8Str;
CHAR16 *Ucs2Str;
EFI_STATUS Status;
CONST CHAR8 *Utf8Str;
CHAR16 *Ucs2Str;
Utf8Str = json_string_value ((json_t *) Json);
Utf8Str = json_string_value ((json_t *)Json);
if (Utf8Str == NULL) {
return NULL;
}
Status = UTF8StrToUCS2 ((CHAR8*)Utf8Str, &Ucs2Str);
Status = UTF8StrToUCS2 ((CHAR8 *)Utf8Str, &Ucs2Str);
if (EFI_ERROR (Status)) {
return NULL;
}
@@ -593,15 +596,15 @@ JsonValueGetUnicodeString (
INT64
EFIAPI
JsonValueGetInteger (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
ASSERT (Json != NULL && JsonValueIsInteger (Json));
if (Json == NULL || !JsonValueIsInteger (Json)) {
if ((Json == NULL) || !JsonValueIsInteger (Json)) {
return 0;
}
return json_integer_value ((json_t *) Json);
return json_integer_value ((json_t *)Json);
}
/**
@@ -618,15 +621,15 @@ JsonValueGetInteger (
BOOLEAN
EFIAPI
JsonValueGetBoolean (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
ASSERT (Json != NULL && JsonValueIsBoolean (Json));
if (Json == NULL || !JsonValueIsBoolean (Json)) {
if ((Json == NULL) || !JsonValueIsBoolean (Json)) {
return FALSE;
}
return json_is_true ((json_t *) Json);
return json_is_true ((json_t *)Json);
}
/**
@@ -639,10 +642,10 @@ JsonValueGetBoolean (
@retval Return the associated Ascii string in JSON value or NULL on errors.
**/
CONST CHAR8*
CONST CHAR8 *
EFIAPI
JsonValueGetString (
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_VALUE Json
)
{
return json_string_value ((const json_t *)Json);
@@ -660,10 +663,10 @@ JsonValueGetString (
UINTN
EFIAPI
JsonObjectSize (
IN EDKII_JSON_OBJECT JsonObject
IN EDKII_JSON_OBJECT JsonObject
)
{
return json_object_size ((json_t *) JsonObject);
return json_object_size ((json_t *)JsonObject);
}
/**
@@ -679,24 +682,23 @@ JsonObjectSize (
JsonObj is not an JSON object, key count is zero or on other errors.
**/
CHAR8**
CHAR8 **
JsonObjectGetKeys (
IN EDKII_JSON_OBJECT JsonObj,
OUT UINTN *KeyCount
IN EDKII_JSON_OBJECT JsonObj,
OUT UINTN *KeyCount
)
{
UINTN Index;
CONST CHAR8 **KeyArray;
CONST CHAR8 *Key;
EDKII_JSON_VALUE Value;
UINTN Index;
CONST CHAR8 **KeyArray;
CONST CHAR8 *Key;
EDKII_JSON_VALUE Value;
if (JsonObj == NULL || KeyCount == NULL) {
if ((JsonObj == NULL) || (KeyCount == NULL)) {
return NULL;
}
Index = 0;
json_object_foreach(JsonObj, Key, Value) {
json_object_foreach (JsonObj, Key, Value) {
Index++;
}
if (Index == 0) {
@@ -705,7 +707,7 @@ JsonObjectGetKeys (
}
*KeyCount = Index;
KeyArray = (CONST CHAR8 **) AllocateZeroPool (*KeyCount * sizeof (CHAR8 *));
KeyArray = (CONST CHAR8 **)AllocateZeroPool (*KeyCount * sizeof (CHAR8 *));
if (KeyArray == NULL) {
return NULL;
}
@@ -713,7 +715,7 @@ JsonObjectGetKeys (
Key = NULL;
Value = NULL;
Index = 0;
json_object_foreach((json_t *) JsonObj, Key, Value) {
json_object_foreach ((json_t *)JsonObj, Key, Value) {
KeyArray[Index] = Key;
Index++;
}
@@ -740,8 +742,8 @@ JsonObjectGetKeys (
EDKII_JSON_VALUE
EFIAPI
JsonObjectGetValue (
IN CONST EDKII_JSON_OBJECT JsonObj,
IN CONST CHAR8 *Key
IN CONST EDKII_JSON_OBJECT JsonObj,
IN CONST CHAR8 *Key
)
{
return (EDKII_JSON_VALUE)json_object_get ((const json_t *)JsonObj, (const char *)Key);
@@ -768,12 +770,12 @@ JsonObjectGetValue (
EFI_STATUS
EFIAPI
JsonObjectSetValue (
IN EDKII_JSON_OBJECT JsonObj,
IN CONST CHAR8 *Key,
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_OBJECT JsonObj,
IN CONST CHAR8 *Key,
IN EDKII_JSON_VALUE Json
)
{
if (json_object_set ((json_t *) JsonObj, Key, (json_t *) Json) != 0) {
if (json_object_set ((json_t *)JsonObj, Key, (json_t *)Json) != 0) {
return EFI_ABORTED;
} else {
return EFI_SUCCESS;
@@ -792,10 +794,10 @@ JsonObjectSetValue (
UINTN
EFIAPI
JsonArrayCount (
IN EDKII_JSON_ARRAY JsonArray
IN EDKII_JSON_ARRAY JsonArray
)
{
return json_array_size ((json_t *) JsonArray);
return json_array_size ((json_t *)JsonArray);
}
/**
@@ -817,11 +819,11 @@ JsonArrayCount (
EDKII_JSON_VALUE
EFIAPI
JsonArrayGetValue (
IN EDKII_JSON_ARRAY JsonArray,
IN UINTN Index
IN EDKII_JSON_ARRAY JsonArray,
IN UINTN Index
)
{
return (EDKII_JSON_VALUE)json_array_get ((json_t *) JsonArray, Index);
return (EDKII_JSON_VALUE)json_array_get ((json_t *)JsonArray, Index);
}
/**
@@ -840,11 +842,11 @@ JsonArrayGetValue (
EFI_STATUS
EFIAPI
JsonArrayAppendValue (
IN EDKII_JSON_ARRAY JsonArray,
IN EDKII_JSON_VALUE Json
IN EDKII_JSON_ARRAY JsonArray,
IN EDKII_JSON_VALUE Json
)
{
if (json_array_append ((json_t *) JsonArray, (json_t *) Json) != 0) {
if (json_array_append ((json_t *)JsonArray, (json_t *)Json) != 0) {
return EFI_ABORTED;
} else {
return EFI_SUCCESS;
@@ -868,11 +870,11 @@ JsonArrayAppendValue (
EFI_STATUS
EFIAPI
JsonArrayRemoveValue (
IN EDKII_JSON_ARRAY JsonArray,
IN UINTN Index
IN EDKII_JSON_ARRAY JsonArray,
IN UINTN Index
)
{
if (json_array_remove ((json_t *) JsonArray, Index) != 0) {
if (json_array_remove ((json_t *)JsonArray, Index) != 0) {
return EFI_ABORTED;
} else {
return EFI_SUCCESS;
@@ -904,14 +906,15 @@ JsonArrayRemoveValue (
CHAR8 *
EFIAPI
JsonDumpString (
IN EDKII_JSON_VALUE JsonValue,
IN UINTN Flags
IN EDKII_JSON_VALUE JsonValue,
IN UINTN Flags
)
{
if (JsonValue == NULL) {
return NULL;
}
return json_dumps((json_t *)JsonValue, Flags);
if (JsonValue == NULL) {
return NULL;
}
return json_dumps ((json_t *)JsonValue, Flags);
}
/**
@@ -934,12 +937,12 @@ JsonDumpString (
EDKII_JSON_VALUE
EFIAPI
JsonLoadString (
IN CONST CHAR8* String,
IN UINT64 Flags,
IN EDKII_JSON_ERROR *Error
IN CONST CHAR8 *String,
IN UINT64 Flags,
IN EDKII_JSON_ERROR *Error
)
{
return (EDKII_JSON_VALUE) json_loads ((const char *)String, Flags, (json_error_t *)Error);
return (EDKII_JSON_VALUE)json_loads ((const char *)String, Flags, (json_error_t *)Error);
}
/**
@@ -964,13 +967,13 @@ JsonLoadString (
EDKII_JSON_VALUE
EFIAPI
JsonLoadBuffer (
IN CONST CHAR8 *Buffer,
IN CONST CHAR8 *Buffer,
IN UINTN BufferLen,
IN UINTN Flags,
IN OUT EDKII_JSON_ERROR *Error
)
{
return json_loadb(Buffer, BufferLen, Flags, (json_error_t *)Error);
return json_loadb (Buffer, BufferLen, Flags, (json_error_t *)Error);
}
/**
@@ -989,7 +992,7 @@ JsonLoadBuffer (
VOID
EFIAPI
JsonDecreaseReference (
IN EDKII_JSON_VALUE JsonValue
IN EDKII_JSON_VALUE JsonValue
)
{
json_decref (JsonValue);
@@ -1010,7 +1013,7 @@ JsonDecreaseReference (
EDKII_JSON_VALUE
EFIAPI
JsonIncreaseReference (
IN EDKII_JSON_VALUE JsonValue
IN EDKII_JSON_VALUE JsonValue
)
{
return json_incref (JsonValue);
@@ -1026,7 +1029,7 @@ JsonIncreaseReference (
VOID *
EFIAPI
JsonObjectIterator (
IN EDKII_JSON_VALUE JsonValue
IN EDKII_JSON_VALUE JsonValue
)
{
return json_object_iter (JsonValue);
@@ -1041,10 +1044,10 @@ JsonObjectIterator (
EDKII_JSON_VALUE
EFIAPI
JsonObjectIteratorValue (
IN VOID *Iterator
IN VOID *Iterator
)
{
return json_object_iter_value(Iterator);
return json_object_iter_value (Iterator);
}
/**
@@ -1058,11 +1061,11 @@ JsonObjectIteratorValue (
VOID *
EFIAPI
JsonObjectIteratorNext (
IN EDKII_JSON_VALUE JsonValue,
IN VOID *Iterator
IN EDKII_JSON_VALUE JsonValue,
IN VOID *Iterator
)
{
return json_object_iter_next(JsonValue, Iterator);
return json_object_iter_next (JsonValue, Iterator);
}
/**
@@ -1074,10 +1077,10 @@ JsonObjectIteratorNext (
CHAR8 *
EFIAPI
JsonObjectIteratorKey (
IN VOID *Iterator
)
IN VOID *Iterator
)
{
return (CHAR8 *)json_object_iter_key(Iterator);
return (CHAR8 *)json_object_iter_key (Iterator);
}
/**
@@ -1089,10 +1092,10 @@ JsonObjectIteratorKey (
VOID *
EFIAPI
JsonObjectKeyToIterator (
IN CHAR8 *Key
)
IN CHAR8 *Key
)
{
return json_object_key_to_iter(Key);
return json_object_key_to_iter (Key);
}
/**
@@ -1104,7 +1107,7 @@ JsonObjectKeyToIterator (
EDKII_JSON_TYPE
EFIAPI
JsonGetType (
IN EDKII_JSON_VALUE JsonValue
IN EDKII_JSON_VALUE JsonValue
)
{
return ((json_t *)JsonValue)->type;

View File

@@ -16,26 +16,26 @@
///
/// We support long long on edk2
///
#define JSON_INTEGER_IS_LONG_LONG 1
#define JSON_INTEGER_IS_LONG_LONG 1
///
/// We don't support locale on edk2
///
#define JSON_HAVE_LOCALECONV 0
#define JSON_HAVE_LOCALECONV 0
///
/// We don't support atomic builtins on edk2
///
#define JSON_HAVE_ATOMIC_BUILTINS 0
#define JSON_HAVE_ATOMIC_BUILTINS 0
///
/// We don't support sync builtins on edk2
///
#define JSON_HAVE_SYNC_BUILTINS 0
#define JSON_HAVE_SYNC_BUILTINS 0
///
/// Mzximum deepth is set to 2048
///
#define JSON_PARSER_MAX_DEPTH 2048
#define JSON_PARSER_MAX_DEPTH 2048
#endif

View File

@@ -11,9 +11,9 @@
#ifndef JANSSON_PRIVATE_CONFIG_H_
#define JANSSON_PRIVATE_CONFIG_H_
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define INITIAL_HASHTABLE_ORDER 3
#define INITIAL_HASHTABLE_ORDER 3
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,7 @@
**/
#include <Uefi.h>
#include <Protocol/EdkIIRedfishCredential.h>
/**
Notification of Exit Boot Service.
@@ -17,7 +18,7 @@ VOID
EFIAPI
LibCredentialExitBootServicesNotify (
IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This
)
)
{
return;
}
@@ -31,7 +32,7 @@ VOID
EFIAPI
LibCredentialEndOfDxeNotify (
IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This
)
)
{
return;
}
@@ -67,7 +68,7 @@ LibCredentialGetAuthInfo (
OUT EDKII_REDFISH_AUTH_METHOD *AuthMethod,
OUT CHAR8 **UserId,
OUT CHAR8 **Password
)
)
{
return EFI_UNSUPPORTED;
}
@@ -92,10 +93,9 @@ LibCredentialGetAuthInfo (
EFI_STATUS
EFIAPI
LibStopRedfishService (
IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This,
IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType
IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This,
IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType
)
{
return EFI_UNSUPPORTED;
}

View File

@@ -23,12 +23,13 @@
**/
EFI_STATUS
RedfishPlatformHostInterfaceDeviceDescriptor (
IN UINT8 *DeviceType,
IN UINT8 *DeviceType,
OUT REDFISH_INTERFACE_DATA **DeviceDescriptor
)
)
{
return EFI_NOT_FOUND;
}
/**
Get platform Redfish host interface protocol data.
Caller should pass NULL in ProtocolRecord to retrive the first protocol record.
@@ -44,9 +45,9 @@ RedfishPlatformHostInterfaceDeviceDescriptor (
**/
EFI_STATUS
RedfishPlatformHostInterfaceProtocolData (
IN OUT MC_HOST_INTERFACE_PROTOCOL_RECORD **ProtocolRecord,
IN UINT8 IndexOfProtocolData
)
IN OUT MC_HOST_INTERFACE_PROTOCOL_RECORD **ProtocolRecord,
IN UINT8 IndexOfProtocolData
)
{
return EFI_NOT_FOUND;
}

View File

@@ -34,11 +34,11 @@
**/
EFI_STATUS
RedfishContentEncode (
IN CHAR8 *ContentEncodedValue,
IN CHAR8 *OriginalContent,
IN UINTN OriginalContentLength,
OUT VOID **EncodedContentPointer,
OUT UINTN *EncodedContentLength
IN CHAR8 *ContentEncodedValue,
IN CHAR8 *OriginalContent,
IN UINTN OriginalContentLength,
OUT VOID **EncodedContentPointer,
OUT UINTN *EncodedContentLength
)
{
return EFI_UNSUPPORTED;
@@ -70,11 +70,11 @@ RedfishContentEncode (
**/
EFI_STATUS
RedfishContentDecode (
IN CHAR8 *ContentDecodedValue,
IN VOID *ContentPointer,
IN UINTN ContentLength,
OUT VOID **DecodedContentPointer,
OUT UINTN *DecodedContentLength
IN CHAR8 *ContentDecodedValue,
IN VOID *ContentPointer,
IN UINTN ContentLength,
OUT VOID **DecodedContentPointer,
OUT UINTN *DecodedContentLength
)
{
return EFI_UNSUPPORTED;