[Libreoffice-commits] core.git: sc/source

Stephan Bergmann sbergman at redhat.com
Tue Oct 6 03:48:41 PDT 2015


 sc/source/filter/excel/xestring.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit e41fad1944139e5129f8a99e07c08655f50136f7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 6 12:44:38 2015 +0200

    Replace some OSL_ENSURE with assert
    
    ...at least in the !IsEmpty() branch of XclExpString::WriteBufferToMem, pnMem is
    used in ways were being null would be undefined behavior, and the only place
    from which WriteHeaderToMem, WriteBufferToMem are called (lclAppend in
    sc/source/filter/excel/xeformula.cxx, via WriteToMem) will always pass a non-
    null argument anyway
    
    Change-Id: Iabc06b53ae6059246c5c222d43a789c6bdc440d5

diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx
index 1404e18..6076f5a 100644
--- a/sc/source/filter/excel/xestring.cxx
+++ b/sc/source/filter/excel/xestring.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <algorithm>
+#include <cassert>
 
 #include <osl/diagnose.h>
 #include "xlstyle.hxx"
@@ -335,7 +336,7 @@ void XclExpString::Write( XclExpStream& rStrm ) const
 
 void XclExpString::WriteHeaderToMem( sal_uInt8* pnMem ) const
 {
-    OSL_ENSURE( pnMem, "XclExpString::WriteHeaderToMem - no memory to write to" );
+    assert(pnMem);
     OSL_ENSURE( !mb8BitLen || (mnLen < 256), "XclExpString::WriteHeaderToMem - string too long" );
     OSL_ENSURE( !IsWriteFormats(), "XclExpString::WriteHeaderToMem - formatted strings not supported" );
     // length
@@ -356,7 +357,7 @@ void XclExpString::WriteHeaderToMem( sal_uInt8* pnMem ) const
 
 void XclExpString::WriteBufferToMem( sal_uInt8* pnMem ) const
 {
-    OSL_ENSURE( pnMem, "XclExpString::WriteBufferToMem - no memory to write to" );
+    assert(pnMem);
     if( !IsEmpty() )
     {
         if( mbIsBiff8 )


More information about the Libreoffice-commits mailing list