From 8199d9b75c7d4ea6760d711f1d3c27004476b6fe Mon Sep 17 00:00:00 2001 From: Jief L Date: Sat, 22 Feb 2020 00:22:30 +0300 Subject: [PATCH] Remove unecessary cast. Some cleanups. --- BaseTools/Source/Python/build/build.py | 2 +- MdePkg/Include/Base.h | 3 +-- rEFIt_UEFI/Platform/BdsConnect.cpp | 7 ++----- rEFIt_UEFI/Platform/DataHubCpu.cpp | 2 +- rEFIt_UEFI/Platform/Nvram.cpp | 2 +- rEFIt_UEFI/Platform/Platform.h | 3 --- rEFIt_UEFI/Platform/Settings.cpp | 16 ++++++++-------- rEFIt_UEFI/Platform/smbios.cpp | 12 ++++++------ rEFIt_UEFI/cpp_util/XStringW.cpp | 14 +++++++------- rEFIt_UEFI/cpp_util/XStringW.h | 6 +++--- rEFIt_UEFI/cpp_util/globals_dtor.cpp | 1 - rEFIt_UEFI/libeg/VectorGraphics.cpp | 2 +- rEFIt_UEFI/libeg/image.cpp | 4 ++-- rEFIt_UEFI/refit.inf | 1 + rEFIt_UEFI/refit/main.cpp | 22 ++++++++++------------ rEFIt_UEFI/refit/menu.cpp | 6 +++--- 16 files changed, 47 insertions(+), 56 deletions(-) diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index bcd832c52..6c8798ef9 100755 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -2064,7 +2064,7 @@ class Build(): if Fdf.CurrentFdName and Fdf.CurrentFdName in Fdf.Profile.FdDict: FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName] for FdRegion in FdDict.RegionList: - if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList): + if str(FdRegion.RegionType) == 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList): if int(FdRegion.Offset) % 8 != 0: EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base Address %s must be 8-byte aligned.' % (FdRegion.Offset)) Wa.FdfProfile = Fdf.Profile diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index 33199eb67..d642659f9 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -26,7 +26,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Disable warning when last field of data structure is a zero sized array. // #pragma warning ( disable : 4200 ) -#pragma warning ( disable : 4804 ) #endif /** @@ -40,7 +39,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent @param Size The expected size for the TYPE. **/ -#define VERIFY_SIZE_OF(TYPE, Size) extern UINT8 _VerifySizeof##TYPE[((sizeof(TYPE) == (Size))?1:0) / ((sizeof(TYPE) == (Size))?1:0)] +#define VERIFY_SIZE_OF(TYPE, Size) extern UINT8 _VerifySizeof##TYPE[(unsigned char)((sizeof(TYPE) == (Size))) / (unsigned char)((sizeof(TYPE) == (Size)))] // // Verify that ProcessorBind.h produced UEFI Data Types that are compliant with diff --git a/rEFIt_UEFI/Platform/BdsConnect.cpp b/rEFIt_UEFI/Platform/BdsConnect.cpp index 9bb8a36b9..734ab0562 100644 --- a/rEFIt_UEFI/Platform/BdsConnect.cpp +++ b/rEFIt_UEFI/Platform/BdsConnect.cpp @@ -310,11 +310,8 @@ EFI_STATUS ScanDeviceHandles(EFI_HANDLE ControllerHandle, // Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, HandleCount, HandleBuffer); if (EFI_ERROR (Status)) goto Error; -#ifdef _MSC_VER - *HandleType = static_cast(AllocatePool(*HandleCount * sizeof(UINT32))); -#else - *HandleType = (__typeof__(*HandleType))AllocatePool (*HandleCount * sizeof (UINT32)); -#endif + + *HandleType = (__typeof_am__(*HandleType))AllocatePool (*HandleCount * sizeof (UINT32)); if (*HandleType == NULL) goto Error; for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) { diff --git a/rEFIt_UEFI/Platform/DataHubCpu.cpp b/rEFIt_UEFI/Platform/DataHubCpu.cpp index 42236955e..372e73441 100644 --- a/rEFIt_UEFI/Platform/DataHubCpu.cpp +++ b/rEFIt_UEFI/Platform/DataHubCpu.cpp @@ -267,7 +267,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry) --VariablePtr; } - gRT->SetVariable((CHAR16*)KbdPrevLang, &gEfiAppleBootGuid, Attributes, LangLen, &gSettings.Language); + gRT->SetVariable(KbdPrevLang, &gEfiAppleBootGuid, Attributes, LangLen, &gSettings.Language); } else { FreePool(OldData); } diff --git a/rEFIt_UEFI/Platform/Nvram.cpp b/rEFIt_UEFI/Platform/Nvram.cpp index 1da89d4e4..7650f17f0 100644 --- a/rEFIt_UEFI/Platform/Nvram.cpp +++ b/rEFIt_UEFI/Platform/Nvram.cpp @@ -848,7 +848,7 @@ LoadNvramPlist ( // DBG (" parsing error\n"); // } - FreePool ((VOID*)NvramPtr); + FreePool (NvramPtr); // we will leave nvram.plist loaded and parsed for later processing //FreeTag(gNvramDict); diff --git a/rEFIt_UEFI/Platform/Platform.h b/rEFIt_UEFI/Platform/Platform.h index d0aa5fa03..983c161ea 100755 --- a/rEFIt_UEFI/Platform/Platform.h +++ b/rEFIt_UEFI/Platform/Platform.h @@ -1736,7 +1736,6 @@ extern BOOLEAN gRemapSmBiosIsRequire; // syscl: pass arg //----------------------------------- -//void FreePool(const wchar_t * A); VOID FixBiosDsdt ( @@ -2298,8 +2297,6 @@ iStrLen( UINTN MaxLen ); -//VOID CheckEmptyFB(); //not needed to be global - EFI_STATUS PrepatchSmbios (VOID); diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index e05ab556d..2a4237213 100644 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -408,7 +408,7 @@ ParseLoadOptions ( AsciiConf = (__typeof__(AsciiConf))AllocateCopyPool (TailSize + 1, Start); if (AsciiConf != NULL) { *(AsciiConf + TailSize) = '\0'; - *Conf = (CHAR16*)AllocateZeroPool ((TailSize + 1) * sizeof (CHAR16)); + *Conf = (__typeof_am__(*Conf))AllocateZeroPool ((TailSize + 1) * sizeof (CHAR16)); AsciiStrToUnicodeStrS (AsciiConf, *Conf, TailSize); FreePool (AsciiConf); } @@ -1062,7 +1062,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches, } if (AsciiStrSize(Prop2->string) > 1) { - Patches->ForceKexts[Patches->NrForceKexts] = (CHAR16*)AllocateZeroPool (AsciiStrSize(Prop2->string) * sizeof(CHAR16)); + Patches->ForceKexts[Patches->NrForceKexts] = (__typeof_am__(Patches->ForceKexts[Patches->NrForceKexts]))AllocateZeroPool (AsciiStrSize(Prop2->string) * sizeof(CHAR16)); AsciiStrToUnicodeStrS(Prop2->string, Patches->ForceKexts[Patches->NrForceKexts], 255); DBG (" - [%d]: %s\n", Patches->NrForceKexts, Patches->ForceKexts[Patches->NrForceKexts]); ++Patches->NrForceKexts; @@ -1588,7 +1588,7 @@ MatchOSes *GetStrArraySeparatedByChar(CHAR8 *str, CHAR8 sep) /* comp = (CHAR8 *) AllocatePool(newLen); AsciiStrnCpy(comp, str + startLocation, newLen); comp[newLen] = '\0'; */ - mo->array[i] = (CHAR8*)AllocateCopyPool(newLen, str + startLocation); + mo->array[i] = (__typeof_am__(mo->array[i]))AllocateCopyPool(newLen, str + startLocation); mo->array[i][newLen - 1] = '\0'; } @@ -1596,7 +1596,7 @@ MatchOSes *GetStrArraySeparatedByChar(CHAR8 *str, CHAR8 sep) } else { // DBG("str contains only one component and it is our string %s!\n", str); - mo->array[0] = (CHAR8*)AllocateCopyPool(AsciiStrLen(str)+1, str); + mo->array[0] = (__typeof_am__(mo->array[0]))AllocateCopyPool(AsciiStrLen(str)+1, str); } return mo; } @@ -5051,7 +5051,7 @@ GetUserSettings( for (j = 0; j < PropCount; j++) { Prop3 = NULL; DevProps = *Child; - *Child = (DEV_PROPERTY *)AllocateZeroPool(sizeof(DEV_PROPERTY)); + *Child = (__typeof_am__(*Child))AllocateZeroPool(sizeof(__typeof_am__(*Child))); (*Child)->Next = DevProps; if (EFI_ERROR(GetElement(Prop2, j, &Prop3))) { // Prop3 -> @@ -5628,7 +5628,7 @@ GetUserSettings( } else { AsciiSPrint(DSDTPatchesLabel, 255, " (NoLabel)"); } - gSettings.PatchDsdtLabel[i] = (CHAR8*)AllocateZeroPool(256); + gSettings.PatchDsdtLabel[i] = (__typeof_am__(gSettings.PatchDsdtLabel[i]))AllocateZeroPool(256); AsciiSPrint(gSettings.PatchDsdtLabel[i], 255, "%a", DSDTPatchesLabel); DBG(" (%a)", gSettings.PatchDsdtLabel[i]); @@ -6730,8 +6730,8 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry) Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8); } } - FreePool((VOID*)fileBuffer); - FreePool((VOID*)targetString); + FreePool(fileBuffer); + FreePool(targetString); } } } diff --git a/rEFIt_UEFI/Platform/smbios.cpp b/rEFIt_UEFI/Platform/smbios.cpp index 7303b92c7..a6fcc6958 100644 --- a/rEFIt_UEFI/Platform/smbios.cpp +++ b/rEFIt_UEFI/Platform/smbios.cpp @@ -180,16 +180,16 @@ VOID* GetSmbiosTablesFromHob (VOID) EFI_PHYSICAL_ADDRESS *Table; EFI_PEI_HOB_POINTERS GuidHob; - GuidHob.Raw = (__typeof__(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbiosTableGuid); + GuidHob.Raw = (__typeof_am__(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbiosTableGuid); if (GuidHob.Raw != NULL) { Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid); if (Table != NULL) { return (VOID *)(UINTN)*Table; } } - GuidHob.Raw = (__typeof__(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbios3TableGuid); + GuidHob.Raw = (__typeof_am__(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbios3TableGuid); if (GuidHob.Raw != NULL) { - Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid); + Table = (__typeof_am__(Table))GET_GUID_HOB_DATA (GuidHob.Guid); if (Table != NULL) { return (VOID *)(UINTN)*Table; } @@ -2107,14 +2107,14 @@ VOID FinalizeSmbios() //continue BOOLEAN FoundTable3 = FALSE; // Get Hob List - HobStart.Raw = (__typeof__(HobStart.Raw))GetHobList(); + HobStart.Raw = (__typeof_am__(HobStart.Raw))GetHobList(); if (HobStart.Raw != NULL) { // find SMBIOS in hob for (Index = 0; Index < sizeof (gTableGuidArray) / sizeof (*gTableGuidArray); ++Index) { - GuidHob.Raw = (__typeof__(HobStart.Raw))GetNextGuidHob (gTableGuidArray[Index], HobStart.Raw); + GuidHob.Raw = (__typeof_am__(HobStart.Raw))GetNextGuidHob (gTableGuidArray[Index], HobStart.Raw); if (GuidHob.Raw != NULL) { - Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid); + Table = (__typeof_am__(Table))GET_GUID_HOB_DATA (GuidHob.Guid); //TableLength = GET_GUID_HOB_DATA_SIZE (GuidHob); if (Table != NULL) { if (Index != 0) { diff --git a/rEFIt_UEFI/cpp_util/XStringW.cpp b/rEFIt_UEFI/cpp_util/XStringW.cpp index 29e7948d1..74541306f 100755 --- a/rEFIt_UEFI/cpp_util/XStringW.cpp +++ b/rEFIt_UEFI/cpp_util/XStringW.cpp @@ -72,7 +72,7 @@ XStringW::XStringW(const wchar_t aChar) { DBG("Constructor(const wchar_t aChar)\n"); Init(1); - XStringW::StrnCpy(&aChar, 1); + StrnCpy(&aChar, 1); } //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @@ -132,7 +132,7 @@ void XStringW::StrnCpy(const wchar_t *buf, UINTN len) void XStringW::StrCpy(const wchar_t *buf) { if ( buf && *buf ) { - XStringW::StrnCpy(buf, StrLen(buf)); + StrnCpy(buf, StrLen(buf)); }else{ SetLength(0); /* data()[0]=0 done in SetLength */ } @@ -154,13 +154,13 @@ void XStringW::StrnCat(const wchar_t *buf, UINTN len) inline void XStringW::StrCat(const wchar_t *buf) { if ( buf && *buf ) { - XStringW::StrnCat(buf, StrLen(buf)); + StrnCat(buf, StrLen(buf)); } } void XStringW::StrCat(const XStringW &uneXStringWW) { - XStringW::StrnCat(uneXStringWW.data(), uneXStringWW.length()); + StrnCat(uneXStringWW.data(), uneXStringWW.length()); } void XStringW::Delete(UINTN pos, UINTN count) @@ -183,7 +183,7 @@ void XStringW::Insert(UINTN pos, const XStringW& Str) CopyMem(data(pos), Str.data(), Str.length()*sizeof(wchar_t)); SetLength(length()+Str.length()); }else{ - XStringW::StrCat(Str); + StrCat(Str); } } @@ -245,14 +245,14 @@ XStringW XStringW::basename() const { UINTN idx = RIdxOf(LPATH_SEPARATOR); if ( idx == MAX_UINTN ) return XStringW(); - return XStringW::SubString(idx+1, length()-idx-1); + return SubString(idx+1, length()-idx-1); } XStringW XStringW::dirname() const { UINTN idx = RIdxOf(LPATH_SEPARATOR); if ( idx == MAX_UINTN ) return XStringW(); - return XStringW::SubString(0, idx); + return SubString(0, idx); } XStringW XStringW::SubString(UINTN pos, UINTN count) const diff --git a/rEFIt_UEFI/cpp_util/XStringW.h b/rEFIt_UEFI/cpp_util/XStringW.h index 26573fae8..0848d5213 100755 --- a/rEFIt_UEFI/cpp_util/XStringW.h +++ b/rEFIt_UEFI/cpp_util/XStringW.h @@ -115,11 +115,11 @@ public: void Replace(wchar_t c1, wchar_t c2); XStringW SubStringReplace(wchar_t c1, wchar_t c2); - INTN Compare(const wchar_t* S) const { return StrCmp((const CHAR16*)data(), (const CHAR16*)S) ; } + INTN Compare(const wchar_t* S) const { return StrCmp(data(), S) ; } bool Equal(const wchar_t* S) const { return Compare(S) == 0; }; - bool BeginingEqual(const wchar_t* S) const { return StrnCmp((const CHAR16*)data(), (const CHAR16*)S, StrLen((const CHAR16*)S)); } - bool SubStringEqual(UINTN Pos, const wchar_t* S) const { return StrCmp((const CHAR16*)data(Pos), (const CHAR16*)S); } + bool BeginingEqual(const wchar_t* S) const { return StrnCmp(data(), S, StrLen(S)); } + bool SubStringEqual(UINTN Pos, const wchar_t* S) const { return StrCmp(data(Pos), S); } XStringW basename() const; XStringW dirname() const; diff --git a/rEFIt_UEFI/cpp_util/globals_dtor.cpp b/rEFIt_UEFI/cpp_util/globals_dtor.cpp index 3f1238bed..09631c749 100755 --- a/rEFIt_UEFI/cpp_util/globals_dtor.cpp +++ b/rEFIt_UEFI/cpp_util/globals_dtor.cpp @@ -51,7 +51,6 @@ DBG("atexit(%p, %p, %p, %d)\n", destructor_func, objptr, dso, sizeof(atexit_func #elif defined(_MSC_VER) -extern "C" int atexit(void(__cdecl *)(void)); extern "C" int atexit(void(__cdecl *destructor_func)(void)) { DBG("atexit(%p, %p, %p, %d)\n", destructor_func, objptr, dso, sizeof(atexit_func_entry_t)); diff --git a/rEFIt_UEFI/libeg/VectorGraphics.cpp b/rEFIt_UEFI/libeg/VectorGraphics.cpp index 50206f49f..0f8454815 100644 --- a/rEFIt_UEFI/libeg/VectorGraphics.cpp +++ b/rEFIt_UEFI/libeg/VectorGraphics.cpp @@ -409,7 +409,7 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict, UINT32 bufSize) nsvgDeleteRasterizer(rast); - *dict = (TagPtr)AllocateZeroPool(sizeof(TagStruct)); + *dict = (__typeof_am__(*dict))AllocateZeroPool(sizeof(TagStruct)); (*dict)->type = kTagTypeNone; GlobalConfig.TypeSVG = TRUE; GlobalConfig.ThemeDesignHeight = (int)SVGimage->height; diff --git a/rEFIt_UEFI/libeg/image.cpp b/rEFIt_UEFI/libeg/image.cpp index 635fc6acf..f655af889 100644 --- a/rEFIt_UEFI/libeg/image.cpp +++ b/rEFIt_UEFI/libeg/image.cpp @@ -436,7 +436,7 @@ EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *File // end of folder checking // Delete existing file if it exists - Status = BaseDir->Open(BaseDir, &FileHandle, (CHAR16*)FileName, + Status = BaseDir->Open(BaseDir, &FileHandle, FileName, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0); if (!EFI_ERROR(Status)) { Status = FileHandle->Delete(FileHandle); @@ -449,7 +449,7 @@ EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *File if (CreateNew) { // Write new file - Status = BaseDir->Open(BaseDir, &FileHandle, (CHAR16*)FileName, + Status = BaseDir->Open(BaseDir, &FileHandle, FileName, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0); if (EFI_ERROR(Status)) { // DBG("no write %r\n", Status); diff --git a/rEFIt_UEFI/refit.inf b/rEFIt_UEFI/refit.inf index 4e2393248..0c4f54c9f 100644 --- a/rEFIt_UEFI/refit.inf +++ b/rEFIt_UEFI/refit.inf @@ -169,6 +169,7 @@ cpp_util/globals_dtor.h cpp_util/operatorNewDelete.cpp cpp_util/operatorNewDelete.h + cpp_util/remove_ref.h [Sources.IA32] libeg/ftol.asm | MSFT diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index a4ee6d894..0a1163edd 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -69,8 +69,10 @@ // variables #ifdef FIRMWARE_REVISION -CONST CHAR16 gFirmwareRevisionM[] = FIRMWARE_REVISION; -CONST CHAR16 *gFirmwareRevision = &gFirmwareRevisionM[0]; +//CONST CHAR16 gFirmwareRevisionM[] = FIRMWARE_REVISION; +//CONST CHAR16 *gFirmwareRevision = &gFirmwareRevisionM[0]; +CONST CHAR16 *gFirmwareRevision = FIRMWARE_REVISION; + #else CONST CHAR16 *gFirmwareRevision = NULL; #endif @@ -118,12 +120,12 @@ extern UINTN AudioNum; extern HDA_OUTPUTS AudioList[20]; extern EFI_AUDIO_IO_PROTOCOL *AudioIo; -#ifdef _cplusplus -void FreePool(const wchar_t * A) -{ - FreePool((VOID*)A); -} -#endif +//#ifdef _cplusplus +//void FreePool(const wchar_t * A) +//{ +// FreePool((VOID*)A); +//} +//#endif static EFI_STATUS LoadEFIImageList(IN EFI_DEVICE_PATH **DevicePaths, IN CONST CHAR16 *ImageTitle, @@ -489,11 +491,7 @@ VOID FilterBootPatches(IN LOADER_ENTRY *Entry) VOID ReadSIPCfg() { UINT32 csrCfg = gSettings.CsrActiveConfig & CSR_VALID_FLAGS; -#ifdef _MSC_VER - CHAR16 *csrLog = (decltype(csrLog))AllocateZeroPool(SVALUE_MAX_SIZE); -#else CHAR16 *csrLog = (__typeof__(csrLog))AllocateZeroPool(SVALUE_MAX_SIZE); -#endif if (csrCfg & CSR_ALLOW_UNTRUSTED_KEXTS) StrCatS(csrLog, SVALUE_MAX_SIZE/2, L"CSR_ALLOW_UNTRUSTED_KEXTS"); diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 8539a8212..d20587b9d 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -2829,7 +2829,7 @@ static VOID TextMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, for (i = 0; i < (INTN)Screen->InfoLineCount; i++) { gST->ConOut->SetCursorPosition (gST->ConOut, 3, 4 + i); - gST->ConOut->OutputString (gST->ConOut, (CHAR16*)Screen->InfoLines[i]); + gST->ConOut->OutputString (gST->ConOut, Screen->InfoLines[i]); } } @@ -4352,7 +4352,7 @@ UINTN RunMenu(IN REFIT_MENU_SCREEN *Screen, OUT REFIT_MENU_ENTRY **ChosenEntry) VOID NewEntry(REFIT_MENU_ENTRY **Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title) { //create entry - *Entry = (REFIT_MENU_ENTRY*) AllocateZeroPool(sizeof(LOADER_ENTRY)); + *Entry = (__typeof_am__(*Entry))AllocateZeroPool(sizeof(LOADER_ENTRY)); if (Title) { (*Entry)->Title = PoolPrint(L"%a", Title); } else { @@ -4363,7 +4363,7 @@ VOID NewEntry(REFIT_MENU_ENTRY **Entry, REFIT_MENU_SCREEN **SubScreen, ACTION At (*Entry)->Tag = TAG_OPTIONS; (*Entry)->AtClick = AtClick; // create the submenu - *SubScreen = (REFIT_MENU_SCREEN*)AllocateZeroPool(sizeof(REFIT_MENU_SCREEN)); + *SubScreen = (__typeof_am__(*SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN)); (*SubScreen)->Title = (*Entry)->Title; (*SubScreen)->TitleImage = (*Entry)->Image; (*SubScreen)->ID = ID;