Replace all occurrences of NULL with NULLPTR for unified C and C++ null pointer handling
Some checks failed
Builds / ExectOS (amd64, release) (push) Failing after 24s
Builds / ExectOS (amd64, debug) (push) Successful in 27s
Builds / ExectOS (i686, debug) (push) Successful in 27s
Builds / ExectOS (i686, release) (push) Failing after 25s

This commit is contained in:
2025-09-16 15:59:56 +02:00
parent ba9e5b1b88
commit fabf3a3a5e
46 changed files with 294 additions and 288 deletions

View File

@@ -709,7 +709,7 @@ AR::CpuFunc::StoreSegment(IN USHORT Segment,
: "=r" (*(PUINT)Destination));
break;
default:
Destination = NULL;
Destination = NULLPTR;
break;
}
}

View File

@@ -307,7 +307,7 @@ AR::ProcSup::InitializeProcessorBlock(OUT PKPROCESSOR_BLOCK ProcessorBlock,
ProcessorBlock->Prcb.CurrentThread = &(KE::KThread::GetInitialThread())->ThreadControlBlock;
ProcessorBlock->Prcb.CurrentThread->ApcState.Process = &(KE::KProcess::GetInitialProcess())->ProcessControlBlock;
ProcessorBlock->Prcb.IdleThread = &(KE::KThread::GetInitialThread())->ThreadControlBlock;
ProcessorBlock->Prcb.NextThread = nullptr;
ProcessorBlock->Prcb.NextThread = NULLPTR;
/* Set initial MXCSR register value */
ProcessorBlock->Prcb.MxCsr = INITIAL_MXCSR;

View File

@@ -679,7 +679,7 @@ AR::CpuFunc::StoreSegment(IN USHORT Segment,
: "=r" (*(PUINT)Destination));
break;
default:
Destination = NULL;
Destination = NULLPTR;
break;
}
}

View File

@@ -304,7 +304,7 @@ AR::ProcSup::InitializeProcessorBlock(OUT PKPROCESSOR_BLOCK ProcessorBlock,
ProcessorBlock->Prcb.CurrentThread = &(KE::KThread::GetInitialThread())->ThreadControlBlock;
ProcessorBlock->Prcb.CurrentThread->ApcState.Process = &(KE::KProcess::GetInitialProcess())->ProcessControlBlock;
ProcessorBlock->Prcb.IdleThread = &(KE::KThread::GetInitialThread())->ThreadControlBlock;
ProcessorBlock->Prcb.NextThread = nullptr;
ProcessorBlock->Prcb.NextThread = NULLPTR;
/* Set initial runlevel */
ProcessorBlock->RunLevel = PASSIVE_LEVEL;

View File

@@ -106,7 +106,7 @@ XTFASTCALL
VOID
EX::Rundown::ReInitializeProtection(IN PEX_RUNDOWN_REFERENCE Descriptor)
{
RTL::Atomic::ExchangePointer(&Descriptor->Ptr, NULL);
RTL::Atomic::ExchangePointer(&Descriptor->Ptr, NULLPTR);
}
/**

View File

@@ -71,7 +71,7 @@ HL::Acpi::GetAcpiTable(IN ULONG Signature,
XTSTATUS Status;
/* Assume ACPI table not found */
*AcpiTable = nullptr;
*AcpiTable = NULLPTR;
/* Attempt to get ACPI table from the cache */
Status = QueryAcpiCache(Signature, &Table);
@@ -182,7 +182,7 @@ HL::Acpi::InitializeAcpiSystemDescriptionTable(OUT PACPI_DESCRIPTION_HEADER *Acp
XTSTATUS Status;
/* Assume ACPI table not found */
*AcpiTable = nullptr;
*AcpiTable = NULLPTR;
/* Get ACPI system resource */
Status = KeGetSystemResource(SystemResourceAcpi, &ResourceHeader);
@@ -512,7 +512,7 @@ HL::Acpi::QueryAcpiCache(IN ULONG Signature,
PLIST_ENTRY ListEntry;
/* Initialize variables */
TableHeader = nullptr;
TableHeader = NULLPTR;
/* Iterate through ACPI tables cache list */
ListEntry = CacheList.Flink;
@@ -534,7 +534,7 @@ HL::Acpi::QueryAcpiCache(IN ULONG Signature,
}
/* Check if the requested ACPI table was found in the cache */
if(TableHeader == NULL)
if(TableHeader == NULLPTR)
{
/* ACPI table not found in cache, return error */
return STATUS_NOT_FOUND;
@@ -580,7 +580,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
}
/* Ensure that table header is not set before attempting to find ACPI table */
TableHeader = nullptr;
TableHeader = NULLPTR;
/* Check if DSDT or FACS table requested */
if(Signature == ACPI_DSDT_SIGNATURE || Signature == ACPI_FACS_SIGNATURE)
@@ -634,7 +634,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
}
/* Get table count depending on root table type */
if(Xsdt != NULL)
if(Xsdt != NULLPTR)
{
/* Get table count from XSDT */
TableCount = (Xsdt->Header.Length - sizeof(ACPI_DESCRIPTION_HEADER)) / 8;
@@ -649,7 +649,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
for(TableIndex = 0; TableIndex < TableCount; TableIndex++)
{
/* Check if XSDP or RSDT is used */
if(Xsdt != NULL)
if(Xsdt != NULLPTR)
{
/* Get table header physical address from XSDT */
TableAddress.QuadPart = Xsdt->Tables[TableIndex];
@@ -662,7 +662,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
}
/* Check whether some table is already mapped */
if(TableHeader != NULL)
if(TableHeader != NULLPTR)
{
/* Unmap previous table */
MM::HardwarePool::UnmapHardwareMemory(TableHeader, 2, TRUE);
@@ -689,7 +689,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
if(TableHeader->Signature != Signature)
{
/* ACPI table not found, check if cleanup is needed */
if(TableHeader != NULL)
if(TableHeader != NULLPTR)
{
/* Unmap non-matching ACPI table */
MM::HardwarePool::UnmapHardwareMemory(TableHeader, 2, TRUE);

View File

@@ -19,7 +19,7 @@ PKD_INIT_ROUTINE KD::DebugIo::IoProvidersInitRoutines[KDBG_PROVIDERS_COUNT] = {
};
/* Pointer to DbgPrint() routine */
PKD_PRINT_ROUTINE KD::DebugIo::KdPrint = nullptr;
PKD_PRINT_ROUTINE KD::DebugIo::KdPrint = NULLPTR;
/* List of active I/O providers */
LIST_ENTRY KD::DebugIo::Providers;

View File

@@ -99,7 +99,8 @@ KE::KernelInit::StartKernel(VOID)
CurrentProcess->Quantum = MAXCHAR;
/* Initialize Idle thread */
KThread::InitializeThread(CurrentProcess, CurrentThread, nullptr, nullptr, nullptr, nullptr, nullptr, AR::ProcSup::GetBootStack(), TRUE);
KThread::InitializeThread(CurrentProcess, CurrentThread, NULLPTR, NULLPTR, NULLPTR,
NULLPTR, NULLPTR, AR::ProcSup::GetBootStack(), TRUE);
CurrentThread->NextProcessor = Prcb->CpuNumber;
CurrentThread->Priority = THREAD_HIGH_PRIORITY;
CurrentThread->State = Running;

View File

@@ -99,7 +99,7 @@ KE::KThread::InitializeThreadContext(IN PKTHREAD Thread,
Thread->NpxState = NPX_STATE_UNUSED;
/* Set thread start address */
ThreadFrame->StartFrame.Return = (ULONG64)NULL;
ThreadFrame->StartFrame.Return = (ULONG64)NULLPTR;
}
/* Initialize thread startup information */

View File

@@ -83,7 +83,7 @@ KE::Apc::InitializeApc(IN PKAPC Apc,
{
/* Set context and mode for special APC */
Apc->ApcMode = KernelMode;
Apc->NormalContext = NULL;
Apc->NormalContext = NULLPTR;
}
/* Mark APC as not inserted yet */

View File

@@ -44,7 +44,7 @@ KE::BootInformation::GetFirmwareType(VOID)
* Supplies a pointer to a null-terminated wide string specifying the name of the parameter to search for.
*
* @param Parameter
* Supplies a pointer to a variable that receives a pointer to the matching parameter, or NULL if not found.
* Supplies a pointer to a variable that receives a pointer to the matching parameter, or NULLPTR if not found.
*
* @return This routine returns a status code.
*
@@ -74,7 +74,7 @@ KE::BootInformation::GetKernelParameter(IN PCWSTR ParameterName,
}
/* Assume the requested parameter is not present in the kernel parameters */
*Parameter = nullptr;
*Parameter = NULLPTR;
/* Start searching from the beginning of the list */
SearchStart = InitializationBlock->KernelParameters;

View File

@@ -39,7 +39,7 @@ KE::Dpc::InitializeDpc(IN PKDPC Dpc,
/* Initialize DPC routine and context data */
Dpc->DeferredContext = DpcContext;
Dpc->DeferredRoutine = DpcRoutine;
Dpc->DpcData = NULL;
Dpc->DpcData = NULLPTR;
}
/**
@@ -72,7 +72,7 @@ KE::Dpc::InitializeThreadedDpc(IN PKDPC Dpc,
/* Initialize DPC routine and context data */
Dpc->DeferredContext = DpcContext;
Dpc->DeferredRoutine = DpcRoutine;
Dpc->DpcData = NULL;
Dpc->DpcData = NULLPTR;
}
/**

View File

@@ -99,7 +99,8 @@ KE::KernelInit::StartKernel(VOID)
CurrentProcess->Quantum = MAXCHAR;
/* Initialize Idle thread */
KThread::InitializeThread(CurrentProcess, CurrentThread, nullptr, nullptr, nullptr, nullptr, nullptr, AR::ProcSup::GetBootStack(), TRUE);
KThread::InitializeThread(CurrentProcess, CurrentThread, NULLPTR, NULLPTR, NULLPTR,
NULLPTR, NULLPTR, AR::ProcSup::GetBootStack(), TRUE);
CurrentThread->NextProcessor = Prcb->CpuNumber;
CurrentThread->Priority = THREAD_HIGH_PRIORITY;
CurrentThread->State = Running;

View File

@@ -47,7 +47,7 @@ KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters)
}
/* Initialize boot CPU */
AR::ProcSup::InitializeProcessor(NULL);
AR::ProcSup::InitializeProcessor(NULLPTR);
/* Initialize system resources */
SystemResources::InitializeResources();

View File

@@ -131,7 +131,7 @@ KE::KThread::InitializeThread(IN PKPROCESS Process,
/* Initialize kernel-mode suspend APC */
Apc::InitializeApc(&Thread->SuspendApc, Thread, OriginalApcEnvironment, SuspendNop,
SuspendRundown, SuspendThread, KernelMode, NULL);
SuspendRundown, SuspendThread, KernelMode, NULLPTR);
/* Initialize suspend semaphore */
Semaphore::InitializeSemaphore(&Thread->SuspendSemaphore, 0, 2);
@@ -179,8 +179,8 @@ KE::KThread::InitializeThread(IN PKPROCESS Process,
{
/* Deallocate stack */
MM::KernelPool::FreeKernelStack(Stack, FALSE);
Thread->InitialStack = NULL;
Thread->StackBase = NULL;
Thread->InitialStack = NULLPTR;
Thread->StackBase = NULLPTR;
}
/* Thread initialization failed */

View File

@@ -104,8 +104,8 @@ KE::SystemResources::GetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
/* Check if resource was found */
if(ListEntry == &ResourcesListHead)
{
/* Resource not found, return NULL */
Resource = nullptr;
/* Resource not found, return NULLPTR */
Resource = NULLPTR;
Status = STATUS_NOT_FOUND;
}

View File

@@ -36,7 +36,7 @@ MM::PageMap::ClearPte(PHARDWARE_PTE PtePointer)
* @param Address
* Specifies the virtual address for which to retrieve the corresponding P5E.
*
* @return This routine returns the address of the P5E, or NULL if LA57 is not enabled.
* @return This routine returns the address of the P5E, or NULLPTR if LA57 is not enabled.
*
* @since XT 1.0
*/

View File

@@ -176,13 +176,13 @@ MM::HardwarePool::MapHardwareMemory(IN PHYSICAL_ADDRESS PhysicalAddress,
BaseAddress = HardwareHeapStart;
MappedPages = 0;
ReturnAddress = BaseAddress;
*VirtualAddress = NULL;
*VirtualAddress = NULLPTR;
/* Iterate through all pages */
while(MappedPages < PageCount)
{
/* Check if address overflows */
if(BaseAddress == NULL)
if(BaseAddress == NULLPTR)
{
/* Not enough free pages, return error */
return STATUS_INSUFFICIENT_RESOURCES;

View File

@@ -524,7 +524,7 @@ RTL::Atomic::ExchangePointer(IN PVOID *Address,
* @param Header
* Supplies a pointer to the header of linked list.
*
* @return This routine returns a pointer to the original list, or NULL if the list was already empty.
* @return This routine returns a pointer to the original list, or NULLPTR if the list was already empty.
*
* @since XT 1.0
*/
@@ -532,7 +532,7 @@ XTFASTCALL
PSINGLE_LIST_ENTRY
RTL::Atomic::FlushSingleList(IN PSINGLE_LIST_HEADER Header)
{
return (PSINGLE_LIST_ENTRY)Exchange64((PLONG_PTR)&Header->Alignment, (LONGLONG)NULL);
return (PSINGLE_LIST_ENTRY)Exchange64((PLONG_PTR)&Header->Alignment, (LONGLONG)NULLPTR);
}
/**
@@ -693,7 +693,7 @@ RTL::Atomic::Or64(IN PLONG_PTR Address,
* @param Header
* Supplies a pointer to the header of a single linked list.
*
* @return This routine returns a pointer to the removed element, or NULL if the list was empty.
* @return This routine returns a pointer to the removed element, or NULLPTR if the list was empty.
*
* @since XT 1.0
*/
@@ -712,7 +712,7 @@ RTL::Atomic::PopEntrySingleList(IN PSINGLE_LIST_HEADER Header)
if(!FirstEntry)
{
/* Empty list */
return nullptr;
return NULLPTR;
}
/* Update link */
@@ -737,7 +737,7 @@ RTL::Atomic::PopEntrySingleList(IN PSINGLE_LIST_HEADER Header)
* @param Entry
* Supplies a pointer to entry, that will be inserted into linked list.
*
* @return This routine returns a pointer to original heading, or NULL if the list was originally empty.
* @return This routine returns a pointer to original heading, or NULLPTR if the list was originally empty.
*
* @since XT 1.0
*/

View File

@@ -256,10 +256,10 @@ RtlCompareWideStringInsensitive(IN PCWSTR String1,
* Appends a copy of the source string to the end of the destination string.
*
* @param Destination
* Supplies a pointer to the null-terminated string to append to.
* Supplies a pointer to the NULL-terminated string to append to.
*
* @param Source
* Supplies a pointer to the null-terminated string to copy from.
* Supplies a pointer to the NULL-terminated string to copy from.
*
* @param Count
* Sets a maximum number of characters to copy. If no limit set, appends whole string.
@@ -282,10 +282,10 @@ RtlConcatenateString(OUT PCHAR Destination,
* Appends a copy of the source wide string to the end of the destination wide string.
*
* @param Destination
* Supplies a pointer to the null-terminated wide string to append to.
* Supplies a pointer to the NULL-terminated wide string to append to.
*
* @param Source
* Supplies a pointer to the null-terminated wide string to copy from.
* Supplies a pointer to the NULL-terminated wide string to copy from.
*
* @param Count
* Sets a maximum number of wide characters to copy. If no limit set, appends whole wide string.
@@ -967,12 +967,12 @@ RtlSetMemory(OUT PVOID Destination,
* Calculates the length of a given string.
*
* @param String
* Pointer to the null-terminated string to be examined.
* Pointer to the NULL-terminated string to be examined.
*
* @param MaxLength
* Maximum number of characters to examine. If no limit set, it examines whole string.
*
* @return The length of the null-terminated string.
* @return The length of the NULL-terminated string.
*
* @since: XT 1.0
*/
@@ -1034,13 +1034,13 @@ RtlTestBit(IN PRTL_BITMAP BitMap,
}
/**
* Finds the next token in a null-terminated string.
* Finds the next token in a NULL-terminated string.
*
* @param String
* Pointer to the null-terminated string to tokenize.
* Pointer to the NULL-terminated string to tokenize.
*
* @param Delimiter
* Pointer to the null-terminated string identifying delimiters.
* Pointer to the NULL-terminated string identifying delimiters.
*
* @param SavePtr
* Pointer to an object used to store routine internal state.
@@ -1060,18 +1060,18 @@ RtlTokenizeString(IN PCHAR String,
}
/**
* Finds the next token in a null-terminated wide string.
* Finds the next token in a NULL-terminated wide string.
*
* @param String
* Pointer to the null-terminated wide string to tokenize.
* Pointer to the NULL-terminated wide string to tokenize.
*
* @param Delimiter
* Pointer to the null-terminated wide string identifying delimiters.
* Pointer to the NULL-terminated wide string identifying delimiters.
*
* @param SavePtr
* Pointer to an object used to store routine internal state.
*
* @return Pointer to the beginning of the next token or NULL if there are no more tokens.
* @return Pointer to the beginning of the next token or NULLPTR if there are no more tokens.
*
* @since: XT 1.0
*/
@@ -1161,7 +1161,7 @@ RtlToUpperWideCharacter(IN WCHAR Character)
* Removes certain characters from a beginning of the string.
*
* @param String
* Pointer to the null-terminated string to be trimmed.
* Pointer to the NULL-terminated string to be trimmed.
*
* @return This routine returns a pointer to the left-trimmed string.
*
@@ -1179,7 +1179,7 @@ RtlTrimLeftString(IN PCHAR String)
* Removes certain characters from a beginning of the wide string.
*
* @param String
* Pointer to the null-terminated wide string to be trimmed.
* Pointer to the NULL-terminated wide string to be trimmed.
*
* @return This routine returns a pointer to the left-trimmed wide string.
*
@@ -1197,7 +1197,7 @@ RtlTrimLeftWideString(IN PWCHAR String)
* Removes certain characters from the end of the string.
*
* @param String
* Pointer to the null-terminated string to be trimmed.
* Pointer to the NULL-terminated string to be trimmed.
*
* @return This routine returns a pointer to the right-trimmed string.
*
@@ -1215,7 +1215,7 @@ RtlTrimRightString(IN PCHAR String)
* Removes certain characters from the end of the wide string.
*
* @param String
* Pointer to the null-terminated wide string to be trimmed.
* Pointer to the NULL-terminated wide string to be trimmed.
*
* @return This routine returns a pointer to the right-trimmed wide string.
*
@@ -1233,7 +1233,7 @@ RtlTrimRightWideString(IN PWCHAR String)
* Removes certain characters from the beginning and the end of the string.
*
* @param String
* Pointer to the null-terminated string to be trimmed.
* Pointer to the NULL-terminated string to be trimmed.
*
* @return This routine returns a pointer to the trimmed string.
*
@@ -1251,7 +1251,7 @@ RtlTrimString(IN PCHAR String)
* Removes certain characters from the beginning and the end of the wide string.
*
* @param String
* Pointer to the null-terminated wide string to be trimmed.
* Pointer to the NULL-terminated wide string to be trimmed.
*
* @return This routine returns a pointer to the trimmed wide string.
*
@@ -1269,12 +1269,12 @@ RtlTrimWideString(IN PWCHAR String)
* Calculates the length of a given wide string.
*
* @param String
* Pointer to the null-terminated wide string to be examined.
* Pointer to the NULL-terminated wide string to be examined.
*
* @param MaxLength
* Maximum number of wide characters to examine. If no limit set, it examines whole string.
*
* @return The length of the null-terminated wide string.
* @return The length of the NULL-terminated wide string.
*
* @since: XT 1.0
*/

View File

@@ -107,7 +107,7 @@ XTCDECL
BOOLEAN
RTL::LinkedList::ListEmpty(IN PLIST_ENTRY ListHead)
{
return (BOOLEAN)(((ListHead->Flink == NULL) && (ListHead->Blink == NULL)) || (ListHead->Flink == ListHead));
return (BOOLEAN)(((ListHead->Flink == NULLPTR) && (ListHead->Blink == NULLPTR)) || (ListHead->Flink == ListHead));
}
/**
@@ -127,7 +127,7 @@ RTL::LinkedList::ListLoop(IN PLIST_ENTRY ListHead)
PLIST_ENTRY SlowEntry, FastEntry;
/* Check if list exists */
if(ListHead == NULL)
if(ListHead == NULLPTR)
{
/* No loop in non-existen list */
return FALSE;
@@ -138,7 +138,7 @@ RTL::LinkedList::ListLoop(IN PLIST_ENTRY ListHead)
SlowEntry = ListHead;
/* Iterate through the linked list to find a loop */
while(SlowEntry != NULL && FastEntry != NULL && FastEntry->Flink != NULL)
while(SlowEntry != NULLPTR && FastEntry != NULLPTR && FastEntry->Flink != NULLPTR)
{
/* Move slow and fast pointers by one and two positions accordingly */
SlowEntry = SlowEntry->Flink;

View File

@@ -193,7 +193,7 @@ RTL::Math::Divide64(IN LONGLONG Dividend,
/* Calculate the quotient */
DividendSign ^= DivisorSign;
Quotient = (DivideUnsigned64(UDividend, UDivisor, nullptr) ^ DividendSign) - DividendSign;
Quotient = (DivideUnsigned64(UDividend, UDivisor, NULLPTR) ^ DividendSign) - DividendSign;
/* Make sure a pointer to remainder provided */
if(Remainder)
@@ -284,7 +284,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend,
if(DivisorParts.u.HighPart == 0)
{
/* 32-bit divide operation, check if remainder provided */
if(Remainder != NULL)
if(Remainder != NULLPTR)
{
/* Calculate remainder */
*Remainder = DividendParts.u.LowPart % DivisorParts.u.LowPart;
@@ -295,7 +295,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend,
}
/* 32-bit value divided by a 64-bit value, check if remainder provided */
if(Remainder != NULL)
if(Remainder != NULLPTR)
{
/* Calculate remainder */
*Remainder = DividendParts.u.LowPart;
@@ -318,7 +318,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend,
if(Shift > ((sizeof(ULONG) * BITS_PER_BYTE) - 1))
{
/* Check if remainder provided */
if(Remainder != NULL)
if(Remainder != NULLPTR)
{
/* Calculate remainder */
*Remainder = DividendParts.QuadPart;
@@ -388,7 +388,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend,
if(DividendParts.u.LowPart == 0)
{
/* Check if remainder provided */
if(Remainder != NULL)
if(Remainder != NULLPTR)
{
/* Calculate the remainder */
RemainderParts.u.HighPart = DividendParts.u.HighPart % DivisorParts.u.HighPart;
@@ -407,7 +407,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend,
if(Shift > ((sizeof(ULONG) * BITS_PER_BYTE) - 2))
{
/* Check if remainder provided */
if(Remainder != NULL)
if(Remainder != NULLPTR)
{
/* Calculate the remainder */
*Remainder = DividendParts.QuadPart;
@@ -457,7 +457,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend,
QuotientParts.QuadPart = (QuotientParts.QuadPart << 1) | Carry;
/* Check if remainder provided */
if(Remainder != NULL)
if(Remainder != NULLPTR)
{
/* Calculate the remainder */
*Remainder = RemainderParts.QuadPart;
@@ -497,7 +497,7 @@ RTL::Math::DivideLargeInteger(IN LARGE_INTEGER Dividend,
UDividend = (Dividend.QuadPart ^ DividendSign) - DividendSign;
/* Calculate the quotient */
LargeInt.QuadPart = (DivideUnsigned64(UDividend, Divisor, nullptr) ^ DividendSign) - DividendSign;
LargeInt.QuadPart = (DivideUnsigned64(UDividend, Divisor, NULLPTR) ^ DividendSign) - DividendSign;
/* Make sure a pointer to remainder provided */
if(Remainder)

View File

@@ -132,10 +132,10 @@ RTL::String::CompareStringInsensitive(IN PCSTR String1,
* Appends a copy of the source string to the end of the destination string.
*
* @param Destination
* Supplies a pointer to the null-terminated string to append to.
* Supplies a pointer to the NULL-terminated string to append to.
*
* @param Source
* Supplies a pointer to the null-terminated string to copy from.
* Supplies a pointer to the NULL-terminated string to copy from.
*
* @param Count
* Sets a maximum number of characters to copy. If no limit set, appends whole string.
@@ -164,7 +164,7 @@ RTL::String::ConcatenateString(OUT PCHAR Destination,
/* Copy character-by-character */
do
{
/* Check if NULL terminated character found */
/* Check if NULL-terminated character found */
if((*Destination = *Source++) == '\0')
{
/* Break on '\0' character */
@@ -174,7 +174,7 @@ RTL::String::ConcatenateString(OUT PCHAR Destination,
}
while(--Count != 0);
/* Add NULL termination character to the end of destination string */
/* Add NULL-termination character to the end of destination string */
*Destination = '\0';
}
else
@@ -217,7 +217,7 @@ RTL::String::CopyString(IN PCHAR Destination,
/* Copy source character */
Destination[Index] = Source[Index];
/* Check if NULL terminated character found */
/* Check if NULL-terminated character found */
if(Source[Index] == '\0')
{
/* End of source string reached */
@@ -253,8 +253,8 @@ RTL::String::FindString(IN PCSTR Source,
/* Validate input parameters */
if(!Source || !Search)
{
/* Invalid input parameters, return NULL */
return nullptr;
/* Invalid input parameters, return NULLPTR */
return NULLPTR;
}
/* Check if search string is empty */
@@ -287,8 +287,8 @@ RTL::String::FindString(IN PCSTR Source,
}
}
/* No match found, return NULL */
return nullptr;
/* No match found, return NULLPTR */
return NULLPTR;
}
/**
@@ -315,8 +315,8 @@ RTL::String::FindStringInsensitive(IN PCSTR Source,
/* Validate input parameters */
if(!Source || !Search)
{
/* Invalid input parameters, return NULL */
return nullptr;
/* Invalid input parameters, return NULLPTR */
return NULLPTR;
}
/* Check if search string is empty */
@@ -350,8 +350,8 @@ RTL::String::FindStringInsensitive(IN PCSTR Source,
}
}
/* No match found, return NULL */
return nullptr;
/* No match found, return NULLPTR */
return NULLPTR;
}
/**
@@ -389,12 +389,12 @@ RTL::String::ReverseString(IN OUT PCHAR String,
* Calculates the length of a given string.
*
* @param String
* Pointer to the null-terminated string to be examined.
* Pointer to the NULL-terminated string to be examined.
*
* @param MaxLength
* Maximum number of characters to examine. If no limit set, it examines whole string.
*
* @return The length of the null-terminated string.
* @return The length of the NULL-terminated string.
*
* @since: XT 1.0
*/
@@ -406,7 +406,7 @@ RTL::String::StringLength(IN PCSTR String,
SIZE_T Length;
/* Check if NULL pointer passed */
if(String == NULL)
if(String == NULLPTR)
{
return 0;
}
@@ -453,7 +453,7 @@ RTL::String::StringToWideString(OUT PWCHAR Destination,
SIZE_T Count = Length;
/* Check if NULL pointer passed */
if(Destination == NULL)
if(Destination == NULLPTR)
{
/* No wide characters written */
return 0;
@@ -466,7 +466,7 @@ RTL::String::StringToWideString(OUT PWCHAR Destination,
if((*Destination = *LocalSource) == 0)
{
/* End of string reached */
LocalSource = nullptr;
LocalSource = NULLPTR;
break;
}
@@ -488,13 +488,13 @@ RTL::String::StringToWideString(OUT PWCHAR Destination,
}
/**
* Finds the next token in a null-terminated string.
* Finds the next token in a NULL-terminated string.
*
* @param String
* Pointer to the null-terminated string to tokenize.
* Pointer to the NULL-terminated string to tokenize.
*
* @param Delimiter
* Pointer to the null-terminated string identifying delimiters.
* Pointer to the NULL-terminated string identifying delimiters.
*
* @param SavePtr
* Pointer to an object used to store routine internal state.
@@ -513,18 +513,18 @@ RTL::String::TokenizeString(IN PCHAR String,
CHAR Char, SpanChar;
/* Check if there is anything to tokenize */
if(String == NULL && (String = *SavePtr) == NULL)
if(String == NULLPTR && (String = *SavePtr) == NULLPTR)
{
/* Empty string given */
return nullptr;
return NULLPTR;
}
/* Check non-delimiter characters */
Char = *String++;
if(Char == '\0')
{
*SavePtr = nullptr;
return nullptr;
*SavePtr = NULLPTR;
return NULLPTR;
}
Token = String - 1;
@@ -542,7 +542,7 @@ RTL::String::TokenizeString(IN PCHAR String,
if(Char == '\0')
{
/* End of string reached, no more tokens */
String = nullptr;
String = NULLPTR;
}
else
{
@@ -615,7 +615,7 @@ RTL::String::ToUpperCharacter(IN CHAR Character)
* Removes certain characters from a beginning of the string.
*
* @param String
* Pointer to the null-terminated string to be trimmed.
* Pointer to the NULL-terminated string to be trimmed.
*
* @return This routine returns a pointer to the left-trimmed string.
*
@@ -645,7 +645,7 @@ RTL::String::TrimLeftString(IN PCHAR String)
* Removes certain characters from the end of the string.
*
* @param String
* Pointer to the null-terminated string to be trimmed.
* Pointer to the NULL-terminated string to be trimmed.
*
* @return This routine returns a pointer to the right-trimmed string.
*
@@ -678,7 +678,7 @@ RTL::String::TrimRightString(IN PCHAR String)
* Removes certain characters from the beginning and the end of the string.
*
* @param String
* Pointer to the null-terminated string to be trimmed.
* Pointer to the NULL-terminated string to be trimmed.
*
* @return This routine returns a pointer to the trimmed string.
*

View File

@@ -132,10 +132,10 @@ RTL::WideString::CompareWideStringInsensitive(IN PCWSTR String1,
* Appends a copy of the source wide string to the end of the destination wide string.
*
* @param Destination
* Supplies a pointer to the null-terminated wide string to append to.
* Supplies a pointer to the NULL-terminated wide string to append to.
*
* @param Source
* Supplies a pointer to the null-terminated wide string to copy from.
* Supplies a pointer to the NULL-terminated wide string to copy from.
*
* @param Count
* Sets a maximum number of wide characters to copy. If no limit set, appends whole wide string.
@@ -253,8 +253,8 @@ RTL::WideString::FindWideString(IN PCWSTR Source,
/* Validate input parameters */
if(!Source || !Search)
{
/* Invalid input parameters, return NULL */
return nullptr;
/* Invalid input parameters, return NULLPTR */
return NULLPTR;
}
/* Check if search string is empty */
@@ -287,8 +287,8 @@ RTL::WideString::FindWideString(IN PCWSTR Source,
}
}
/* No match found, return NULL */
return nullptr;
/* No match found, return NULLPTR */
return NULLPTR;
}
/**
@@ -315,8 +315,8 @@ RTL::WideString::FindWideStringInsensitive(IN PCWSTR Source,
/* Validate input parameters */
if(!Source || !Search)
{
/* Invalid input parameters, return NULL */
return nullptr;
/* Invalid input parameters, return NULLPTR */
return NULLPTR;
}
/* Check if search string is empty */
@@ -350,8 +350,8 @@ RTL::WideString::FindWideStringInsensitive(IN PCWSTR Source,
}
}
/* No match found, return NULL */
return nullptr;
/* No match found, return NULLPTR */
return NULLPTR;
}
/**
@@ -835,8 +835,8 @@ RTL::WideString::FormatArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
GuidArg = VA_ARG(*ArgumentList, PGUID);
}
/* Make sure a pointer to GUID is not NULL */
if(GuidArg != NULL)
/* Make sure a pointer to GUID is not NULL pointer */
if(GuidArg != NULLPTR)
{
/* Check if using uppercase format */
if(FormatProperties.Flags & PFL_UPPERCASE)
@@ -967,7 +967,7 @@ RTL::WideString::FormatArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
if(Specifier == L'n')
{
/* Make sure, that integer pointer parameter is not NULL */
if(IntArg != (UINT_PTR)NULL)
if(IntArg != (UINT_PTR)NULLPTR)
{
/* Store number of characters written in integer pointer parameter */
*((PINT)(UINT_PTR)IntArg) = Context->CharactersWritten;
@@ -1031,7 +1031,7 @@ RTL::WideString::FormatArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
}
/* Make sure a pointer to ANSI_STRING is not NULL */
if(AnsiStrArg != NULL)
if(AnsiStrArg != NULLPTR)
{
/* Write formatted ANSI string value */
Status = WriteStringValue(Context, &FormatProperties, AnsiStrArg->Buffer, AnsiStrArg->Length);
@@ -1053,7 +1053,7 @@ RTL::WideString::FormatArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
}
/* Make sure a pointer to UNICODE_STRING is not NULL */
if(UnicodeStrArg != NULL)
if(UnicodeStrArg != NULLPTR)
{
/* Write formatted UNICODE string value */
Status = WriteValue(Context, &FormatProperties, UnicodeStrArg->Buffer, UnicodeStrArg->Length);
@@ -1097,14 +1097,14 @@ RTL::WideString::FormatWideString(IN PRTL_PRINT_CONTEXT Context,
ULONG Index;
/* Make sure, that we have valid context and write routine */
if(Context == NULL || Context->WriteWideCharacter == NULL)
if(Context == NULLPTR || Context->WriteWideCharacter == NULLPTR)
{
/* Invalid context or write routine not set */
return FALSE;
}
/* Check format string pointer */
if(Format == NULL)
if(Format == NULLPTR)
{
/* Write null string */
Format = L"(null)";
@@ -1278,18 +1278,18 @@ RTL::WideString::ReverseWideString(IN OUT PWCHAR String,
}
/**
* Finds the next token in a null-terminated wide string.
* Finds the next token in a NULL-terminated wide string.
*
* @param String
* Pointer to the null-terminated wide string to tokenize.
* Pointer to the NULL-terminated wide string to tokenize.
*
* @param Delimiter
* Pointer to the null-terminated wide string identifying delimiters.
* Pointer to the NULL-terminated wide string identifying delimiters.
*
* @param SavePtr
* Pointer to an object used to store routine internal state.
*
* @return Pointer to the beginning of the next token or NULL if there are no more tokens.
* @return Pointer to the beginning of the next token or NULLPTR if there are no more tokens.
*
* @since: XT 1.0
*/
@@ -1303,18 +1303,18 @@ RTL::WideString::TokenizeWideString(IN PWCHAR String,
WCHAR Char, SpanChar;
/* Check if there is anything to tokenize */
if(String == NULL && (String = *SavePtr) == NULL)
if(String == NULLPTR && (String = *SavePtr) == NULLPTR)
{
/* Empty string given */
return nullptr;
return NULLPTR;
}
/* Check non-delimiter characters */
Char = *String++;
if(Char == L'\0')
{
*SavePtr = nullptr;
return nullptr;
*SavePtr = NULLPTR;
return NULLPTR;
}
Token = String - 1;
@@ -1332,7 +1332,7 @@ RTL::WideString::TokenizeWideString(IN PWCHAR String,
if(Char == L'\0')
{
/* End of string reached, no more tokens */
String = nullptr;
String = NULLPTR;
}
else
{
@@ -1405,7 +1405,7 @@ RTL::WideString::ToUpperWideCharacter(IN WCHAR Character)
* Removes certain characters from a beginning of the wide string.
*
* @param String
* Pointer to the null-terminated wide string to be trimmed.
* Pointer to the NULL-terminated wide string to be trimmed.
*
* @return This routine returns a pointer to the left-trimmed wide string.
*
@@ -1435,7 +1435,7 @@ RTL::WideString::TrimLeftWideString(IN PWCHAR String)
* Removes certain characters from the end of the wide string.
*
* @param String
* Pointer to the null-terminated wide string to be trimmed.
* Pointer to the NULL-terminated wide string to be trimmed.
*
* @return This routine returns a pointer to the right-trimmed wide string.
*
@@ -1469,7 +1469,7 @@ RTL::WideString::TrimRightWideString(IN PWCHAR String)
* Removes certain characters from the beginning and the end of the wide string.
*
* @param String
* Pointer to the null-terminated wide string to be trimmed.
* Pointer to the NULL-terminated wide string to be trimmed.
*
* @return This routine returns a pointer to the trimmed wide string.
*
@@ -1486,12 +1486,12 @@ RTL::WideString::TrimWideString(IN PWCHAR String)
* Calculates the length of a given wide string.
*
* @param String
* Pointer to the null-terminated wide string to be examined.
* Pointer to the NULL-terminated wide string to be examined.
*
* @param MaxLength
* Maximum number of wide characters to examine. If no limit set, it examines whole string.
*
* @return The length of the null-terminated wide string.
* @return The length of the NULL-terminated wide string.
*
* @since: XT 1.0
*/
@@ -1503,7 +1503,7 @@ RTL::WideString::WideStringLength(IN PCWSTR String,
SIZE_T Length;
/* Check if NULL pointer passed */
if(String == NULL)
if(String == NULLPTR)
{
return 0;
}
@@ -2876,7 +2876,7 @@ RTL::WideString::WriteStringValue(PRTL_PRINT_CONTEXT Context,
XTSTATUS Status;
/* Check for NULL string */
if(String == NULL)
if(String == NULLPTR)
{
/* Print '(null)' instead */
String = "(null)";
@@ -2985,7 +2985,7 @@ RTL::WideString::WriteValue(PRTL_PRINT_CONTEXT Context,
XTSTATUS Status;
/* Check for NULL string */
if(String == NULL)
if(String == NULLPTR)
{
/* Print '(null)' instead */
String = L"(null)";