Kaydet (Commit) e5262ed7 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst a5eea680
...@@ -449,7 +449,7 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, RemoveButtonHdl, Button*, void) ...@@ -449,7 +449,7 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, RemoveButtonHdl, Button*, void)
{ {
try 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); maSignatureManager.remove(nSelected);
mbSignaturesChanged = true; mbSignaturesChanged = true;
...@@ -728,7 +728,7 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails() ...@@ -728,7 +728,7 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails()
{ {
if( m_pSignaturesLB->FirstSelected() ) 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 ]; const SignatureInformation& rInfo = maSignatureManager.maCurrentSignatureInformations[ nSelected ];
uno::Reference<security::XCertificate> xCert = getCertificate(rInfo); uno::Reference<security::XCertificate> xCert = getCertificate(rInfo);
......
...@@ -125,7 +125,7 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(vcl::Window* _pParent, MacroSecurity* ...@@ -125,7 +125,7 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(vcl::Window* _pParent, MacroSecurity*
m_pHighRB->SetClickHdl( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) ); m_pHighRB->SetClickHdl( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) );
m_pVeryHighRB->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 ); bool bReadonly = mpDlg->maSecOptions.IsReadOnly( SvtSecurityOptions::EOption::MacroSecLevel );
RadioButton* pCheck = nullptr; RadioButton* pCheck = nullptr;
......
...@@ -1041,8 +1041,8 @@ void SAL_CALL SAXEventKeeperImpl::startElement( ...@@ -1041,8 +1041,8 @@ void SAL_CALL SAXEventKeeperImpl::startElement(
for ( int i = 0; i<nLength; ++i ) for ( int i = 0; i<nLength; ++i )
{ {
aAttributes[i].sName = xAttribs->getNameByIndex((short)i); aAttributes[i].sName = xAttribs->getNameByIndex(static_cast<short>(i));
aAttributes[i].sValue =xAttribs->getValueByIndex((short)i); aAttributes[i].sValue =xAttribs->getValueByIndex(static_cast<short>(i));
} }
m_xCompressedDocumentHandler->compressedStartElement(aName, aAttributes); m_xCompressedDocumentHandler->compressedStartElement(aName, aAttributes);
......
...@@ -46,7 +46,7 @@ sal_Int32 SAL_CALL XMLSecurityContextGpg::getSecurityEnvironmentNumber() ...@@ -46,7 +46,7 @@ sal_Int32 SAL_CALL XMLSecurityContextGpg::getSecurityEnvironmentNumber()
Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContextGpg::getSecurityEnvironmentByIndex(sal_Int32 index) 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"); throw RuntimeException("Invalid index");
return m_vSecurityEnvironments[index]; return m_vSecurityEnvironments[index];
...@@ -54,7 +54,7 @@ Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContextGpg::getSecurityEnv ...@@ -54,7 +54,7 @@ Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContextGpg::getSecurityEnv
Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContextGpg::getSecurityEnvironment() 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"); throw RuntimeException("Invalid index");
return getSecurityEnvironmentByIndex(m_nDefaultEnvIndex); return getSecurityEnvironmentByIndex(m_nDefaultEnvIndex);
......
...@@ -36,7 +36,7 @@ Sequence< sal_Int8 > numericStringToBigInteger ( const OUString& numeral ) ...@@ -36,7 +36,7 @@ Sequence< sal_Int8 > numericStringToBigInteger ( const OUString& numeral )
OString onumeral = OUStringToOString( numeral , RTL_TEXTENCODING_ASCII_US ) ; 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 ) { if( xmlSecBnInitialize( &bn, 0 ) < 0 ) {
xmlFree( chNumeral ) ; xmlFree( chNumeral ) ;
......
...@@ -59,7 +59,7 @@ getCertError(PRErrorCode errNum) ...@@ -59,7 +59,7 @@ getCertError(PRErrorCode errNum)
void void
printChainFailure(CERTVerifyLog *log) printChainFailure(CERTVerifyLog *log)
{ {
unsigned int depth = (unsigned int)-1; unsigned int depth = static_cast<unsigned int>(-1);
CERTVerifyLogNode *node = nullptr; CERTVerifyLogNode *node = nullptr;
if (log->count > 0) if (log->count > 0)
......
...@@ -430,7 +430,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::getCertificate( const OUS ...@@ -430,7 +430,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::getCertificate( const OUS
// Create cert info from issue and serial // Create cert info from issue and serial
OString ostr = OUStringToOString( issuerName , RTL_TEXTENCODING_UTF8 ) ; 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 ) ; nmIssuer = CERT_AsciiToName( chIssuer ) ;
if( nmIssuer == nullptr ) { if( nmIssuer == nullptr ) {
PL_strfree( chIssuer ) ; PL_strfree( chIssuer ) ;
...@@ -547,7 +547,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::createCertificateFromRaw( ...@@ -547,7 +547,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::createCertificateFromRaw(
Reference< XCertificate > SecurityEnvironment_NssImpl::createCertificateFromAscii( const OUString& asciiCertificate ) Reference< XCertificate > SecurityEnvironment_NssImpl::createCertificateFromAscii( const OUString& asciiCertificate )
{ {
OString oscert = OUStringToOString( asciiCertificate , RTL_TEXTENCODING_ASCII_US ) ; 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 ) ) ; int certSize = xmlSecBase64Decode( chCert, reinterpret_cast<xmlSecByte*>(chCert), xmlStrlen( chCert ) ) ;
if (certSize > 0) if (certSize > 0)
{ {
...@@ -723,7 +723,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, ...@@ -723,7 +723,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert,
SAL_INFO("xmlsecurity.xmlsec", "Testing usage " << i+1 << SAL_INFO("xmlsecurity.xmlsec", "Testing usage " << i+1 <<
" of " << numUsages << ": " << " of " << numUsages << ": " <<
arUsages[i].description << 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, status = CERT_PKIXVerifyCert(const_cast<CERTCertificate *>(cert), arUsages[i].usage,
cvin, cvout, nullptr); cvin, cvout, nullptr);
......
...@@ -58,7 +58,7 @@ X509Certificate_NssImpl::~X509Certificate_NssImpl() { ...@@ -58,7 +58,7 @@ X509Certificate_NssImpl::~X509Certificate_NssImpl() {
sal_Int16 SAL_CALL X509Certificate_NssImpl::getVersion() { sal_Int16 SAL_CALL X509Certificate_NssImpl::getVersion() {
if( m_pCert != nullptr ) { if( m_pCert != nullptr ) {
if( m_pCert->version.len > 0 ) { if( m_pCert->version.len > 0 ) {
return ( char )*( m_pCert->version.data ) ; return static_cast<char>(*( m_pCert->version.data )) ;
} else } else
return 0 ; return 0 ;
} else { } else {
......
...@@ -62,7 +62,7 @@ sal_Int32 SAL_CALL XMLSecurityContext_NssImpl::getSecurityEnvironmentNumber( ) ...@@ -62,7 +62,7 @@ sal_Int32 SAL_CALL XMLSecurityContext_NssImpl::getSecurityEnvironmentNumber( )
css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL
XMLSecurityContext_NssImpl::getSecurityEnvironmentByIndex( sal_Int32 index ) 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(); throw RuntimeException();
css::uno::Reference< css::xml::crypto::XSecurityEnvironment > xSecurityEnvironment = m_vSecurityEnvironments[index]; css::uno::Reference< css::xml::crypto::XSecurityEnvironment > xSecurityEnvironment = m_vSecurityEnvironments[index];
...@@ -72,7 +72,7 @@ css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL ...@@ -72,7 +72,7 @@ css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL
css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL
XMLSecurityContext_NssImpl::getSecurityEnvironment( ) 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(); throw RuntimeException();
return getSecurityEnvironmentByIndex(m_nDefaultEnvIndex); return getSecurityEnvironmentByIndex(m_nDefaultEnvIndex);
......
...@@ -38,7 +38,7 @@ namespace cssxcsax = com::sun::star::xml::csax; ...@@ -38,7 +38,7 @@ namespace cssxcsax = com::sun::star::xml::csax;
xmlChar* ous_to_xmlstr( const OUString& oustr ) xmlChar* ous_to_xmlstr( const OUString& oustr )
{ {
OString ostr = OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ; 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()) ) ;
} }
/** /**
......
...@@ -820,8 +820,8 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::startElement( const OUString& aName ...@@ -820,8 +820,8 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::startElement( const OUString& aName
for (int i = 0; i < nLength; ++i) for (int i = 0; i < nLength; ++i)
{ {
aAttributes[i].sName = xAttribs->getNameByIndex((short)i); aAttributes[i].sName = xAttribs->getNameByIndex(static_cast<short>(i));
aAttributes[i].sValue =xAttribs->getValueByIndex((short)i); aAttributes[i].sValue =xAttribs->getValueByIndex(static_cast<short>(i));
} }
compressedStartElement(aName, aAttributes); compressedStartElement(aName, aAttributes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment