Sync tianocompress with upstream and more warning fixes

This commit is contained in:
vit9696 2018-05-08 19:02:25 +03:00
parent 02cce9c6bd
commit d130533e32
5 changed files with 154 additions and 163 deletions

View File

@ -57,12 +57,11 @@ extern "C" {
--*/
EFI_STATUS
TianoCompress (
CONST VOID *SrcBuffer,
UINT32 SrcSize,
VOID *DstBuffer,
UINT32 *DstSize
)
;
IN CONST VOID *SrcBuffer,
IN UINT32 SrcSize,
IN VOID *DstBuffer,
IN OUT UINT32 *DstSize
);
EFI_STATUS
TianoCompressLegacy(
@ -70,8 +69,7 @@ extern "C" {
UINT32 SrcSize,
VOID *DstBuffer,
UINT32 *DstSize
)
;
);
/*++
Routine Description:
@ -97,20 +95,19 @@ extern "C" {
--*/
EFI_STATUS
EfiCompress (
CONST VOID *SrcBuffer,
UINT32 SrcSize,
VOID *DstBuffer,
UINT32 *DstSize
)
;
IN CONST VOID *SrcBuffer,
IN UINT32 SrcSize,
IN VOID *DstBuffer,
IN OUT UINT32 *DstSize
);
EFI_STATUS
EfiCompressLegacy(
CONST VOID *SrcBuffer,
UINT32 SrcSize,
VOID *DstBuffer,
UINT32 *DstSize
)
;
);
#ifdef __cplusplus
}

View File

@ -79,12 +79,6 @@ typedef struct {
UINT8 mPBit;
} SCRATCH_DATA;
STATIC
VOID
FillBuf(
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
)
/*++
Routine Description:
@ -99,6 +93,12 @@ NumOfBits - The number of bits to shift and read.
Returns: (VOID)
--*/
STATIC
VOID
FillBuf (
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
)
{
Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits);
@ -127,12 +127,6 @@ Returns: (VOID)
Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
}
STATIC
UINT32
GetBits(
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
)
/*++
Routine Description:
@ -151,6 +145,12 @@ Returns:
The bits that are popped out.
--*/
STATIC
UINT32
GetBits (
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfBits
)
{
UINT32 OutBits;
@ -161,15 +161,6 @@ The bits that are popped out.
return OutBits;
}
STATIC
UINT16
MakeTable(
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfChar,
IN UINT8 *BitLen,
IN UINT16 TableBits,
OUT UINT16 *Table
)
/*++
Routine Description:
@ -190,6 +181,15 @@ Returns:
BAD_TABLE - The table is corrupted.
--*/
STATIC
UINT16
MakeTable (
IN SCRATCH_DATA *Sd,
IN UINT16 NumOfChar,
IN UINT8 *BitLen,
IN UINT16 TableBits,
OUT UINT16 *Table
)
{
UINT16 Count[17];
UINT16 Weight[17];
@ -321,11 +321,6 @@ BAD_TABLE - The table is corrupted.
return 0;
}
STATIC
UINT32
DecodeP(
IN SCRATCH_DATA *Sd
)
/*++
Routine Description:
@ -341,6 +336,11 @@ Returns:
The position value decoded.
--*/
STATIC
UINT32
DecodeP (
IN SCRATCH_DATA *Sd
)
{
UINT16 Val;
UINT32 Mask;
@ -375,14 +375,6 @@ The position value decoded.
return Pos;
}
STATIC
UINT16
ReadPTLen(
IN SCRATCH_DATA *Sd,
IN UINT16 nn,
IN UINT16 nbit,
IN UINT16 Special
)
/*++
Routine Description:
@ -402,6 +394,14 @@ Returns:
BAD_TABLE - Table is corrupted.
--*/
STATIC
UINT16
ReadPTLen (
IN SCRATCH_DATA *Sd,
IN UINT16 nn,
IN UINT16 nbit,
IN UINT16 Special
)
{
UINT16 Number;
UINT16 CharC;
@ -469,11 +469,6 @@ BAD_TABLE - Table is corrupted.
return MakeTable(Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
}
STATIC
VOID
ReadCLen(
SCRATCH_DATA *Sd
)
/*++
Routine Description:
@ -487,6 +482,11 @@ Sd - the global scratch data
Returns: (VOID)
--*/
STATIC
VOID
ReadCLen (
SCRATCH_DATA *Sd
)
{
UINT16 Number;
UINT16 CharC;
@ -560,11 +560,6 @@ Returns: (VOID)
return;
}
STATIC
UINT16
DecodeC(
SCRATCH_DATA *Sd
)
/*++
Routine Description:
@ -580,6 +575,11 @@ Returns:
The value decoded.
--*/
STATIC
UINT16
DecodeC (
SCRATCH_DATA *Sd
)
{
UINT16 Index2;
UINT32 Mask;
@ -627,11 +627,6 @@ The value decoded.
return Index2;
}
STATIC
VOID
Decode(
SCRATCH_DATA *Sd
)
/*++
Routine Description:
@ -645,6 +640,11 @@ Sd - The global scratch data
Returns: (VOID)
--*/
STATIC
VOID
Decode (
SCRATCH_DATA *Sd
)
{
UINT16 BytesRemain;
UINT32 DataIdx;
@ -700,13 +700,6 @@ Returns: (VOID)
}
}
EFI_STATUS
GetInfo(
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
)
/*++
Routine Description:
@ -726,6 +719,13 @@ EFI_SUCCESS - The size of destination buffer and the size of scratch b
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
EFI_STATUS
GetInfo(
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
)
{
const UINT8 *Src;
@ -740,16 +740,6 @@ EFI_INVALID_PARAMETER - The source data is corrupted
return EFI_SUCCESS;
}
EFI_STATUS
Decompress(
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize,
IN UINT8 Version
)
/*++
Routine Description:
@ -774,6 +764,16 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
EFI_STATUS
Decompress (
IN CONST VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize,
IN UINT8 Version
)
{
UINT32 Index;
UINT32 CompSize;
@ -866,14 +866,6 @@ EFI_INVALID_PARAMETER - The source data is corrupted
return Status;
}
EFI_STATUS
EFIAPI
EfiTianoGetInfo(
IN const VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
)
/*++
Routine Description:
@ -894,25 +886,18 @@ EFI_SUCCESS - The size of destination buffer and the size of scratch b
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
{
return GetInfo(
Source,
SrcSize,
DstSize,
ScratchSize
);
}
EFI_STATUS
EFIAPI
EfiDecompress(
IN const VOID *Source,
EfiTianoGetInfo(
IN CONST VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
)
{
return GetInfo (Source, SrcSize, DstSize, ScratchSize);
}
/*++
Routine Description:
@ -935,6 +920,16 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
EFI_STATUS
EFIAPI
EfiDecompress (
IN CONST VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
{
//
// For EFI 1.1 de/compression algorithm, the version is 1.
@ -950,16 +945,6 @@ EFI_INVALID_PARAMETER - The source data is corrupted
);
}
EFI_STATUS
EFIAPI
TianoDecompress(
IN const VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
/*++
Routine Description:
@ -982,6 +967,16 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
EFI_STATUS
EFIAPI
TianoDecompress (
IN CONST VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
{
//
// For Tiano de/compression algorithm, the version is 2.

View File

@ -37,14 +37,6 @@ typedef struct EFI_TIANO_HEADER_ {
UINT32 OrigSize;
} EFI_TIANO_HEADER;
EFI_STATUS
EFIAPI
EfiTianoGetInfo(
const VOID *Source,
UINT32 SrcSize,
UINT32 *DstSize,
UINT32 *ScratchSize
)
/*++
Routine Description:
@ -64,18 +56,16 @@ EFI_SUCCESS - The size of destination buffer and the size of scratch b
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
;
EFI_STATUS
EFIAPI
EfiDecompress(
const VOID *Source,
UINT32 SrcSize,
VOID *Destination,
UINT32 DstSize,
VOID *Scratch,
UINT32 ScratchSize
EfiTianoGetInfo (
IN CONST VOID *Source,
IN UINT32 SrcSize,
OUT UINT32 *DstSize,
OUT UINT32 *ScratchSize
);
/*++
Routine Description:
@ -97,18 +87,17 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
;
EFI_STATUS
EFIAPI
TianoDecompress(
const VOID *Source,
UINT32 SrcSize,
VOID *Destination,
UINT32 DstSize,
VOID *Scratch,
UINT32 ScratchSize
)
EfiDecompress(
IN CONST VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
);
/*++
Routine Description:
@ -130,7 +119,16 @@ EFI_SUCCESS - Decompression is successful
EFI_INVALID_PARAMETER - The source data is corrupted
--*/
;
EFI_STATUS
EFIAPI
TianoDecompress(
IN CONST VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
);
#ifdef __cplusplus
}

View File

@ -16,8 +16,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <stdarg.h>
#include <stdint.h>
#include <stddef.h>
typedef uint8_t USTATUS;
typedef size_t USTATUS;
#define U_SUCCESS 0
#define U_INVALID_PARAMETER 1
#define U_BUFFER_TOO_SMALL 2
@ -79,7 +80,7 @@ typedef int64_t INT64;
typedef uint64_t UINT64;
typedef char CHAR8;
typedef uint16_t CHAR16;
typedef unsigned int UINTN;
typedef size_t UINTN;
#define CONST const
#define VOID void
@ -161,11 +162,11 @@ typedef struct EFI_TIME_ {
UINT8 Hour; // Hour: 0 - 23
UINT8 Minute; // Minute: 0 - 59
UINT8 Second; // Second: 0 - 59
UINT8 : 8;
UINT8 Reserved0;
UINT32 Nanosecond; // Nanosecond: 0 - 999,999,999
INT16 TimeZone; // TimeZone: -1440 to 1440 or UNSPECIFIED (0x07FF)
UINT8 Daylight; // Daylight: ADJUST_DAYLIGHT (1) or IN_DAYLIGHT (2)
UINT8 : 8;
UINT8 Reserved1;
} EFI_TIME;
// Align to 4 or 8 bytes

View File

@ -1390,7 +1390,7 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen
UINT32 storedCrc32 = 0;
UINT32 calculatedCrc32 = 0;
UINT64 monotonicCounter = 0;
EFI_TIME timestamp = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
EFI_TIME timestamp = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
UINT32 pubKeyIndex = 0;
UINT8 subtype = 0;