diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-04 21:29:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-05 05:02:29 +0200 |
commit | f3ff488fd4fb56f178ffbb7b3880dfafdd9d8e9c (patch) | |
tree | ad5d8b09e36457beaa906a393dce0a67c1686fb1 /unotools/source/config/securityoptions.cxx | |
parent | 48a3d6b85e3c2858c281d5f258fcf2120ca84265 (diff) |
loplugin:flatten in unotools
Change-Id: I2fad16061bca6dc3e57926863e7a3b71947a8ade
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100139
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools/source/config/securityoptions.cxx')
-rw-r--r-- | unotools/source/config/securityoptions.cxx | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index d81517f255a0..36aa85b3ac8c 100644 --- a/unotools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -412,49 +412,49 @@ void SvtSecurityOptions_Impl::LoadAuthors() m_seqTrustedAuthors.realloc( 0 ); // first clear const Sequence< OUString > lAuthors = GetNodeNames( PROPERTYNAME_MACRO_TRUSTEDAUTHORS ); sal_Int32 c1 = lAuthors.getLength(); - if( c1 ) + if( !c1 ) + return; + + sal_Int32 c2 = c1 * 3; // 3 Properties inside Struct TrustedAuthor + Sequence< OUString > lAllAuthors( c2 ); + + sal_Int32 i2 = 0; + OUString aSep( "/" ); + for( const auto& rAuthor : lAuthors ) { - sal_Int32 c2 = c1 * 3; // 3 Properties inside Struct TrustedAuthor - Sequence< OUString > lAllAuthors( c2 ); + lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + rAuthor + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME; + ++i2; + lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + rAuthor + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER; + ++i2; + lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + rAuthor + aSep + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA; + ++i2; + } - sal_Int32 i2 = 0; - OUString aSep( "/" ); - for( const auto& rAuthor : lAuthors ) - { - lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + rAuthor + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME; - ++i2; - lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + rAuthor + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER; - ++i2; - lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + rAuthor + aSep + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA; - ++i2; - } + Sequence< Any > lValues = GetProperties( lAllAuthors ); + if( lValues.getLength() != c2 ) + return; - Sequence< Any > lValues = GetProperties( lAllAuthors ); - if( lValues.getLength() == c2 ) + std::vector< SvtSecurityOptions::Certificate > v; + SvtSecurityOptions::Certificate aCert( 3 ); + i2 = 0; + for( sal_Int32 i1 = 0; i1 < c1; ++i1 ) + { + lValues[ i2 ] >>= aCert[ 0 ]; + ++i2; + lValues[ i2 ] >>= aCert[ 1 ]; + ++i2; + lValues[ i2 ] >>= aCert[ 2 ]; + ++i2; + // Filter out TrustedAuthor entries with empty RawData, which + // would cause an unexpected std::bad_alloc in + // SecurityEnvironment_NssImpl::createCertificateFromAscii and + // have been observed in the wild (fdo#55019): + if( !aCert[ 2 ].isEmpty() ) { - std::vector< SvtSecurityOptions::Certificate > v; - SvtSecurityOptions::Certificate aCert( 3 ); - i2 = 0; - for( sal_Int32 i1 = 0; i1 < c1; ++i1 ) - { - lValues[ i2 ] >>= aCert[ 0 ]; - ++i2; - lValues[ i2 ] >>= aCert[ 1 ]; - ++i2; - lValues[ i2 ] >>= aCert[ 2 ]; - ++i2; - // Filter out TrustedAuthor entries with empty RawData, which - // would cause an unexpected std::bad_alloc in - // SecurityEnvironment_NssImpl::createCertificateFromAscii and - // have been observed in the wild (fdo#55019): - if( !aCert[ 2 ].isEmpty() ) - { - v.push_back( aCert ); - } - } - m_seqTrustedAuthors = comphelper::containerToSequence(v); + v.push_back( aCert ); } } + m_seqTrustedAuthors = comphelper::containerToSequence(v); } sal_Int32 SvtSecurityOptions_Impl::GetHandle( const OUString& rName ) |