Replace all occurrences of NULL with NULLPTR for unified C and C++ null pointer handling
This commit is contained in:
@@ -61,7 +61,7 @@ AcGetAcpiDescriptionPointer(OUT PVOID *AcpiTable)
|
||||
* Supplies a pointer to the table to start searching from.
|
||||
*
|
||||
* @param AcpiTable
|
||||
* Supplies a pointer to memory area where ACPI table address will be stored, or NULL if not found.
|
||||
* Supplies a pointer to memory area where ACPI table address will be stored, or NULLPTR if not found.
|
||||
*
|
||||
* @return This routine returns a status code.
|
||||
*
|
||||
@@ -81,8 +81,8 @@ AcGetAcpiTable(IN CONST UINT Signature,
|
||||
PACPI_RSDT Rsdt;
|
||||
BOOLEAN Xsdp;
|
||||
|
||||
/* Return NULL address by default if requested table not found */
|
||||
*AcpiTable = NULL;
|
||||
/* Return NULLPTR by default if requested table not found */
|
||||
*AcpiTable = NULLPTR;
|
||||
|
||||
/* Get Root System Description Table Pointer */
|
||||
Status = AcGetAcpiDescriptionPointer((PVOID)&Rsdp);
|
||||
@@ -127,13 +127,13 @@ AcGetAcpiTable(IN CONST UINT Signature,
|
||||
}
|
||||
|
||||
/* Check if previous table provided */
|
||||
if(PreviousTable != NULL)
|
||||
if(PreviousTable != NULLPTR)
|
||||
{
|
||||
/* Check if this is a table previously found */
|
||||
if(TableHeader == (PVOID)PreviousTable)
|
||||
{
|
||||
/* Unset previous table */
|
||||
PreviousTable = NULL;
|
||||
PreviousTable = NULLPTR;
|
||||
}
|
||||
|
||||
/* Skip to next ACPI table */
|
||||
@@ -231,7 +231,7 @@ AcGetRsdpTable(OUT PVOID *AcpiTable)
|
||||
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(RsdpTable, 20))
|
||||
{
|
||||
/* RSDP not found or checksum mismatch */
|
||||
*AcpiTable = NULL;
|
||||
*AcpiTable = NULLPTR;
|
||||
return STATUS_EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ AcGetSMBiosTable(OUT PVOID *SmBiosTable)
|
||||
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(SmBios, SmBios->Length))
|
||||
{
|
||||
/* SMBIOS not found or checksum mismatch */
|
||||
*SmBiosTable = NULL;
|
||||
*SmBiosTable = NULLPTR;
|
||||
return STATUS_EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ AcGetSMBios3Table(OUT PVOID *SmBiosTable)
|
||||
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(SmBios, SmBios->Length))
|
||||
{
|
||||
/* SMBIOS3 not found or checksum mismatch */
|
||||
*SmBiosTable = NULL;
|
||||
*SmBiosTable = NULLPTR;
|
||||
return STATUS_EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ AcGetXsdpTable(OUT PVOID *AcpiTable)
|
||||
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(XsdpTable, 36))
|
||||
{
|
||||
/* XSDP not found or checksum mismatch */
|
||||
*AcpiTable = NULL;
|
||||
*AcpiTable = NULLPTR;
|
||||
return STATUS_EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@@ -98,7 +98,7 @@ BpPlayTune(IN PWCHAR Arguments)
|
||||
Argument = RtlTokenizeWideString(Arguments, L" ", &LastArgument);
|
||||
|
||||
/* Iterate over all arguments */
|
||||
while(Argument != NULL)
|
||||
while(Argument != NULLPTR)
|
||||
{
|
||||
/* Check if tempo, pitch and duration are set */
|
||||
if(Tempo < 0)
|
||||
@@ -137,7 +137,7 @@ BpPlayTune(IN PWCHAR Arguments)
|
||||
}
|
||||
|
||||
/* Get next argument */
|
||||
Argument = RtlTokenizeWideString(NULL, L" ", &LastArgument);
|
||||
Argument = RtlTokenizeWideString(NULLPTR, L" ", &LastArgument);
|
||||
}
|
||||
|
||||
/* Stop emitting beep tone */
|
||||
|
@@ -39,7 +39,7 @@ ChBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
||||
PVOID LoaderData;
|
||||
|
||||
/* Check if image file is provided */
|
||||
if(Parameters->KernelFile == NULL)
|
||||
if(Parameters->KernelFile == NULLPTR)
|
||||
{
|
||||
/* No image filename provided, return error code */
|
||||
XtLdrProtocol->Debug.Print(L"ERROR: No EFI image filename provided\n");
|
||||
|
@@ -185,7 +185,7 @@ FbInitializeDisplay()
|
||||
}
|
||||
|
||||
/* Query current graphics mode */
|
||||
QueryMode = FbpDisplayInfo.Driver.Gop->Mode == NULL ? 0 : FbpDisplayInfo.Driver.Gop->Mode->Mode;
|
||||
QueryMode = FbpDisplayInfo.Driver.Gop->Mode == NULLPTR ? 0 : FbpDisplayInfo.Driver.Gop->Mode->Mode;
|
||||
Status = FbpDisplayInfo.Driver.Gop->QueryMode(FbpDisplayInfo.Driver.Gop, QueryMode, &InfoSize, &GopModeInfo);
|
||||
if(Status == STATUS_EFI_NOT_STARTED)
|
||||
{
|
||||
@@ -357,7 +357,7 @@ FbSetScreenResolution(IN UINT Width,
|
||||
{
|
||||
/* Get mode information */
|
||||
Status = FbpDisplayInfo.Driver.Gop->QueryMode(FbpDisplayInfo.Driver.Gop, Mode, &Size, &ModeInfo);
|
||||
if(Status == STATUS_EFI_SUCCESS && Size >= sizeof(*ModeInfo) && ModeInfo != NULL)
|
||||
if(Status == STATUS_EFI_SUCCESS && Size >= sizeof(*ModeInfo) && ModeInfo != NULLPTR)
|
||||
{
|
||||
/* Check if match found */
|
||||
if(ModeInfo->HorizontalResolution == Width && ModeInfo->VerticalResolution == Height)
|
||||
@@ -441,7 +441,7 @@ FbpFindFramebufferAddress(OUT PEFI_PHYSICAL_ADDRESS Address)
|
||||
|
||||
/* Initialize variables */
|
||||
FramebufAddressLength = 0;
|
||||
Handles = NULL;
|
||||
Handles = NULLPTR;
|
||||
|
||||
/* Locate EFI_PCI_IO_PROTOCOL handles */
|
||||
Status = XtLdrProtocol->Protocol.LocateHandles(&Handles, &HandlesCount, &PciIoGuid);
|
||||
@@ -488,7 +488,7 @@ FbpFindFramebufferAddress(OUT PEFI_PHYSICAL_ADDRESS Address)
|
||||
for(UINT Bars = 0; Bars < 6; Bars++)
|
||||
{
|
||||
/* Get BAR attributes */
|
||||
Status = IoProtocol->GetBarAttributes(IoProtocol, Bars, NULL, (VOID **)&BarInfo);
|
||||
Status = IoProtocol->GetBarAttributes(IoProtocol, Bars, NULLPTR, (VOID **)&BarInfo);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Failed to get BAR attributes, continue with next BAR */
|
||||
|
@@ -400,7 +400,7 @@ PeLoadImage(IN PEFI_FILE_HANDLE FileHandle,
|
||||
}
|
||||
|
||||
/* Store file size and memory type, nullify data and free up memory */
|
||||
ImageData->Data = NULL;
|
||||
ImageData->Data = NULLPTR;
|
||||
ImageData->FileSize = FileInfo->FileSize;
|
||||
ImageData->MemoryType = MemoryType;
|
||||
XtLdrProtocol->Memory.FreePool(FileInfo);
|
||||
|
@@ -260,7 +260,7 @@ XtBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
||||
}
|
||||
|
||||
/* Check device path */
|
||||
if(Parameters->DevicePath == NULL)
|
||||
if(Parameters->DevicePath == NULLPTR)
|
||||
{
|
||||
/* No device path set */
|
||||
XtLdrProtocol->Debug.Print(L"ERROR: No device path provided, unable to boot system\n");
|
||||
@@ -268,7 +268,7 @@ XtBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
||||
}
|
||||
|
||||
/* Check if system path is set */
|
||||
if(Parameters->SystemPath != NULL)
|
||||
if(Parameters->SystemPath != NULLPTR)
|
||||
{
|
||||
/* Make sure system path begins with backslash, the only separator supported by EFI */
|
||||
if(Parameters->SystemPath[0] == '/')
|
||||
@@ -300,7 +300,7 @@ XtBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
||||
}
|
||||
|
||||
/* Check if kernel file is set */
|
||||
if(Parameters->KernelFile == NULL)
|
||||
if(Parameters->KernelFile == NULLPTR)
|
||||
{
|
||||
/* No kernel filename set, fallback to default */
|
||||
XtLdrProtocol->Debug.Print(L"WARNING: No kernel file specified, falling back to defaults\n");
|
||||
@@ -308,7 +308,7 @@ XtBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
||||
}
|
||||
|
||||
/* Check if provided any kernel boot arguments */
|
||||
if(Parameters->Parameters == NULL)
|
||||
if(Parameters->Parameters == NULLPTR)
|
||||
{
|
||||
/* No argument supplied */
|
||||
Parameters->Parameters = L"";
|
||||
@@ -382,7 +382,7 @@ XtpBootSequence(IN PEFI_FILE_HANDLE BootDir,
|
||||
EFI_GUID FrameBufGuid = XT_FRAMEBUFFER_PROTOCOL_GUID;
|
||||
PKERNEL_INITIALIZATION_BLOCK KernelParameters;
|
||||
PXTBL_FRAMEBUFFER_PROTOCOL FrameBufProtocol;
|
||||
PPECOFF_IMAGE_CONTEXT ImageContext = NULL;
|
||||
PPECOFF_IMAGE_CONTEXT ImageContext = NULLPTR;
|
||||
PEFI_LOADED_IMAGE_PROTOCOL ImageProtocol;
|
||||
PVOID VirtualAddress, VirtualMemoryArea;
|
||||
PXT_ENTRY_POINT KernelEntryPoint;
|
||||
@@ -412,7 +412,7 @@ XtpBootSequence(IN PEFI_FILE_HANDLE BootDir,
|
||||
/* Initialize virtual memory mappings */
|
||||
XtLdrProtocol->Memory.InitializePageMap(&PageMap, XtpDeterminePagingLevel(Parameters->Parameters), Size4K);
|
||||
|
||||
Status = XtLdrProtocol->Memory.MapEfiMemory(&PageMap, &VirtualMemoryArea, NULL);
|
||||
Status = XtLdrProtocol->Memory.MapEfiMemory(&PageMap, &VirtualMemoryArea, NULLPTR);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
return Status;
|
||||
@@ -582,7 +582,7 @@ XtpInitializeLoaderBlock(IN PXTBL_PAGE_MAPPING PageMap,
|
||||
/* Set FirmwareInformation block properties */
|
||||
LoaderBlock->FirmwareInformation.FirmwareType = SystemFirmwareEfi;
|
||||
LoaderBlock->FirmwareInformation.EfiFirmware.EfiVersion = 0; //EfiSystemTable->Hdr.Revision;
|
||||
LoaderBlock->FirmwareInformation.EfiFirmware.EfiRuntimeServices = NULL;
|
||||
LoaderBlock->FirmwareInformation.EfiFirmware.EfiRuntimeServices = NULLPTR;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
Reference in New Issue
Block a user