Fix CONST warnings (prepa C++)

This commit is contained in:
jief 2019-12-27 17:12:28 +01:00
parent 5e650e92cf
commit 2d4a9a77c5
11 changed files with 32 additions and 32 deletions

View File

@ -394,7 +394,7 @@ AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* data, UINT32
return node;
}
AML_CHUNK* aml_add_string_buffer(AML_CHUNK* parent, /* CONST*/ CHAR8* StringBuf)
AML_CHUNK* aml_add_string_buffer(AML_CHUNK* parent, CONST CHAR8* StringBuf)
{
AML_CHUNK* node = aml_create_node(parent);

View File

@ -40,7 +40,7 @@ UINT32 aml_write_size(UINT32 size, CHAR8* buffer, UINT32 offset);
// add by pcj
AML_CHUNK* aml_add_string(AML_CHUNK* parent, /* CONST*/ CHAR8* string);
AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* data,UINT32 size);
AML_CHUNK* aml_add_string_buffer(AML_CHUNK* parent, /* CONST*/ CHAR8* string);
AML_CHUNK* aml_add_string_buffer(AML_CHUNK* parent, CONST CHAR8* string);
AML_CHUNK* aml_add_device(AML_CHUNK* parent, /* CONST*/ CHAR8* name);
AML_CHUNK* aml_add_local0(AML_CHUNK* parent);
AML_CHUNK* aml_add_store(AML_CHUNK* parent);

View File

@ -135,11 +135,11 @@ VOID *GetNvramVariable (
/** Sets NVRAM variable. Does nothing if variable with the same data and attributes already exists. */
EFI_STATUS
SetNvramVariable (
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN CONST VOID *Data
)
{
//EFI_STATUS Status;
@ -174,7 +174,7 @@ SetNvramVariable (
//DBG (" -> writing new (%r)\n", Status);
//return Status;
return gRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
return gRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, (VOID*)Data); // CONST missing in EFI_SET_VARIABLE->SetVariable
}
@ -1034,7 +1034,7 @@ PutNvramPlistToRtVars ()
// <string> element
Value = ValTag->string;
Size = AsciiStrLen (Value);
Size = AsciiStrLen((CONST CHAR8*)Value);
if (!GlobalConfig.DebugLog) {
DBG ("String: Size = %d, Val = '%a'\n", Size, Value);
}

View File

@ -1950,11 +1950,11 @@ AddNvramVariable (
EFI_STATUS
SetNvramVariable (
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN CONST VOID *Data
);
EFI_STATUS

View File

@ -52,7 +52,7 @@ static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *FullTitle, IN CHAR16 *LoaderTitl
{
LEGACY_ENTRY *Entry, *SubEntry;
REFIT_MENU_SCREEN *SubScreen;
CHAR16 *VolDesc;
CONST CHAR16 *VolDesc;
CHAR16 ShortcutLetter = 0;
INTN i;

View File

@ -403,7 +403,7 @@ STATIC EFI_STATUS GetOSXVolumeName(LOADER_ENTRY *Entry)
extern BOOLEAN CopyKernelAndKextPatches(IN OUT KERNEL_AND_KEXT_PATCHES *Dst, IN KERNEL_AND_KEXT_PATCHES *Src);
STATIC LOADER_ENTRY *CreateLoaderEntry(IN CHAR16 *LoaderPath,
IN CHAR16 *LoaderOptions,
IN CONST CHAR16 *LoaderOptions,
IN CHAR16 *FullTitle,
IN CHAR16 *LoaderTitle,
IN REFIT_VOLUME *Volume,
@ -976,7 +976,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
// DBG(" Added '%s': OSType='%d', OSVersion='%a'\n", Entry->me.Title, Entry->LoaderType, Entry->OSVersion);
}
STATIC BOOLEAN AddLoaderEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderOptions,
STATIC BOOLEAN AddLoaderEntry(IN CHAR16 *LoaderPath, IN CONST CHAR16 *LoaderOptions,
IN CHAR16 *LoaderTitle,
IN REFIT_VOLUME *Volume, IN EG_IMAGE *Image,
IN UINT8 OSType, IN UINT8 Flags)

View File

@ -148,7 +148,7 @@ EfiLibFileSystemVolumeLabelInfo (
**/
CHAR16 *
EfiStrDuplicate (
IN CHAR16 *Src
IN CONST CHAR16 *Src
)
{
CHAR16 *Dest;

View File

@ -318,7 +318,7 @@ VOID egFreeImage(IN EG_IMAGE *Image)
//
// Basic file operations
//
EFI_STATUS egLoadFile(IN EFI_FILE_HANDLE BaseDir, IN CHAR16 *FileName,
EFI_STATUS egLoadFile(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName,
OUT UINT8 **FileData, OUT UINTN *FileDataLength)
{
EFI_STATUS Status = EFI_NOT_FOUND;
@ -332,7 +332,7 @@ EFI_STATUS egLoadFile(IN EFI_FILE_HANDLE BaseDir, IN CHAR16 *FileName,
goto Error;
}
Status = BaseDir->Open(BaseDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);
Status = BaseDir->Open(BaseDir, &FileHandle, (CHAR16*)FileName, EFI_FILE_MODE_READ, 0); // const missing in EFI_FILE_HANDLE->Open
if (EFI_ERROR(Status) || !FileHandle) {
goto Error;
}
@ -398,7 +398,7 @@ EFI_STATUS egFindESP(OUT EFI_FILE_HANDLE *RootDir)
}
//if (NULL, ...) then save to EFI partition
EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CHAR16 *FileName,
IN UINT8 *FileData, IN UINTN FileDataLength)
IN CONST VOID *FileData, IN UINTN FileDataLength)
{
EFI_STATUS Status;
EFI_FILE_HANDLE FileHandle;
@ -473,7 +473,7 @@ EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CHAR16 *FileName,
}
BufferSize = FileDataLength;
Status = FileHandle->Write(FileHandle, &BufferSize, FileData);
Status = FileHandle->Write(FileHandle, &BufferSize, (VOID*)FileData); // CONST missing in EFI_FILE_HANDLE->write
FileHandle->Close(FileHandle);
// DBG("not written %r\n", Status);
return Status;
@ -510,7 +510,7 @@ EFI_STATUS egMkDir(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CHAR16 *DirName)
}
//caller is responsible for free image
EG_IMAGE * egLoadImage(IN EFI_FILE_HANDLE BaseDir, IN CHAR16 *FileName, IN BOOLEAN WantAlpha)
EG_IMAGE * egLoadImage(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName, IN BOOLEAN WantAlpha)
{
EFI_STATUS Status;
UINT8 *FileData = NULL;

View File

@ -222,15 +222,15 @@ EG_IMAGE * egCopyScaledImage(IN EG_IMAGE *Image, IN INTN Ratio);
VOID egFreeImage(IN EG_IMAGE *Image);
VOID ScaleImage(OUT EG_IMAGE *NewImage, IN EG_IMAGE *OldImage);
EG_IMAGE * egLoadImage(IN EFI_FILE_HANDLE BaseDir, IN CHAR16 *FileName, IN BOOLEAN WantAlpha);
EG_IMAGE * egLoadImage(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName, IN BOOLEAN WantAlpha);
EG_IMAGE * egLoadIcon(IN EFI_FILE_HANDLE BaseDir, IN CHAR16 *FileName, IN UINTN IconSize);
EG_IMAGE * egEnsureImageSize(IN EG_IMAGE *Image, IN INTN Width, IN INTN Height, IN EG_PIXEL *Color);
EFI_STATUS egLoadFile(IN EFI_FILE_HANDLE BaseDir, IN CHAR16 *FileName,
EFI_STATUS egLoadFile(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName,
OUT UINT8 **FileData, OUT UINTN *FileDataLength);
EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CHAR16 *FileName,
IN UINT8 *FileData, IN UINTN FileDataLength);
IN CONST VOID *FileData, IN UINTN FileDataLength);
EFI_STATUS egMkDir(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CHAR16 *DirName);
EFI_STATUS egFindESP(OUT EFI_FILE_HANDLE *RootDir);

View File

@ -1619,12 +1619,12 @@ CHAR16 * egFindExtension(IN CHAR16 *FileName)
// memory string search
//
INTN FindMem(IN VOID *Buffer, IN UINTN BufferLength, IN VOID *SearchString, IN UINTN SearchStringLength)
INTN FindMem(IN CONST VOID *Buffer, IN UINTN BufferLength, IN CONST VOID *SearchString, IN UINTN SearchStringLength)
{
UINT8 *BufferPtr;
CONST UINT8 *BufferPtr;
UINTN Offset;
BufferPtr = Buffer;
BufferPtr = (CONST UINT8 *)Buffer;
BufferLength -= SearchStringLength;
for (Offset = 0; Offset < BufferLength; Offset++, BufferPtr++) {
if (CompareMem(BufferPtr, SearchString, SearchStringLength) == 0)

View File

@ -638,7 +638,7 @@ typedef struct {
REFIT_MENU_ENTRY me;
REFIT_VOLUME *Volume;
CHAR16 *DevicePathString;
CHAR16 *LoadOptions;
CONST CHAR16 *LoadOptions;
UINTN BootNum;
CHAR16 *LoaderPath; //will be set to NULL
} LEGACY_ENTRY;
@ -741,7 +741,7 @@ CHAR16 * Basename(IN CHAR16 *Path);
VOID ReplaceExtension(IN OUT CHAR16 *Path, IN CHAR16 *Extension);
CHAR16 * egFindExtension(IN CHAR16 *FileName);
INTN FindMem(IN VOID *Buffer, IN UINTN BufferLength, IN VOID *SearchString, IN UINTN SearchStringLength);
INTN FindMem(IN CONST VOID *Buffer, IN UINTN BufferLength, IN CONST VOID *SearchString, IN UINTN SearchStringLength);
CHAR16 *FileDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath);
CHAR16 *FileDevicePathFileToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath);
@ -952,7 +952,7 @@ EfiLibFileSystemVolumeLabelInfo (
);
extern CHAR16 *
EfiStrDuplicate (
IN CHAR16 *Src
IN CONST CHAR16 *Src
);
extern INTN StriCmp (