Skip to content

Commit e88f561

Browse files
committed
lint.
1 parent 788f2b6 commit e88f561

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/common/io.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#define NOMINMAX
66
#endif // !defined(NOMINMAX)
77

8-
#if defined(__unix__) || defined(__APPLE__) || defined(__MINGW32__)
8+
#if defined(__unix__) || defined(__APPLE__)
99
#include <fcntl.h> // for open, O_RDONLY
1010
#include <sys/mman.h> // for mmap, mmap64, munmap
1111
#include <unistd.h> // for close, getpagesize
12-
#elif defined(_MSC_VER)
12+
#elif defined(_MSC_VER) || defined(__MINGW32__)
1313
#define WIN32_LEAN_AND_MEAN
1414
#include <windows.h>
1515
#endif // defined(__unix__)
@@ -231,7 +231,7 @@ char* PrivateMmapStream::Open(std::string path, bool read_only, std::size_t offs
231231
access = read_only ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS;
232232
std::uint32_t loff = static_cast<std::uint32_t>(view_start);
233233
std::uint32_t hoff = view_start >> 32;
234-
CHECK(map_file) << "Failed to map: " << path << ". " << GetLastError();
234+
CHECK(map_file) << "Failed to map: " << path << ". " << SystemErrorMsg();
235235
ptr = reinterpret_cast<char*>(MapViewOfFile(map_file, access, hoff, loff, view_size));
236236
CHECK_NE(ptr, nullptr) << "Failed to map: " << path << ". " << SystemErrorMsg();
237237
#else
@@ -261,16 +261,16 @@ PrivateMmapStream::~PrivateMmapStream() {
261261
CHECK(handle_);
262262
#if defined(_MSC_VER)
263263
if (p_buffer_) {
264-
CHECK(UnmapViewOfFile(handle_->base_ptr)) "Faled to munmap." << GetLastError();
264+
CHECK(UnmapViewOfFile(handle_->base_ptr)) "Faled to munmap. " << SystemErrorMsg();
265265
}
266266
if (handle_->fd != INVALID_HANDLE_VALUE) {
267-
CHECK(CloseHandle(handle_->fd));
267+
CHECK(CloseHandle(handle_->fd)) << "Failed to close handle. " << SystemErrorMsg();
268268
}
269269
#else
270270
CHECK_NE(munmap(handle_->base_ptr, handle_->base_size), -1)
271-
<< "Faled to munmap." << handle_->path << ". " << strerror(errno);
271+
<< "Faled to munmap." << handle_->path << ". " << SystemErrorMsg();
272272
CHECK_NE(close(handle_->fd), -1)
273-
<< "Faled to close: " << handle_->path << ". " << strerror(errno);
273+
<< "Faled to close: " << handle_->path << ". " << SystemErrorMsg();
274274
#endif
275275
}
276276
} // namespace common

src/common/io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
#include <cstring>
1515
#include <fstream>
16+
#include <memory> // for unique_ptr
1617
#include <string> // for string
17-
#include <utility> // for move
1818

1919
#include "common.h"
2020

0 commit comments

Comments
 (0)