mirror of https://github.com/aria2/aria2
Clang-format and small amends
mapaddr_ is always nullptr in this context, so no need to set to nullptr again.pull/675/head
parent
134c804b86
commit
b64ea39c7b
|
@ -373,7 +373,8 @@ void AbstractDiskWriter::ensureMmapWrite(size_t len, int64_t offset)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (static_cast<uint64_t>(std::numeric_limits<size_t>::max()) < static_cast<uint64_t>(filesize)) {
|
if (static_cast<uint64_t>(std::numeric_limits<size_t>::max()) <
|
||||||
|
static_cast<uint64_t>(filesize)) {
|
||||||
// filesize could overflow in 32bit OS with 64bit off_t type
|
// filesize could overflow in 32bit OS with 64bit off_t type
|
||||||
// the filesize will be truncated if provided as a 32bit size_t
|
// the filesize will be truncated if provided as a 32bit size_t
|
||||||
enableMmap_ = false;
|
enableMmap_ = false;
|
||||||
|
@ -398,11 +399,11 @@ void AbstractDiskWriter::ensureMmapWrite(size_t len, int64_t offset)
|
||||||
errNum = GetLastError();
|
errNum = GetLastError();
|
||||||
}
|
}
|
||||||
#else // !__MINGW32__
|
#else // !__MINGW32__
|
||||||
void * pa = mmap(nullptr, filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0);
|
auto pa =
|
||||||
|
mmap(nullptr, filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0);
|
||||||
|
|
||||||
if (pa == MAP_FAILED) {
|
if (pa == MAP_FAILED) {
|
||||||
errNum = errno;
|
errNum = errno;
|
||||||
mapaddr_ = nullptr;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mapaddr_ = reinterpret_cast<unsigned char*>(pa);
|
mapaddr_ = reinterpret_cast<unsigned char*>(pa);
|
||||||
|
|
Loading…
Reference in New Issue