diff --git a/rEFIt_UEFI/Platform/BootOptions.c b/rEFIt_UEFI/Platform/BootOptions.c index 215a4cfd9..2364dc6c0 100644 --- a/rEFIt_UEFI/Platform/BootOptions.c +++ b/rEFIt_UEFI/Platform/BootOptions.c @@ -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; @@ -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; } diff --git a/rEFIt_UEFI/Platform/DataHubCpu.c b/rEFIt_UEFI/Platform/DataHubCpu.c index 215010029..2b71c6b95 100644 --- a/rEFIt_UEFI/Platform/DataHubCpu.c +++ b/rEFIt_UEFI/Platform/DataHubCpu.c @@ -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. diff --git a/rEFIt_UEFI/Platform/Nvram.c b/rEFIt_UEFI/Platform/Nvram.c index ac89dffc8..ea52d24ea 100644 --- a/rEFIt_UEFI/Platform/Nvram.c +++ b/rEFIt_UEFI/Platform/Nvram.c @@ -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); @@ -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 @@ -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) { diff --git a/rEFIt_UEFI/Platform/Settings.c b/rEFIt_UEFI/Platform/Settings.c index 05400a1f1..076457427 100644 --- a/rEFIt_UEFI/Platform/Settings.c +++ b/rEFIt_UEFI/Platform/Settings.c @@ -513,7 +513,7 @@ SetBootCurrent(REFIT_MENU_ENTRY *LoadedEntry) DBG("Can't save BootCurrent, status=%r\n", Status); } //Next step is rotate BootOrder to set BootNum to first place - BootOrder = GetNvramVariable (L"BootOrder", &gEfiGlobalVariableGuid, NULL, &BootOrderSize); + BootOrder = (__typeof__(BootOrder))GetNvramVariable (L"BootOrder", &gEfiGlobalVariableGuid, NULL, &BootOrderSize); if (BootOrder == NULL) { return; } @@ -4302,7 +4302,7 @@ InitTheme( } // Try theme from nvram if (ThemeDict == NULL && UseThemeDefinedInNVRam) { - ChosenTheme = GetNvramVariable(L"Clover.Theme", &gEfiAppleBootGuid, NULL, &Size); + ChosenTheme = (__typeof__(ChosenTheme))GetNvramVariable(L"Clover.Theme", &gEfiAppleBootGuid, NULL, &Size); if (ChosenTheme != NULL) { if (AsciiStrCmp (ChosenTheme, "embedded") == 0) { goto finish; diff --git a/rEFIt_UEFI/Platform/StartupSound.c b/rEFIt_UEFI/Platform/StartupSound.c index 341c948d8..f0cf5f8f0 100644 --- a/rEFIt_UEFI/Platform/StartupSound.c +++ b/rEFIt_UEFI/Platform/StartupSound.c @@ -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; diff --git a/rEFIt_UEFI/Platform/platformdata.c b/rEFIt_UEFI/Platform/platformdata.c index 911dc200f..1a2f95e65 100644 --- a/rEFIt_UEFI/Platform/platformdata.c +++ b/rEFIt_UEFI/Platform/platformdata.c @@ -1359,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); diff --git a/rEFIt_UEFI/refit/main.c b/rEFIt_UEFI/refit/main.c index 55deddbce..2f3a81e68 100644 --- a/rEFIt_UEFI/refit/main.c +++ b/rEFIt_UEFI/refit/main.c @@ -1666,7 +1666,7 @@ 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 @@ -1728,7 +1728,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; }