[Libreoffice-commits] core.git: include/rtl

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sat Oct 12 13:32:07 UTC 2019


 include/rtl/string.hxx  |    8 ++------
 include/rtl/ustring.hxx |    8 ++------
 2 files changed, 4 insertions(+), 12 deletions(-)

New commits:
commit a65551a078539a5a2bc34cca2368075537e772fe
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Oct 12 13:13:45 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Oct 12 15:30:54 2019 +0200

    Simplify some O(U)String methods
    
    Change-Id: I020b7fef3c30cf6d5b161c33dab5bee6d2a6f91b
    Reviewed-on: https://gerrit.libreoffice.org/80713
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index a7a04f9d06e4..a497c951c3b0 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -1279,9 +1279,7 @@ public:
     */
     SAL_WARN_UNUSED_RESULT OString copy( sal_Int32 beginIndex ) const
     {
-        rtl_String *pNew = NULL;
-        rtl_string_newFromSubString( &pNew, pData, beginIndex, getLength() - beginIndex );
-        return OString( pNew, SAL_NO_ACQUIRE );
+        return copy(beginIndex, getLength() - beginIndex);
     }
 
     /**
@@ -1774,9 +1772,7 @@ public:
     static OString boolean( bool b )
     {
         sal_Char aBuf[RTL_STR_MAX_VALUEOFBOOLEAN];
-        rtl_String* pNewData = NULL;
-        rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfBoolean( aBuf, b ) );
-        return OString( pNewData, SAL_NO_ACQUIRE );
+        return OString(aBuf, rtl_str_valueOfBoolean(aBuf, b));
     }
 
     /**
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index a974e3ac7a12..573ed70e6a3c 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -2239,9 +2239,7 @@ public:
     */
     SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex ) const
     {
-        rtl_uString *pNew = NULL;
-        rtl_uString_newFromSubString( &pNew, pData, beginIndex, getLength() - beginIndex );
-        return OUString( pNew, SAL_NO_ACQUIRE );
+        return copy(beginIndex, getLength() - beginIndex);
     }
 
     /**
@@ -3517,9 +3515,7 @@ public:
     static OUString boolean( bool b )
     {
         sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFBOOLEAN];
-        rtl_uString* pNewData = NULL;
-        rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfBoolean( aBuf, b ) );
-        return OUString( pNewData, SAL_NO_ACQUIRE );
+        return OUString(aBuf, rtl_ustr_valueOfBoolean(aBuf, b));
     }
 
     /**


More information about the Libreoffice-commits mailing list