@ -32,7 +32,7 @@ bool IsPowerOfTwo(const size_t alignment) {
}
}
inline
inline
bool IsSectorAligned ( const size_t off ) {
bool IsSectorAligned ( const size_t off ) {
return ( off & ( kSectorSize - 1 ) ) = = 0 ;
return ( off & ( kSectorSize - 1 ) ) = = 0 ;
}
}
@ -194,11 +194,13 @@ WinMmapReadableFile::WinMmapReadableFile(const std::string& fileName,
length_ ( length ) { }
length_ ( length ) { }
WinMmapReadableFile : : ~ WinMmapReadableFile ( ) {
WinMmapReadableFile : : ~ WinMmapReadableFile ( ) {
BOOL ret = : : UnmapViewOfFile ( mapped_region_ ) ;
# ifndef NDEBUG
assert ( ret ) ;
assert ( : : UnmapViewOfFile ( mapped_region_ ) ) ;
assert ( : : CloseHandle ( hMap_ ) ) ;
ret = : : CloseHandle ( hMap_ ) ;
# else
assert ( ret ) ;
: : UnmapViewOfFile ( mapped_region_ ) ;
: : CloseHandle ( hMap_ ) ;
# endif
}
}
Status WinMmapReadableFile : : Read ( uint64_t offset , size_t n , Slice * result ,
Status WinMmapReadableFile : : Read ( uint64_t offset , size_t n , Slice * result ,
@ -745,7 +747,9 @@ Status WinWritableImpl::AppendImpl(const Slice& data) {
assert ( data . size ( ) < std : : numeric_limits < DWORD > : : max ( ) ) ;
assert ( data . size ( ) < std : : numeric_limits < DWORD > : : max ( ) ) ;
# ifndef NDEBUG
uint64_t written = 0 ;
uint64_t written = 0 ;
# endif
if ( file_data_ - > use_direct_io ( ) ) {
if ( file_data_ - > use_direct_io ( ) ) {
@ -765,7 +769,9 @@ Status WinWritableImpl::AppendImpl(const Slice& data) {
" Failed to pwrite for: " + file_data_ - > GetName ( ) , lastError ) ;
" Failed to pwrite for: " + file_data_ - > GetName ( ) , lastError ) ;
}
}
else {
else {
# ifndef NDEBUG
written = ret ;
written = ret ;
# endif
}
}
} else {
} else {
@ -779,7 +785,9 @@ Status WinWritableImpl::AppendImpl(const Slice& data) {
lastError ) ;
lastError ) ;
}
}
else {
else {
# ifndef NDEBUG
written = bytesWritten ;
written = bytesWritten ;
# endif
}
}
}
}