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

Neil Moore dar13.moore at gmail.com
Sat Aug 10 08:04:33 PDT 2013


 forms/source/xforms/convert.cxx    |    7 ++-----
 forms/source/xforms/model_ui.cxx   |   29 ++++++++---------------------
 forms/source/xforms/submission.cxx |    9 ++-------
 3 files changed, 12 insertions(+), 33 deletions(-)

New commits:
commit 6cd939111aaf32a35ffe4eb893115e91df2eb664
Author: Neil Moore <dar13.moore at gmail.com>
Date:   Fri Aug 9 12:29:54 2013 -0400

    BUG:57950 Remove chained appends
    
    Removed some chained OUString::append()'s from forms. OUStringBuffer
    could really use a append operator(+=).
    
    Change-Id: I635bdd25da9f09373e686d87a1d198bc09bda906
    Reviewed-on: https://gerrit.libreoffice.org/5329
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx
index 651ecc1..4bdfe21 100644
--- a/forms/source/xforms/convert.cxx
+++ b/forms/source/xforms/convert.cxx
@@ -386,11 +386,8 @@ namespace
                     aDateTime.Minutes, aDateTime.Hours, aDateTime.IsUTC);
         OUString sTime = lcl_toXSD_UNOTime_typed( aTime );
 
-        OUStringBuffer sInfo;
-        sInfo.append( sDate );
-        sInfo.append( (sal_Unicode) 'T' );
-        sInfo.append( sTime );
-        return sInfo.makeStringAndClear();
+        OUString sRet = sDate + "T" + sTime;
+        return sRet;
     }
 
     // ------------------------------------------------------------------------
diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx
index 4dec45b..e4b07df 100644
--- a/forms/source/xforms/model_ui.cxx
+++ b/forms/source/xforms/model_ui.cxx
@@ -300,9 +300,7 @@ OUString Model::getNodeDisplayName( const XNode_t& xNode,
             OUString sContent = xNode->getNodeValue();
             if( bDetail || ! lcl_isWhitespace( sContent ) )
             {
-                aBuffer.append( sal_Unicode('"') );
-                aBuffer.append( Convert::collapseWhitespace( sContent ) );
-                aBuffer.append( sal_Unicode('"') );
+                aBuffer = aBuffer + "\"" + Convert::collapseWhitespace( sContent ) + "\"";
             }
         }
         break;
@@ -360,18 +358,15 @@ OUString Model::getBindingName( const XPropertySet_t& xBinding,
     OUString sExpression;
     xBinding->getPropertyValue( "BindingExpression" ) >>= sExpression;
 
-    OUStringBuffer aBuffer;
+    OUString sRet;
     if( !sID.isEmpty() )
     {
-        aBuffer.append( sID );
-        aBuffer.append( " (" );
-        aBuffer.append( sExpression );
-        aBuffer.append( ")" );
+        sRet = sID + " (" + sExpression + ") ";
     }
     else
-        aBuffer.append( sExpression );
+        sRet = sExpression;
 
-    return aBuffer.makeStringAndClear();
+    return sRet;
 }
 
 OUString Model::getSubmissionName( const XPropertySet_t& xSubmission,
@@ -766,18 +761,12 @@ static OUString lcl_serializeForDisplay( const Reference< XAttr >& _rxAttrNode )
     OSL_ENSURE( _rxAttrNode.is(), "lcl_serializeForDisplay( attr ): invalid argument!" );
     if ( _rxAttrNode.is() )
     {
-        OUStringBuffer aBuffer;
-        aBuffer.append( _rxAttrNode->getName() );
-        aBuffer.appendAscii( "=" );
         OUString sValue = _rxAttrNode->getValue();
         sal_Unicode nQuote = '"';
         if ( sValue.indexOf( nQuote ) >= 0 )
             nQuote = '\'';
-        aBuffer.append( nQuote );
-        aBuffer.append( sValue );
-        aBuffer.append( nQuote );
-        aBuffer.append( (sal_Unicode)' ' );
-        sResult = aBuffer.makeStringAndClear();
+
+        sResult = _rxAttrNode->getName() + "=" + OUString(nQuote) + sValue + OUString(nQuote) + " ";
     }
     return sResult;
 }
@@ -884,9 +873,7 @@ static OUString lcl_serializeForDisplay( const Reference<XXPathObject>& xResult
         break;
 
     case XPathObjectType_XPATH_STRING:
-        aBuffer.append( sal_Unicode('"') );
-        aBuffer.append( xResult->getString() );
-        aBuffer.append( sal_Unicode('"') );
+        aBuffer = aBuffer + "\"" + xResult->getString() + "\"";
         break;
 
     case XPathObjectType_XPATH_NODESET:
diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx
index cc4f53c..873b6c1 100644
--- a/forms/source/xforms/submission.cxx
+++ b/forms/source/xforms/submission.cxx
@@ -478,13 +478,8 @@ sal_Int64 SAL_CALL Submission::getSomething(
 
 static OUString lcl_message( const OUString& rID, const OUString& rText )
 {
-    OUStringBuffer aMessage;
-    aMessage.append( "XForms submission '" );
-    aMessage.append( rID );
-    aMessage.append( "' failed" );
-    aMessage.append( rText );
-    aMessage.append( "." );
-    return aMessage.makeStringAndClear();
+    OUString aMessage = "XForms submission '" + rID + "' failed" + rText + ".";
+    return aMessage;
 }
 
 void SAL_CALL Submission::submitWithInteraction(


More information about the Libreoffice-commits mailing list