[Libreoffice-commits] core.git: sal/osl

Stephan Bergmann sbergman at redhat.com
Thu Jul 13 11:35:15 UTC 2017


 sal/osl/unx/file.cxx |   10 ++++------
 sal/osl/w32/file.cxx |    8 ++++----
 2 files changed, 8 insertions(+), 10 deletions(-)

New commits:
commit 647382f52351a7586459201203e399956b763527
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jul 13 12:03:03 2017 +0200

    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 <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

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 <cassert>
 #include <cstdio>
 #include <algorithm>
 #include <limits>
@@ -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);
 }
 


More information about the Libreoffice-commits mailing list