This commit is contained in:
Sergey Isakov 2019-12-31 12:13:32 +03:00
commit 36e7d8340b
56 changed files with 578 additions and 565 deletions

View File

@ -230,7 +230,7 @@ void AddDropTable(EFI_ACPI_DESCRIPTION_HEADER* Table, UINT32 Index)
CopyMem(&OTID[0], &Table->OemTableId, 8);
//DBG(" Found table: %a %a len=%d\n", sign, OTID, (INT32)Table->Length);
DBG(" - [%02d]: %a %a len=%d\n", Index, sign, OTID, (INT32)Table->Length);
ACPI_DROP_TABLE* DropTable = AllocateZeroPool(sizeof(ACPI_DROP_TABLE));
ACPI_DROP_TABLE* DropTable = (__typeof__(DropTable))AllocateZeroPool(sizeof(ACPI_DROP_TABLE));
DropTable->Signature = Table->Signature;
DropTable->TableId = Table->OemTableId;
DropTable->Length = Table->Length;
@ -782,7 +782,7 @@ VOID MarkTableAsSaved(VOID *TableEntry)
//DBG(" Allocaing mSavedTables");
mSavedTablesEntries = SAVED_TABLES_ALLOC_ENTRIES;
mSavedTablesNum = 0;
mSavedTables = AllocateZeroPool(sizeof(*mSavedTables) * mSavedTablesEntries);
mSavedTables = (__typeof__(mSavedTables))AllocateZeroPool(sizeof(*mSavedTables) * mSavedTablesEntries);
if (mSavedTables == NULL) {
return;
}
@ -804,7 +804,7 @@ VOID MarkTableAsSaved(VOID *TableEntry)
if (mSavedTablesNum + 1 >= mSavedTablesEntries) {
// not enough space
//DBG(" - extending mSavedTables from %d", mSavedTablesEntries);
mSavedTables = ReallocatePool(
mSavedTables = (__typeof__(mSavedTables))ReallocatePool(
sizeof(*mSavedTables) * mSavedTablesEntries,
sizeof(*mSavedTables) * (mSavedTablesEntries + SAVED_TABLES_ALLOC_ENTRIES),
mSavedTables
@ -1186,7 +1186,7 @@ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* GetFadt()
// EFI_STATUS Status;
RsdPtr = FindAcpiRsdPtr();
RsdPtr = (__typeof(RsdPtr))FindAcpiRsdPtr();
if (RsdPtr == NULL) {
/*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, (VOID **)&RsdPtr);
if (RsdPtr == NULL) {
@ -2078,7 +2078,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
// XsdtReplaceSizes array is used to keep track of allocations for the merged tables,
// as those tables may need to be freed if patched later.
XsdtReplaceSizes = AllocateZeroPool(XsdtTableCount() * sizeof(*XsdtReplaceSizes));
XsdtReplaceSizes = (__typeof__(XsdtReplaceSizes))AllocateZeroPool(XsdtTableCount() * sizeof(*XsdtReplaceSizes));
// Load merged ACPI files from ACPI/patched
LoadAllPatchedAML(AcpiOemPath, AUTOMERGE_PASS1);

View File

@ -91,7 +91,7 @@ AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* buffer, UINT32 si
{
node->Type = AML_CHUNK_NONE;
node->Length = (UINT16)size;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
CopyMem(node->Buffer, buffer, node->Length);
}
@ -107,7 +107,7 @@ AML_CHUNK* aml_add_byte(AML_CHUNK* parent, UINT8 value)
node->Type = AML_CHUNK_BYTE;
node->Length = 1;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[0] = value;
}
@ -122,7 +122,7 @@ AML_CHUNK* aml_add_word(AML_CHUNK* parent, UINT16 value)
{
node->Type = AML_CHUNK_WORD;
node->Length = 2;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[0] = value & 0xff;
node->Buffer[1] = value >> 8;
}
@ -138,7 +138,7 @@ AML_CHUNK* aml_add_dword(AML_CHUNK* parent, UINT32 value)
{
node->Type = AML_CHUNK_DWORD;
node->Length = 4;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[0] = value & 0xff;
node->Buffer[1] = (value >> 8) & 0xff;
node->Buffer[2] = (value >> 16) & 0xff;
@ -156,7 +156,7 @@ AML_CHUNK* aml_add_qword(AML_CHUNK* parent, UINT64 value)
{
node->Type = AML_CHUNK_QWORD;
node->Length = 8;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[0] = value & 0xff;
node->Buffer[1] = RShiftU64(value, 8) & 0xff;
node->Buffer[2] = RShiftU64(value, 16) & 0xff;
@ -206,7 +206,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, /* CONST*/ CHAR8* name)
if (count == 1)
{
node->Length = (UINT16)(4 + root);
node->Buffer = AllocateZeroPool (node->Length+4);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length+4);
CopyMem(node->Buffer, name, 4 + root);
offset += 4 + root;
return (UINT32)offset;
@ -215,7 +215,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, /* CONST*/ CHAR8* name)
if (count == 2)
{
node->Length = 2 + 8;
node->Buffer = AllocateZeroPool (node->Length+4);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length+4);
node->Buffer[offset++] = 0x5c; // Root Char
node->Buffer[offset++] = 0x2e; // Double name
CopyMem(node->Buffer+offset, name + root, 8);
@ -224,7 +224,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, /* CONST*/ CHAR8* name)
}
node->Length = (UINT16)(3 + (count << 2));
node->Buffer = AllocateZeroPool (node->Length+4);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length+4);
node->Buffer[offset++] = 0x5c; // Root Char
node->Buffer[offset++] = 0x2f; // Multi name
node->Buffer[offset++] = (CHAR8)count; // Names count
@ -288,7 +288,7 @@ AML_CHUNK* aml_add_package(AML_CHUNK* parent)
node->Type = AML_CHUNK_PACKAGE;
node->Length = 1;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
}
return node;
@ -303,7 +303,7 @@ AML_CHUNK* aml_add_alias(AML_CHUNK* parent, /* CONST*/ CHAR8* name1, /* CONST*/
node->Type = AML_CHUNK_ALIAS;
node->Length = 8;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
aml_fill_simple_name(node->Buffer, name1);
aml_fill_simple_name(node->Buffer+4, name2);
}
@ -385,7 +385,7 @@ AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* data, UINT32
INTN offset=0;
node->Type = AML_CHUNK_BUFFER;
node->Length = (UINT8)(size + 2);
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[offset++] = AML_CHUNK_BYTE; //0x0A
node->Buffer[offset++] = (CHAR8)size;
CopyMem(node->Buffer+offset, data, node->Length);
@ -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);
@ -404,7 +404,7 @@ AML_CHUNK* aml_add_string_buffer(AML_CHUNK* parent, /* CONST*/ CHAR8* StringBuf)
UINTN len = AsciiStrLen(StringBuf);
node->Type = AML_CHUNK_BUFFER;
node->Length = (UINT8)(len + 3);
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[offset++] = AML_CHUNK_BYTE;
node->Buffer[offset++] = (CHAR8)(len + 1);
CopyMem(node->Buffer+offset, StringBuf, len);
@ -423,7 +423,7 @@ AML_CHUNK* aml_add_string(AML_CHUNK* parent, /* CONST*/ CHAR8* StringBuf)
INTN len = AsciiStrLen(StringBuf);
node->Type = AML_CHUNK_STRING;
node->Length = (UINT8)(len + 1);
node->Buffer = AllocateZeroPool (len + 1);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (len + 1);
CopyMem(node->Buffer, StringBuf, len);
// node->Buffer[len] = '\0';
}

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

@ -311,7 +311,7 @@ EFI_STATUS ScanDeviceHandles(EFI_HANDLE ControllerHandle,
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, HandleCount, HandleBuffer);
if (EFI_ERROR (Status)) goto Error;
*HandleType = AllocatePool (*HandleCount * sizeof (UINT32));
*HandleType = (__typeof__(*HandleType))AllocatePool (*HandleCount * sizeof (UINT32));
if (*HandleType == NULL) goto Error;
for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) {
@ -459,7 +459,7 @@ EFI_STATUS BdsLibConnectMostlyAllEfi()
if (!Parent) {
if (HandleType[Index] & EFI_HANDLE_TYPE_DEVICE_HANDLE) {
Status = gBS->HandleProtocol (AllHandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID*)&PciIo);
Status = gBS->HandleProtocol (AllHandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID**)&PciIo);
if (!EFI_ERROR (Status)) {
Status = PciIo->Pci.Read (PciIo,EfiPciIoWidthUint32, 0, sizeof (Pci) / sizeof (UINT32), &Pci);
if (!EFI_ERROR (Status)) {

View File

@ -371,7 +371,7 @@ GetBootOrder (
//
// Get gEfiGlobalVariableGuid:BootOrder and it's length
//
*BootOrder = GetNvramVariable (BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
*BootOrder = (__typeof__(*BootOrder))GetNvramVariable (BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
if (*BootOrder == NULL) {
DBG(" EFI_NOT_FOUND\n");
return EFI_NOT_FOUND;
@ -413,7 +413,7 @@ AddToBootOrder (
//
// Make new order buffer with space for our option
//
BootOrderNew = AllocateZeroPool ((BootOrderLen + 1) * sizeof(UINT16));
BootOrderNew = (__typeof__(BootOrderNew))AllocateZeroPool ((BootOrderLen + 1) * sizeof(UINT16));
if (BootOrderNew == NULL) {
DBG("AddToBootOrder: EFI_OUT_OF_RESOURCES\n");
if (BootOrder) {
@ -667,7 +667,7 @@ CompileBootOption (
+ BootOption->DescriptionSize
+ BootOption->FilePathListLength
+ BootOption->OptionalDataSize;
BootOption->Variable = AllocateZeroPool (BootOption->VariableSize);
BootOption->Variable = (__typeof__(BootOption->Variable))AllocateZeroPool (BootOption->VariableSize);
if (BootOption->Variable == NULL) {
DBG("CompileBootOption: EFI_OUT_OF_RESOURCES\n");
return EFI_OUT_OF_RESOURCES;
@ -717,7 +717,7 @@ GetBootOption (
BootOption->BootNum = BootNum;
UnicodeSPrint (VarName, sizeof(VarName), L"Boot%04X", BootNum);
BootOption->Variable = GetNvramVariable (VarName, &gEfiGlobalVariableGuid, NULL, (UINTN *)(UINTN)(OFFSET_OF(BO_BOOT_OPTION, VariableSize) + (UINTN)BootOption));
BootOption->Variable = (__typeof__(BootOption->Variable))GetNvramVariable (VarName, &gEfiGlobalVariableGuid, NULL, (UINTN *)(UINTN)(OFFSET_OF(BO_BOOT_OPTION, VariableSize) + (UINTN)BootOption));
if (BootOption->Variable == NULL) {
return EFI_NOT_FOUND;
}

View File

@ -259,7 +259,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
// using AddNvramVariable content instead of calling the function to do LangLen calculation only when necessary
// Do not mess with prev-lang:kbd on UEFI systems without NVRAM emulation; it's OS X's business
KbdPrevLang = L"prev-lang:kbd";
OldData = GetNvramVariable(KbdPrevLang, &gEfiAppleBootGuid, NULL, NULL);
OldData = (__typeof__(OldData))GetNvramVariable(KbdPrevLang, &gEfiAppleBootGuid, NULL, NULL);
if (OldData == NULL) {
LangLen = 16;
VariablePtr = &gSettings.Language[15];
@ -276,7 +276,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
}
//#define EFI_PLATFORM_LANG_VARIABLE_NAME L"PlatformLang"
PlatformLang = GetNvramVariable(EFI_PLATFORM_LANG_VARIABLE_NAME, &gEfiGlobalVariableGuid, NULL, NULL);
PlatformLang = (__typeof__(PlatformLang))GetNvramVariable(EFI_PLATFORM_LANG_VARIABLE_NAME, &gEfiGlobalVariableGuid, NULL, NULL);
//
// On some platforms with missing gEfiUnicodeCollation2ProtocolGuid EFI_PLATFORM_LANG_VARIABLE_NAME is set
// to the value different from "en-...". This is not going to work with our driver UEFI Shell load failures.
@ -464,10 +464,10 @@ SetupDataForOSX(BOOLEAN Hibernate)
// Locate DataHub Protocol
Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (VOID**)&gDataHub);
if (!EFI_ERROR(Status)) {
ProductName = AllocateZeroPool(128);
ProductName = (__typeof__(ProductName))AllocateZeroPool(128);
AsciiStrToUnicodeStrS(gSettings.ProductName, ProductName, 64);
SerialNumber = AllocateZeroPool(128);
SerialNumber = (__typeof__(SerialNumber))AllocateZeroPool(128);
AsciiStrToUnicodeStrS(gSettings.SerialNr, SerialNumber, 64);
LogDataHub(&gEfiProcessorSubClassGuid, L"FSBFrequency", &FrontSideBus, sizeof(UINT64));

View File

@ -42,7 +42,7 @@ CatPrint (
VA_LIST Args;
UINTN StringSize;
AppendStr = AllocateZeroPool (0x1000);
AppendStr = (__typeof__(AppendStr))AllocateZeroPool (0x1000);
if (AppendStr == NULL) {
return Str->Str;
}
@ -52,13 +52,13 @@ CatPrint (
VA_END (Args);
if (NULL == Str->Str) {
StringSize = StrSize (AppendStr);
Str->Str = AllocateZeroPool (StringSize);
Str->Str = (__typeof__(Str->Str))AllocateZeroPool (StringSize);
// ASSERT (Str->Str != NULL);
} else {
StringSize = StrSize (AppendStr);
StringSize += (StrSize (Str->Str) - sizeof (UINT16));
Str->Str = ReallocatePool (
Str->Str = (__typeof__(Str->Str))ReallocatePool (
StrSize (Str->Str),
StringSize,
Str->Str
@ -1610,7 +1610,7 @@ DevicePathToStr (
Done:
NewSize = (Str.Len + 1) * sizeof (CHAR16);
Str.Str = ReallocatePool (NewSize, NewSize, Str.Str);
Str.Str = (__typeof__(Str.Str))ReallocatePool (NewSize, NewSize, Str.Str);
// ASSERT (Str.Str != NULL);
if (!Str.Str) {
return NULL;

View File

@ -42,7 +42,7 @@ InitializeEdidOverride ()
EFI_STATUS Status;
EFI_EDID_OVERRIDE_PROTOCOL *EdidOverride;
EdidOverride = AllocateCopyPool(sizeof(EFI_EDID_OVERRIDE_PROTOCOL), &gEdidOverride);
EdidOverride = (__typeof__(EdidOverride))AllocateCopyPool(sizeof(EFI_EDID_OVERRIDE_PROTOCOL), &gEdidOverride);
Status = gBS->InstallMultipleProtocolInterfaces (
&gImageHandle,
@ -69,7 +69,7 @@ UINT8* getCurrentEdid (VOID)
if (!EFI_ERROR (Status)) {
DBG(" size=%d", EdidProtocol->SizeOfEdid);
if (EdidProtocol->SizeOfEdid > 0) {
Edid = AllocateCopyPool (EdidProtocol->SizeOfEdid, EdidProtocol->Edid);
Edid = (__typeof__(Edid))AllocateCopyPool (EdidProtocol->SizeOfEdid, EdidProtocol->Edid);
}
}
DBG(" %a\n", Edid != NULL ? "found" : "not found");
@ -119,7 +119,7 @@ EFI_STATUS GetEdidDiscovered(VOID)
if (N == 0) {
return EFI_NOT_FOUND;
}
gSettings.CustomEDID = AllocateAlignedPages(EFI_SIZE_TO_PAGES(N), 128);
gSettings.CustomEDID = (__typeof__(gSettings.CustomEDID))AllocateAlignedPages(EFI_SIZE_TO_PAGES(N), 128);
CopyMem(gSettings.CustomEDID, EdidDiscovered->Edid, N);
DebugDumpEDID("--- Discovered EDID Table", N);
}

View File

@ -884,7 +884,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
if (acpi_cpu_score) {
FreePool(acpi_cpu_score);
}
acpi_cpu_score = AllocateZeroPool(128);
acpi_cpu_score = (__typeof__(acpi_cpu_score))AllocateZeroPool(128);
acpi_cpu_count = 0;
// 5B 83 41 0C 5C 2E 5F 50 52 5F 43 50 55 30 01 10
// 10 00 00 06
@ -1034,7 +1034,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
}
if (add_name) {
acpi_cpu_name[acpi_cpu_count] = AllocateZeroPool(5);
acpi_cpu_name[acpi_cpu_count] = (__typeof__(acpi_cpu_name[acpi_cpu_count]))AllocateZeroPool(5);
CopyMem(acpi_cpu_name[acpi_cpu_count], dsdt+offset, 4);
acpi_cpu_processor_id[acpi_cpu_count] = dsdt[offset + 4];
i = offset + 5;
@ -1056,7 +1056,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
if (!acpi_cpu_count) {
for (i=0; i < acpi_cpu_max; i++) {
acpi_cpu_name[i] = AllocateZeroPool(5);
acpi_cpu_name[i] = (__typeof__(acpi_cpu_name[i]))AllocateZeroPool(5);
AsciiSPrint(acpi_cpu_name[i], 5, "CPU%1x", i);
acpi_cpu_processor_id[i] = (UINT8)(i & 0x7F);
}
@ -2370,7 +2370,7 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
continue;
}
LPCBSIZE = get_size(dsdt, LPCBADR);
device_name[3] = AllocateZeroPool(5);
device_name[3] = (__typeof__(device_name[3]))AllocateZeroPool(5);
CopyMem(device_name[3], dsdt + j, 4);
MsgLog("found LPCB device NAME(_ADR,0x001F0000) at %x And Name is %a\n", j,
device_name[3]);
@ -2424,7 +2424,7 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
lpcb = AllocateZeroPool(root->Size);
lpcb = (__typeof__(lpcb))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, lpcb, 0);
aml_destroy_node(root);
@ -2683,7 +2683,7 @@ Skip_DSM:
//now insert video
DBG("now inserting Video device\n");
aml_calculate_size(root);
display = AllocateZeroPool(root->Size);
display = (__typeof__(display))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, display, 0);
aml_destroy_node(root);
@ -2791,7 +2791,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len)
if (!devadr1) {
continue;
}
device_name[11] = AllocateZeroPool(5);
device_name[11] = (__typeof__(device_name[11]))AllocateZeroPool(5);
CopyMem(device_name[11], dsdt+k, 4);
DBG("found HDMI device [0x%08x:%x] at %x and Name is %a\n",
HDMIADR1, HDMIADR2, devadr1, device_name[11]);
@ -2884,7 +2884,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
hdmi = AllocateZeroPool(root->Size);
hdmi = (__typeof__(hdmi))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, hdmi, 0);
aml_destroy_node(root);
@ -2966,7 +2966,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
continue;
}
device_name[1] = AllocateZeroPool(5);
device_name[1] = (__typeof__(device_name[1]))AllocateZeroPool(5);
CopyMem(device_name[1], dsdt+k, 4);
DBG("found NetWork device [0x%08x:%x] at %x and Name is %a\n",
NetworkADR1[card], NetworkADR2[card], NetworkADR, device_name[1]);
@ -3083,7 +3083,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
}
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
network = AllocateZeroPool(root->Size);
network = (__typeof__(network))AllocateZeroPool(root->Size);
if (!network) {
return len;
}
@ -3166,7 +3166,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
if (!ArptADR) {
continue;
}
device_name[9] = AllocateZeroPool(5);
device_name[9] = (__typeof__(device_name[9]))AllocateZeroPool(5);
CopyMem(device_name[9], dsdt+k, 4);
DBG("found Airport device [%08x:%x] at %x And Name is %a\n",
ArptADR1, ArptADR2, ArptADR, device_name[9]);
@ -3280,7 +3280,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
network = AllocateZeroPool(root->Size);
network = (__typeof__(network))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, network, 0);
aml_destroy_node(root);
@ -3466,7 +3466,7 @@ UINT32 AddMCHC (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
*/
aml_calculate_size(root);
mchc = AllocateZeroPool(root->Size);
mchc = (__typeof__(mchc))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, mchc, 0);
aml_destroy_node(root);
@ -3553,7 +3553,7 @@ UINT32 AddIMEI (UINT8 *dsdt, UINT32 len)
}
aml_calculate_size(root);
imei = AllocateZeroPool(root->Size);
imei = (__typeof__(imei))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, imei, 0);
aml_destroy_node(root);
@ -3611,7 +3611,7 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
continue;
}
device_name[2] = AllocateZeroPool(5);
device_name[2] = (__typeof__(device_name[2]))AllocateZeroPool(5);
CopyMem(device_name[2], dsdt+k, 4);
DBG("found Firewire device NAME(_ADR,0x%08x) at %x And Name is %a\n",
FirewireADR2, k, device_name[2]);
@ -3701,7 +3701,7 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
firewire = AllocateZeroPool(root->Size);
firewire = (__typeof__(firewire))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, firewire, 0);
aml_destroy_node(root);
@ -3754,7 +3754,7 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, CHAR8* OSVersion)
}
// BridgeSize = get_size(dsdt, HDAADR);
device_name[4] = AllocateZeroPool(5);
device_name[4] = (__typeof__(device_name[4]))AllocateZeroPool(5);
CopyMem(device_name[4], dsdt+i, 4);
DBG("found HDA device NAME(_ADR,0x%08x) And Name is %a\n",
HDAADR1, device_name[4]);
@ -3822,7 +3822,7 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, CHAR8* OSVersion)
*/
}
aml_calculate_size(root);
hdef = AllocateZeroPool(root->Size);
hdef = (__typeof__(hdef))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, hdef, 0);
aml_destroy_node(root);
@ -3895,7 +3895,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
USBDATA1 = AllocateZeroPool(root->Size);
USBDATA1 = (__typeof__(USBDATA1))AllocateZeroPool(root->Size);
size1 = root->Size;
// DBG("USB1 code size = 0x%08x\n", size1);
aml_write_node(root, USBDATA1, 0);
@ -3968,7 +3968,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root1);
USBDATA2 = AllocateZeroPool(root1->Size);
USBDATA2 = (__typeof__(USBDATA2))AllocateZeroPool(root1->Size);
size2 = root1->Size;
// DBG("USB2 code size = 0x%08x\n", size2);
aml_write_node(root1, USBDATA2, 0);
@ -3976,7 +3976,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
//NFORCE_USB_START -- already done Intel or NForce same USBDATA2
/* aml_calculate_size(root1);
USBDATA4 = AllocateZeroPool(root1->Size);
USBDATA4 = (__typeof__(USBDATA4))AllocateZeroPool(root1->Size);
size4 = root1->Size;
DBG("USB OHCI code size = 0x%08x\n", size4);
aml_write_node(root1, USBDATA4, 0);
@ -4017,7 +4017,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root1);
USBDATA3 = AllocateZeroPool(root1->Size);
USBDATA3 = (__typeof__(USBDATA3))AllocateZeroPool(root1->Size);
size3 = root1->Size;
// DBG("USB3 code size = 0x%08x\n", size3);
aml_write_node(root1, USBDATA3, 0);
@ -4032,7 +4032,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
for (j = 0x20; len >= 4 && j < len - 4; j++) {
if (CmpAdr(dsdt, j, USBADR[i])) { //j+4 -> _ADR
XhciName = FALSE;
UsbName[i] = AllocateZeroPool(5);
UsbName[i] = (__typeof__(UsbName[i]))AllocateZeroPool(5);
// DBG("found USB at 0x%x\n", j);
adr1 = devFind(dsdt, j + 2);
if (!adr1) {
@ -4049,7 +4049,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
continue;
}
device_name[10] = AllocateZeroPool(5);
device_name[10] = (__typeof__(device_name[10]))AllocateZeroPool(5);
CopyMem(device_name[10], dsdt+k, 4);
DBG("found USB device [%08x:%x] at %x and Name was %a ->",
USBADR[i], USBADR2[i], k, device_name[10]);
@ -4169,7 +4169,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
}
//NFORCE_USB_START
else if (CmpAdr(dsdt, j, USBADR3[i])) {
UsbName[i] = AllocateZeroPool(5);
UsbName[i] = (__typeof__(UsbName[i]))AllocateZeroPool(5);
CopyMem(UsbName[i], dsdt+j, 4);
adr1 = devFind(dsdt, j);
@ -4374,7 +4374,7 @@ UINT32 FIXIDE (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
ide = AllocateZeroPool(root->Size);
ide = (__typeof__(ide))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, ide, 0);
aml_destroy_node(root);
@ -4484,7 +4484,7 @@ UINT32 FIXSATAAHCI (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
sata = AllocateZeroPool(root->Size);
sata = (__typeof__(sata))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, sata, 0);
aml_destroy_node(root);
@ -4580,7 +4580,7 @@ UINT32 FIXSATA (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
sata = AllocateZeroPool(root->Size);
sata = (__typeof__(sata))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, sata, 0);
aml_destroy_node(root);
@ -4923,7 +4923,7 @@ UINT32 FIXOTHER (UINT8 *dsdt, UINT32 len)
for (i=0; i<len-5; i++) {
if (CmpAdr(dsdt, i, USBADR[j])) {
// get USB name
UsbName[j] = AllocateZeroPool(5);
UsbName[j] = (__typeof__(UsbName[j]))AllocateZeroPool(5);
CopyMem(UsbName[j], dsdt+i, 4);
DBG("found USB device NAME(_ADR,0x%08x) And Name is %a\n",
USBADR[j], UsbName[j]);
@ -5144,7 +5144,7 @@ VOID GetBiosRegions(UINT8 *buffer)
}
}
if (tmp.Address) {
OPER_REGION *newRegion = AllocateZeroPool(sizeof(OPER_REGION));
OPER_REGION *newRegion = (__typeof__(newRegion))AllocateZeroPool(sizeof(OPER_REGION));
MsgLog("Found OperationRegion(%a, SystemMemory, %x, ...)\n", tmp.Name, tmp.Address);
*newRegion = tmp;
newRegion->next = gRegions;
@ -5234,7 +5234,7 @@ BOOLEAN CmpFullName(UINT8* Table, UINTN Len, ACPI_NAME_LIST *Bridge)
if (NameLen < 4) {
return FALSE;
}
Name = AllocateCopyPool(NameLen + 1, Table);
Name = (__typeof__(Name))AllocateCopyPool(NameLen + 1, Table);
Name[NameLen] = '\0';
i = NameLen - 4;
while (Bridge && (i >= 0)) {

View File

@ -420,7 +420,7 @@ EFI_STATUS SaveHdaDumpBin() {
HdaCodec.WidgetCount = AudioFuncGroup->WidgetsCount;
// Allocate space for codec data
HdaCodecData = AllocateZeroPool(HdaCodecDataSize);
HdaCodecData = (__typeof__(HdaCodecData))AllocateZeroPool(HdaCodecDataSize);
HdaCodecDataPtr = HdaCodecData;
if (!HdaCodecData)

View File

@ -423,7 +423,7 @@ GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume,
if (VolNameEnd) {
VolNameSize = (VolNameEnd - VolNameStart + 1) * sizeof(CHAR16);
if (VolNameSize > 0) {
VolName = AllocateZeroPool(VolNameSize);
VolName = (__typeof__(VolName))AllocateZeroPool(VolNameSize);
}
}
}
@ -523,7 +523,7 @@ GetSleepImagePosition (IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume)
// We want to read the first 512 bytes from sleepimage
BufferSize = 512;
Buffer = AllocatePool(BufferSize);
Buffer = (__typeof__(Buffer))AllocatePool(BufferSize);
if (Buffer == NULL) {
DBG(" could not allocate buffer for sleepimage\n");
return 0;
@ -611,7 +611,7 @@ IsSleepImageValidBySleepTime (IN REFIT_VOLUME *Volume)
// use 4KB aligned page to avoid possible issues with BlockIo buffer alignment
BlockIo = Volume->BlockIO;
Pages = EFI_SIZE_TO_PAGES(BlockIo->Media->BlockSize);
Buffer = AllocatePages(Pages);
Buffer = (__typeof__(Buffer))AllocatePages(Pages);
if (Buffer == NULL) {
return FALSE;
}

View File

@ -250,7 +250,7 @@ OSInfoOSNameImpl (
// for future developers
// this variable can be used at OnExitBoootServices,
// as it will be set by boot.efi
BootOSName = AllocateCopyPool(AsciiStrLen(OSName) + 1, (VOID*)OSName);
BootOSName = (__typeof__(BootOSName))AllocateCopyPool(AsciiStrLen(OSName) + 1, (VOID*)OSName);
EfiNamedEventSignal (&gAppleOsLoadedNamedEventGuid);
}

View File

@ -238,7 +238,7 @@ EFI_STATUS GetBiosDriveCRC32(UINT8 DriveNum,
// read first 2 sectors
Status = BiosReadSectorsFromDrive(DriveNum, 0, 2, Dap, Buffer);
if (!EFI_ERROR(Status)) {
*DriveCRC32 = GetCrc32(Buffer, 2 * 512);
*DriveCRC32 = GetCrc32((UINT8*)Buffer, 2 * 512);
//gBS->CalculateCrc32(Buffer, 2 * 512, DriveCRC32);
DBG("Bios drive CRC32 = 0x%x\n", *DriveCRC32);
}
@ -310,7 +310,7 @@ EFI_STATUS bootElTorito(REFIT_VOLUME* volume)
IA32_REGISTER_SET Regs;
//UINTN LogSize;
sectorBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (2048), 64);
sectorBuffer = (__typeof__(sectorBuffer))AllocateAlignedPages (EFI_SIZE_TO_PAGES (2048), 64);
krnMemoryTop = addrRealFromSegOfs(0xA000, 0x0000);
addrEnablePaging(0);
@ -650,7 +650,7 @@ EFI_STATUS bootPBRtest(REFIT_VOLUME* volume)
return Status;
}
mBootSector = AllocateAlignedPages(1, 16);
mBootSector = (__typeof__(mBootSector))AllocateAlignedPages(1, 16);
Status = pDisk->ReadBlocks(pDisk, pDisk->Media->MediaId, 0, 2*512, mBootSector);
CopyMem(pBootSector, mBootSector, 1024);
DBG("PBR after readDisk:\n");
@ -900,7 +900,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset)
//
// read partition boot record and copy it to BIOS boot area 0000:07C00
//
mBootSector = AllocatePages(1);
mBootSector = (__typeof__(mBootSector))AllocatePages(1);
Status = pDisk->ReadBlocks(pDisk, pDisk->Media->MediaId, 0, 1*512, mBootSector);
CopyMem(pBootSector, mBootSector, 1*512);
DBG("PBR:\n");

View File

@ -112,7 +112,7 @@ VOID *GetNvramVariable (
//
// Allocate the buffer to return
//
Data = AllocateZeroPool (IntDataSize + 1);
Data = (__typeof__(Data))AllocateZeroPool (IntDataSize + 1);
if (Data != NULL) {
//
// Read variable into the allocated buffer.
@ -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;
@ -148,7 +148,7 @@ SetNvramVariable (
UINT32 OldAttributes = 0;
//DBG ("SetNvramVariable (%s, guid, 0x%x, %d):", VariableName, Attributes, DataSize);
OldData = GetNvramVariable (VariableName, VendorGuid, &OldAttributes, &OldDataSize);
OldData = (__typeof__(OldData))GetNvramVariable (VariableName, VendorGuid, &OldAttributes, &OldDataSize);
if (OldData != NULL) {
// var already exists - check if it equal to new value
//DBG (" exists(0x%x, %d)", OldAttributes, OldDataSize);
@ -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
}
@ -191,7 +191,7 @@ AddNvramVariable (
VOID *OldData;
//DBG ("SetNvramVariable (%s, guid, 0x%x, %d):\n", VariableName, Attributes, DataSize);
OldData = GetNvramVariable (VariableName, VendorGuid, NULL, NULL);
OldData = (__typeof__(OldData))GetNvramVariable (VariableName, VendorGuid, NULL, NULL);
if (OldData == NULL)
{
// set new value
@ -285,7 +285,7 @@ ResetNativeNvram ()
//DbgHeader("ResetNativeNvram: cleanup NVRAM variables");
NameSize = sizeof (CHAR16);
Name = AllocateZeroPool (NameSize);
Name = (__typeof__(Name))AllocateZeroPool (NameSize);
if (Name == NULL) {
return Status;
}
@ -300,7 +300,7 @@ ResetNativeNvram ()
NewNameSize = NameSize;
Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
if (Status == EFI_BUFFER_TOO_SMALL) {
Name = ReallocatePool (NameSize, NewNameSize, Name);
Name = (__typeof__(Name))ReallocatePool (NameSize, NewNameSize, Name);
if (Name == NULL) {
return Status;
}
@ -414,7 +414,7 @@ GetSmcKeys (BOOLEAN WriteToSMC)
NameSize = sizeof (CHAR16);
Name = AllocateZeroPool (NameSize);
Name = (__typeof__(Name))AllocateZeroPool (NameSize);
if (Name == NULL) {
return;
}
@ -431,7 +431,7 @@ GetSmcKeys (BOOLEAN WriteToSMC)
NewNameSize = NameSize;
Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
if (Status == EFI_BUFFER_TOO_SMALL) {
Name = ReallocatePool (NameSize, NewNameSize, Name);
Name = (__typeof__(Name))ReallocatePool (NameSize, NewNameSize, Name);
if (Name == NULL) {
return; //if something wrong then just do nothing
}
@ -448,7 +448,7 @@ GetSmcKeys (BOOLEAN WriteToSMC)
continue; //the variable is not interesting for us
}
Data = GetNvramVariable (Name, &Guid, NULL, &DataSize);
Data = (__typeof__(Data))GetNvramVariable (Name, &Guid, NULL, &DataSize);
if (Data) {
/* UINTN Index;
DBG(" %s:", Name);
@ -712,7 +712,7 @@ GetEfiBootDeviceFromNvram ()
return EFI_SUCCESS;
}
gEfiBootDeviceData = GetNvramVariable (L"efi-boot-next-data", &gEfiAppleBootGuid, NULL, &Size);
gEfiBootDeviceData = (__typeof__(gEfiBootDeviceData))GetNvramVariable (L"efi-boot-next-data", &gEfiAppleBootGuid, NULL, &Size);
if (gEfiBootDeviceData != NULL) {
// DBG("Got efi-boot-next-data size=%d\n", Size);
if (IsDevicePathValid(gEfiBootDeviceData, Size)) {
@ -729,9 +729,9 @@ GetEfiBootDeviceFromNvram ()
EFI_STATUS Status;
Status = GetVariable2 (L"aptiofixflag", &gEfiAppleBootGuid, &Value, &Size2);
if (EFI_ERROR(Status)) {
gEfiBootDeviceData = GetNvramVariable (L"efi-boot-device-data", &gEfiAppleBootGuid, NULL, &Size);
gEfiBootDeviceData = (__typeof__(gEfiBootDeviceData))GetNvramVariable (L"efi-boot-device-data", &gEfiAppleBootGuid, NULL, &Size);
} else {
gEfiBootDeviceData = GetNvramVariable (L"specialbootdevice", &gEfiAppleBootGuid, NULL, &Size);
gEfiBootDeviceData = (__typeof__(gEfiBootDeviceData))GetNvramVariable (L"specialbootdevice", &gEfiAppleBootGuid, NULL, &Size);
}
if (gEfiBootDeviceData != NULL) {
@ -758,7 +758,7 @@ GetEfiBootDeviceFromNvram ()
// then Startup Disk sets BootCampHD to Win disk dev path.
//
if (DevicePathType(gEfiBootDeviceData) == HARDWARE_DEVICE_PATH && DevicePathSubType (gEfiBootDeviceData) == HW_MEMMAP_DP) {
gBootCampHD = GetNvramVariable (L"BootCampHD", &gEfiAppleBootGuid, NULL, &Size);
gBootCampHD = (__typeof__(gBootCampHD))GetNvramVariable (L"BootCampHD", &gEfiAppleBootGuid, NULL, &Size);
gEfiBootVolume = gBootCampHD;
if (gBootCampHD == NULL) {
@ -782,7 +782,7 @@ GetEfiBootDeviceFromNvram ()
gEfiBootLoaderPath = NULL;
FileDevPath = (FILEPATH_DEVICE_PATH *)FindDevicePathNodeWithType (gEfiBootVolume, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP);
if (FileDevPath != NULL) {
gEfiBootLoaderPath = AllocateCopyPool (StrSize(FileDevPath->PathName), FileDevPath->PathName);
gEfiBootLoaderPath = (__typeof__(gEfiBootLoaderPath))AllocateCopyPool (StrSize(FileDevPath->PathName), FileDevPath->PathName);
// copy DevPath and write end of path node after in place of file path node
gEfiBootVolume = DuplicateDevicePath (gEfiBootVolume);
FileDevPath = (FILEPATH_DEVICE_PATH *)FindDevicePathNodeWithType (gEfiBootVolume, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP);
@ -799,7 +799,7 @@ GetEfiBootDeviceFromNvram ()
//
Guid = FindGPTPartitionGuidInDevicePath (gEfiBootVolume);
if (Guid != NULL) {
gEfiBootDeviceGuid = AllocatePool (sizeof(EFI_GUID));
gEfiBootDeviceGuid = (__typeof__(gEfiBootDeviceGuid))AllocatePool (sizeof(EFI_GUID));
if (gEfiBootDeviceGuid != NULL) {
CopyMem (gEfiBootDeviceGuid, Guid, sizeof(EFI_GUID));
DBG (" - Guid = %g\n", gEfiBootDeviceGuid);
@ -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);
}
@ -1377,7 +1377,7 @@ EFI_STATUS SetStartupDiskVolume (
"</dict></array>";
Size = AsciiStrLen (EfiBootDeviceTmpl) + 36;
EfiBootDevice = AllocateZeroPool(AsciiStrLen (EfiBootDeviceTmpl) + 36);
EfiBootDevice = (__typeof__(EfiBootDevice))AllocateZeroPool(AsciiStrLen (EfiBootDeviceTmpl) + 36);
AsciiSPrint (EfiBootDevice, Size, EfiBootDeviceTmpl, Guid);
Size = AsciiStrLen (EfiBootDevice);
DBG (" * efi-boot-device: %a\n", EfiBootDevice);

View File

@ -713,15 +713,15 @@ struct Symbol {
typedef struct Symbol Symbol, *SymbolPtr;
typedef struct {
typedef struct TagStruct {
UINTN type;
CHAR8 *string;
UINT8 *data;
UINTN dataLen;
UINTN offset;
VOID *tag;
VOID *tagNext;
struct TagStruct *tag;
struct TagStruct *tagNext;
} TagStruct, *TagPtr;
@ -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

File diff suppressed because it is too large Load Diff

View File

@ -165,7 +165,7 @@ StartupSoundPlay(EFI_FILE *Dir, CHAR16* SoundFile)
DBG("not found wave data\n");
goto DONE_ERROR;
}
TempData = AllocateZeroPool(Len * sizeof(INT16));
TempData = (__typeof__(TempData))AllocateZeroPool(Len * sizeof(INT16));
Tmp = *(Ptr++);
for (Ind = 0; Ind < WaveData.SamplesLength / 2 - 1; Ind++) {
Next = *(Ptr++);
@ -260,10 +260,10 @@ GetStoredOutput()
}
DBG("found %d handles with audio\n", AudioIoHandleCount);
// Get stored device path size. First from AppleBootGuid
StoredDevicePath = GetNvramVariable(L"Clover.SoundDevice", &gEfiAppleBootGuid, NULL, &StoredDevicePathSize);
StoredDevicePath = (__typeof__(StoredDevicePath))GetNvramVariable(L"Clover.SoundDevice", &gEfiAppleBootGuid, NULL, &StoredDevicePathSize);
if (!StoredDevicePath) {
// second attempt with BootChimeGuid
StoredDevicePath = GetNvramVariable(BOOT_CHIME_VAR_DEVICE, &gBootChimeVendorVariableGuid, NULL, &StoredDevicePathSize);
StoredDevicePath = (__typeof__(StoredDevicePath))GetNvramVariable(BOOT_CHIME_VAR_DEVICE, &gBootChimeVendorVariableGuid, NULL, &StoredDevicePathSize);
if (!StoredDevicePath) {
MsgLog("No AudioIoDevice stored\n");
Status = EFI_NOT_FOUND;

View File

@ -421,7 +421,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
aml_calculate_size(root);
ssdt = (SSDT_TABLE *)AllocateZeroPool(root->Size);
aml_write_node(root, (VOID*)ssdt, 0);
aml_write_node(root, (CHAR8*)ssdt, 0);
ssdt->Length = root->Size;
FixChecksum(ssdt);
//ssdt->Checksum = 0;
@ -641,7 +641,7 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
ssdt = (SSDT_TABLE *)AllocateZeroPool(root->Size);
aml_write_node(root, (VOID*)ssdt, 0);
aml_write_node(root, (CHAR8*)ssdt, 0);
ssdt->Length = root->Size;
FixChecksum(ssdt);

View File

@ -1226,7 +1226,7 @@ BOOLEAN get_bootdisplay_val(value_t *val, INTN index, BOOLEAN Sier)
v = 1;
val->type = kCst;
val->size = 4;
val->data = AllocatePool(4);
val->data = (__typeof__(val->data))AllocatePool(4);
*(val->data) = (UINT8)v;
return TRUE;
}
@ -1248,7 +1248,7 @@ BOOLEAN get_dual_link_val(value_t *val, INTN index, BOOLEAN Sier)
val->type = kCst;
val->size = 4;
val->data = AllocatePool(4);
val->data = (__typeof__(val->data))AllocatePool(4);
*(val->data) = (UINT8)v;
return TRUE;
}
@ -1276,7 +1276,7 @@ BOOLEAN get_edid_val(value_t *val, INTN index, BOOLEAN Sier)
v = 1;
val->type = kPtr;
val->size = 128;
val->data = AllocateCopyPool(val->size, gSettings.CustomEDID);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, gSettings.CustomEDID);
return TRUE;
}
@ -1292,7 +1292,7 @@ BOOLEAN get_display_type(value_t *val, INTN index, BOOLEAN Sier)
}
val->type = kStr;
val->size = (UINT32)AsciiStrSize(dtyp[dti]);
val->data = AllocateCopyPool(val->size, (UINT8 *)dtyp[dti]);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)dtyp[dti]);
return TRUE;
}
@ -1301,7 +1301,7 @@ BOOLEAN get_name_val(value_t *val, INTN index, BOOLEAN Sier)
{
val->type = aty_name.type;
val->size = aty_name.size;
val->data = AllocateCopyPool(aty_name.size, (UINT8 *)aty_name.data);
val->data = (__typeof__(val->data))AllocateCopyPool(aty_name.size, (UINT8 *)aty_name.data);
return TRUE;
}
@ -1309,14 +1309,14 @@ BOOLEAN get_nameparent_val(value_t *val, INTN index, BOOLEAN Sier)
{
val->type = aty_nameparent.type;
val->size = aty_nameparent.size;
val->data = AllocateCopyPool(aty_nameparent.size, (UINT8 *)aty_nameparent.data);
val->data = (__typeof__(val->data))AllocateCopyPool(aty_nameparent.size, (UINT8 *)aty_nameparent.data);
return TRUE;
}
//static CHAR8 pciName[15];
BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
{
CHAR8* pciName = AllocateZeroPool(15);
CHAR8* pciName = (__typeof__(pciName))AllocateZeroPool(15);
if (!card->info->model_name || !gSettings.FakeATI) {
return FALSE;
@ -1333,14 +1333,14 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
CONST CHAR8* NamePolaris = "AMD Radeon %a";
BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier)
{
CHAR8 *ModelName = AllocateZeroPool(35);
CHAR8 *ModelName = (__typeof__(ModelName))AllocateZeroPool(35);
if (!card->info->model_name) {
return FALSE;
}
val->type = kStr;
if (card->pci_dev->device_id != 0x67DF) {
val->size = (UINT32)AsciiStrLen(card->info->model_name);
val->data = AllocateCopyPool(val->size, (UINT8 *)card->info->model_name);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)card->info->model_name);
} else {
switch (card->pci_dev->revision) {
case 0xC4:
@ -1366,7 +1366,7 @@ BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier)
break;
}
val->size = (UINT32)AsciiStrLen(ModelName);
val->data = AllocateCopyPool(val->size, ModelName);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, ModelName);
}
FreePool(ModelName);
return TRUE;
@ -1403,7 +1403,7 @@ BOOLEAN get_conntype_val(value_t *val, INTN index, BOOLEAN Sier)
val->type = kCst;
val->size = 4;
val->data = AllocateCopyPool(val->size, (UINT8 *)&ct[index * Len]);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&ct[index * Len]);
// cti++;
// if(cti > 3) cti = 0;
@ -1423,7 +1423,7 @@ BOOLEAN get_vrammemsize_val(value_t *val, INTN index, BOOLEAN Sier)
}
val->type = kCst;
val->size = 8;
val->data = AllocateCopyPool(val->size, (UINT8 *)&memsize);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&memsize);
return TRUE;
}
@ -1434,7 +1434,7 @@ BOOLEAN get_binimage_val(value_t *val, INTN index, BOOLEAN Sier)
}
val->type = kPtr;
val->size = card->rom_size;
val->data = AllocateCopyPool(val->size, (UINT8 *)card->rom);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)card->rom);
return TRUE;
}
@ -1445,7 +1445,7 @@ BOOLEAN get_binimage_owr(value_t *val, INTN index, BOOLEAN Sier)
}
val->type = kCst;
val->size = 4;
val->data = AllocatePool(4);
val->data = (__typeof__(val->data))AllocatePool(4);
*(val->data) = 1;
return TRUE;
}
@ -1457,7 +1457,7 @@ BOOLEAN get_romrevision_val(value_t *val, INTN index, BOOLEAN Sier)
if (!card->rom){
val->type = kPtr;
val->size = 13;
val->data = AllocateCopyPool(val->size, cRev);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, cRev);
return TRUE;
}
@ -1469,7 +1469,7 @@ BOOLEAN get_romrevision_val(value_t *val, INTN index, BOOLEAN Sier)
rev = (UINT8 *)cRev;
val->size = 13;
}
val->data = AllocateCopyPool(val->size, rev);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, rev);
return TRUE;
}
@ -1477,7 +1477,7 @@ BOOLEAN get_deviceid_val(value_t *val, INTN index, BOOLEAN Sier)
{
val->type = kCst;
val->size = 2;
val->data = AllocateCopyPool(val->size, (UINT8 *)&card->pci_dev->device_id);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&card->pci_dev->device_id);
return TRUE;
}
@ -1499,13 +1499,13 @@ BOOLEAN get_refclk_val(value_t *val, INTN index, BOOLEAN Sier)
//
val->type = kCst;
val->size = 4;
val->data = AllocateCopyPool(val->size, (UINT8 *)&gSettings.RefCLK);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&gSettings.RefCLK);
return TRUE;
}
BOOLEAN get_platforminfo_val(value_t *val, INTN index, BOOLEAN Sier)
{
val->data = AllocateZeroPool(0x80);
val->data = (__typeof__(val->data))AllocateZeroPool(0x80);
if (!val->data)
return FALSE;
@ -1522,7 +1522,7 @@ BOOLEAN get_vramtotalsize_val(value_t *val, INTN index, BOOLEAN Sier)
val->type = kCst;
val->size = 4;
val->data = AllocateCopyPool(val->size, (UINT8 *)&card->vram_size);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&card->vram_size);
return TRUE;
}
@ -1548,7 +1548,7 @@ VOID devprop_add_list(AtiDevProp devprop_list[], CHAR8 *OSVersion)
{
INTN i, pnum;
BOOLEAN Sier;
value_t *val = AllocateZeroPool(sizeof(value_t));
value_t *val = (__typeof__(val))AllocateZeroPool(sizeof(value_t));
Sier = (AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.12"));
@ -1647,7 +1647,7 @@ BOOLEAN load_vbios_file(UINT16 vendor_id, UINT16 device_id)
}
DBG("Loaded ROM len=%d\n", bufferLen);
card->rom_size = (UINT32)bufferLen;
card->rom = AllocateZeroPool(bufferLen);
card->rom = (__typeof__(card->rom))AllocateZeroPool(bufferLen);
if (!card->rom) {
return FALSE;
}
@ -1728,7 +1728,7 @@ BOOLEAN read_vbios(BOOLEAN from_pci)
return FALSE;
}
card->rom = AllocateZeroPool(card->rom_size);
card->rom = (__typeof__(card->rom))AllocateZeroPool(card->rom_size);
if (!card->rom) {
return FALSE;
}
@ -1897,7 +1897,7 @@ BOOLEAN devprop_add_pci_config_space(VOID)
{
int offset;
UINT8 *config_space = AllocateZeroPool(0x100);
UINT8 *config_space = (__typeof__(config_space))AllocateZeroPool(0x100);
if (!config_space)
return FALSE;
@ -1924,7 +1924,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
UINTN ExpansionRom = 0;
UINTN Reg1, Reg3, Reg5;
card = AllocateZeroPool(sizeof(card_t));
card = (__typeof__(card))AllocateZeroPool(sizeof(card_t));
if (!card) {
return FALSE;
}
@ -1934,7 +1934,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
if (radeon_cards[i].device_id != pci_dev->device_id) {
continue;
}
card->info = AllocateCopyPool(sizeof(radeon_card_info_t), &radeon_cards[i]);
card->info = (__typeof__(card->info))AllocateCopyPool(sizeof(radeon_card_info_t), &radeon_cards[i]);
if (!card->info->cfg_name) {
card->info->cfg_name = kRadeon;
}
@ -1957,7 +1957,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
DBG("search for brothers family\n");
for (i = 0; radeon_cards[i].device_id ; i++) {
if ((radeon_cards[i].device_id & ~0xf) == (pci_dev->device_id & ~0xf)) {
card->info = AllocateCopyPool(sizeof(radeon_card_info_t), &radeon_cards[i]);
card->info = (__typeof__(card->info))AllocateCopyPool(sizeof(radeon_card_info_t), &radeon_cards[i]);
break;
}
}
@ -2019,7 +2019,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
NameLen = StrLen(gSettings.FBName);
if (NameLen > 2) { //fool proof: cfg_name is 3 character or more.
CfgName = AllocateZeroPool(NameLen);
CfgName = (__typeof__(CfgName))AllocateZeroPool(NameLen);
UnicodeStrToAsciiStrS((CHAR16*)&gSettings.FBName[0], CfgName, 16);
DBG("Users config name %a\n", CfgName);
card->cfg_name = CfgName;
@ -2057,13 +2057,13 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
DBG("Nr of ports set to min: %d\n", card->ports);
}
//
name = AllocateZeroPool(24);
name = (__typeof__(name))AllocateZeroPool(24);
AsciiSPrint(name, 24, "ATY,%a", card->cfg_name);
aty_name.type = kStr;
aty_name.size = (UINT32)AsciiStrLen(name);
aty_name.data = (UINT8 *)name;
name_parent = AllocateZeroPool(24);
name_parent = (__typeof__(name_parent))AllocateZeroPool(24);
AsciiSPrint(name_parent, 24, "ATY,%aParent", card->cfg_name);
aty_nameparent.type = kStr;
aty_nameparent.size = (UINT32)AsciiStrLen(name_parent);

View File

@ -107,7 +107,7 @@ UINT8 *Base64DecodeClover(IN CHAR8 *EncodedData, OUT UINTN *DecodedSize)
return NULL;
}
// to simplify, we'll allocate the same size, although smaller size is needed
DecodedData = AllocateZeroPool(EncodedSize);
DecodedData = (__typeof__(DecodedData))AllocateZeroPool(EncodedSize);
base64_init_decodestate(&state_in);
DecodedSizeInternal = base64_decode_block(EncodedData, (const int)EncodedSize, (char*) DecodedData, &state_in);

View File

@ -70,7 +70,7 @@ LIST_ENTRY gCardList = INITIALIZE_LIST_HEAD_VARIABLE (gCardList);
VOID AddCard(CONST CHAR8* Model, UINT32 Id, UINT32 SubId, UINT64 VideoRam, UINTN VideoPorts, BOOLEAN LoadVBios)
{
CARDLIST* new_card;
new_card = AllocateZeroPool(sizeof(CARDLIST));
new_card = (__typeof__(new_card))AllocateZeroPool(sizeof(CARDLIST));
if (new_card) {
new_card->Signature = CARDLIST_SIGNATURE;
new_card->Id = Id;

View File

@ -74,7 +74,7 @@ CHAR8 *get_pci_dev_path(pci_dt_t *PciDt)
return NULL;
devpathstr = FileDevicePathToStr(DevicePath);
Size = StrLen(devpathstr) + 1;
tmp = AllocateZeroPool(Size);
tmp = (__typeof__(tmp))AllocateZeroPool(Size);
UnicodeStrToAsciiStrS(devpathstr, tmp, Size);
return tmp;
@ -137,7 +137,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt,
if (!DevicePath)
return NULL;
device = AllocateZeroPool(sizeof(DevPropDevice));
device = (__typeof__(device))AllocateZeroPool(sizeof(DevPropDevice));
if (!device) {
return NULL;
}

View File

@ -31,7 +31,7 @@ BootArgs1 *bootArgs1 = NULL;
BootArgs2 *bootArgs2 = NULL;
CHAR8 *dtRoot = NULL;
UINT32 *dtLength;
VOID *KernelData = NULL;
UINT8 *KernelData = NULL;
UINT32 KernelSlide = 0;
BOOLEAN isKernelcache = FALSE;
BOOLEAN is64BitKernel = FALSE;
@ -1831,9 +1831,9 @@ KernelAndKextPatcherInit(IN LOADER_ENTRY *Entry)
UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
if (os_version < AsciiOSVersionToUint64("10.6")) {
KernelData = (VOID*)(UINTN)(KernelSlide + KernelRelocBase + 0x00111000);
KernelData = (UINT8*)(UINTN)(KernelSlide + KernelRelocBase + 0x00111000);
} else {
KernelData = (VOID*)(UINTN)(KernelSlide + KernelRelocBase + 0x00200000);
KernelData = (UINT8*)(UINTN)(KernelSlide + KernelRelocBase + 0x00200000);
}
// check that it is Mach-O header and detect architecture

View File

@ -77,7 +77,7 @@ extern BootArgs1 *bootArgs1;
extern BootArgs2 *bootArgs2;
extern CHAR8 *dtRoot;
extern UINT32 *dtLength;
extern VOID *KernelData;
extern UINT8 *KernelData;
extern UINT32 KernelSlide;
extern BOOLEAN isKernelcache;
extern BOOLEAN is64BitKernel;

View File

@ -194,7 +194,7 @@ EFI_STATUS EFIAPI LoadKext(IN LOADER_ENTRY *Entry, IN EFI_FILE *RootDir, IN CHAR
}
}
bundlePathBufferLength = StrLen(FileName) + 1;
bundlePathBuffer = AllocateZeroPool(bundlePathBufferLength);
bundlePathBuffer = (__typeof__(bundlePathBuffer))AllocateZeroPool(bundlePathBufferLength);
UnicodeStrToAsciiStrS(FileName, bundlePathBuffer, bundlePathBufferLength);
kext->length = (UINT32)(sizeof(_BooterKextFileInfo) + infoDictBufferLength + executableBufferLength + bundlePathBufferLength);
@ -221,7 +221,7 @@ EFI_STATUS EFIAPI AddKext(IN LOADER_ENTRY *Entry, IN EFI_FILE *RootDir, IN CHAR1
EFI_STATUS Status;
KEXT_ENTRY *KextEntry;
KextEntry = AllocatePool (sizeof(KEXT_ENTRY));
KextEntry = (__typeof__(KextEntry))AllocatePool (sizeof(KEXT_ENTRY));
KextEntry->Signature = KEXT_SIGNATURE;
Status = LoadKext(Entry, RootDir, FileName, archCpuType, &KextEntry->kext);
if(EFI_ERROR(Status)) {
@ -540,10 +540,10 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry)
// reserve space in the device tree
if (GetKextCount() > 0) {
mm_extra_size = GetKextCount() * (sizeof(DeviceTreeNodeProperty) + sizeof(_DeviceTreeBuffer));
mm_extra = AllocateZeroPool(mm_extra_size - sizeof(DeviceTreeNodeProperty));
mm_extra = (__typeof__(mm_extra))AllocateZeroPool(mm_extra_size - sizeof(DeviceTreeNodeProperty));
/*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"mm_extra", mm_extra, (UINT32)(mm_extra_size - sizeof(DeviceTreeNodeProperty)));
extra_size = GetKextsSize();
extra = AllocateZeroPool(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE);
extra = (__typeof__(extra))AllocateZeroPool(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE);
/*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"extra", extra, (UINT32)(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE));
// MsgLog("count: %d \n", GetKextCount());
// MsgLog("mm_extra_size: %d \n", mm_extra_size);
@ -721,7 +721,7 @@ EFI_STATUS InjectKexts(/*IN EFI_MEMORY_DESCRIPTOR *Desc*/ IN UINT32 deviceTreeP,
}
}
if (Entry->KernelAndKextPatches->KPDebug) {
if (Entry->KernelAndKextPatches->KPDebug) {
DBG_RT(Entry, "Done.\n");
gBS->Stall(5000000);
}

View File

@ -2289,7 +2289,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
}
if (EFI_ERROR(Status)) {
rom = AllocateZeroPool(NVIDIA_ROM_SIZE+1);
rom = (__typeof__(rom))AllocateZeroPool(NVIDIA_ROM_SIZE+1);
// PRAMIN first
read_nVidia_PRAMIN(nvda_dev, rom, nvCardType);
@ -2316,7 +2316,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
if (buffer[i] == 0x55 && buffer[i+1] == 0xaa) {
DBG(" header found at: %d\n", i);
bufferLen -= i;
rom = AllocateZeroPool(bufferLen);
rom = (__typeof__(rom))AllocateZeroPool(bufferLen);
for (j = 0; j < bufferLen; j++) {
rom[j] = buffer[i+j];
}

View File

@ -86,7 +86,7 @@ void png_alloc_add_node(void *addr, UINT32 size)
png_alloc_node_t *node;
if (png_alloc_find_node(addr, size))
return;
node = AllocateZeroPool(sizeof (png_alloc_node_t));
node = (__typeof__(node))AllocateZeroPool(sizeof (png_alloc_node_t));
node->addr = addr;
node->size = size;
node->prev = png_alloc_tail;
@ -114,7 +114,7 @@ void png_alloc_remove_node(png_alloc_node_t *node)
void *png_alloc_malloc(UINT32 size)
{
void *addr = AllocateZeroPool(size);
void *addr = (__typeof__(addr))AllocateZeroPool(size);
png_alloc_add_node(addr, size);
return addr;
}
@ -127,7 +127,7 @@ void *png_alloc_realloc(void *addr, UINT32 oldSize, UINT32 newSize)
if ( newSize > oldSize ) {
png_alloc_node_t *old_node = png_alloc_find_node(addr, oldSize);
if (old_node) {
void *new_addr = ReallocatePool(oldSize, newSize, addr);
void *new_addr = (__typeof__(new_addr))ReallocatePool(oldSize, newSize, addr);
old_node->addr = new_addr;
old_node->size = newSize;
return new_addr;

View File

@ -541,7 +541,8 @@ PLATFORMDATA ApplePlatformData[] =
VOID SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
{
const CHAR8 *i;
CHAR8 *Res1 = AllocateZeroPool(9), *Res2 = AllocateZeroPool(11);
CHAR8 *Res1 = (__typeof__(Res1))AllocateZeroPool(9);
CHAR8 *Res2 = (__typeof__(Res2))AllocateZeroPool(11);
AsciiStrCpyS (gSettings.VendorName, 64, BiosVendor);
AsciiStrCpyS (gSettings.RomVersion, 64, ApplePlatformData[Model].firmwareVersion);
@ -1301,9 +1302,9 @@ VOID SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
MACHINE_TYPES GetModelFromString(CHAR8 *ProductName)
{
UINTN i;
MACHINE_TYPES i;
for (i = 0; i < MaxMachineType; ++i) {
for (i = (MACHINE_TYPES)(0); i < MaxMachineType; i = (MACHINE_TYPES)(i + 1)) {
if (AsciiStrCmp (ApplePlatformData[i].productName, ProductName) == 0) {
return i;
}
@ -1358,7 +1359,7 @@ VOID GetDefaultSettings()
gSettings.BooterConfig = 0;
// MemSet(gSettings.BooterCfgStr, 64, 0);
// AsciiStrCpyS(gSettings.BooterCfgStr, 64, "log=0");
CHAR8 *OldCfgStr = GetNvramVariable (L"bootercfg", &gEfiAppleBootGuid, NULL, NULL);
CHAR8 *OldCfgStr = (__typeof__(OldCfgStr))GetNvramVariable (L"bootercfg", &gEfiAppleBootGuid, NULL, NULL);
if (OldCfgStr) {
AsciiStrCpyS(gSettings.BooterCfgStr, 64, OldCfgStr);
FreePool(OldCfgStr);

View File

@ -94,7 +94,7 @@ XMLDecode(CHAR8* src)
len = AsciiStrLen(src);
#if 0
out = AllocateZeroPool(len+1);
out = (__typeof__(out))AllocateZeroPool(len+1);
if (!out)
return 0;
#else // unsafe
@ -213,7 +213,7 @@ EFI_STATUS ParseXML(const CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
return EFI_INVALID_PARAMETER;
}
configBuffer = AllocateZeroPool(bufferSize+1);
configBuffer = (__typeof__(configBuffer))AllocateZeroPool(bufferSize+1);
if(configBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}

View File

@ -180,16 +180,16 @@ VOID* GetSmbiosTablesFromHob (VOID)
EFI_PHYSICAL_ADDRESS *Table;
EFI_PEI_HOB_POINTERS GuidHob;
GuidHob.Raw = GetFirstGuidHob (&gEfiSmbiosTableGuid);
GuidHob.Raw = (__typeof(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbiosTableGuid);
if (GuidHob.Raw != NULL) {
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 = GetFirstGuidHob (&gEfiSmbios3TableGuid);
GuidHob.Raw = (__typeof(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbios3TableGuid);
if (GuidHob.Raw != NULL) {
Table = GET_GUID_HOB_DATA (GuidHob.Guid);
Table = (__typeof(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
if (Table != NULL) {
return (VOID *)(UINTN)*Table;
}
@ -2022,8 +2022,8 @@ EFI_STATUS PrepatchSmbios()
}
//Create space for SPD
//gRAM = AllocateZeroPool(sizeof(MEM_STRUCTURE));
//gDMI = AllocateZeroPool(sizeof(DMI));
//gRAM = (__typeof__(gRAM))AllocateZeroPool(sizeof(MEM_STRUCTURE));
//gDMI = (__typeof__(gDMI))AllocateZeroPool(sizeof(DMI));
//Collect information for use in menu
GetTableType1();
@ -2085,14 +2085,14 @@ VOID FinalizeSmbios() //continue
BOOLEAN FoundTable3 = FALSE;
// Get Hob List
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 = GetNextGuidHob (gTableGuidArray[Index], HobStart.Raw);
GuidHob.Raw = (__typeof(HobStart.Raw))GetNextGuidHob (gTableGuidArray[Index], HobStart.Raw);
if (GuidHob.Raw != NULL) {
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) {

View File

@ -540,7 +540,7 @@ UINT16 getDDRspeedMhz(UINT8 * spd)
CHAR8* getDDRSerial(UINT8* spd)
{
CHAR8* asciiSerial; //[16];
asciiSerial = AllocatePool(17);
asciiSerial = (__typeof__(asciiSerial))AllocatePool(17);
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR4) { // DDR4
AsciiSPrint(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(325) /*& 0x7*/, SLST(325), SMST(326), SLST(326), SMST(327), SLST(327), SMST(328), SLST(328));
} else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) { // DDR3
@ -560,7 +560,7 @@ CHAR8* getDDRPartNum(UINT8* spd, UINT32 base, UINT8 slot)
{
UINT16 i, start=0, index = 0;
CHAR8 c;
CHAR8* asciiPartNo = AllocatePool(32); //[32];
CHAR8* asciiPartNo = (__typeof__(asciiPartNo))AllocatePool(32); //[32];
if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR4) {
start = 329;
@ -671,7 +671,7 @@ STATIC VOID read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did)
// needed at least for laptops
//fullBanks = (gDMI->MemoryModules == gDMI->CntMemorySlots);
spdbuf = AllocateZeroPool(MAX_SPD_SIZE);
spdbuf = (__typeof__(spdbuf))AllocateZeroPool(MAX_SPD_SIZE);
// Search MAX_RAM_SLOTS slots
//==>

View File

@ -147,7 +147,7 @@ LOADER_ENTRY * DuplicateLoaderEntry(IN LOADER_ENTRY *Entry)
if(Entry == NULL) {
return NULL;
}
DuplicateEntry = AllocateZeroPool(sizeof(LOADER_ENTRY));
DuplicateEntry = (__typeof__(DuplicateEntry))AllocateZeroPool(sizeof(LOADER_ENTRY));
if (DuplicateEntry) {
DuplicateEntry->me.Tag = Entry->me.Tag;
DuplicateEntry->me.AtClick = ActionEnter;
@ -226,7 +226,7 @@ CHAR16 *RemoveLoadOption(IN CHAR16 *LoadOptions, IN CHAR16 *LoadOption)
NewLoadOptions = EfiStrDuplicate(LoadOptions + OptionLength);
} else {
// The rest of LoadOptions is Length - OptionLength, but we may need additional space and ending 0
NewLoadOptions = AllocateZeroPool((Length - OptionLength + 2) * sizeof(CHAR16));
NewLoadOptions = (__typeof__(NewLoadOptions))AllocateZeroPool((Length - OptionLength + 2) * sizeof(CHAR16));
// Copy preceeding substring
CopyMem(NewLoadOptions, LoadOptions, Offset * sizeof(CHAR16));
if ((Offset + OptionLength) < Length) {

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;
@ -115,7 +115,7 @@ static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *FullTitle, IN CHAR16 *LoaderTitl
VolDesc = (Volume->DiskKind == DISK_KIND_OPTICAL) ? L"CD" : L"HD";
// prepare the menu entry
Entry = AllocateZeroPool(sizeof(LEGACY_ENTRY));
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LEGACY_ENTRY));
if (FullTitle) {
Entry->me.Title = EfiStrDuplicate(FullTitle);
} else {
@ -152,17 +152,16 @@ static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *FullTitle, IN CHAR16 *LoaderTitl
Entry->Volume = Volume;
Entry->DevicePathString = Volume->DevicePathString;
Entry->LoadOptions = (Volume->DiskKind == DISK_KIND_OPTICAL) ? L"CD" :
((Volume->DiskKind == DISK_KIND_EXTERNAL) ? L"USB" : L"HD");
Entry->LoadOptions = (Volume->DiskKind == DISK_KIND_OPTICAL) ? L"CD" : ((Volume->DiskKind == DISK_KIND_EXTERNAL) ? L"USB" : L"HD");
// create the submenu
SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen->Title = PoolPrint(L"Boot Options for %s on %s", LoaderTitle, VolDesc);
SubScreen->TitleImage = Entry->me.Image;
SubScreen->AnimeRun = GetAnime(SubScreen);
// default entry
SubEntry = AllocateZeroPool(sizeof(LEGACY_ENTRY));
SubEntry = (__typeof__(SubEntry))AllocateZeroPool(sizeof(LEGACY_ENTRY));
SubEntry->me.Title = PoolPrint(L"Boot %s", LoaderTitle);
SubEntry->me.Tag = TAG_LEGACY;
SubEntry->Volume = Entry->Volume;

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,
@ -554,7 +554,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CHAR16 *LoaderPath,
}
// prepare the menu entry
Entry = AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry->me.Tag = TAG_LOADER;
Entry->me.Row = 0;
Entry->Volume = Volume;
@ -758,7 +758,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
FileName = Basename(Entry->LoaderPath);
// create the submenu
SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen->Title = PoolPrint(L"Options for %s", Entry->me.Title, Entry->VolName);
SubScreen->TitleImage = Entry->me.Image;
SubScreen->ID = Entry->LoaderType + 20;
@ -769,7 +769,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
AddMenuInfoLine(SubScreen, FileDevicePathToStr(Entry->DevicePath));
Guid = FindGPTPartitionGuidInDevicePath(Volume->DevicePath);
if (Guid) {
CHAR8 *GuidStr = AllocateZeroPool(50);
CHAR8 *GuidStr = (__typeof__(GuidStr))AllocateZeroPool(50);
AsciiSPrint(GuidStr, 50, "%g", Guid);
AddMenuInfoLine(SubScreen, PoolPrint(L"UUID: %a", GuidStr));
FreePool(GuidStr);
@ -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)
@ -1970,7 +1970,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
} else if (Custom->SubEntries != NULL) {
UINTN CustomSubIndex = 0;
// Add subscreen
REFIT_MENU_SCREEN *SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
REFIT_MENU_SCREEN *SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
if (SubScreen) {
SubScreen->Title = PoolPrint(L"Boot Options for %s on %s", (Custom->Title != NULL) ? Custom->Title : CustomPath, Entry->VolName);
SubScreen->TitleImage = Entry->me.Image;
@ -1980,7 +1980,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
AddMenuInfoLine(SubScreen, PoolPrint(L"Volume size: %dMb", VolumeSize));
AddMenuInfoLine(SubScreen, FileDevicePathToStr(Entry->DevicePath));
if (Guid) {
CHAR8 *GuidStr = AllocateZeroPool(50);
CHAR8 *GuidStr = (__typeof__(GuidStr))AllocateZeroPool(50);
AsciiSPrint(GuidStr, 50, "%g", Guid);
AddMenuInfoLine(SubScreen, PoolPrint(L"UUID: %a", GuidStr));
FreePool(GuidStr);

View File

@ -666,7 +666,7 @@ STATIC VOID *CreateImageSignatureDatabase(IN VOID *FileBuffer,
SectionPtr = (EFI_IMAGE_SECTION_HEADER *)(ImageBase + PeHeaderOffset + sizeof(EFI_IMAGE_FILE_HEADER) +
sizeof(UINT32) + PeHeader.Pe32->FileHeader.SizeOfOptionalHeader);
// Allocate a new array for the image section headers
Sections = AllocateZeroPool(sizeof(EFI_IMAGE_SECTION_HEADER) * PeHeader.Pe32->FileHeader.NumberOfSections);
Sections = (__typeof__(Sections))AllocateZeroPool(sizeof(EFI_IMAGE_SECTION_HEADER) * PeHeader.Pe32->FileHeader.NumberOfSections);
if (Sections == NULL) {
goto Failed;
}
@ -711,7 +711,7 @@ STATIC VOID *CreateImageSignatureDatabase(IN VOID *FileBuffer,
}
// Create the signature list
Size = (sizeof(EFI_SIGNATURE_LIST) + sizeof(EFI_GUID) + 256);
Database = AllocateZeroPool(Size);
Database = (__typeof__(Database))AllocateZeroPool(Size);
if (Database == NULL) {
goto Failed;
}

View File

@ -64,7 +64,7 @@ VOID AddSecureBootTool(VOID)
if (!gSettings.SecureBoot && !gSettings.SecureBootSetupMode) {
return;
}
Entry = AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
if (gSettings.SecureBoot) {
Entry->me.Title = PoolPrint(L"Clover Secure Boot Configuration");
Entry->me.Tag = TAG_SECURE_BOOT_CONFIG;

View File

@ -250,7 +250,7 @@ VOID *GetSignatureDatabase(IN CHAR16 *DatabaseName,
return NULL;
}
// Allocate a buffer large enough to hold the database
Database = AllocateZeroPool(Size);
Database = (__typeof__(Database))AllocateZeroPool(Size);
if (Database == NULL) {
return NULL;
}
@ -453,7 +453,7 @@ EFI_STATUS SetSignedVariable(IN CHAR16 *DatabaseName,
EVP_PKEY_free(PrivateKey);
DataSize = i2d_PKCS7(p7, NULL);
Data = AllocateZeroPool(DataSize);
Data = (__typeof__(Data))AllocateZeroPool(DataSize);
i2d_PKCS7(p7, (unsigned char **)&Data);

View File

@ -81,7 +81,7 @@ STATIC BOOLEAN AddToolEntry(IN CHAR16 *LoaderPath, IN CHAR16 *FullTitle, IN CHAR
return FALSE;
}
// Allocate the entry
Entry = AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
if (Entry == NULL) {
return FALSE;
}
@ -117,7 +117,7 @@ STATIC VOID AddCloverEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle, IN REF
// EFI_STATUS Status;
// prepare the menu entry
Entry = AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry->me.Title = LoaderTitle;
Entry->me.Tag = TAG_CLOVER;
Entry->me.Row = 1;
@ -138,7 +138,7 @@ STATIC VOID AddCloverEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle, IN REF
Entry->me.AtRightClick = ActionDetails;
// create the submenu
SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen->Title = EfiStrDuplicate(LoaderTitle);
SubScreen->TitleImage = Entry->me.Image;
SubScreen->ID = SCREEN_BOOT;

View File

@ -114,7 +114,7 @@ EfiLibFileSystemVolumeLabelInfo (
if (Status == EFI_BUFFER_TOO_SMALL) {
// inc size by 2 because some drivers (HFSPlus.efi) do not count 0 at the end of file name
Size += 2;
VolumeInfo = AllocateZeroPool (Size);
VolumeInfo = (__typeof__(VolumeInfo))AllocateZeroPool (Size);
Status = FHand->GetInfo (FHand, &gEfiFileSystemVolumeLabelInfoIdGuid, &Size, VolumeInfo);
// Check to make sure this isn't actually EFI_FILE_SYSTEM_INFO
if (!EFI_ERROR(Status))
@ -148,14 +148,14 @@ EfiLibFileSystemVolumeLabelInfo (
**/
CHAR16 *
EfiStrDuplicate (
IN CHAR16 *Src
IN CONST CHAR16 *Src
)
{
CHAR16 *Dest;
UINTN Size;
Size = StrSize (Src); //at least 2bytes
Dest = AllocatePool (Size);
Dest = (__typeof__(Dest))AllocatePool (Size);
// ASSERT (Dest != NULL);
if (Dest != NULL) {
CopyMem (Dest, Src, Size);
@ -242,7 +242,7 @@ EfiLibFileInfo (
if (Status == EFI_BUFFER_TOO_SMALL) {
// inc size by 2 because some drivers (HFSPlus.efi) do not count 0 at the end of file name
Size += 2;
FileInfo = AllocateZeroPool (Size);
FileInfo = (__typeof__(FileInfo))AllocateZeroPool (Size);
Status = FHand->GetInfo (FHand, &gEfiFileInfoGuid, &Size, FileInfo);
}
@ -262,7 +262,7 @@ EfiLibFileSystemInfo (
if (Status == EFI_BUFFER_TOO_SMALL) {
// inc size by 2 because some drivers (HFSPlus.efi) do not count 0 at the end of file name
Size += 2;
FileSystemInfo = AllocateZeroPool (Size);
FileSystemInfo = (__typeof__(FileSystemInfo))AllocateZeroPool (Size);
Status = FHand->GetInfo (FHand, &gEfiFileSystemInfoGuid, &Size, FileSystemInfo);
}
@ -319,7 +319,7 @@ EfiReallocatePool (
NewPool = NULL;
if (NewSize != 0) {
NewPool = AllocateZeroPool (NewSize);
NewPool = (__typeof__(NewPool))AllocateZeroPool (NewSize);
}
if (OldPool != NULL) {

View File

@ -320,7 +320,7 @@ VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size, INTN (*compare)(CONS
INTN i = Low, j = High;
VOID *Med, *Temp;
Med = Array + ((Low + High) / 2) * Size; // Central element, just pointer
Temp = AllocatePool(Size);
Temp = (__typeof__(Temp))AllocatePool(Size);
// Sort around center
while (i <= j)
{

View File

@ -39,7 +39,6 @@ extern void DumpFloat2 (char* s, float* t, int N);
extern EG_IMAGE *BackgroundImage;
extern EG_IMAGE *Banner;
extern EG_IMAGE *BigBack;
extern VOID *fontsDB;
extern INTN BanHeight;
extern INTN row0TileSize;
extern INTN row1TileSize;
@ -327,7 +326,7 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
}
// DBG("next icon=%s Len=%d\n", ptr, StrLen(ptr));
UINTN Size = StrLen(ptr)+1;
IconName = AllocateZeroPool(Size);
IconName = (__typeof__(IconName))AllocateZeroPool(Size);
UnicodeStrToAsciiStrS(ptr, IconName, Size);
// DBG("search for icon name %a\n", IconName);
CHAR8 IconNight[64];
@ -396,7 +395,7 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
}
//banner animation
GUI_ANIME *Anime = AllocateZeroPool (sizeof(GUI_ANIME));
GUI_ANIME *Anime = (__typeof__(Anime))AllocateZeroPool (sizeof(GUI_ANIME));
Anime->ID = 1; //main screen
//there is no Anime->Path in vectors
Anime->Frames = NumFrames;
@ -410,7 +409,7 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
nsvgDeleteRasterizer(rast);
*dict = AllocateZeroPool(sizeof(TagStruct));
*dict = (__typeof__(*dict))AllocateZeroPool(sizeof(TagStruct));
(*dict)->type = kTagTypeNone;
GlobalConfig.TypeSVG = TRUE;
GlobalConfig.ThemeDesignHeight = (int)SVGimage->height;

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;
@ -564,7 +564,7 @@ EG_IMAGE * egLoadIcon(IN EFI_FILE_HANDLE BaseDir, IN CHAR16 *FileName, IN UINTN
}
CHAR16 *ptr2 = StrStr(ptr, L".");
Size = ptr2 - ptr + 2;
IconName = AllocateZeroPool(Size);
IconName = (__typeof__(IconName))AllocateZeroPool(Size);
UnicodeStrToAsciiStrS(ptr, IconName, Size - 1);
while (OSIconsTable[i].name) {

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

@ -54,7 +54,7 @@ extern void qsort(void *a, size_t n, size_t es, int (*cmp)(const void *, const v
// rewrite by RehabMan
void* lodepng_malloc(size_t size)
{
size_t* p = AllocateZeroPool(size+sizeof(size_t));
size_t* p = (__typeof__(p))AllocateZeroPool(size+sizeof(size_t));
if (!p) {
return NULL;
}
@ -75,7 +75,7 @@ void* lodepng_realloc(void* ptr, size_t new_size)
return lodepng_malloc(new_size);
}
size_t* old_p = (size_t*)ptr-1;
size_t* new_p = ReallocatePool(*old_p, new_size+sizeof(size_t), old_p);
size_t* new_p = (__typeof__(new_p))ReallocatePool(*old_p, new_size+sizeof(size_t), old_p);
if (!new_p) {
return NULL;
}

View File

@ -51,7 +51,6 @@
#endif
typedef UINTN size_t;
extern VOID *fontsDB;
#define NSVG_PI (3.14159265358979323846264338327f)
#define NSVG_PI_DEG (0.01745329251994f)
@ -2861,7 +2860,7 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
if (!p1) {
DBG("font %a not parsed\n", text->fontFace->fontFamily);
} else {
fontSVG = AllocateCopyPool(sizeof(NSVGfont), p1->font);
fontSVG = (__typeof__(fontSVG))AllocateCopyPool(sizeof(NSVGfont), p1->font);
// DBG("font family %a parsed\n", fontSVG->fontFamily);
fontSVG->next = fontsDB;
fontsDB = fontSVG;
@ -3202,7 +3201,7 @@ static void parsePattern(NSVGparser* p, const char** dict)
}
}
pt = AllocateZeroPool(sizeof(NSVGpattern));
pt = (__typeof__(pt))AllocateZeroPool(sizeof(NSVGpattern));
AsciiStrCpyS(pt->id, 64, attr->id);
pt->width = w;
pt->height = h;

View File

@ -58,9 +58,6 @@
#define strlen(s) AsciiStrLen(s)
#define strncpy(a,b,n) AsciiSPrint(a,n,"%a",b)
extern VOID *fontsDB;
extern struct NSVGparser *mainParser;
enum NSVGpaintType {
NSVG_PAINT_NONE = 0,
NSVG_PAINT_COLOR = 1,
@ -571,4 +568,7 @@ struct NSVGrasterizer
int width, height, stride;
};
extern NSVGfont *fontsDB;
extern struct NSVGparser *mainParser;
#endif

View File

@ -92,7 +92,7 @@ void nsvg_qsort(NSVGedge* Array, int Low, int High)
int Imed;
Imed = (Low + High) / 2; // Central element, just pointer
float med = Array[Imed].y0;
// Temp = AllocatePool(sizeof(NSVGedge));
// Temp = (__typeof__(Temp))AllocatePool(sizeof(NSVGedge));
// Sort around center
while (i <= j) {
while (Array[i].y0 < med) i++;

View File

@ -36,6 +36,7 @@
//Slice 2011 - 2016 numerous improvements
#include "libegint.h"
#include "nanosvg.h"
//#include "egemb_font.h"
//#define FONT_CELL_WIDTH (7)
@ -58,7 +59,7 @@ EG_IMAGE *FontImage = NULL;
INTN FontWidth = 9;
INTN FontHeight = 18;
INTN TextHeight = 19;
VOID *fontsDB = NULL;
NSVGfont *fontsDB = NULL;
CONST EG_PIXEL SemiWhitePixel = {255, 255, 255, 210}; //semitransparent

View File

@ -32,7 +32,7 @@ typedef struct {
BOOLEAN Ascii;
UINTN Index;
union {
CHAR16 *pw;
CONST CHAR16 *pw;
CHAR8 *pc;
} u;
} POINTER;
@ -109,8 +109,8 @@ _PPrint (
EFI_STATUS
EFIAPI
_SPrint (
IN VOID *Context,
IN CHAR16 *Buffer
IN POOL_PRINT *Context,
IN CHAR16 *Buffer
);
UINTN
@ -127,14 +127,14 @@ _IPrint (
VOID
EFIAPI
_PoolCatPrint (
IN CHAR16 *fmt,
IN CONST CHAR16 *fmt,
IN VA_LIST args,
IN OUT POOL_PRINT *spc,
IN EFI_STATUS
(EFIAPI
*Output)
(
VOID *context,
POOL_PRINT *context,
CHAR16 *str
)
);
@ -142,8 +142,8 @@ _PoolCatPrint (
EFI_STATUS
EFIAPI
_PoolPrint (
IN VOID *Context,
IN CHAR16 *Buffer
IN POOL_PRINT *Context,
IN CHAR16 *Buffer
);
VOID
@ -205,7 +205,7 @@ _DbgOut (
EFI_STATUS
EFIAPI
_SPrint (
IN VOID *Context,
IN POOL_PRINT *Context,
IN CHAR16 *Buffer
)
/*++
@ -261,14 +261,14 @@ Returns:
VOID
EFIAPI
_PoolCatPrint (
IN CHAR16 *fmt,
IN CONST CHAR16 *fmt,
IN VA_LIST args,
IN OUT POOL_PRINT *spc,
IN EFI_STATUS
(EFIAPI
*Output)
(
VOID *context,
POOL_PRINT *context,
CHAR16 *str
)
)
@ -291,7 +291,7 @@ Returns:
PRINT_STATE ps;
SetMem (&ps, sizeof (ps), 0);
ps.Output = Output;
ps.Output = (IN EFI_STATUS (EFIAPI *)(VOID *context, CHAR16 *str))Output;
ps.Context = spc;
ps.fmt.u.pw = fmt;
//ps.args = args;
@ -303,7 +303,7 @@ Returns:
CHAR16 *
EFIAPI
PoolPrint (
IN CHAR16 *fmt,
IN CONST CHAR16 *fmt,
...
)
/*++
@ -770,12 +770,12 @@ Returns:
return 0;
}
Item.Scratch = AllocateZeroPool (sizeof (CHAR16) * PRINT_ITEM_BUFFER_LEN);
Item.Scratch = (__typeof__(Item.Scratch))AllocateZeroPool (sizeof (CHAR16) * PRINT_ITEM_BUFFER_LEN);
if (NULL == Item.Scratch) {
return EFI_OUT_OF_RESOURCES;
}
Buffer = AllocateZeroPool (sizeof (CHAR16) * PRINT_STRING_LEN);
Buffer = (__typeof__(Buffer))AllocateZeroPool (sizeof (CHAR16) * PRINT_STRING_LEN);
if (NULL == Buffer) {
FreePool (Item.Scratch);
return EFI_OUT_OF_RESOURCES;
@ -820,9 +820,9 @@ Returns:
//
// %% -> %
//
Item.Scratch[0] = '%';
Item.Scratch[1] = 0;
Item.Item.u.pw = Item.Scratch;
Item.Item.u.pw[0] = '%';
Item.Item.u.pw[1] = 0;
break;
case '0':
@ -882,9 +882,9 @@ Returns:
break;
case 'c':
Item.Scratch[0] = (CHAR16) VA_ARG (ps->args, UINTN);
Item.Scratch[1] = 0;
Item.Item.u.pw = Item.Scratch;
Item.Item.u.pw[0] = (CHAR16) VA_ARG (ps->args, UINTN);
Item.Item.u.pw[1] = 0;
break;
case 'l':
@ -896,13 +896,13 @@ Returns:
Item.Pad = '0';
case 'x':
Item.Item.u.pw = Item.Scratch;
//SPrint(Buffer, 64, L"EFI Error №%r", (UINTN)Status);
// ValueToHex (
UnicodeSPrint(
Item.Item.u.pw, 64, L"%x",
Item.Scratch, 64, L"%x",
Item.Long ? VA_ARG (ps->args, UINT64) : VA_ARG (ps->args, UINTN)
);
Item.Item.u.pw = Item.Scratch;
break;
/*
@ -915,13 +915,13 @@ Returns:
break;
*/
case 'd':
Item.Item.u.pw = Item.Scratch;
// ValueToString (
UnicodeSPrint(
Item.Item.u.pw, 64, L"%d",
Item.Scratch, 64, L"%d",
// Item.Comma,
Item.Long ? VA_ARG (ps->args, UINT64) : VA_ARG (ps->args, INTN)
);
Item.Item.u.pw = Item.Scratch;
break;
/*
case 't':
@ -930,9 +930,9 @@ Returns:
break;
*/
case 'r':
Item.Item.u.pw = Item.Scratch;
// StatusToString
UnicodeSPrint(Item.Item.u.pw, 64, L"%r", VA_ARG (ps->args, EFI_STATUS));
UnicodeSPrint(Item.Scratch, 64, L"%r", VA_ARG (ps->args, EFI_STATUS));
Item.Item.u.pw = Item.Scratch;
break;
case 'n':
@ -976,9 +976,9 @@ Returns:
break;
default:
Item.Scratch[0] = '?';
Item.Scratch[1] = 0;
Item.Item.u.pw = Item.Scratch;
Item.Item.u.pw[0] = '?';
Item.Item.u.pw[1] = 0;
break;
}
//
@ -1266,8 +1266,8 @@ SetOutputPause (
EFI_STATUS
EFIAPI
_PoolPrint (
IN VOID *Context,
IN CHAR16 *Buffer
IN POOL_PRINT *Context,
IN CHAR16 *Buffer
)
/*++
@ -1303,7 +1303,7 @@ Returns:
//
newlen += PRINT_STRING_LEN;
spc->Maxlen = newlen;
spc->Str = EfiReallocatePool (
spc->Str = (__typeof__(spc->Str))EfiReallocatePool (
spc->Str,
spc->Len * sizeof (CHAR16),
spc->Maxlen * sizeof (CHAR16)
@ -1926,7 +1926,7 @@ CHAR8* Bytes2HexStr(UINT8 *data, UINTN len)
{
UINTN i, j, b = 0;
CHAR8 *result = (CHAR8*)AllocateZeroPool((len*2)+1);
//CHAR8 *buf = AllocateZeroPool(2);
//CHAR8 *buf = (__typeof__(buf))AllocateZeroPool(2);
for (i = j = 0; i < len; i++) {
b = data[i] >> 4;

View File

@ -118,7 +118,7 @@ VSPrint (
CHAR16 *
EFIAPI
PoolPrint (
IN CHAR16 *fmt,
IN CONST CHAR16 *fmt,
...
);
/*

View File

@ -198,7 +198,7 @@ EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
SelfDeviceHandle = SelfLoadedImage->DeviceHandle;
TmpDevicePath = DevicePathFromHandle (SelfDeviceHandle);
DevicePathSize = GetDevicePathSize (TmpDevicePath);
SelfDevicePath = AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
SelfDevicePath = (__typeof__(SelfDevicePath))AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
CopyMem(SelfDevicePath, TmpDevicePath, DevicePathSize);
DBG("SelfDevicePath=%s @%x\n", FileDevicePathToStr(SelfDevicePath), SelfDeviceHandle);
@ -215,7 +215,7 @@ EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
FilePathAsString[1] = 0;
}
} else {
FilePathAsString = AllocateCopyPool(StrSize(L"\\"), L"\\");
FilePathAsString = (__typeof__(FilePathAsString))AllocateCopyPool(StrSize(L"\\"), L"\\");
}
SelfDirPath = FilePathAsString;
@ -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 = AllocatePool(sizeof(VOID *) * AllocateCount);
*ListPtr = (__typeof__(*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 = AllocatePool(sizeof(VOID *) * AllocateCount);
*ListPtr = (__typeof__(*ListPtr))AllocatePool(sizeof(VOID *) * AllocateCount);
else
*ListPtr = EfiReallocatePool((VOID *)*ListPtr, sizeof(VOID *) * (*ElementCount), sizeof(VOID *) * AllocateCount);
*ListPtr = (__typeof__(*ListPtr))EfiReallocatePool((VOID *)*ListPtr, sizeof(VOID *) * (*ElementCount), sizeof(VOID *) * AllocateCount);
}
(*ListPtr)[*ElementCount] = NewElement;
(*ElementCount)++;
@ -484,7 +484,7 @@ static VOID ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl
BlockSize = Volume->BlockIO->Media->BlockSize;
if (BlockSize > 2048)
return; // our buffer is too small... the bred of thieve of cable
SectorBuffer = AllocateAlignedPages(EFI_SIZE_TO_PAGES (2048), 16); //align to 16 byte?! Poher
SectorBuffer = (__typeof__(SectorBuffer))AllocateAlignedPages(EFI_SIZE_TO_PAGES (2048), 16); //align to 16 byte?! Poher
ZeroMem((CHAR8*)&SectorBuffer[0], 2048);
// look at the boot sector (this is used for both hard disks and El Torito images!)
Status = Volume->BlockIO->ReadBlocks(Volume->BlockIO, Volume->BlockIO->Media->MediaId,
@ -720,7 +720,7 @@ static VOID ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl
if (MbrTable[i].Flags != 0x00 && MbrTable[i].Flags != 0x80)
MbrTableFound = FALSE;
if (MbrTableFound) {
Volume->MbrPartitionTable = AllocatePool(4 * 16);
Volume->MbrPartitionTable = (__typeof__(Volume->MbrPartitionTable))AllocatePool(4 * 16);
CopyMem(Volume->MbrPartitionTable, MbrTable, 4 * 16);
Volume->BootType = BOOTING_BY_MBR;
}
@ -751,7 +751,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
// get device path
DiskDevicePath = DevicePathFromHandle(Volume->DeviceHandle);
DevicePathSize = GetDevicePathSize (DiskDevicePath);
Volume->DevicePath = AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
Volume->DevicePath = (__typeof__(Volume->DevicePath))AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
CopyMem(Volume->DevicePath, DiskDevicePath, DevicePathSize);
Volume->DevicePathString = FileDevicePathToStr(Volume->DevicePath);
@ -1034,7 +1034,7 @@ static VOID ScanExtendedPartition(REFIT_VOLUME *WholeDiskVolume, MBR_PARTITION_I
MBR_PARTITION_INFO *EMbrTable;
ExtBase = MbrEntry->StartLBA;
SectorBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), WholeDiskVolume->BlockIO->Media->IoAlign);
SectorBuffer = (__typeof__(SectorBuffer))AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), WholeDiskVolume->BlockIO->Media->IoAlign);
for (ExtCurrent = ExtBase; ExtCurrent; ExtCurrent = NextExtCurrent) {
// read current EMBR
@ -1060,7 +1060,7 @@ static VOID ScanExtendedPartition(REFIT_VOLUME *WholeDiskVolume, MBR_PARTITION_I
} else {
// found a logical partition
Volume = AllocateZeroPool(sizeof(REFIT_VOLUME));
Volume = (__typeof__(Volume))AllocateZeroPool(sizeof(REFIT_VOLUME));
Volume->DiskKind = WholeDiskVolume->DiskKind;
Volume->IsMbrPartition = TRUE;
Volume->MbrPartitionIndex = LogicalPartitionIndex++;
@ -1110,8 +1110,8 @@ VOID ScanVolumes(VOID)
// first pass: collect information about all handles
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
Volume = AllocateZeroPool(sizeof(REFIT_VOLUME));
Volume->LegacyOS = AllocateZeroPool(sizeof(LEGACY_OS));
Volume = (__typeof__(Volume))AllocateZeroPool(sizeof(REFIT_VOLUME));
Volume->LegacyOS = (__typeof__(Volume->LegacyOS))AllocateZeroPool(sizeof(LEGACY_OS));
Volume->DeviceHandle = Handles[HandleIndex];
if (Volume->DeviceHandle == SelfDeviceHandle) {
SelfVolume = Volume;
@ -1155,7 +1155,7 @@ VOID ScanVolumes(VOID)
// DBG("Found %d volumes\n", VolumesCount);
if (SelfVolume == NULL){
DBG(" WARNING: SelfVolume not found"); //Slice - and what?
SelfVolume = AllocateZeroPool(sizeof(REFIT_VOLUME));
SelfVolume = (__typeof__(SelfVolume))AllocateZeroPool(sizeof(REFIT_VOLUME));
SelfVolume->DeviceHandle = SelfDeviceHandle;
SelfVolume->DevicePath = SelfDevicePath;
SelfVolume->RootDir = SelfRootDir;
@ -1198,8 +1198,8 @@ VOID ScanVolumes(VOID)
if (WholeDiskVolume != NULL && WholeDiskVolume->MbrPartitionTable != NULL) {
// check if this volume is one of the partitions in the table
MbrTable = WholeDiskVolume->MbrPartitionTable;
SectorBuffer1 = AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), 16);
SectorBuffer2 = AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), 16);
SectorBuffer1 = (__typeof__(SectorBuffer1))AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), 16);
SectorBuffer2 = (__typeof__(SectorBuffer2))AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), 16);
for (PartitionIndex = 0; PartitionIndex < 4; PartitionIndex++) {
// check size
@ -1308,7 +1308,7 @@ VOID ReinitVolumes(VOID)
Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, &RemainingDevicePath, &WholeDiskHandle);
if (!EFI_ERROR(Status)) {
Volume->WholeDiskBlockIO = WholeDiskHandle;
Volume->WholeDiskBlockIO = (__typeof__(Volume->WholeDiskBlockIO))WholeDiskHandle;
// get the BlockIO protocol
Status = gBS->HandleProtocol(WholeDiskHandle, &gEfiBlockIoProtocolGuid, (VOID **) &Volume->WholeDiskBlockIO);
if (EFI_ERROR(Status)) {
@ -1419,7 +1419,7 @@ EFI_STATUS DirNextEntry(IN EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry,
// read next directory entry
LastBufferSize = BufferSize = 256;
Buffer = AllocateZeroPool (BufferSize);
Buffer = (__typeof__(Buffer))AllocateZeroPool (BufferSize);
for (IterCount = 0; ; IterCount++) {
Status = Directory->Read(Directory, &BufferSize, Buffer);
if (Status != EFI_BUFFER_TOO_SMALL || IterCount >= 4)
@ -1432,7 +1432,7 @@ EFI_STATUS DirNextEntry(IN EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry,
DBG("Reallocating buffer from %d to %d\n", LastBufferSize, BufferSize);
#endif
}
Buffer = EfiReallocatePool(Buffer, LastBufferSize, BufferSize);
Buffer = (__typeof__(Buffer))EfiReallocatePool(Buffer, LastBufferSize, BufferSize);
LastBufferSize = BufferSize;
}
if (EFI_ERROR(Status)) {
@ -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)
@ -1693,7 +1693,7 @@ BOOLEAN DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt)
Status = gRT->GetVariable (Name, Guid, NULL, &dataSize, data);
if (Status == EFI_BUFFER_TOO_SMALL) {
data = AllocateZeroPool(dataSize);
data = (__typeof__(data))AllocateZeroPool(dataSize);
Status = gRT->GetVariable (Name, Guid, NULL, &dataSize, data);
if (EFI_ERROR(Status)) {
DBG("Can't get %s, size=%d\n", Name, dataSize);

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);
@ -882,7 +882,7 @@ EG_IMAGE * GetSmallHover(IN UINTN Id);
// menu module
//
#define MENU_EXIT_ENTER (1)
#define MENU_EXIT_ENTER ((ACTION)(1))
#define MENU_EXIT_ESCAPE (2)
#define MENU_EXIT_DETAILS (3)
#define MENU_EXIT_TIMEOUT (4)
@ -952,7 +952,7 @@ EfiLibFileSystemVolumeLabelInfo (
);
extern CHAR16 *
EfiStrDuplicate (
IN CHAR16 *Src
IN CONST CHAR16 *Src
);
extern INTN StriCmp (

View File

@ -146,7 +146,7 @@ Add_ListElement(
//
// Create a new list entry
//
CurrentList = AllocateZeroPool (sizeof (REFIT_LIST));
CurrentList = (__typeof__(CurrentList))AllocateZeroPool (sizeof (REFIT_LIST));
if (!CurrentList) {
return EFI_OUT_OF_RESOURCES;

View File

@ -89,6 +89,16 @@ EFI_HANDLE ConsoleInHandle;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL* SimpleTextEx;
EFI_KEY_DATA KeyData;
CHAR8* AudioOutputNames[] = {
"LineOut",
"Speaker",
"Headphones",
"SPDIF",
"Garniture",
"HDMI",
"Other"
};
extern VOID HelpRefit(VOID);
extern VOID AboutRefit(VOID);
extern BOOLEAN BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize, LOADER_ENTRY *Entry);
@ -101,6 +111,7 @@ extern UINTN DsdtsNum;
extern CHAR16 *DsdtsList[];
extern UINTN AudioNum;
extern HDA_OUTPUTS AudioList[20];
extern CHAR8 *AudioOutputNames[];
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
@ -459,7 +470,7 @@ VOID FilterBootPatches(IN LOADER_ENTRY *Entry)
VOID ReadSIPCfg()
{
UINT32 csrCfg = gSettings.CsrActiveConfig & CSR_VALID_FLAGS;
CHAR16 *csrLog = AllocateZeroPool(SVALUE_MAX_SIZE);
CHAR16 *csrLog = (__typeof__(csrLog))AllocateZeroPool(SVALUE_MAX_SIZE);
if (csrCfg & CSR_ALLOW_UNTRUSTED_KEXTS)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, L"CSR_ALLOW_UNTRUSTED_KEXTS");
@ -628,7 +639,7 @@ static VOID StartLoader(IN LOADER_ENTRY *Entry)
/*
Start OSName Mac OS X 10.12 End OSName Start OSVendor Apple Inc. End
*/
InstallerVersion = SearchString(LoadedImage->ImageBase, LoadedImage->ImageSize, "Mac OS X ", 9);
InstallerVersion = SearchString((CHAR8*)LoadedImage->ImageBase, LoadedImage->ImageSize, "Mac OS X ", 9);
if (InstallerVersion != NULL) { // string was found
InstallerVersion += 9; // advance to version location
@ -648,7 +659,7 @@ static VOID StartLoader(IN LOADER_ENTRY *Entry)
if (Entry->OSVersion != NULL) {
FreePool(Entry->OSVersion);
}
Entry->OSVersion = AllocateCopyPool(AsciiStrLen(InstallerVersion)+1, InstallerVersion);
Entry->OSVersion = (__typeof__(Entry->OSVersion))AllocateCopyPool(AsciiStrLen(InstallerVersion)+1, InstallerVersion);
Entry->OSVersion[AsciiStrLen(InstallerVersion)] = '\0';
// DBG("Corrected OSVersion: %a\n", Entry->OSVersion);
}
@ -678,7 +689,7 @@ static VOID StartLoader(IN LOADER_ENTRY *Entry)
FilterKextPatches(Entry);
FilterKernelPatches(Entry);
FilterBootPatches(Entry);
if (LoadedImage && !BooterPatch(LoadedImage->ImageBase, LoadedImage->ImageSize, Entry)) {
if (LoadedImage && !BooterPatch((UINT8*)LoadedImage->ImageBase, LoadedImage->ImageSize, Entry)) {
DBG("Will not patch boot.efi\n");
}
@ -1202,10 +1213,10 @@ static VOID ScanDriverDir(IN CHAR16 *Path, OUT EFI_HANDLE **DriversToConnect, OU
if (DriversArrSize == 0) {
// new array
DriversArrSize = 16;
DriversArr = AllocateZeroPool(sizeof(EFI_HANDLE) * DriversArrSize);
DriversArr = (__typeof__(DriversArr))AllocateZeroPool(sizeof(EFI_HANDLE) * DriversArrSize);
} else if (DriversArrNum + 1 == DriversArrSize) {
// extend array
DriversArr = ReallocatePool(DriversArrSize, DriversArrSize + 16, DriversArr);
DriversArr = (__typeof__(DriversArr))ReallocatePool(DriversArrSize, DriversArrSize + 16, DriversArr);
DriversArrSize += 16;
}
DriversArr[DriversArrNum] = DriverHandle;
@ -1666,13 +1677,13 @@ VOID SetVariablesFromNvram()
// DbgHeader("SetVariablesFromNvram");
tmpString = GetNvramVariable(L"boot-args", &gEfiAppleBootGuid, NULL, &Size);
tmpString = (__typeof__(tmpString))GetNvramVariable(L"boot-args", &gEfiAppleBootGuid, NULL, &Size);
if (tmpString && (Size <= 0x1000) && (Size > 0)) {
DBG("found boot-args in NVRAM:%a, size=%d\n", tmpString, Size);
// use and forget old one
// DeleteNvramVariable(L"boot-args", &gEfiAppleBootGuid);
Size = AsciiStrLen(tmpString); // some EFI implementations include '\0' in Size, and others don't, so update Size to string length
arg = AllocatePool(Size+1);
arg = (__typeof__(arg))AllocatePool(Size+1);
/* if (AsciiStrStr(tmpString, "nvda_drv=1")) { //found substring
gSettings.NvidiaWeb = TRUE;
@ -1728,7 +1739,7 @@ VOID SetVariablesFromNvram()
FreePool(tmpString);
}
tmpString = GetNvramVariable(L"nvda_drv", &gEfiAppleBootGuid, NULL, NULL);
tmpString = (__typeof__(tmpString))GetNvramVariable(L"nvda_drv", &gEfiAppleBootGuid, NULL, NULL);
if (tmpString && AsciiStrCmp(tmpString, "1") == 0) {
gSettings.NvidiaWeb = TRUE;
}
@ -1869,7 +1880,7 @@ UINT8 *APFSContainer_Support(VOID) {
EFI_GUID *TmpUUID = NULL;
//Fill APFSUUIDBank
APFSUUIDBank = AllocateZeroPool(0x10*VolumesCount);
APFSUUIDBank = (__typeof__(APFSUUIDBank))AllocateZeroPool(0x10*VolumesCount);
for (VolumeIndex = 0; VolumeIndex < VolumesCount; VolumeIndex++) {
Volume = Volumes[VolumeIndex];
//Check that current volume - apfs partition
@ -1945,13 +1956,13 @@ VOID SystemVersionInit(VOID)
/*Allocate Memory for systemplists, installplists and recoveryplists********************/
//Check apfs support
if (APFSSupport == TRUE) {
SystemPlists = AllocateZeroPool((2*APFSUUIDBankCounter+3)*sizeof(CHAR16 *));//array of pointers
InstallPlists = AllocateZeroPool((APFSUUIDBankCounter+2)*sizeof(CHAR16 *));//array of pointers
RecoveryPlists = AllocateZeroPool((APFSUUIDBankCounter+2)*sizeof(CHAR16 *));//array of pointers
SystemPlists = (__typeof__(SystemPlists))AllocateZeroPool((2*APFSUUIDBankCounter+3)*sizeof(CHAR16 *));//array of pointers
InstallPlists = (__typeof__(InstallPlists))AllocateZeroPool((APFSUUIDBankCounter+2)*sizeof(CHAR16 *));//array of pointers
RecoveryPlists = (__typeof__(RecoveryPlists))AllocateZeroPool((APFSUUIDBankCounter+2)*sizeof(CHAR16 *));//array of pointers
} else {
SystemPlists = AllocateZeroPool(sizeof(CHAR16 *)*3);
InstallPlists = AllocateZeroPool(sizeof(CHAR16 *)*2);
RecoveryPlists = AllocateZeroPool(sizeof(CHAR16 *)*2);
SystemPlists = (__typeof__(SystemPlists))AllocateZeroPool(sizeof(CHAR16 *)*3);
InstallPlists = (__typeof__(InstallPlists))AllocateZeroPool(sizeof(CHAR16 *)*2);
RecoveryPlists = (__typeof__(RecoveryPlists))AllocateZeroPool(sizeof(CHAR16 *)*2);
}
/* Fill it with standard paths*******************************************/
SystemPlists[0] = SystemVersionPlist;
@ -1967,10 +1978,10 @@ VOID SystemVersionInit(VOID)
//Store UUID from bank
CHAR16 *CurrentUUID = GuidLEToStr((EFI_GUID *)((UINT8 *)APFSUUIDBank+i*0x10));
//Init temp string with system/install/recovery APFS path
CHAR16 *TmpSysPlistPath = AllocateZeroPool(86*sizeof(CHAR16));
CHAR16 *TmpServerPlistPath = AllocateZeroPool(86*sizeof(CHAR16));
CHAR16 *TmpInsPlistPath = AllocateZeroPool(79*sizeof(CHAR16));
CHAR16 *TmpRecPlistPath = AllocateZeroPool(58*sizeof(CHAR16));
CHAR16 *TmpSysPlistPath = (__typeof__(TmpSysPlistPath))AllocateZeroPool(86*sizeof(CHAR16));
CHAR16 *TmpServerPlistPath = (__typeof__(TmpServerPlistPath))AllocateZeroPool(86*sizeof(CHAR16));
CHAR16 *TmpInsPlistPath = (__typeof__(TmpInsPlistPath))AllocateZeroPool(79*sizeof(CHAR16));
CHAR16 *TmpRecPlistPath = (__typeof__(TmpRecPlistPath))AllocateZeroPool(58*sizeof(CHAR16));
StrnCpy(TmpSysPlistPath, APFSSysPlistPath, 85);
StrnCpy(TmpServerPlistPath, APFSServerPlistPath, 85);
StrnCpy(TmpInsPlistPath, APFSInstallPlistPath, 78);
@ -2485,11 +2496,18 @@ RefitMain (IN EFI_HANDLE ImageHandle,
PutNvramPlistToRtVars();
}
}
// log Audio devices in boot-log. Thisis for clients like Clover.app
GetOutputs();
for (i = 0; i < AudioNum; i++) {
if (AudioList[i].Name) {
// Never change this log, otherwise clients will stop interprete the output.
MsgLog("Found Audio Device %s (%a) at index %d\n", AudioList[i].Name, AudioOutputNames[AudioList[i].Device], i);
}
}
if (!GlobalConfig.FastBoot) {
CHAR16 *TmpArgs;
GetOutputs();
if (gThemeNeedInit) {
InitTheme(TRUE, &Now);
gThemeNeedInit = FALSE;
@ -2828,7 +2846,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
Description = PoolPrint(L"Clover start %s at %s", (LoaderName != NULL)?LoaderName:L"legacy", VolName);
OptionalDataSize = NameSize + Name2Size + 4 + 2; //signature + VolNameSize
OptionalData = AllocateZeroPool(OptionalDataSize);
OptionalData = (__typeof__(OptionalData))AllocateZeroPool(OptionalDataSize);
if (OptionalData == NULL) {
break;
}

View File

@ -74,6 +74,7 @@ extern UINTN DsdtsNum;
extern CHAR16 *DsdtsList[];
extern UINTN AudioNum;
extern HDA_OUTPUTS AudioList[20];
extern CHAR8 *AudioOutputNames[];
extern CHAR8 *NonDetected;
extern BOOLEAN GetLegacyLanAddress;
extern UINT8 gLanMac[4][6]; // their MAC addresses
@ -237,16 +238,6 @@ CHAR16* ArgOptional[NUM_OPT] = {
L"nvda_drv=1" //19
};
CHAR8* OutputNames[] = {
"LineOut",
"Speaker",
"Headphones",
"SPDIF",
"Garniture",
"HDMI",
"Other"
};
UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC StyleFunc, IN OUT INTN *DefaultEntryIndex, OUT REFIT_MENU_ENTRY **ChosenEntry);
@ -260,23 +251,23 @@ VOID FillInputs(BOOLEAN New)
InputItemsCount = 0;
if (New) {
InputItems = AllocateZeroPool(130 * sizeof(INPUT_ITEM)); //XXX
InputItems = (__typeof__(InputItems))AllocateZeroPool(130 * sizeof(INPUT_ITEM)); //XXX
}
InputItems[InputItemsCount].ItemType = ASString; //0
//even though Ascii we will keep value as Unicode to convert later
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(SVALUE_MAX_SIZE);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(SVALUE_MAX_SIZE);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, L"%a ", gSettings.BootArgs);
InputItems[InputItemsCount].ItemType = UNIString; //1
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(32);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(32);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 32, L"%s", gSettings.DsdtName); // 1-> 2
InputItems[InputItemsCount].ItemType = UNIString; //2
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(63);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(63);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 63, L"%s", gSettings.BlockKexts);
@ -291,12 +282,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.SlpSmiEnable;
InputItems[InputItemsCount].ItemType = Decimal; //7
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.PLimitDict);
InputItems[InputItemsCount].ItemType = Decimal; //8
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.UnderVoltStep);
InputItems[InputItemsCount].ItemType = BoolValue; //9
@ -311,7 +302,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.EnableISS;
InputItems[InputItemsCount].ItemType = Decimal; //14
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%06d", gSettings.QPI);
InputItems[InputItemsCount].ItemType = BoolValue; //15
@ -320,17 +311,17 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.PatchVBios;
InputItems[InputItemsCount].ItemType = Decimal; //17
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%x", gPlatformFeature);
InputItems[InputItemsCount].ItemType = Hex; //18
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(36);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(36);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 36, L"0x%X", gSettings.BacklightLevel);
InputItems[InputItemsCount].ItemType = Decimal; //19
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
if (gSettings.BusSpeed > 20000) {
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%06d", gSettings.BusSpeed);
@ -341,7 +332,7 @@ VOID FillInputs(BOOLEAN New)
for (i=0; i<NGFX; i++) {
InputItems[InputItemsCount].ItemType = ASString; //20+i*6
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gGraphics[i].Model);
@ -350,7 +341,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.InjectATI;
InputItems[InputItemsCount].ItemType = ASString; //22+6i
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
if (StrLen(gSettings.FBName) > 2) { //fool proof: cfg_name is 3 character or more.
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 20, L"%s", gSettings.FBName);
@ -365,7 +356,7 @@ VOID FillInputs(BOOLEAN New)
AsciiSPrint((CHAR8*)&tmp[2*j], 3, "%02x", gSettings.Dcfg[j]);
}
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(40);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(40);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 40, L"%a", tmp);
@ -375,7 +366,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.InjectIntel;
InputItems[InputItemsCount].ItemType = Hex; //22+6i
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.IgPlatform);
// InputItemsCount += 3;
@ -384,7 +375,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Decimal; //23+6i
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
if (gSettings.VideoPorts > 0) {
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.VideoPorts);
@ -398,13 +389,13 @@ VOID FillInputs(BOOLEAN New)
AsciiSPrint((CHAR8*)&tmp[2*j], 3, "%02x", gSettings.NVCAP[j]);
}
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(84);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(84);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 84, L"%a", tmp);
} else { //ATI and others there will be connectors
InputItems[InputItemsCount].ItemType = Hex; //24+6i
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 20, L"%08lx", gGraphics[i].Connectors);
}
@ -430,13 +421,13 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Decimal; //50
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%06d", gSettings.RefCLK);
InputItems[InputItemsCount].ItemType = ASString; //51 OS version if non-detected
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(SVALUE_MAX_SIZE);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(SVALUE_MAX_SIZE);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, L"%a ", NonDetected);
@ -446,12 +437,12 @@ VOID FillInputs(BOOLEAN New)
//VendorEDID & ProductEDID 53, 54
InputItems[InputItemsCount].ItemType = Decimal; //53
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.VendorEDID);
InputItems[InputItemsCount].ItemType = Decimal; //54
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.ProductEDID);
@ -468,7 +459,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.HDAInjection;
InputItems[InputItemsCount].ItemType = Decimal; // 60
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%d", gSettings.HDALayoutId);
@ -479,13 +470,13 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //62
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(24);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(24);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 24, L"0x%08x", gFwFeatures);
InputItems[InputItemsCount].ItemType = Hex; //63
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(24);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(24);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 24, L"0x%08x", gFwFeaturesMask);
@ -510,12 +501,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Decimal; //70
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.PointerSpeed);
InputItems[InputItemsCount].ItemType = Decimal; //71
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%04d", gSettings.DoubleClickTime);
InputItems[InputItemsCount].ItemType = BoolValue; //72
@ -529,68 +520,68 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //75
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.C3Latency);
InputItems[InputItemsCount].ItemType = Decimal; //76
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%02d", gSettings.EnabledCores);
InputItems[InputItemsCount].ItemType = Decimal; //77
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%02d", gSettings.SavingMode);
InputItems[InputItemsCount].ItemType = ASString; //78
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.ProductName);
InputItems[InputItemsCount].ItemType = ASString; //79
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.VersionNr);
InputItems[InputItemsCount].ItemType = ASString; //80
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.SerialNr);
InputItems[InputItemsCount].ItemType = ASString; //81
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BoardNumber);
InputItems[InputItemsCount].ItemType = ASString; //82
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BoardSerialNumber);
InputItems[InputItemsCount].ItemType = Decimal; //83
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%d", gSettings.BoardType);
InputItems[InputItemsCount].ItemType = ASString; //84
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BoardVersion);
InputItems[InputItemsCount].ItemType = Decimal; //85
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%d", gSettings.ChassisType);
InputItems[InputItemsCount].ItemType = ASString; //86
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.RomVersion);
InputItems[InputItemsCount].ItemType = ASString; //87
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.ReleaseDate);
@ -611,38 +602,38 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //94
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeATI);
InputItems[InputItemsCount].ItemType = Hex; //95
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeNVidia);
InputItems[InputItemsCount].ItemType = Hex; //96
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeIntel);
InputItems[InputItemsCount].ItemType = Hex; //97
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeLAN);
InputItems[InputItemsCount].ItemType = Hex; //98
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeWIFI);
InputItems[InputItemsCount].ItemType = Hex; //99
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeSATA);
InputItems[InputItemsCount].ItemType = Hex; //100
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeXHCI);
InputItems[InputItemsCount].ItemType = CheckBit; //101
@ -652,12 +643,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.DebugDSDT;
InputItems[InputItemsCount].ItemType = Hex; //103
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeIMEI);
InputItems[InputItemsCount].ItemType = Hex; //104
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.KernelAndKextPatches.FakeCPUID);
@ -674,7 +665,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //109
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%01x", gSettings.DualLink);
@ -685,7 +676,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //112
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.IntelMaxValue);
@ -700,12 +691,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = ASString; //117
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.EfiVersion);
InputItems[InputItemsCount].ItemType = ASString; //118
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BooterCfgStr);
@ -713,7 +704,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].IValue = 119;
InputItems[InputItemsCount].ItemType = Decimal; //120
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%04d", DefaultAudioVolume);
@ -1298,7 +1289,7 @@ VOID ApplyInputs(VOID)
if (InputItems[i].Valid) {
EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
UINT8 TmpIndex = OldChosenAudio & 0xFF;
DBG("Chosen output %d:%s_%a\n", OldChosenAudio, AudioList[OldChosenAudio].Name, OutputNames[OldChosenAudio]);
DBG("Chosen output %d:%s_%a\n", OldChosenAudio, AudioList[OldChosenAudio].Name, AudioOutputNames[OldChosenAudio]);
DevicePath = DevicePathFromHandle(AudioList[OldChosenAudio].Handle);
if (DevicePath != NULL) {
@ -1339,7 +1330,7 @@ VOID AddMenuInfo(REFIT_MENU_SCREEN *SubScreen, CHAR16 *Line)
{
REFIT_INPUT_DIALOG *InputBootArgs;
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s", Line);
InputBootArgs->Entry.Tag = TAG_INFO;
InputBootArgs->Item = NULL;
@ -2262,7 +2253,7 @@ static UINTN InputDialog(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Style
(Item->ItemType != RadioSwitch) &&
(Item->ItemType != CheckBit)) {
// Grow Item->SValue to SVALUE_MAX_SIZE if we want to edit a text field
Item->SValue = EfiReallocatePool(Item->SValue, StrSize(Item->SValue), SVALUE_MAX_SIZE);
Item->SValue = (__typeof__(Item->SValue))EfiReallocatePool(Item->SValue, StrSize(Item->SValue), SVALUE_MAX_SIZE);
}
Buffer = Item->SValue;
@ -3098,7 +3089,7 @@ VOID DrawBCSText(IN CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign)
// if the text exceeds the given limit
if (TextLen > MaxTextLen) {
BCSText = AllocatePool((sizeof(CHAR16) * MaxTextLen) + 1);
BCSText = (__typeof__(BCSText))AllocatePool((sizeof(CHAR16) * MaxTextLen) + 1);
// error check, not enough memory
if (!BCSText) {
@ -4014,8 +4005,8 @@ VOID MainMenuVerticalStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State,
textPosY = TimeoutPosY - (int)(GlobalConfig.TileYSpace * GlobalConfig.Scale) - MessageHeight; //message text
row1PosY = textPosY - row1TileSize - (int)(GlobalConfig.TileYSpace * GlobalConfig.Scale) - LayoutTextOffset;
if (!itemPosX) {
itemPosX = AllocatePool(sizeof(UINT64) * Screen->EntryCount);
itemPosY = AllocatePool(sizeof(UINT64) * Screen->EntryCount);
itemPosX = (__typeof__(itemPosX))AllocatePool(sizeof(UINT64) * Screen->EntryCount);
itemPosY = (__typeof__(itemPosY))AllocatePool(sizeof(UINT64) * Screen->EntryCount);
}
row0PosYRunning = row0PosY;
row1PosXRunning = row1PosX;
@ -4187,7 +4178,7 @@ VOID MainMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, IN UINT
FunctextPosY = row1PosY + row1TileSize + (INTN)((GlobalConfig.TileYSpace + LayoutTextOffset) * GlobalConfig.Scale);
if (!itemPosX) {
itemPosX = AllocatePool(sizeof(UINT64) * Screen->EntryCount);
itemPosX = (__typeof__(itemPosX))AllocatePool(sizeof(UINT64) * Screen->EntryCount);
}
row0PosXRunning = row0PosX;
@ -4356,18 +4347,18 @@ 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 = AllocateZeroPool(sizeof(LOADER_ENTRY));
*Entry = (__typeof__(*Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
if (Title) {
(*Entry)->Title = PoolPrint(L"%a", Title);
} else {
(*Entry)->Title = AllocateZeroPool(128);
(*Entry)->Title = (__typeof__((*Entry)->Title))AllocateZeroPool(128);
}
(*Entry)->Image = OptionMenu.TitleImage;
(*Entry)->Tag = TAG_OPTIONS;
(*Entry)->AtClick = AtClick;
// create the submenu
*SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
*SubScreen = (__typeof__(*SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
(*SubScreen)->Title = (*Entry)->Title;
(*SubScreen)->TitleImage = (*Entry)->Image;
(*SubScreen)->ID = ID;
@ -4379,7 +4370,7 @@ VOID AddMenuCheck(REFIT_MENU_SCREEN *SubScreen, CONST CHAR8 *Text, UINTN Bit, IN
{
REFIT_INPUT_DIALOG *InputBootArgs;
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%a", Text);
InputBootArgs->Entry.Tag = TAG_CHECKBIT;
InputBootArgs->Entry.Row = Bit;
@ -4412,7 +4403,7 @@ VOID ModifyTitles(REFIT_MENU_ENTRY *ChosenEntry)
VOID AddMenuItem(REFIT_MENU_SCREEN *SubScreen, INTN Inx, CONST CHAR8 *Title, UINTN Tag, BOOLEAN Cursor)
{
REFIT_INPUT_DIALOG *InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
REFIT_INPUT_DIALOG *InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%a", Title);
InputBootArgs->Entry.Tag = Tag;
@ -4605,7 +4596,7 @@ REFIT_MENU_ENTRY *SubMenuKextPatches()
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KEXTS, "Custom kexts patches->");
for (Index = 0; Index < NrKexts; Index++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%30a", KextPatchesMenu[Index].Label);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4645,7 +4636,7 @@ REFIT_MENU_ENTRY *SubMenuKextBlockInjection(CHAR16* UniSysVer)
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KEXT_INJECT, sysVer);
AddMenuInfoLine(SubScreen, PoolPrint(L"Choose/check kext to disable:"));
}
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s, v.%s", Kext->FileName, Kext->Version);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4656,7 +4647,7 @@ REFIT_MENU_ENTRY *SubMenuKextBlockInjection(CHAR16* UniSysVer)
SIDELOAD_KEXT *plugInKext = Kext->PlugInList;
while (plugInKext) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L" |-- %s, v.%s", plugInKext->FileName, plugInKext->Version);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4809,7 +4800,7 @@ REFIT_MENU_ENTRY *SubMenuKernelPatches()
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KERNELS, "Custom kernel patches->");
for (Index = 0; Index < NrKernels; Index++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%30a", KernelPatchesMenu[Index].Label);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4835,7 +4826,7 @@ REFIT_MENU_ENTRY *SubMenuBootPatches()
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_BOOTER, "Custom booter patches->");
for (Index = 0; Index < NrBoots; Index++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%30a", BootPatchesMenu[Index].Label);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4906,7 +4897,7 @@ REFIT_MENU_ENTRY *SubMenuDropTables()
// sign, DropTable->Signature,
// OTID, DropTable->TableId,
// DropTable->Length, DropTable->Length);
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"Drop \"%4.4a\" \"%8.8a\" %d", sign, OTID, DropTable->Length);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4926,7 +4917,7 @@ REFIT_MENU_ENTRY *SubMenuDropTables()
if (ACPIPatchedAML) {
ACPI_PATCHED_AML *ACPIPatchedAMLTmp = ACPIPatchedAML;
while (ACPIPatchedAMLTmp) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"Drop \"%s\"", ACPIPatchedAMLTmp->FileName);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -5068,7 +5059,7 @@ REFIT_MENU_ENTRY *SubMenuDSDTPatches() //yyyy
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_DSDT_PATCHES, "Custom DSDT patches->");
for (Index = 0; Index < PatchDsdtNum; Index++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%a", gSettings.PatchDsdtLabel[Index]);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -5095,7 +5086,7 @@ REFIT_MENU_ENTRY *SubMenuDsdts()
AddMenuItem(SubScreen, 116, "BIOS.aml", TAG_SWITCH, FALSE);
for (i = 0; i < DsdtsNum; i++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s", DsdtsList[i]);
InputBootArgs->Entry.Tag = TAG_SWITCH;
InputBootArgs->Entry.Row = i + 1;
@ -5147,8 +5138,8 @@ REFIT_MENU_ENTRY *SubMenuAudioPort()
AddMenuItem(SubScreen, 120, "Volume:", TAG_INPUT, TRUE);
for (i = 0; i < AudioNum; i++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s_%a", AudioList[i].Name, OutputNames[AudioList[i].Device]);
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s_%a", AudioList[i].Name, AudioOutputNames[AudioList[i].Device]);
InputBootArgs->Entry.Tag = TAG_SWITCH;
InputBootArgs->Entry.Row = i;
InputBootArgs->Item = &InputItems[119];
@ -5165,7 +5156,7 @@ VOID CreateMenuProps(REFIT_MENU_SCREEN *SubScreen, DEV_PROPERTY *Prop)
{
REFIT_INPUT_DIALOG *InputBootArgs;
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L" key: %a", Prop->Key);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -5277,7 +5268,7 @@ REFIT_MENU_ENTRY *SubMenuThemes()
AddMenuItem(SubScreen, 3, "embedded", TAG_SWITCH, FALSE);
for (i = 0; i < ThemesNum; i++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s", ThemesList[i]);
InputBootArgs->Entry.Tag = TAG_SWITCH;
InputBootArgs->Entry.Row = i + 1;
@ -5412,7 +5403,7 @@ REFIT_MENU_ENTRY *SubMenuConfigs()
AddMenuInfoLine(SubScreen, L"Select a config file:");
for (i = 0; i < ConfigsNum; i++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s", ConfigsList[i]);
InputBootArgs->Entry.Tag = TAG_SWITCH;
InputBootArgs->Entry.Row = i;

View File

@ -229,7 +229,7 @@ VOID TerminateScreen(VOID)
static VOID DrawScreenHeader(IN CHAR16 *Title)
{
UINTN i;
CHAR16* BannerLine = AllocatePool((ConWidth + 1) * sizeof(CHAR16));
CHAR16* BannerLine = (__typeof__(BannerLine))AllocatePool((ConWidth + 1) * sizeof(CHAR16));
BannerLine[ConWidth] = 0;
// clear to black background
@ -1051,7 +1051,7 @@ VOID InitAnime(REFIT_MENU_SCREEN *Screen)
// Copy some settings from Anime into Screen
Screen->FrameTime = Anime->FrameTime;
Screen->Once = Anime->Once;
Screen->Theme = AllocateCopyPool(StrSize(GlobalConfig.Theme), GlobalConfig.Theme);
Screen->Theme = (__typeof__(Screen->Theme))AllocateCopyPool(StrSize(GlobalConfig.Theme), GlobalConfig.Theme);
} /*else {
DBG("Film[0] == NULL\n");
} */
@ -1146,7 +1146,7 @@ static VOID UpdateConsoleVars()
}
// make a buffer for a whole text line
BlankLine = AllocatePool((ConWidth + 1) * sizeof(CHAR16));
BlankLine = (__typeof__(BlankLine))AllocatePool((ConWidth + 1) * sizeof(CHAR16));
for (i = 0; i < ConWidth; i++) {
BlankLine[i] = ' ';