summaryrefslogtreecommitdiff
path: root/sal/osl/unx/file.cxx
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2017-06-24 13:09:03 +1000
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-25 11:52:41 +0200
commit7c6ccc424eec53cac72a9fc81913f6ad780d91aa (patch)
treeb26a7ebcac0e34943d4c2e02c77462f6782d37ef /sal/osl/unx/file.cxx
parentb376eec5c70b5fced2e2bdc205191381b66948a7 (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/unx/file.cxx')
-rw-r--r--sal/osl/unx/file.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 85ce42135db4..4ed11ec8192f 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -190,7 +190,7 @@ FileHandle_Impl::Allocator::Allocator()
size_t const pagesize = FileHandle_Impl::getpagesize();
if (pagesize != size_t(-1))
{
- m_cache = rtl_cache_create (
+ m_cache = rtl_cache_create (
"osl_file_buffer_cache", pagesize, 0, nullptr, nullptr, nullptr, nullptr, nullptr, 0);
if (m_cache != nullptr)
m_bufsiz = pagesize;
@@ -204,7 +204,8 @@ FileHandle_Impl::Allocator::~Allocator()
void FileHandle_Impl::Allocator::allocate (sal_uInt8 ** ppBuffer, size_t * pnSize)
{
- OSL_PRECOND((nullptr != ppBuffer) && (nullptr != pnSize), "FileHandle_Impl::Allocator::allocate(): contract violation");
+ SAL_WARN_IF((!ppBuffer) || (!pnSize), "sal.osl", "FileHandle_Impl::Allocator::allocate(): contract violation");
+ assert(ppBuffer && pnSize);
if ((ppBuffer != nullptr) && (pnSize != nullptr))
{
*ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache));
@@ -340,11 +341,11 @@ oslFileError FileHandle_Impl::readAt (
size_t 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;
@@ -388,11 +389,11 @@ oslFileError FileHandle_Impl::writeAt (
size_t 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;