[Libreoffice-commits] .: 2 commits - sal/inc sal/rtl

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 19 09:49:05 PST 2012


 sal/inc/rtl/ustrbuf.hxx    |    2 +-
 sal/rtl/source/strtmpl.cxx |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c3b822e46c04c3b294b1cb1e633ab8e62ad3412b
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Dec 19 18:47:09 2012 +0100

    don't use shared empty string if extra space is to be allocated
    
    fix crash for fdo#58306 when appending to OUStringBuffer initialised with ""

diff --git a/sal/rtl/source/strtmpl.cxx b/sal/rtl/source/strtmpl.cxx
index cdb4f11..505d5ab 100644
--- a/sal/rtl/source/strtmpl.cxx
+++ b/sal/rtl/source/strtmpl.cxx
@@ -1225,7 +1225,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral )( IMPL_RTL_STRINGDATA** ppThi
                                                      sal_Int32 allocExtra )
     SAL_THROW_EXTERN_C()
 {
-    if ( !nLen )
+    if ( nLen + allocExtra == 0 )
     {
         IMPL_RTL_STRINGNAME( new )( ppThis );
         return;
commit f484a8949334cdb659f3a0c222052fc05a9e76e5
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Dec 19 18:45:55 2012 +0100

    Revert "fix crash for fdo#58306 when appending to OUStringBuffer initialised with """
    
    newFromLiteral doesn't cheat, it's broken
    This reverts commit 8b9b779e9fc1de7186217b7be75ef02bb66e2da9.

diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index b6ddb66..98f1fc5 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -183,7 +183,7 @@ public:
         , nCapacity( internal::ConstCharArrayDetector< T, void >::size - 1 + 16 )
     {
         assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
-        ( internal::ConstCharArrayDetector< T >::size - 1 ) ? rtl_uString_newFromLiteral( &pData, literal, internal::ConstCharArrayDetector< T, void >::size - 1, 16 ) : rtl_uString_new_WithLength( &pData, 16 );
+        rtl_uString_newFromLiteral( &pData, literal, internal::ConstCharArrayDetector< T, void >::size - 1, 16 );
 #ifdef RTL_STRING_UNITTEST
         rtl_string_unittest_const_literal = true;
 #endif


More information about the Libreoffice-commits mailing list