fdo#57950: Remove some chained appends in xmlsecurity
Change-Id: I35ac622abb995a9259f0774f463ec2816b3668b6 Reviewed-on: https://gerrit.libreoffice.org/5477 Reviewed-by: Andrzej J.R. Hunt <andrzej@ahunt.org> Tested-by: Andrzej J.R. Hunt <andrzej@ahunt.org>
This commit is contained in:
committed by
Andrzej J.R. Hunt
parent
4abb7e5c58
commit
b5e5ce956b
@@ -65,12 +65,8 @@ CertificateChooser::CertificateChooser( Window* _pParent, uno::Reference< uno::X
|
|||||||
m_pCertLB = new SvSimpleTable(*pSignatures);
|
m_pCertLB = new SvSimpleTable(*pSignatures);
|
||||||
static long nTabs[] = { 3, 0, 30*nControlWidth/100, 60*nControlWidth/100 };
|
static long nTabs[] = { 3, 0, 30*nControlWidth/100, 60*nControlWidth/100 };
|
||||||
m_pCertLB->SetTabs( &nTabs[0] );
|
m_pCertLB->SetTabs( &nTabs[0] );
|
||||||
OUStringBuffer sHeader;
|
m_pCertLB->InsertHeaderEntry(get<FixedText>("issuedto")->GetText() + "\t" + get<FixedText>("issuedby")->GetText()
|
||||||
sHeader.append(get<FixedText>("issuedto")->GetText())
|
+ "\t" + get<FixedText>("expiration")->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->SetSelectHdl( LINK( this, CertificateChooser, CertificateHighlightHdl ) );
|
||||||
m_pCertLB->SetDoubleClickHdl( LINK( this, CertificateChooser, CertificateSelectHdl ) );
|
m_pCertLB->SetDoubleClickHdl( LINK( this, CertificateChooser, CertificateSelectHdl ) );
|
||||||
m_pViewBtn->SetClickHdl( LINK( this, CertificateChooser, ViewButtonHdl ) );
|
m_pViewBtn->SetClickHdl( LINK( this, CertificateChooser, ViewButtonHdl ) );
|
||||||
@@ -174,12 +170,9 @@ void CertificateChooser::ImplInitialize()
|
|||||||
// fill list of certificates; the first entry will be selected
|
// fill list of certificates; the first entry will be selected
|
||||||
for ( sal_Int32 nC = 0; nC < nCertificates; ++nC )
|
for ( sal_Int32 nC = 0; nC < nCertificates; ++nC )
|
||||||
{
|
{
|
||||||
OUStringBuffer sEntry( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName() ) );
|
SvTreeListEntry* pEntry = m_pCertLB->InsertEntry( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName() )
|
||||||
sEntry.append( '\t' );
|
+ "\t" + XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName() )
|
||||||
sEntry.append( XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName() ) );
|
+ "\t" + XmlSec::GetDateString( maCerts[ nC ]->getNotValidAfter() ) );
|
||||||
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
|
pEntry->SetUserData( ( void* )(sal_IntPtr)nC ); // missuse user data as index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -208,11 +208,8 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
|
|||||||
static long aTabs[] = { 4, 0, 6*nControlWidth/100, 36*nControlWidth/100, 74*nControlWidth/100 };
|
static long aTabs[] = { 4, 0, 6*nControlWidth/100, 36*nControlWidth/100, 74*nControlWidth/100 };
|
||||||
m_pSignaturesLB->SetTabs(aTabs);
|
m_pSignaturesLB->SetTabs(aTabs);
|
||||||
|
|
||||||
OUStringBuffer sHeader;
|
m_pSignaturesLB->InsertHeaderEntry("\t" + get<FixedText>("signed")->GetText() + "\t"
|
||||||
sHeader.append("\t").append(get<FixedText>("signed")->GetText())
|
+ get<FixedText>("issued")->GetText() + "\t" + get<FixedText>("date")->GetText());
|
||||||
.append("\t").append(get<FixedText>("issued")->GetText())
|
|
||||||
.append("\t").append(get<FixedText>("date")->GetText());
|
|
||||||
m_pSignaturesLB->InsertHeaderEntry(sHeader.makeStringAndClear());
|
|
||||||
|
|
||||||
mbVerifySignatures = true;
|
mbVerifySignatures = true;
|
||||||
mbSignaturesChanged = false;
|
mbSignaturesChanged = false;
|
||||||
|
@@ -361,10 +361,8 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(Window* _pParent, M
|
|||||||
static long aTabs[] = { 3, 0, 0, 0 };
|
static long aTabs[] = { 3, 0, 0, 0 };
|
||||||
m_pTrustCertLB->SetTabs( aTabs );
|
m_pTrustCertLB->SetTabs( aTabs );
|
||||||
|
|
||||||
OUStringBuffer aBuf(get<FixedText>("to")->GetText());
|
m_pTrustCertLB->InsertHeaderEntry(get<FixedText>("to")->GetText() + "\t"
|
||||||
aBuf.append("\t").append(get<FixedText>("by")->GetText())
|
+ get<FixedText>("by")->GetText() + "\t" + get<FixedText>("date")->GetText());
|
||||||
.append("\t").append(get<FixedText>("date")->GetText());
|
|
||||||
m_pTrustCertLB->InsertHeaderEntry(aBuf.makeStringAndClear());
|
|
||||||
|
|
||||||
m_pTrustCertLB->SetSelectHdl( LINK( this, MacroSecurityTrustedSourcesTP, TrustCertLBSelectHdl ) );
|
m_pTrustCertLB->SetSelectHdl( LINK( this, MacroSecurityTrustedSourcesTP, TrustCertLBSelectHdl ) );
|
||||||
m_pViewCertPB->SetClickHdl( LINK( this, MacroSecurityTrustedSourcesTP, ViewCertPBHdl ) );
|
m_pViewCertPB->SetClickHdl( LINK( this, MacroSecurityTrustedSourcesTP, ViewCertPBHdl ) );
|
||||||
|
@@ -62,10 +62,8 @@ namespace XmlSec
|
|||||||
// String with date and time information (#i20172#)
|
// String with date and time information (#i20172#)
|
||||||
DateTime aDT( GetDateTime( _rDT ) );
|
DateTime aDT( GetDateTime( _rDT ) );
|
||||||
const LocaleDataWrapper& rLoDa = GetLocaleData();
|
const LocaleDataWrapper& rLoDa = GetLocaleData();
|
||||||
OUStringBuffer sRet( rLoDa.getDate( aDT ) );
|
|
||||||
sRet.append( ' ' );
|
return rLoDa.getDate( aDT ) + " " + rLoDa.getTime( aDT );
|
||||||
sRet.append( rLoDa.getTime( aDT ) );
|
|
||||||
return sRet.makeStringAndClear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString GetDateString( const ::com::sun::star::util::DateTime& _rDT )
|
OUString GetDateString( const ::com::sun::star::util::DateTime& _rDT )
|
||||||
@@ -95,9 +93,7 @@ namespace XmlSec
|
|||||||
s2.append(static_cast<sal_Unicode>('\n'));
|
s2.append(static_cast<sal_Unicode>('\n'));
|
||||||
}
|
}
|
||||||
s1.append(i->second);
|
s1.append(i->second);
|
||||||
s2.append(i->first);
|
s2.append(i->first + sEqual + i->second);
|
||||||
s2.append(sEqual);
|
|
||||||
s2.append(i->second);
|
|
||||||
}
|
}
|
||||||
return make_pair(s1.makeStringAndClear(), s2.makeStringAndClear());
|
return make_pair(s1.makeStringAndClear(), s2.makeStringAndClear());
|
||||||
}
|
}
|
||||||
|
@@ -313,16 +313,11 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex
|
|||||||
if (::osl::File::E_None == ::osl::File::getSystemPathFromFileURL(rootModule, rootModulePath))
|
if (::osl::File::E_None == ::osl::File::getSystemPathFromFileURL(rootModule, rootModulePath))
|
||||||
{
|
{
|
||||||
OString ospath = OUStringToOString(rootModulePath, osl_getThreadTextEncoding());
|
OString ospath = OUStringToOString(rootModulePath, osl_getThreadTextEncoding());
|
||||||
OStringBuffer pkcs11moduleSpec;
|
OString aStr = "name=\"" ROOT_CERTS "\" library=\"" + ospath + "\"";
|
||||||
pkcs11moduleSpec.append("name=\"");
|
|
||||||
pkcs11moduleSpec.append(ROOT_CERTS);
|
|
||||||
pkcs11moduleSpec.append("\" library=\"");
|
|
||||||
pkcs11moduleSpec.append(ospath.getStr());
|
|
||||||
pkcs11moduleSpec.append("\"");
|
|
||||||
|
|
||||||
SECMODModule * RootsModule =
|
SECMODModule * RootsModule =
|
||||||
SECMOD_LoadUserModule(
|
SECMOD_LoadUserModule(
|
||||||
const_cast<char*>(pkcs11moduleSpec.makeStringAndClear().getStr()),
|
const_cast<char*>(aStr.getStr()),
|
||||||
0, // no parent
|
0, // no parent
|
||||||
PR_FALSE); // do not recurse
|
PR_FALSE); // do not recurse
|
||||||
|
|
||||||
|
@@ -296,13 +296,12 @@ IMPL_LINK_NOARG(MyWin, VerifyDigitalSignaturesHdl)
|
|||||||
for ( int n = 0; n < nInfos; n++ )
|
for ( int n = 0; n < nInfos; n++ )
|
||||||
{
|
{
|
||||||
security::DocumentSignatureInformation& rInf = aInfos[n];
|
security::DocumentSignatureInformation& rInf = aInfos[n];
|
||||||
OUStringBuffer aText( "The document is signed by\n\n " );
|
OUString aText = "The document is signed by\n\n " + rInf.Signer->getSubjectName()
|
||||||
aText.append( rInf.Signer->getSubjectName() );
|
+ "\n\n The signature is ";
|
||||||
aText.append( "\n\n The signature is " );
|
|
||||||
if ( !rInf.SignatureIsValid )
|
if ( !rInf.SignatureIsValid )
|
||||||
aText.append( "NOT " );
|
aText.append( "NOT " );
|
||||||
aText.append( "valid" );
|
aText.append( "valid" );
|
||||||
InfoBox( this, aText.makeStringAndClear() ).Execute();
|
InfoBox( this, aText ).Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user