mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-12 09:54:36 +01:00
more type casting fixes
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
f8098a8336
commit
5b02b51273
@ -1186,7 +1186,7 @@ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* GetFadt()
|
||||
|
||||
// EFI_STATUS Status;
|
||||
|
||||
RsdPtr = (__typeof(RsdPtr))FindAcpiRsdPtr();
|
||||
RsdPtr = (__typeof__(RsdPtr))FindAcpiRsdPtr();
|
||||
if (RsdPtr == NULL) {
|
||||
/*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, (VOID **)&RsdPtr);
|
||||
if (RsdPtr == NULL) {
|
||||
|
@ -371,7 +371,7 @@ GetBootOrder (
|
||||
//
|
||||
// Get gEfiGlobalVariableGuid:BootOrder and it's length
|
||||
//
|
||||
*BootOrder = (__typeof__(*BootOrder))GetNvramVariable (BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
|
||||
*BootOrder = (UINT16*)GetNvramVariable (BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
|
||||
if (*BootOrder == NULL) {
|
||||
DBG(" EFI_NOT_FOUND\n");
|
||||
return EFI_NOT_FOUND;
|
||||
|
@ -267,7 +267,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
--VariablePtr;
|
||||
}
|
||||
|
||||
gRT->SetVariable(KbdPrevLang, &gEfiAppleBootGuid, Attributes, LangLen, &gSettings.Language);
|
||||
gRT->SetVariable((CHAR16*)KbdPrevLang, &gEfiAppleBootGuid, Attributes, LangLen, &gSettings.Language);
|
||||
} else {
|
||||
FreePool(OldData);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ CONST CHAR8 hdcID[4] = HDC_ID;
|
||||
extern UINTN AudioNum;
|
||||
extern HDA_OUTPUTS AudioList[20];
|
||||
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
|
||||
extern CONST CHAR16 *OEMPath;
|
||||
extern CHAR16 *OEMPath;
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
|
@ -408,7 +408,7 @@ ParseLoadOptions (
|
||||
AsciiConf = (__typeof__(AsciiConf))AllocateCopyPool (TailSize + 1, Start);
|
||||
if (AsciiConf != NULL) {
|
||||
*(AsciiConf + TailSize) = '\0';
|
||||
*Conf = (__typeof__(*Conf))AllocateZeroPool ((TailSize + 1) * sizeof (CHAR16));
|
||||
*Conf = (CHAR16*)AllocateZeroPool ((TailSize + 1) * sizeof (CHAR16));
|
||||
AsciiStrToUnicodeStrS (AsciiConf, *Conf, TailSize);
|
||||
FreePool (AsciiConf);
|
||||
}
|
||||
@ -1062,7 +1062,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
}
|
||||
|
||||
if (AsciiStrSize(Prop2->string) > 1) {
|
||||
Patches->ForceKexts[Patches->NrForceKexts] = (__typeof__(Patches->ForceKexts[Patches->NrForceKexts]))AllocateZeroPool (AsciiStrSize(Prop2->string) * sizeof(CHAR16));
|
||||
Patches->ForceKexts[Patches->NrForceKexts] = (CHAR16*)AllocateZeroPool (AsciiStrSize(Prop2->string) * sizeof(CHAR16));
|
||||
AsciiStrToUnicodeStrS(Prop2->string, Patches->ForceKexts[Patches->NrForceKexts], 255);
|
||||
DBG (" - [%d]: %s\n", Patches->NrForceKexts, Patches->ForceKexts[Patches->NrForceKexts]);
|
||||
++Patches->NrForceKexts;
|
||||
@ -1588,7 +1588,7 @@ MatchOSes *GetStrArraySeparatedByChar(CHAR8 *str, CHAR8 sep)
|
||||
/* comp = (CHAR8 *) AllocatePool(newLen);
|
||||
AsciiStrnCpy(comp, str + startLocation, newLen);
|
||||
comp[newLen] = '\0'; */
|
||||
mo->array[i] = (__typeof__(mo->array[i]))AllocateCopyPool(newLen, str + startLocation);
|
||||
mo->array[i] = (CHAR8*)AllocateCopyPool(newLen, str + startLocation);
|
||||
mo->array[i][newLen - 1] = '\0';
|
||||
}
|
||||
|
||||
@ -1596,7 +1596,7 @@ MatchOSes *GetStrArraySeparatedByChar(CHAR8 *str, CHAR8 sep)
|
||||
}
|
||||
else {
|
||||
// DBG("str contains only one component and it is our string %s!\n", str);
|
||||
mo->array[0] = (__typeof__(mo->array[0]))AllocateCopyPool(AsciiStrLen(str)+1, str);
|
||||
mo->array[0] = (CHAR8*)AllocateCopyPool(AsciiStrLen(str)+1, str);
|
||||
}
|
||||
return mo;
|
||||
}
|
||||
@ -5051,7 +5051,7 @@ GetUserSettings(
|
||||
for (j = 0; j < PropCount; j++) {
|
||||
Prop3 = NULL;
|
||||
DevProps = *Child;
|
||||
*Child = (__typeof__(*Child))AllocateZeroPool(sizeof(DEV_PROPERTY));
|
||||
*Child = (DEV_PROPERTY *)AllocateZeroPool(sizeof(DEV_PROPERTY));
|
||||
(*Child)->Next = DevProps;
|
||||
|
||||
if (EFI_ERROR(GetElement(Prop2, j, &Prop3))) { // Prop3 -> <key>
|
||||
@ -5628,7 +5628,7 @@ GetUserSettings(
|
||||
} else {
|
||||
AsciiSPrint(DSDTPatchesLabel, 255, " (NoLabel)");
|
||||
}
|
||||
gSettings.PatchDsdtLabel[i] = (__typeof__(gSettings.PatchDsdtLabel[i]))AllocateZeroPool(256);
|
||||
gSettings.PatchDsdtLabel[i] = (CHAR8*)AllocateZeroPool(256);
|
||||
AsciiSPrint(gSettings.PatchDsdtLabel[i], 255, "%a", DSDTPatchesLabel);
|
||||
DBG(" (%a)", gSettings.PatchDsdtLabel[i]);
|
||||
|
||||
@ -6008,7 +6008,7 @@ GetUserSettings(
|
||||
// Get memory tables
|
||||
Prop2 = GetProperty (Prop, "Modules");
|
||||
if (Prop2 != NULL) {
|
||||
INTN i, Count = GetTagCount (Prop2);
|
||||
INTN Count = GetTagCount (Prop2);
|
||||
Prop3 = NULL;
|
||||
|
||||
for (i = 0; i < Count; i++) {
|
||||
@ -6094,10 +6094,10 @@ GetUserSettings(
|
||||
Prop = GetProperty (DictPointer, "Slots");
|
||||
if (Prop != NULL) {
|
||||
INTN DeviceN;
|
||||
INTN Index, Count = GetTagCount (Prop);
|
||||
INTN Count = GetTagCount (Prop);
|
||||
Prop3 = NULL;
|
||||
|
||||
for (Index = 0; Index < Count; ++Index) {
|
||||
for (INTN Index = 0; Index < Count; ++Index) {
|
||||
if (EFI_ERROR (GetElement (Prop, Index, &Prop3))) {
|
||||
continue;
|
||||
}
|
||||
@ -6730,8 +6730,8 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
|
||||
}
|
||||
}
|
||||
FreePool(fileBuffer);
|
||||
FreePool(targetString);
|
||||
FreePool((VOID*)fileBuffer);
|
||||
FreePool((VOID*)targetString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1561,11 +1561,12 @@ VOID devprop_add_list(AtiDevProp devprop_list[], CHAR8 *OSVersion)
|
||||
if (devprop_list[i].all_ports) {
|
||||
for (pnum = 1; pnum < card->ports; pnum++) {
|
||||
if (devprop_list[i].get_value(val, pnum, Sier)) {
|
||||
char newname[AsciiStrLen(devprop_list[i].name)+1];
|
||||
char* newname = (char*)AllocatePool(AsciiStrLen(devprop_list[i].name)+1);
|
||||
AsciiStrCpy(newname, devprop_list[i].name);
|
||||
newname[1] = (CHAR8)(0x30 + pnum); // convert to ascii
|
||||
devprop_add_value(card->device, newname, val->data, val->size);
|
||||
free_val(val);
|
||||
FreePool((VOID*)newname);
|
||||
}
|
||||
}
|
||||
// devprop_list[i].name[1] = 0x30; // write back our "@0," for a next possible card
|
||||
@ -1581,12 +1582,13 @@ VOID devprop_add_list(AtiDevProp devprop_list[], CHAR8 *OSVersion)
|
||||
if (devprop_list[i].all_ports) {
|
||||
for (pnum = 1; pnum < card->ports; pnum++) {
|
||||
if (devprop_list[i].default_val.type != kNul) {
|
||||
char newname[AsciiStrLen(devprop_list[i].name)+1];
|
||||
char* newname = (char*)AllocatePool(AsciiStrLen(devprop_list[i].name)+1);
|
||||
newname[1] = (CHAR8)(0x30 + pnum); // convert to ascii
|
||||
devprop_add_value(card->device, newname,
|
||||
devprop_list[i].default_val.type == kCst ?
|
||||
(UINT8 *)&(devprop_list[i].default_val.data) : devprop_list[i].default_val.data,
|
||||
devprop_list[i].default_val.size);
|
||||
FreePool((VOID*)newname);
|
||||
}
|
||||
}
|
||||
// devprop_list[i].name[1] = 0x30; // write back our "@0," for a next possible card
|
||||
|
@ -180,16 +180,16 @@ VOID* GetSmbiosTablesFromHob (VOID)
|
||||
EFI_PHYSICAL_ADDRESS *Table;
|
||||
EFI_PEI_HOB_POINTERS GuidHob;
|
||||
|
||||
GuidHob.Raw = (__typeof(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbiosTableGuid);
|
||||
GuidHob.Raw = (__typeof__(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbiosTableGuid);
|
||||
if (GuidHob.Raw != NULL) {
|
||||
Table = (__typeof(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
if (Table != NULL) {
|
||||
return (VOID *)(UINTN)*Table;
|
||||
}
|
||||
}
|
||||
GuidHob.Raw = (__typeof(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbios3TableGuid);
|
||||
GuidHob.Raw = (__typeof__(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbios3TableGuid);
|
||||
if (GuidHob.Raw != NULL) {
|
||||
Table = (__typeof(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
if (Table != NULL) {
|
||||
return (VOID *)(UINTN)*Table;
|
||||
}
|
||||
@ -2107,14 +2107,14 @@ VOID FinalizeSmbios() //continue
|
||||
BOOLEAN FoundTable3 = FALSE;
|
||||
|
||||
// Get Hob List
|
||||
HobStart.Raw = (__typeof(HobStart.Raw))GetHobList();
|
||||
HobStart.Raw = (__typeof__(HobStart.Raw))GetHobList();
|
||||
|
||||
if (HobStart.Raw != NULL) {
|
||||
// find SMBIOS in hob
|
||||
for (Index = 0; Index < sizeof (gTableGuidArray) / sizeof (*gTableGuidArray); ++Index) {
|
||||
GuidHob.Raw = (__typeof(HobStart.Raw))GetNextGuidHob (gTableGuidArray[Index], HobStart.Raw);
|
||||
GuidHob.Raw = (__typeof__(HobStart.Raw))GetNextGuidHob (gTableGuidArray[Index], HobStart.Raw);
|
||||
if (GuidHob.Raw != NULL) {
|
||||
Table = (__typeof(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
//TableLength = GET_GUID_HOB_DATA_SIZE (GuidHob);
|
||||
if (Table != NULL) {
|
||||
if (Index != 0) {
|
||||
|
@ -409,7 +409,7 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
|
||||
|
||||
nsvgDeleteRasterizer(rast);
|
||||
|
||||
*dict = (__typeof__(*dict))AllocateZeroPool(sizeof(TagStruct));
|
||||
*dict = (TagPtr)AllocateZeroPool(sizeof(TagStruct));
|
||||
(*dict)->type = kTagTypeNone;
|
||||
GlobalConfig.TypeSVG = TRUE;
|
||||
GlobalConfig.ThemeDesignHeight = (int)SVGimage->height;
|
||||
|
@ -436,7 +436,7 @@ EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *File
|
||||
// end of folder checking
|
||||
|
||||
// Delete existing file if it exists
|
||||
Status = BaseDir->Open(BaseDir, &FileHandle, FileName,
|
||||
Status = BaseDir->Open(BaseDir, &FileHandle, (CHAR16*)FileName,
|
||||
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = FileHandle->Delete(FileHandle);
|
||||
@ -449,7 +449,7 @@ EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *File
|
||||
|
||||
if (CreateNew) {
|
||||
// Write new file
|
||||
Status = BaseDir->Open(BaseDir, &FileHandle, FileName,
|
||||
Status = BaseDir->Open(BaseDir, &FileHandle, (CHAR16*)FileName,
|
||||
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
|
||||
if (EFI_ERROR(Status)) {
|
||||
// DBG("no write %r\n", Status);
|
||||
|
@ -29,6 +29,10 @@ The manual and changelog are in the header file "lodepng.h"
|
||||
Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for C.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __typeof__(x) decltype(x)
|
||||
#endif
|
||||
|
||||
#include "lodepng.h"
|
||||
|
||||
//MODSNI v
|
||||
|
@ -342,7 +342,7 @@ VOID CreateList(OUT VOID ***ListPtr, OUT UINTN *ElementCount, IN UINTN InitialEl
|
||||
*ElementCount = InitialElementCount;
|
||||
if (*ElementCount > 0) {
|
||||
AllocateCount = (*ElementCount + 7) & ~7; // next multiple of 8
|
||||
*ListPtr = (__typeof__(*ListPtr))AllocatePool(sizeof(VOID *) * AllocateCount);
|
||||
**ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);
|
||||
} else {
|
||||
*ListPtr = NULL;
|
||||
}
|
||||
@ -355,9 +355,9 @@ VOID AddListElement(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount, IN VOID
|
||||
if ((*ElementCount & 7) == 0) {
|
||||
AllocateCount = *ElementCount + 8;
|
||||
if (*ElementCount == 0)
|
||||
*ListPtr = (__typeof__(*ListPtr))AllocatePool(sizeof(VOID *) * AllocateCount);
|
||||
**ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);
|
||||
else
|
||||
*ListPtr = (__typeof__(*ListPtr))EfiReallocatePool((VOID *)*ListPtr, sizeof(VOID *) * (*ElementCount), sizeof(VOID *) * AllocateCount);
|
||||
**ListPtr = EfiReallocatePool((VOID *)*ListPtr, sizeof(VOID *) * (*ElementCount), sizeof(VOID *) * AllocateCount);
|
||||
}
|
||||
(*ListPtr)[*ElementCount] = NewElement;
|
||||
(*ElementCount)++;
|
||||
@ -1369,7 +1369,7 @@ BOOLEAN FileExists(IN CONST EFI_FILE *Root, IN CONST CHAR16 *RelativePath)
|
||||
EFI_STATUS Status;
|
||||
EFI_FILE *TestFile = NULL;
|
||||
|
||||
Status = Root->Open(Root, &TestFile, RelativePath, EFI_FILE_MODE_READ, 0);
|
||||
Status = Root->Open((EFI_FILE_PROTOCOL*)Root, &TestFile, (CHAR16*)RelativePath, EFI_FILE_MODE_READ, 0);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
if (TestFile && TestFile->Close) {
|
||||
TestFile->Close(TestFile);
|
||||
@ -1387,7 +1387,7 @@ BOOLEAN DeleteFile(IN EFI_FILE *Root, IN CONST CHAR16 *RelativePath)
|
||||
|
||||
//DBG("DeleteFile: %s\n", RelativePath);
|
||||
// open file for read/write to see if it exists, need write for delete
|
||||
Status = Root->Open(Root, &File, RelativePath, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
||||
Status = Root->Open(Root, &File, (CHAR16*)RelativePath, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
||||
//DBG(" Open: %r\n", Status);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
// exists - check if it is a file
|
||||
@ -1485,7 +1485,7 @@ VOID DirIterOpen(IN EFI_FILE *BaseDir, IN CONST CHAR16 *RelativePath OPTIONAL, O
|
||||
DirIter->DirHandle = BaseDir;
|
||||
DirIter->CloseDirHandle = FALSE;
|
||||
} else {
|
||||
DirIter->LastStatus = BaseDir->Open(BaseDir, &(DirIter->DirHandle), RelativePath, EFI_FILE_MODE_READ, 0);
|
||||
DirIter->LastStatus = BaseDir->Open(BaseDir, &(DirIter->DirHandle), (CHAR16*)RelativePath, EFI_FILE_MODE_READ, 0);
|
||||
DirIter->CloseDirHandle = EFI_ERROR(DirIter->LastStatus) ? FALSE : TRUE;
|
||||
}
|
||||
DirIter->LastFileInfo = NULL;
|
||||
@ -1547,7 +1547,7 @@ MetaiMatch (
|
||||
//return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return mUnicodeCollation->MetaiMatch (mUnicodeCollation, String, Pattern);
|
||||
return mUnicodeCollation->MetaiMatch (mUnicodeCollation, (CHAR16*)String, (CHAR16*)Pattern);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2831,7 +2831,7 @@ static VOID TextMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State,
|
||||
|
||||
for (i = 0; i < (INTN)Screen->InfoLineCount; i++) {
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 3, 4 + i);
|
||||
gST->ConOut->OutputString (gST->ConOut, Screen->InfoLines[i]);
|
||||
gST->ConOut->OutputString (gST->ConOut, (CHAR16*)Screen->InfoLines[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4354,7 +4354,7 @@ UINTN RunMenu(IN REFIT_MENU_SCREEN *Screen, OUT REFIT_MENU_ENTRY **ChosenEntry)
|
||||
VOID NewEntry(REFIT_MENU_ENTRY **Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title)
|
||||
{
|
||||
//create entry
|
||||
*Entry = (__typeof__(*Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
|
||||
*Entry = (REFIT_MENU_ENTRY*) AllocateZeroPool(sizeof(LOADER_ENTRY));
|
||||
if (Title) {
|
||||
(*Entry)->Title = PoolPrint(L"%a", Title);
|
||||
} else {
|
||||
@ -4365,7 +4365,7 @@ VOID NewEntry(REFIT_MENU_ENTRY **Entry, REFIT_MENU_SCREEN **SubScreen, ACTION At
|
||||
(*Entry)->Tag = TAG_OPTIONS;
|
||||
(*Entry)->AtClick = AtClick;
|
||||
// create the submenu
|
||||
*SubScreen = (__typeof__(*SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
|
||||
*SubScreen = (REFIT_MENU_SCREEN*)AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
|
||||
(*SubScreen)->Title = (*Entry)->Title;
|
||||
(*SubScreen)->TitleImage = (*Entry)->Image;
|
||||
(*SubScreen)->ID = ID;
|
||||
|
Loading…
Reference in New Issue
Block a user