summaryrefslogtreecommitdiff
path: root/core/fxcrt/fxcrt_windows.cpp
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-07 10:46:22 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-07 10:46:23 -0700
commit4997b22f84307521a62838f874928bf56cd3423c (patch)
treead11d99ac0a491ee222e9d0a42ec3b6ad3354e2a /core/fxcrt/fxcrt_windows.cpp
parent0687e76dc259c678b3f29a6608331f07ffd8f1e2 (diff)
downloadpdfium-4997b22f84307521a62838f874928bf56cd3423c.tar.xz
Get rid of NULLs in core/
Review-Url: https://codereview.chromium.org/2032613003
Diffstat (limited to 'core/fxcrt/fxcrt_windows.cpp')
-rw-r--r--core/fxcrt/fxcrt_windows.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/core/fxcrt/fxcrt_windows.cpp b/core/fxcrt/fxcrt_windows.cpp
index d4b4e50c2c..271cc8fda8 100644
--- a/core/fxcrt/fxcrt_windows.cpp
+++ b/core/fxcrt/fxcrt_windows.cpp
@@ -39,7 +39,7 @@ WINBASEAPI BOOL WINAPI SetFilePointerEx(HANDLE hFile,
#ifdef __cplusplus
}
#endif
-CFXCRT_FileAccess_Win64::CFXCRT_FileAccess_Win64() : m_hFile(NULL) {}
+CFXCRT_FileAccess_Win64::CFXCRT_FileAccess_Win64() : m_hFile(nullptr) {}
CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() {
Close();
}
@@ -50,12 +50,11 @@ FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName,
}
uint32_t dwAccess, dwShare, dwCreation;
FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
- m_hFile = ::CreateFileA(fileName.c_str(), dwAccess, dwShare, NULL, dwCreation,
- FILE_ATTRIBUTE_NORMAL, NULL);
- if (m_hFile == INVALID_HANDLE_VALUE) {
- m_hFile = NULL;
- }
- return m_hFile != NULL;
+ m_hFile = ::CreateFileA(fileName.c_str(), dwAccess, dwShare, nullptr,
+ dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr);
+ if (m_hFile == INVALID_HANDLE_VALUE)
+ m_hFile = nullptr;
+ return !!m_hFile;
}
FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName,
uint32_t dwMode) {
@@ -64,19 +63,18 @@ FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName,
}
uint32_t dwAccess, dwShare, dwCreation;
FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
- m_hFile = ::CreateFileW((LPCWSTR)fileName.c_str(), dwAccess, dwShare, NULL,
- dwCreation, FILE_ATTRIBUTE_NORMAL, NULL);
- if (m_hFile == INVALID_HANDLE_VALUE) {
- m_hFile = NULL;
- }
- return m_hFile != NULL;
+ m_hFile = ::CreateFileW((LPCWSTR)fileName.c_str(), dwAccess, dwShare, nullptr,
+ dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr);
+ if (m_hFile == INVALID_HANDLE_VALUE)
+ m_hFile = nullptr;
+ return !!m_hFile;
}
void CFXCRT_FileAccess_Win64::Close() {
if (!m_hFile) {
return;
}
::CloseHandle(m_hFile);
- m_hFile = NULL;
+ m_hFile = nullptr;
}
FX_FILESIZE CFXCRT_FileAccess_Win64::GetSize() const {
if (!m_hFile) {
@@ -116,7 +114,8 @@ size_t CFXCRT_FileAccess_Win64::Read(void* pBuffer, size_t szBuffer) {
return 0;
}
size_t szRead = 0;
- if (!::ReadFile(m_hFile, pBuffer, (DWORD)szBuffer, (LPDWORD)&szRead, NULL)) {
+ if (!::ReadFile(m_hFile, pBuffer, (DWORD)szBuffer, (LPDWORD)&szRead,
+ nullptr)) {
return 0;
}
return szRead;
@@ -127,7 +126,7 @@ size_t CFXCRT_FileAccess_Win64::Write(const void* pBuffer, size_t szBuffer) {
}
size_t szWrite = 0;
if (!::WriteFile(m_hFile, pBuffer, (DWORD)szBuffer, (LPDWORD)&szWrite,
- NULL)) {
+ nullptr)) {
return 0;
}
return szWrite;