summaryrefslogtreecommitdiff
path: root/xmlsecurity/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-12 20:08:53 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-12 20:08:53 +0100
commite5262ed74d175c862356a5b0d7ee1828a6710e0c (patch)
treed4d662c1e4c6800f59c1f9090b11fd3692c7de84 /xmlsecurity/source
parenta5eea680720dd8f3c78143ac635dafdf09b5dd14 (diff)
More loplugin:cstylecast: xmlsecurity
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: Ica6e96072435aa4df4e74accdfe06f798a640bbe
Diffstat (limited to 'xmlsecurity/source')
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx4
-rw-r--r--xmlsecurity/source/dialogs/macrosecurity.cxx2
-rw-r--r--xmlsecurity/source/framework/saxeventkeeperimpl.cxx4
-rw-r--r--xmlsecurity/source/gpg/XMLSecurityContext.cxx4
-rw-r--r--xmlsecurity/source/xmlsec/biginteger.cxx2
-rw-r--r--xmlsecurity/source/xmlsec/nss/secerror.cxx2
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx6
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx2
-rw-r--r--xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx4
-rw-r--r--xmlsecurity/source/xmlsec/saxhelper.cxx2
-rw-r--r--xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx4
11 files changed, 18 insertions, 18 deletions
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index e2dff90c55fa..0da8288adba3 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -449,7 +449,7 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, RemoveButtonHdl, Button*, void)
{
try
{
- sal_uInt16 nSelected = (sal_uInt16) reinterpret_cast<sal_uIntPtr>( m_pSignaturesLB->FirstSelected()->GetUserData() );
+ sal_uInt16 nSelected = static_cast<sal_uInt16>(reinterpret_cast<sal_uIntPtr>( m_pSignaturesLB->FirstSelected()->GetUserData() ));
maSignatureManager.remove(nSelected);
mbSignaturesChanged = true;
@@ -728,7 +728,7 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails()
{
if( m_pSignaturesLB->FirstSelected() )
{
- sal_uInt16 nSelected = (sal_uInt16) reinterpret_cast<sal_uIntPtr>( m_pSignaturesLB->FirstSelected()->GetUserData() );
+ sal_uInt16 nSelected = static_cast<sal_uInt16>(reinterpret_cast<sal_uIntPtr>( m_pSignaturesLB->FirstSelected()->GetUserData() ));
const SignatureInformation& rInfo = maSignatureManager.maCurrentSignatureInformations[ nSelected ];
uno::Reference<security::XCertificate> xCert = getCertificate(rInfo);
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index 6897badd4149..c91432d93c68 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -125,7 +125,7 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(vcl::Window* _pParent, MacroSecurity*
m_pHighRB->SetClickHdl( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) );
m_pVeryHighRB->SetClickHdl( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) );
- mnCurLevel = (sal_uInt16) mpDlg->maSecOptions.GetMacroSecurityLevel();
+ mnCurLevel = static_cast<sal_uInt16>(mpDlg->maSecOptions.GetMacroSecurityLevel());
bool bReadonly = mpDlg->maSecOptions.IsReadOnly( SvtSecurityOptions::EOption::MacroSecLevel );
RadioButton* pCheck = nullptr;
diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
index 9ed84bb165fa..636e6e4d5436 100644
--- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
+++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
@@ -1041,8 +1041,8 @@ void SAL_CALL SAXEventKeeperImpl::startElement(
for ( int i = 0; i<nLength; ++i )
{
- aAttributes[i].sName = xAttribs->getNameByIndex((short)i);
- aAttributes[i].sValue =xAttribs->getValueByIndex((short)i);
+ aAttributes[i].sName = xAttribs->getNameByIndex(static_cast<short>(i));
+ aAttributes[i].sValue =xAttribs->getValueByIndex(static_cast<short>(i));
}
m_xCompressedDocumentHandler->compressedStartElement(aName, aAttributes);
diff --git a/xmlsecurity/source/gpg/XMLSecurityContext.cxx b/xmlsecurity/source/gpg/XMLSecurityContext.cxx
index 1a07648d1622..494b934f520b 100644
--- a/xmlsecurity/source/gpg/XMLSecurityContext.cxx
+++ b/xmlsecurity/source/gpg/XMLSecurityContext.cxx
@@ -46,7 +46,7 @@ sal_Int32 SAL_CALL XMLSecurityContextGpg::getSecurityEnvironmentNumber()
Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContextGpg::getSecurityEnvironmentByIndex(sal_Int32 index)
{
- if (index < 0 || index >= ( sal_Int32 )m_vSecurityEnvironments.size())
+ if (index < 0 || index >= static_cast<sal_Int32>(m_vSecurityEnvironments.size()))
throw RuntimeException("Invalid index");
return m_vSecurityEnvironments[index];
@@ -54,7 +54,7 @@ Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContextGpg::getSecurityEnv
Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContextGpg::getSecurityEnvironment()
{
- if (m_nDefaultEnvIndex < 0 || m_nDefaultEnvIndex >= (sal_Int32) m_vSecurityEnvironments.size())
+ if (m_nDefaultEnvIndex < 0 || m_nDefaultEnvIndex >= static_cast<sal_Int32>(m_vSecurityEnvironments.size()))
throw RuntimeException("Invalid index");
return getSecurityEnvironmentByIndex(m_nDefaultEnvIndex);
diff --git a/xmlsecurity/source/xmlsec/biginteger.cxx b/xmlsecurity/source/xmlsec/biginteger.cxx
index 04037ab59e87..421bbeba3d04 100644
--- a/xmlsecurity/source/xmlsec/biginteger.cxx
+++ b/xmlsecurity/source/xmlsec/biginteger.cxx
@@ -36,7 +36,7 @@ Sequence< sal_Int8 > numericStringToBigInteger ( const OUString& numeral )
OString onumeral = OUStringToOString( numeral , RTL_TEXTENCODING_ASCII_US ) ;
- chNumeral = xmlStrndup( reinterpret_cast<const xmlChar*>(onumeral.getStr()), ( int )onumeral.getLength() ) ;
+ chNumeral = xmlStrndup( reinterpret_cast<const xmlChar*>(onumeral.getStr()), static_cast<int>(onumeral.getLength()) ) ;
if( xmlSecBnInitialize( &bn, 0 ) < 0 ) {
xmlFree( chNumeral ) ;
diff --git a/xmlsecurity/source/xmlsec/nss/secerror.cxx b/xmlsecurity/source/xmlsec/nss/secerror.cxx
index 9473942ab7c5..638e54c3ca82 100644
--- a/xmlsecurity/source/xmlsec/nss/secerror.cxx
+++ b/xmlsecurity/source/xmlsec/nss/secerror.cxx
@@ -59,7 +59,7 @@ getCertError(PRErrorCode errNum)
void
printChainFailure(CERTVerifyLog *log)
{
- unsigned int depth = (unsigned int)-1;
+ unsigned int depth = static_cast<unsigned int>(-1);
CERTVerifyLogNode *node = nullptr;
if (log->count > 0)
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 380ae4d4ee40..36d2e0a57ca4 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -430,7 +430,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::getCertificate( const OUS
// Create cert info from issue and serial
OString ostr = OUStringToOString( issuerName , RTL_TEXTENCODING_UTF8 ) ;
- chIssuer = PL_strndup( ostr.getStr(), ( int )ostr.getLength() ) ;
+ chIssuer = PL_strndup( ostr.getStr(), static_cast<int>(ostr.getLength()) ) ;
nmIssuer = CERT_AsciiToName( chIssuer ) ;
if( nmIssuer == nullptr ) {
PL_strfree( chIssuer ) ;
@@ -547,7 +547,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::createCertificateFromRaw(
Reference< XCertificate > SecurityEnvironment_NssImpl::createCertificateFromAscii( const OUString& asciiCertificate )
{
OString oscert = OUStringToOString( asciiCertificate , RTL_TEXTENCODING_ASCII_US ) ;
- xmlChar* chCert = xmlStrndup( reinterpret_cast<const xmlChar*>(oscert.getStr()), ( int )oscert.getLength() ) ;
+ xmlChar* chCert = xmlStrndup( reinterpret_cast<const xmlChar*>(oscert.getStr()), static_cast<int>(oscert.getLength()) ) ;
int certSize = xmlSecBase64Decode( chCert, reinterpret_cast<xmlSecByte*>(chCert), xmlStrlen( chCert ) ) ;
if (certSize > 0)
{
@@ -723,7 +723,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert,
SAL_INFO("xmlsecurity.xmlsec", "Testing usage " << i+1 <<
" of " << numUsages << ": " <<
arUsages[i].description <<
- " (0x" << std::hex << (int) arUsages[i].usage << ")" << std::dec);
+ " (0x" << std::hex << static_cast<int>(arUsages[i].usage) << ")" << std::dec);
status = CERT_PKIXVerifyCert(const_cast<CERTCertificate *>(cert), arUsages[i].usage,
cvin, cvout, nullptr);
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index 48ca392864ec..b605ff5a2962 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -58,7 +58,7 @@ X509Certificate_NssImpl::~X509Certificate_NssImpl() {
sal_Int16 SAL_CALL X509Certificate_NssImpl::getVersion() {
if( m_pCert != nullptr ) {
if( m_pCert->version.len > 0 ) {
- return ( char )*( m_pCert->version.data ) ;
+ return static_cast<char>(*( m_pCert->version.data )) ;
} else
return 0 ;
} else {
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx
index d01eb3ffa692..17e709eead02 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx
@@ -62,7 +62,7 @@ sal_Int32 SAL_CALL XMLSecurityContext_NssImpl::getSecurityEnvironmentNumber( )
css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL
XMLSecurityContext_NssImpl::getSecurityEnvironmentByIndex( sal_Int32 index )
{
- if (index < 0 || index >= ( sal_Int32 )m_vSecurityEnvironments.size())
+ if (index < 0 || index >= static_cast<sal_Int32>(m_vSecurityEnvironments.size()))
throw RuntimeException();
css::uno::Reference< css::xml::crypto::XSecurityEnvironment > xSecurityEnvironment = m_vSecurityEnvironments[index];
@@ -72,7 +72,7 @@ css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL
css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL
XMLSecurityContext_NssImpl::getSecurityEnvironment( )
{
- if (m_nDefaultEnvIndex < 0 || m_nDefaultEnvIndex >= ( sal_Int32 )m_vSecurityEnvironments.size())
+ if (m_nDefaultEnvIndex < 0 || m_nDefaultEnvIndex >= static_cast<sal_Int32>(m_vSecurityEnvironments.size()))
throw RuntimeException();
return getSecurityEnvironmentByIndex(m_nDefaultEnvIndex);
diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx
index 52d62b120bec..028edbcf547b 100644
--- a/xmlsecurity/source/xmlsec/saxhelper.cxx
+++ b/xmlsecurity/source/xmlsec/saxhelper.cxx
@@ -38,7 +38,7 @@ namespace cssxcsax = com::sun::star::xml::csax;
xmlChar* ous_to_xmlstr( const OUString& oustr )
{
OString ostr = OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ;
- return xmlStrndup( reinterpret_cast<xmlChar const *>(ostr.getStr()), ( int )ostr.getLength() ) ;
+ return xmlStrndup( reinterpret_cast<xmlChar const *>(ostr.getStr()), static_cast<int>(ostr.getLength()) ) ;
}
/**
diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
index 2472a9115144..1e75168e014d 100644
--- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
+++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
@@ -820,8 +820,8 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::startElement( const OUString& aName
for (int i = 0; i < nLength; ++i)
{
- aAttributes[i].sName = xAttribs->getNameByIndex((short)i);
- aAttributes[i].sValue =xAttribs->getValueByIndex((short)i);
+ aAttributes[i].sName = xAttribs->getNameByIndex(static_cast<short>(i));
+ aAttributes[i].sValue =xAttribs->getValueByIndex(static_cast<short>(i));
}
compressedStartElement(aName, aAttributes);