diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2021-10-16 22:47:00 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2021-10-17 12:30:15 +0200 |
commit | 4af72419f3e8a571d0a367c6422424fdc3ab4061 (patch) | |
tree | bde965aca50c5393f5730a900281eaf7f71eece5 /xmlsecurity/source | |
parent | 43a9bf11203ed92096af34ab828501e0218832c7 (diff) |
Simplify vector initialization in xmlsecurity
Change-Id: Ia19ffa1213d578c30f35545bcca515669e7ff7a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123710
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'xmlsecurity/source')
4 files changed, 19 insertions, 13 deletions
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index a6f48625e57f..3d130d01887f 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/security/NoPasswordException.hpp> #include <com/sun/star/security/CertificateCharacters.hpp> +#include <o3tl/safeint.hxx> #include <unotools/datetime.hxx> #include <unotools/useroptions.hxx> @@ -53,11 +54,13 @@ CertificateChooser::CertificateChooser(weld::Window* _pParent, auto nControlWidth = m_xCertLB->get_approximate_digit_width() * 105; m_xCertLB->set_size_request(nControlWidth, m_xCertLB->get_height_rows(12)); - std::vector<int> aWidths; - aWidths.push_back(30*nControlWidth/100); - aWidths.push_back(30*nControlWidth/100); - aWidths.push_back(10*nControlWidth/100); - aWidths.push_back(20*nControlWidth/100); + std::vector<int> aWidths + { + o3tl::narrowing<int>(30*nControlWidth/100), + o3tl::narrowing<int>(30*nControlWidth/100), + o3tl::narrowing<int>(10*nControlWidth/100), + o3tl::narrowing<int>(20*nControlWidth/100) + }; m_xCertLB->set_column_fixed_widths(aWidths); m_xCertLB->connect_changed( LINK( this, CertificateChooser, CertificateHighlightHdl ) ); m_xCertLB->connect_row_activated( LINK( this, CertificateChooser, CertificateSelectHdl ) ); diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 2e1a2e49adf2..c252024ed954 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -165,9 +165,7 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP(weld::Container* pParent, const int nHeight = m_xElementsLB->get_height_rows(8); m_xElementsLB->set_size_request(nWidth, nHeight); m_xValueDetails->set_size_request(nWidth, nHeight); - std::vector<int> aWidths; - aWidths.push_back(nWidth / 2); - m_xElementsLB->set_column_fixed_widths(aWidths); + m_xElementsLB->set_column_fixed_widths( { nWidth / 2 } ); // fill list box Reference< security::XCertificate > xCert = mpDlg->mxCert; diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 86bf4c23f12b..7ffe14da6649 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -379,8 +379,10 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl, weld::Button&, void) return; try { - std::vector<uno::Reference<xml::crypto::XXMLSecurityContext>> xSecContexts; - xSecContexts.push_back(maSignatureManager.getSecurityContext()); + std::vector<uno::Reference<xml::crypto::XXMLSecurityContext>> xSecContexts + { + maSignatureManager.getSecurityContext() + }; // Gpg signing is only possible with ODF >= 1.2 documents if (DocumentSignatureHelper::CanSignWithGPG(maSignatureManager.getStore(), m_sODFVersion)) xSecContexts.push_back(maSignatureManager.getGpgSecurityContext()); diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index d4a7e9f7c23f..bf82606f4287 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -24,6 +24,7 @@ #include <resourcemanager.hxx> #include <strings.hrc> +#include <o3tl/safeint.hxx> #include <osl/file.hxx> #include <sal/log.hxx> @@ -374,9 +375,11 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(weld::Container* pP , m_xRemoveLocPB(m_xBuilder->weld_button("removefile")) { auto nColWidth = m_xTrustCertLB->get_approximate_digit_width() * 12; - std::vector<int> aWidths; - aWidths.push_back(nColWidth * 2); - aWidths.push_back(nColWidth * 2); + std::vector<int> aWidths + { + o3tl::narrowing<int>(nColWidth * 2), + o3tl::narrowing<int>(nColWidth * 2) + }; m_xTrustCertLB->set_column_fixed_widths(aWidths); m_xTrustCertLB->set_size_request(nColWidth * 5.5, m_xTrustCertLB->get_height_rows(5)); |