diff --git a/port/win/env_win.cc b/port/win/env_win.cc index 1b97f756a..0b51d72f0 100644 --- a/port/win/env_win.cc +++ b/port/win/env_win.cc @@ -1088,19 +1088,14 @@ std::string Env::GenerateUniqueId() { UuidCreateSequential(&uuid); RPC_CSTR rpc_str; -#ifndef NDEBUG - assert(UuidToStringA(&uuid, &rpc_str) == RPC_S_OK); -#else - UuidToStringA(&uuid, &rpc_str); -#endif + auto status = UuidToStringA(&uuid, &rpc_str); + (void)status; + assert(status == RPC_S_OK); result = reinterpret_cast(rpc_str); -#ifndef NDEBUG - assert(RpcStringFreeA(&rpc_str) == RPC_S_OK); -#else - RpcStringFreeA(&rpc_str); -#endif + status = RpcStringFreeA(&rpc_str); + assert(status == RPC_S_OK); return result; } diff --git a/port/win/io_win.cc b/port/win/io_win.cc index 0b0eccfce..bf5d18327 100644 --- a/port/win/io_win.cc +++ b/port/win/io_win.cc @@ -32,7 +32,7 @@ bool IsPowerOfTwo(const size_t alignment) { } inline -bool IsSectorAligned(const size_t off) { +bool IsSectorAligned(const size_t off) { return (off & (kSectorSize - 1)) == 0; } @@ -194,13 +194,12 @@ WinMmapReadableFile::WinMmapReadableFile(const std::string& fileName, length_(length) {} WinMmapReadableFile::~WinMmapReadableFile() { -#ifndef NDEBUG - assert(::UnmapViewOfFile(mapped_region_)); - assert(::CloseHandle(hMap_)); -#else - ::UnmapViewOfFile(mapped_region_); - ::CloseHandle(hMap_); -#endif + BOOL ret = ::UnmapViewOfFile(mapped_region_); + (void)ret; + assert(ret); + + ret = ::CloseHandle(hMap_); + assert(ret); } Status WinMmapReadableFile::Read(uint64_t offset, size_t n, Slice* result, @@ -747,9 +746,8 @@ Status WinWritableImpl::AppendImpl(const Slice& data) { assert(data.size() < std::numeric_limits::max()); -#ifndef NDEBUG uint64_t written = 0; -#endif + (void)written; if (file_data_->use_direct_io()) { @@ -769,9 +767,7 @@ Status WinWritableImpl::AppendImpl(const Slice& data) { "Failed to pwrite for: " + file_data_->GetName(), lastError); } else { -#ifndef NDEBUG written = ret; -#endif } } else { @@ -785,9 +781,7 @@ Status WinWritableImpl::AppendImpl(const Slice& data) { lastError); } else { -#ifndef NDEBUG written = bytesWritten; -#endif } }