[Libreoffice-commits] core.git: xmlsecurity/source xmlsecurity/workben

Andrzej J.R. Hunt andrzej at ahunt.org
Sat Aug 17 08:28:32 PDT 2013


 xmlsecurity/source/dialogs/certificatechooser.cxx      |   17 ++++++++++++-----
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |    7 +++++--
 xmlsecurity/source/dialogs/macrosecurity.cxx           |    6 ++++--
 xmlsecurity/source/dialogs/resourcemanager.cxx         |   12 ++++++++----
 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx       |    9 +++++++--
 xmlsecurity/workben/signaturetest.cxx                  |    7 ++++---
 6 files changed, 40 insertions(+), 18 deletions(-)

New commits:
commit 182bf2a63acceb435074e84f1237f1852491be94
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Sat Aug 17 15:27:06 2013 +0000

    Revert "fdo#57950: Remove some chained appends in xmlsecurity"
    
    This reverts commit 4f20c9f6f95c117bcdb520682df4fa1429a56477
    
    Change-Id: I4d8cef801d570b0c20e580144e79a5940b100271
    Reviewed-on: https://gerrit.libreoffice.org/5476
    Reviewed-by: Andrzej J.R. Hunt <andrzej at ahunt.org>
    Tested-by: Andrzej J.R. Hunt <andrzej at ahunt.org>

diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index aa82917..d339cde 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -65,8 +65,12 @@ CertificateChooser::CertificateChooser( Window* _pParent, uno::Reference< uno::X
     m_pCertLB = new SvSimpleTable(*pSignatures);
     static long nTabs[] = { 3, 0, 30*nControlWidth/100, 60*nControlWidth/100 };
     m_pCertLB->SetTabs( &nTabs[0] );
-    m_pCertLB->InsertHeaderEntry(get<FixedText>("issuedto")->GetText() + "\t" + get<FixedText>("issuedby")->GetText()
-        + "\t" + get<FixedText>("expiration")->GetText());
+    OUStringBuffer sHeader;
+    sHeader.append(get<FixedText>("issuedto")->GetText())
+        .append("\t").append(get<FixedText>("issuedby")->GetText())
+        .append("\t").append(get<FixedText>("expiration")->GetText());
+    m_pCertLB->InsertHeaderEntry(sHeader.makeStringAndClear());
+
     m_pCertLB->SetSelectHdl( LINK( this, CertificateChooser, CertificateHighlightHdl ) );
     m_pCertLB->SetDoubleClickHdl( LINK( this, CertificateChooser, CertificateSelectHdl ) );
     m_pViewBtn->SetClickHdl( LINK( this, CertificateChooser, ViewButtonHdl ) );
@@ -170,9 +174,12 @@ void CertificateChooser::ImplInitialize()
         // fill list of certificates; the first entry will be selected
         for ( sal_Int32 nC = 0; nC < nCertificates; ++nC )
         {
-            SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName() )
-                + "\t" + XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName() )
-                + "\t" + XmlSec::GetDateString( maCerts[ nC ]->getNotValidAfter() ) );
+            OUStringBuffer sEntry( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName() ) );
+            sEntry.append( '\t' );
+            sEntry.append( XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName() ) );
+            sEntry.append( '\t' );
+            sEntry.append( XmlSec::GetDateString( maCerts[ nC ]->getNotValidAfter() ) );
+            SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( sEntry.makeStringAndClear() );
             pEntry->SetUserData( ( void* )(sal_IntPtr)nC ); // missuse user data as index
         }
 
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 033b026..866a0de 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -208,8 +208,11 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
     static long aTabs[] = { 4, 0, 6*nControlWidth/100, 36*nControlWidth/100, 74*nControlWidth/100 };
     m_pSignaturesLB->SetTabs(aTabs);
 
-    m_pSignaturesLB->InsertHeaderEntry("\t" + get<FixedText>("signed")->GetText() + "\t"
-               + get<FixedText>("issued")->GetText() + "\t" + get<FixedText>("date")->GetText());
+    OUStringBuffer sHeader;
+    sHeader.append("\t").append(get<FixedText>("signed")->GetText())
+        .append("\t").append(get<FixedText>("issued")->GetText())
+        .append("\t").append(get<FixedText>("date")->GetText());
+    m_pSignaturesLB->InsertHeaderEntry(sHeader.makeStringAndClear());
 
     mbVerifySignatures = true;
     mbSignaturesChanged = false;
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index 70d03c7..4ae1f48 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -361,8 +361,10 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(Window* _pParent, M
     static long aTabs[] = { 3, 0, 0, 0 };
     m_pTrustCertLB->SetTabs( aTabs );
 
-    m_pTrustCertLB->InsertHeaderEntry(get<FixedText>("to")->GetText() + "\t"
-        +  get<FixedText>("by")->GetText() + "\t" + get<FixedText>("date")->GetText());
+    OUStringBuffer aBuf(get<FixedText>("to")->GetText());
+    aBuf.append("\t").append(get<FixedText>("by")->GetText())
+        .append("\t").append(get<FixedText>("date")->GetText());
+    m_pTrustCertLB->InsertHeaderEntry(aBuf.makeStringAndClear());
 
     m_pTrustCertLB->SetSelectHdl( LINK( this, MacroSecurityTrustedSourcesTP, TrustCertLBSelectHdl ) );
     m_pViewCertPB->SetClickHdl( LINK( this, MacroSecurityTrustedSourcesTP, ViewCertPBHdl ) );
diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx
index 8dbb24b..d9279b1 100644
--- a/xmlsecurity/source/dialogs/resourcemanager.cxx
+++ b/xmlsecurity/source/dialogs/resourcemanager.cxx
@@ -62,8 +62,10 @@ namespace XmlSec
         // String with date and time information (#i20172#)
         DateTime aDT( GetDateTime( _rDT ) );
         const LocaleDataWrapper& rLoDa = GetLocaleData();
-
-        return  rLoDa.getDate( aDT ) + " " + rLoDa.getTime( aDT );
+        OUStringBuffer sRet( rLoDa.getDate( aDT ) );
+        sRet.append( ' ' );
+        sRet.append( rLoDa.getTime( aDT ) );
+        return sRet.makeStringAndClear();
     }
 
     OUString GetDateString( const ::com::sun::star::util::DateTime& _rDT )
@@ -92,8 +94,10 @@ namespace XmlSec
                 s1.append(static_cast<sal_Unicode>(','));
                 s2.append(static_cast<sal_Unicode>('\n'));
             }
-            s1.append(i->second + i->first);
-            s2.append(sEqual + i->second);
+            s1.append(i->second);
+            s2.append(i->first);
+            s2.append(sEqual);
+            s2.append(i->second);
         }
         return make_pair(s1.makeStringAndClear(), s2.makeStringAndClear());
     }
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index 379ac70..37188d6 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -313,11 +313,16 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex
         if (::osl::File::E_None == ::osl::File::getSystemPathFromFileURL(rootModule, rootModulePath))
         {
             OString ospath = OUStringToOString(rootModulePath, osl_getThreadTextEncoding());
-            OString aStr = "name=\"" ROOT_CERTS "\" library=\"" + ospath + "\"";
+            OStringBuffer pkcs11moduleSpec;
+            pkcs11moduleSpec.append("name=\"");
+            pkcs11moduleSpec.append(ROOT_CERTS);
+            pkcs11moduleSpec.append("\" library=\"");
+            pkcs11moduleSpec.append(ospath.getStr());
+            pkcs11moduleSpec.append("\"");
 
             SECMODModule * RootsModule =
                 SECMOD_LoadUserModule(
-                    const_cast<char*>(aStr.getStr()),
+                    const_cast<char*>(pkcs11moduleSpec.makeStringAndClear().getStr()),
                     0, // no parent
                     PR_FALSE); // do not recurse
 
diff --git a/xmlsecurity/workben/signaturetest.cxx b/xmlsecurity/workben/signaturetest.cxx
index 4d1a6f4..1346ac3 100644
--- a/xmlsecurity/workben/signaturetest.cxx
+++ b/xmlsecurity/workben/signaturetest.cxx
@@ -296,12 +296,13 @@ IMPL_LINK_NOARG(MyWin, VerifyDigitalSignaturesHdl)
     for ( int n = 0; n < nInfos; n++ )
     {
         security::DocumentSignatureInformation& rInf = aInfos[n];
-        OUString aText = "The document is signed by\n\n  " + rInf.Signer->getSubjectName()
-            + "\n\n The signature is ";
+        OUStringBuffer aText( "The document is signed by\n\n  " );
+        aText.append( rInf.Signer->getSubjectName() );
+        aText.append( "\n\n The signature is " );
         if ( !rInf.SignatureIsValid )
             aText.append( "NOT " );
         aText.append( "valid" );
-        InfoBox( this, aText ).Execute();
+        InfoBox( this, aText.makeStringAndClear() ).Execute();
     }
 
     return 0;


More information about the Libreoffice-commits mailing list