diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-11-20 07:44:43 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-11-20 08:34:06 +0100 |
commit | 186990395d72a803dd4a9f087fe4e05f49e69ad2 (patch) | |
tree | 44c28d013c85b708a418e6e6b5ce71907fde7285 /sal/rtl | |
parent | 8cbfce51ff659581a9602b22c36b9af1c69e51f8 (diff) |
Clean up Mac _imp_getProcessLocale
Introduces OUStringBuffer::appendUninitialized.
Change-Id: If225ec4d798e0df91cad60130e3f22ee26b88abb
Diffstat (limited to 'sal/rtl')
-rw-r--r-- | sal/rtl/math.cxx | 2 | ||||
-rw-r--r-- | sal/rtl/ustrbuf.cxx | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx index e030b9ca0c33..ac5a79387617 100644 --- a/sal/rtl/math.cxx +++ b/sal/rtl/math.cxx @@ -31,6 +31,7 @@ #include "sal/types.h" #include <algorithm> +#include <cassert> #include <float.h> #include <limits.h> #include <math.h> @@ -256,6 +257,7 @@ struct UStringTraits sal_Int32 * pCapacity, sal_Int32 * pOffset, sal_Unicode const * pChars, sal_Int32 nLen) { + assert(pChars != nullptr); rtl_uStringbuffer_insert(pBuffer, pCapacity, *pOffset, pChars, nLen); *pOffset += nLen; } diff --git a/sal/rtl/ustrbuf.cxx b/sal/rtl/ustrbuf.cxx index 759d05ccba0c..df8423ce1b19 100644 --- a/sal/rtl/ustrbuf.cxx +++ b/sal/rtl/ustrbuf.cxx @@ -140,11 +140,14 @@ void SAL_CALL rtl_uStringbuffer_insert( rtl_uString ** This, memmove( pBuf + offset + len, pBuf + offset, n * sizeof(sal_Unicode) ); /* insert the new characters */ - if( len == 1 ) - /* optimized for 1 character */ - pBuf[offset] = *str; - else if( len > 1 ) - memcpy( pBuf + offset, str, len * sizeof(sal_Unicode) ); + if( str != nullptr ) + { + if( len == 1 ) + /* optimized for 1 character */ + pBuf[offset] = *str; + else if( len > 1 ) + memcpy( pBuf + offset, str, len * sizeof(sal_Unicode) ); + } (*This)->length = nOldLen + len; pBuf[ nOldLen + len ] = 0; } |