diff options
author | Yi Kong <yikong@google.com> | 2018-07-16 18:11:34 -0700 |
---|---|---|
committer | Yi Kong <yikong@google.com> | 2018-07-16 18:11:34 -0700 |
commit | e1731a4f2e05f1abb4a45602067708851eaf1e14 (patch) | |
tree | 339c0ce3d3de7d6f5e0fb9bdada9b6210d1d470f /libutils/FileMap.cpp | |
parent | 895acebe946e34d2626716c5c4d7d7f2cc28c39d (diff) | |
download | system_core-e1731a4f2e05f1abb4a45602067708851eaf1e14.tar.gz system_core-e1731a4f2e05f1abb4a45602067708851eaf1e14.tar.bz2 system_core-e1731a4f2e05f1abb4a45602067708851eaf1e14.zip |
[libutils] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I5e89ec8c42151875439d2656475a8739ab9cb7dc
Diffstat (limited to 'libutils/FileMap.cpp')
-rw-r--r-- | libutils/FileMap.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libutils/FileMap.cpp b/libutils/FileMap.cpp index 3c4d81c1e..583c6b9e4 100644 --- a/libutils/FileMap.cpp +++ b/libutils/FileMap.cpp @@ -48,10 +48,10 @@ using namespace android; // Constructor. Create an empty object. FileMap::FileMap(void) - : mFileName(NULL), - mBasePtr(NULL), + : mFileName(nullptr), + mBasePtr(nullptr), mBaseLength(0), - mDataPtr(NULL), + mDataPtr(nullptr), mDataLength(0) #if defined(__MINGW32__) , @@ -69,9 +69,9 @@ FileMap::FileMap(FileMap&& other) , mFileHandle(other.mFileHandle), mFileMapping(other.mFileMapping) #endif { - other.mFileName = NULL; - other.mBasePtr = NULL; - other.mDataPtr = NULL; + other.mFileName = nullptr; + other.mBasePtr = nullptr; + other.mDataPtr = nullptr; #if defined(__MINGW32__) other.mFileHandle = INVALID_HANDLE_VALUE; other.mFileMapping = NULL; @@ -86,9 +86,9 @@ FileMap& FileMap::operator=(FileMap&& other) { mDataOffset = other.mDataOffset; mDataPtr = other.mDataPtr; mDataLength = other.mDataLength; - other.mFileName = NULL; - other.mBasePtr = NULL; - other.mDataPtr = NULL; + other.mFileName = nullptr; + other.mBasePtr = nullptr; + other.mDataPtr = nullptr; #if defined(__MINGW32__) mFileHandle = other.mFileHandle; mFileMapping = other.mFileMapping; @@ -101,7 +101,7 @@ FileMap& FileMap::operator=(FileMap&& other) { // Destructor. FileMap::~FileMap(void) { - if (mFileName != NULL) { + if (mFileName != nullptr) { free(mFileName); } #if defined(__MINGW32__) @@ -196,7 +196,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le if (!readOnly) prot |= PROT_WRITE; - ptr = mmap(NULL, adjLength, prot, flags, fd, adjOffset); + ptr = mmap(nullptr, adjLength, prot, flags, fd, adjOffset); if (ptr == MAP_FAILED) { ALOGE("mmap(%lld,%zu) failed: %s\n", (long long)adjOffset, adjLength, strerror(errno)); @@ -205,7 +205,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le mBasePtr = ptr; #endif // !defined(__MINGW32__) - mFileName = origFileName != NULL ? strdup(origFileName) : NULL; + mFileName = origFileName != nullptr ? strdup(origFileName) : nullptr; mBaseLength = adjLength; mDataOffset = offset; mDataPtr = (char*) mBasePtr + adjust; |