Use nullptr (#1117)

Found with modernize-use-nullptr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-08-17 08:36:22 -07:00 committed by GitHub
parent 29e88cfe66
commit 85c678f587
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 9 deletions

View File

@ -77,7 +77,7 @@ namespace
{
#ifdef _WIN32
if(::wcslen(fileName) == 0)
return 0;
return nullptr;
#else
if(::strlen(fileName) == 0)
return nullptr;

View File

@ -44,10 +44,10 @@ namespace
#ifdef _WIN32
const wstring wstr = msg.toWString();
const int len = WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, NULL, 0, NULL, NULL);
const int len = WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, nullptr, 0, nullptr, nullptr);
if(len != 0) {
std::vector<char> buf(len);
WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, &buf[0], len, NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, &buf[0], len, nullptr, nullptr);
std::cerr << std::string(&buf[0]);
}

View File

@ -52,9 +52,9 @@ namespace
const DWORD access = readOnly ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE);
#if defined (PLATFORM_WINRT)
return CreateFile2(path.wstr().c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
return CreateFile2(path.wstr().c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, nullptr);
#else
return CreateFileW(path.wstr().c_str(), access, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
return CreateFileW(path.wstr().c_str(), access, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
#endif
}
@ -71,7 +71,7 @@ namespace
size_t readFile(FileHandle file, ByteVector &buffer)
{
DWORD length;
if(ReadFile(file, buffer.data(), static_cast<DWORD>(buffer.size()), &length, NULL))
if(ReadFile(file, buffer.data(), static_cast<DWORD>(buffer.size()), &length, nullptr))
return static_cast<size_t>(length);
else
return 0;
@ -80,7 +80,7 @@ namespace
size_t writeFile(FileHandle file, const ByteVector &buffer)
{
DWORD length;
if(WriteFile(file, buffer.data(), static_cast<DWORD>(buffer.size()), &length, NULL))
if(WriteFile(file, buffer.data(), static_cast<DWORD>(buffer.size()), &length, nullptr))
return static_cast<size_t>(length);
else
return 0;
@ -378,7 +378,7 @@ void FileStream::seek(offset_t offset, Position p)
LARGE_INTEGER liOffset;
liOffset.QuadPart = offset;
if(!SetFilePointerEx(d->file, liOffset, NULL, static_cast<DWORD>(p))) {
if(!SetFilePointerEx(d->file, liOffset, nullptr, static_cast<DWORD>(p))) {
debug("FileStream::seek() -- Failed to set the file pointer.");
}

View File

@ -38,7 +38,7 @@ namespace
{
std::wstring ansiToUnicode(const char *str)
{
const int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
const int len = MultiByteToWideChar(CP_ACP, 0, str, -1, nullptr, 0);
if(len == 0)
return std::wstring();