Kaydet (Commit) 647382f5 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

These arguments can apparently never be null

Fixing 7b4f4f15 "osl: followup to 7c6ccc42 for
w32/unx file.cxx" for good...

Change-Id: Icedaaa0b0f909d802dbdcf4fdaa40fd338bcbf11
Reviewed-on: https://gerrit.libreoffice.org/39892Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 51bb6892
...@@ -200,12 +200,10 @@ FileHandle_Impl::Allocator::~Allocator() ...@@ -200,12 +200,10 @@ FileHandle_Impl::Allocator::~Allocator()
void FileHandle_Impl::Allocator::allocate(sal_uInt8 **ppBuffer, size_t *pnSize) 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);
if (ppBuffer && pnSize) assert(pnSize != nullptr);
{ *ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache));
*ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache)); *pnSize = m_bufsiz;
*pnSize = m_bufsiz;
}
} }
void FileHandle_Impl::Allocator::deallocate(sal_uInt8 * pBuffer) void FileHandle_Impl::Allocator::deallocate(sal_uInt8 * pBuffer)
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "file_url.hxx" #include "file_url.hxx"
#include "file_error.hxx" #include "file_error.hxx"
#include <cassert>
#include <cstdio> #include <cstdio>
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
...@@ -180,9 +181,9 @@ FileHandle_Impl::Allocator::~Allocator() ...@@ -180,9 +181,9 @@ FileHandle_Impl::Allocator::~Allocator()
void FileHandle_Impl::Allocator::allocate (sal_uInt8 **ppBuffer, SIZE_T * pnSize) 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)); *ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache));
*pnSize = m_bufsiz; *pnSize = m_bufsiz;
} }
...@@ -195,13 +196,12 @@ void FileHandle_Impl::Allocator::deallocate (sal_uInt8 * pBuffer) ...@@ -195,13 +196,12 @@ void FileHandle_Impl::Allocator::deallocate (sal_uInt8 * pBuffer)
FileHandle_Impl::Guard::Guard(LPCRITICAL_SECTION pMutex) FileHandle_Impl::Guard::Guard(LPCRITICAL_SECTION pMutex)
: m_mutex (pMutex) : m_mutex (pMutex)
{ {
SAL_WARN_IF(!(m_mutex), "sal.osl", "FileHandle_Impl::Guard::Guard(): null pointer."); assert(pMutex != nullptr);
::EnterCriticalSection (m_mutex); ::EnterCriticalSection (m_mutex);
} }
FileHandle_Impl::Guard::~Guard() FileHandle_Impl::Guard::~Guard()
{ {
SAL_WARN_IF(!(m_mutex), "sal.osl", "FileHandle_Impl::Guard::~Guard(): null pointer.");
::LeaveCriticalSection (m_mutex); ::LeaveCriticalSection (m_mutex);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment