diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-06-24 13:09:03 +1000 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-25 11:52:41 +0200 |
commit | 7c6ccc424eec53cac72a9fc81913f6ad780d91aa (patch) | |
tree | b26a7ebcac0e34943d4c2e02c77462f6782d37ef /sal/osl/w32/file.cxx | |
parent | b376eec5c70b5fced2e2bdc205191381b66948a7 (diff) |
tdf#43157 - osl: convert OSL_PRECONDs in w32 & unx file.cxx
Change-Id: Ic914d9240e6b06b7e6550fe311fd69e310254bd5
Reviewed-on: https://gerrit.libreoffice.org/39197
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/osl/w32/file.cxx')
-rw-r--r-- | sal/osl/w32/file.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx index b00b15daf18d..a2fea0ce1fed 100644 --- a/sal/osl/w32/file.cxx +++ b/sal/osl/w32/file.cxx @@ -178,10 +178,12 @@ FileHandle_Impl::Allocator::~Allocator() m_cache = nullptr; } -void FileHandle_Impl::Allocator::allocate (sal_uInt8 ** ppBuffer, SIZE_T * pnSize) +void FileHandle_Impl::Allocator::allocate (sal_uInt8 **ppBuffer, SIZE_T * pnSize) { - OSL_PRECOND((ppBuffer) && (pnSize), "FileHandle_Impl::Allocator::allocate(): contract violation"); + SAL_WARN_IF((!ppBuffer) || (!pnSize), "sal.osl", "FileHandle_Impl::Allocator::allocate(): contract violation"); + assert((ppBuffer) && (pnSize)); *ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache)); + *pnSize = m_bufsiz; } @@ -194,13 +196,15 @@ void FileHandle_Impl::Allocator::deallocate (sal_uInt8 * pBuffer) FileHandle_Impl::Guard::Guard(LPCRITICAL_SECTION pMutex) : m_mutex (pMutex) { - OSL_PRECOND (m_mutex != nullptr, "FileHandle_Impl::Guard::Guard(): null pointer."); + SAL_WARN_IF(!(m_mutex), "sal.osl", "FileHandle_Impl::Guard::Guard(): null pointer."); + assert(m_mutex); ::EnterCriticalSection (m_mutex); } FileHandle_Impl::Guard::~Guard() { - OSL_PRECOND (m_mutex != nullptr, "FileHandle_Impl::Guard::~Guard(): null pointer."); + SAL_WARN_IF(!(m_mutex), "sal.osl", "FileHandle_Impl::Guard::~Guard(): null pointer."); + assert(m_mutex); ::LeaveCriticalSection (m_mutex); } @@ -285,11 +289,11 @@ oslFileError FileHandle_Impl::readAt( DWORD nBytesRequested, sal_uInt64 * pBytesRead) { - OSL_PRECOND(m_state & STATE_SEEKABLE, "FileHandle_Impl::readAt(): not seekable"); + SAL_WARN_IF(!(m_state & STATE_SEEKABLE), "sal.osl", "FileHandle_Impl::readAt(): not seekable"); if (!(m_state & STATE_SEEKABLE)) return osl_File_E_SPIPE; - OSL_PRECOND(m_state & STATE_READABLE, "FileHandle_Impl::readAt(): not readable"); + SAL_WARN_IF(!(m_state & STATE_READABLE), "sal.osl", "FileHandle_Impl::readAt(): not readable"); if (!(m_state & STATE_READABLE)) return osl_File_E_BADF; @@ -316,11 +320,11 @@ oslFileError FileHandle_Impl::writeAt( DWORD nBytesToWrite, sal_uInt64 * pBytesWritten) { - OSL_PRECOND(m_state & STATE_SEEKABLE, "FileHandle_Impl::writeAt(): not seekable"); + SAL_WARN_IF(!(m_state & STATE_SEEKABLE), "sal.osl", "FileHandle_Impl::writeAt(): not seekable"); if (!(m_state & STATE_SEEKABLE)) return osl_File_E_SPIPE; - OSL_PRECOND(m_state & STATE_WRITEABLE, "FileHandle_Impl::writeAt(): not writeable"); + SAL_WARN_IF(!(m_state & STATE_WRITEABLE), "sal.osl", "FileHandle_Impl::writeAt(): not writeable"); if (!(m_state & STATE_WRITEABLE)) return osl_File_E_BADF; |