diff options
author | 2014-05-14 13:26:14 +0000 | |
---|---|---|
committer | 2014-05-14 13:26:14 +0000 | |
commit | 28b896fe35b0345d4e92e5044974f05f2ee443ec (patch) | |
tree | 42d03927e5a04005a43d141f88fe307e8a818211 /native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp | |
parent | ee59975420c975040c0b990812201d3ddb4aacc5 (diff) | |
parent | 2dc8e36f8eaa598371a67dc58757a096a75374a3 (diff) | |
download | latinime-28b896fe35b0345d4e92e5044974f05f2ee443ec.tar.gz latinime-28b896fe35b0345d4e92e5044974f05f2ee443ec.tar.xz latinime-28b896fe35b0345d4e92e5044974f05f2ee443ec.zip |
Merge "Use nullptr instead of MmappedBufferPtr(nullptr)."
Diffstat (limited to 'native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp')
-rw-r--r-- | native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp b/native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp index d3e0c237f..4a126ff85 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp @@ -33,7 +33,7 @@ namespace latinime { const int mmapFd = open(path, O_RDONLY); if (mmapFd < 0) { AKLOGE("DICT: Can't open the source. path=%s errno=%d", path, errno); - return MmappedBufferPtr(nullptr); + return nullptr; } const int pagesize = sysconf(_SC_PAGESIZE); const int offset = bufferOffset % pagesize; @@ -45,13 +45,13 @@ namespace latinime { if (mmappedBuffer == MAP_FAILED) { AKLOGE("DICT: Can't mmap dictionary. errno=%d", errno); close(mmapFd); - return MmappedBufferPtr(nullptr); + return nullptr; } uint8_t *const buffer = static_cast<uint8_t *>(mmappedBuffer) + offset; if (!buffer) { AKLOGE("DICT: buffer is null"); close(mmapFd); - return MmappedBufferPtr(nullptr); + return nullptr; } return MmappedBufferPtr(new MmappedBuffer(buffer, bufferSize, mmappedBuffer, alignedSize, mmapFd, isUpdatable)); @@ -61,7 +61,7 @@ namespace latinime { const char *const path, const bool isUpdatable) { const int fileSize = FileUtils::getFileSize(path); if (fileSize == -1) { - return MmappedBufferPtr(nullptr); + return nullptr; } else if (fileSize == 0) { return MmappedBufferPtr(new MmappedBuffer(isUpdatable)); } else { @@ -76,7 +76,7 @@ namespace latinime { const int filePathLength = snprintf(filePath, filePathBufferSize, "%s%s", dirPath, fileName); if (filePathLength >= filePathBufferSize) { - return MmappedBufferPtr(nullptr); + return nullptr; } return openBuffer(filePath, isUpdatable); } |