Skip to content

Commit d3ac74b

Browse files
Replace more NULLs with nullptr (#1556)
1 parent b42e6ca commit d3ac74b

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

Examples/IcmpFileTransfer/IcmpFileTransfer-pitcher.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ void usleep(__int64 usec)
3636
LARGE_INTEGER ft;
3737

3838
ft.QuadPart = -(10 * usec); // Convert to 100 nanosecond interval, negative value indicates relative time
39-
39+
// NULL is used instead of nullptr for Windows APIs. Check
40+
// https://devblogs.microsoft.com/oldnewthing/20180307-00/?p=98175
4041
timer = CreateWaitableTimer(NULL, TRUE, NULL);
4142
if (timer == nullptr)
4243
{
4344
throw std::runtime_error("Could not create waitable timer with error: " + std::to_string(GetLastError()));
4445
}
46+
// NULL is used instead of nullptr for Windows APIs. Check
47+
// https://devblogs.microsoft.com/oldnewthing/20180307-00/?p=98175
4548
SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0);
4649
WaitForSingleObject(timer, INFINITE);
4750
CloseHandle(timer);

Pcap++/src/RawSocketDevice.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ namespace pcpp
430430

431431
int n = 1;
432432
DWORD dwBytesRet;
433+
// NULL is used instead of nullptr for Windows APIs. Check
434+
// https://devblogs.microsoft.com/oldnewthing/20180307-00/?p=98175
433435
if (WSAIoctl(fd, SIO_RCVALL, &n, sizeof(n), NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR)
434436
{
435437
PCPP_LOG_ERROR("Call to WSAIotcl(" << std::hex << SIO_RCVALL << ") failed with error code "

Tests/Fuzzers/FuzzTarget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ static std::string tmpFile;
1010
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
1111
{
1212
if (tmpName.empty())
13-
tmpName = tmpnam(NULL);
13+
tmpName = tmpnam(nullptr);
1414

1515
if (tmpFile.empty())
1616
tmpFile = tmpName + FILE_EXT;
@@ -59,7 +59,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
5959
pcpp::Packet parsedPacket(&rawPacket);
6060
parsedPacket.toString();
6161
auto layer = parsedPacket.getFirstLayer();
62-
while (layer != NULL)
62+
while (layer != nullptr)
6363
{
6464
std::cout << layer->toString() << std::endl;
6565
layer->getHeaderLen();

Tests/Fuzzers/FuzzWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static int writes = 0;
1313
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
1414
{
1515
if (tmpName.empty())
16-
tmpName = tmpnam(NULL);
16+
tmpName = tmpnam(nullptr);
1717

1818
if (tmpFile.empty())
1919
tmpFile = tmpName + FILE_EXT;

0 commit comments

Comments
 (0)