From 647382f52351a7586459201203e399956b763527 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 13 Jul 2017 12:03:03 +0200 Subject: These arguments can apparently never be null Fixing 7b4f4f15971047664fa278fff96b959d53b272b3 "osl: followup to 7c6ccc42 for w32/unx file.cxx" for good... Change-Id: Icedaaa0b0f909d802dbdcf4fdaa40fd338bcbf11 Reviewed-on: https://gerrit.libreoffice.org/39892 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sal/osl/unx/file.cxx | 10 ++++------ sal/osl/w32/file.cxx | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'sal') diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index f95651dab55a..17790211b02d 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -200,12 +200,10 @@ FileHandle_Impl::Allocator::~Allocator() void FileHandle_Impl::Allocator::allocate(sal_uInt8 **ppBuffer, size_t *pnSize) { - SAL_WARN_IF((!ppBuffer) || (!pnSize), "sal.osl", "FileHandle_Impl::Allocator::allocate(): contract violation"); - if (ppBuffer && pnSize) - { - *ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache)); - *pnSize = m_bufsiz; - } + assert(ppBuffer != nullptr); + assert(pnSize != nullptr); + *ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache)); + *pnSize = m_bufsiz; } void FileHandle_Impl::Allocator::deallocate(sal_uInt8 * pBuffer) diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx index f49076ed4970..3738683402af 100644 --- a/sal/osl/w32/file.cxx +++ b/sal/osl/w32/file.cxx @@ -31,6 +31,7 @@ #include "file_url.hxx" #include "file_error.hxx" +#include #include #include #include @@ -180,9 +181,9 @@ FileHandle_Impl::Allocator::~Allocator() void FileHandle_Impl::Allocator::allocate (sal_uInt8 **ppBuffer, SIZE_T * pnSize) { - SAL_WARN_IF((!ppBuffer) || (!pnSize), "sal.osl", "FileHandle_Impl::Allocator::allocate(): contract violation"); + assert(ppBuffer != nullptr); + assert(pnSize != nullptr); *ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache)); - *pnSize = m_bufsiz; } @@ -195,13 +196,12 @@ void FileHandle_Impl::Allocator::deallocate (sal_uInt8 * pBuffer) FileHandle_Impl::Guard::Guard(LPCRITICAL_SECTION pMutex) : m_mutex (pMutex) { - SAL_WARN_IF(!(m_mutex), "sal.osl", "FileHandle_Impl::Guard::Guard(): null pointer."); + assert(pMutex != nullptr); ::EnterCriticalSection (m_mutex); } FileHandle_Impl::Guard::~Guard() { - SAL_WARN_IF(!(m_mutex), "sal.osl", "FileHandle_Impl::Guard::~Guard(): null pointer."); ::LeaveCriticalSection (m_mutex); } -- cgit