diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-01-19 15:12:02 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-01-20 09:06:54 +0100 |
commit | 2880dfe3012776e49a47e2e1b6e4bcfa1636be17 (patch) | |
tree | 9f1ce820350b9ea6a9e0584b0a5191512f87c6c6 /xmlsecurity | |
parent | b388b9fc48ee0e92dfffef910f141a2ee338c413 (diff) |
Some more loplugin:cstylecast: xmlsecurity
Change-Id: Iceaeefc26fec2643d3fbb916ab7719a918beb496
Diffstat (limited to 'xmlsecurity')
7 files changed, 38 insertions, 38 deletions
diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx index ad706b04725a..cfa312e5c535 100644 --- a/xmlsecurity/source/helper/xsecsign.cxx +++ b/xmlsecurity/source/helper/xsecsign.cxx @@ -44,7 +44,7 @@ namespace cssxs = com::sun::star::xml::sax; OUString XSecController::createId() { cssu::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid ((sal_uInt8 *)aSeq.getArray(), 0, sal_True); + rtl_createUuid (reinterpret_cast<sal_uInt8 *>(aSeq.getArray()), 0, sal_True); char str[68]="ID_"; int length = 3; diff --git a/xmlsecurity/source/xmlsec/biginteger.cxx b/xmlsecurity/source/xmlsec/biginteger.cxx index 567d206b9274..e79bc51577ef 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( ( const xmlChar* )onumeral.getStr(), ( int )onumeral.getLength() ) ; + chNumeral = xmlStrndup( reinterpret_cast<const xmlChar*>(onumeral.getStr()), ( int )onumeral.getLength() ) ; if( xmlSecBnInitialize( &bn, 0 ) < 0 ) { xmlFree( chNumeral ) ; @@ -87,7 +87,7 @@ OUString bigIntegerToNumericString ( const Sequence< sal_Int8 >& integer ) if( xmlSecBnInitialize( &bn, 0 ) < 0 ) return aRet ; - if( xmlSecBnSetData( &bn, ( const unsigned char* )&integer[0], integer.getLength() ) < 0 ) { + if( xmlSecBnSetData( &bn, reinterpret_cast<const unsigned char*>(integer.getConstArray()), integer.getLength() ) < 0 ) { xmlSecBnFinalize( &bn ) ; return aRet ; } @@ -98,7 +98,7 @@ OUString bigIntegerToNumericString ( const Sequence< sal_Int8 >& integer ) return aRet ; } - aRet = OUString::createFromAscii( ( const char* )chNumeral ) ; + aRet = OUString::createFromAscii( reinterpret_cast<char*>(chNumeral) ) ; xmlSecBnFinalize( &bn ) ; xmlFree( chNumeral ) ; diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx index aca47a2da855..c8b061a1a72e 100644 --- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx @@ -89,7 +89,7 @@ namespace { SECItem item; item.type = siDERCertBuffer; - item.data = (unsigned char*) m_xExtnValue.getArray(); + item.data = reinterpret_cast<unsigned char*>(m_xExtnValue.getArray()); item.len = m_xExtnValue.getLength(); PRArenaPool *arena; @@ -123,11 +123,11 @@ namespace { } case certRFC822Name: arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME; - arrCertAltNameEntry[i].Value <<= OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US); + arrCertAltNameEntry[i].Value <<= OUString(reinterpret_cast<char*>(current->name.other.data), current->name.other.len, RTL_TEXTENCODING_ASCII_US); break; case certDNSName: arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME; - arrCertAltNameEntry[i].Value <<= OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US); + arrCertAltNameEntry[i].Value <<= OUString(reinterpret_cast<char*>(current->name.other.data), current->name.other.len, RTL_TEXTENCODING_ASCII_US); break; case certX400Address: { // unsupported @@ -146,7 +146,7 @@ namespace { } case certURI: arrCertAltNameEntry[i].Type = ExtAltNameType_URL; - arrCertAltNameEntry[i].Value <<= OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US); + arrCertAltNameEntry[i].Value <<= OUString(reinterpret_cast<char*>(current->name.other.data), current->name.other.len, RTL_TEXTENCODING_ASCII_US); break; case certIPAddress: { arrCertAltNameEntry[i].Type = ExtAltNameType_IP_ADDRESS; diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index b4ea4ad3b4a2..7ee875443d0a 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -557,7 +557,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: getCertificate( const O issuerAndSN.derIssuer.data = derIssuer->data ; issuerAndSN.derIssuer.len = derIssuer->len ; - issuerAndSN.serialNumber.data = ( unsigned char* )&serialNumber[0] ; + issuerAndSN.serialNumber.data = reinterpret_cast<unsigned char *>(const_cast<sal_Int8 *>(serialNumber.getConstArray())); issuerAndSN.serialNumber.len = serialNumber.getLength() ; cert = CERT_FindCertByIssuerAndSN( m_pHandler, &issuerAndSN ) ; @@ -659,7 +659,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromRa Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromAscii( const OUString& asciiCertificate ) throw( SecurityException , RuntimeException, std::exception ) { OString oscert = OUStringToOString( asciiCertificate , RTL_TEXTENCODING_ASCII_US ) ; - xmlChar* chCert = xmlStrndup( ( const xmlChar* )oscert.getStr(), ( int )oscert.getLength() ) ; + xmlChar* chCert = xmlStrndup( reinterpret_cast<const xmlChar*>(oscert.getStr()), ( int )oscert.getLength() ) ; int certSize = xmlSecBase64Decode( chCert, ( xmlSecByte* )chCert, xmlStrlen( chCert ) ) ; if (certSize > 0) { @@ -714,7 +714,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, Sequence<sal_Int8> der = intermediateCerts[i]->getEncoded(); SECItem item; item.type = siBuffer; - item.data = (unsigned char*)der.getArray(); + item.data = reinterpret_cast<unsigned char*>(der.getArray()); item.len = der.getLength(); CERTCertificate* certTmp = CERT_NewTempCertificate(certDb, &item, diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index decda16a2b6a..c2c7371e5ef9 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -197,7 +197,7 @@ OUString SAL_CALL X509Certificate_NssImpl :: getSubjectName() throw ( ::com::sun objID = oidString; if ( objID.equals("2.5.29.17") ) - pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ; + pExtn = reinterpret_cast<CertificateExtension_XmlSecImpl*>(new SanExtensionImpl()); else pExtn = new CertificateExtension_XmlSecImpl() ; @@ -205,7 +205,7 @@ OUString SAL_CALL X509Certificate_NssImpl :: getSubjectName() throw ( ::com::sun crit = false ; else crit = ( (*extns)->critical.data[0] == 0xFF ) ? sal_True : sal_False ; - pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (unsigned char*)objID.getStr(), objID.getLength(), crit ) ; + pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, reinterpret_cast<unsigned char *>(const_cast<char *>(objID.getStr())), objID.getLength(), crit ) ; xExtns[len] = pExtn ; } @@ -223,7 +223,7 @@ OUString SAL_CALL X509Certificate_NssImpl :: getSubjectName() throw ( ::com::sun SECItem idItem ; bool crit ; - idItem.data = ( unsigned char* )&oid[0] ; + idItem.data = reinterpret_cast<unsigned char *>(const_cast<sal_Int8 *>(oid.getConstArray())); idItem.len = oid.getLength() ; pExtn = NULL ; @@ -232,7 +232,7 @@ OUString SAL_CALL X509Certificate_NssImpl :: getSubjectName() throw ( ::com::sun const SECItem id = (*extns)->id; OString objId(CERT_GetOidString(&id)); if ( objId.equals("OID.2.5.29.17") ) - pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ; + pExtn = reinterpret_cast<CertificateExtension_XmlSecImpl*>(new SanExtensionImpl()); else pExtn = new CertificateExtension_XmlSecImpl() ; if( (*extns)->critical.data == NULL ) @@ -288,7 +288,7 @@ void X509Certificate_NssImpl :: setRawCert( const Sequence< sal_Int8 >& rawCert CERTCertificate* cert ; SECItem certItem ; - certItem.data = ( unsigned char* )&rawCert[0] ; + certItem.data = reinterpret_cast<unsigned char *>(const_cast<sal_Int8 *>(rawCert.getConstArray())); certItem.len = rawCert.getLength() ; cert = CERT_DecodeDERCertificate( &certItem, PR_TRUE, NULL ) ; diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx index 86d5dba09061..9c454a30a921 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( ( xmlChar* )ostr.getStr(), ( int )ostr.getLength() ) ; + return xmlStrndup( reinterpret_cast<xmlChar const *>(ostr.getStr()), ( int )ostr.getLength() ) ; } /** @@ -50,7 +50,7 @@ xmlChar* ous_to_nxmlstr( const OUString& oustr, int& length ) OString ostr = OUStringToOString( oustr , RTL_TEXTENCODING_UTF8 ) ; length = ostr.getLength(); - return xmlStrndup( ( xmlChar* )ostr.getStr(), length ) ; + return xmlStrndup( reinterpret_cast<xmlChar const *>(ostr.getStr()), length ) ; } /** diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx index 658fce053812..4f37d71b3a06 100644 --- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx @@ -228,15 +228,15 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement( { pAttributeList->AddAttribute( OUString(C2U( STRXMLNS )), - OUString(C2U( (sal_Char*)pNsHref ))); + OUString(C2U( reinterpret_cast<char const *>(pNsHref) ))); } else { pAttributeList->AddAttribute( OUString(C2U( STRXMLNS )) +OUString(C2U( ":" )) - +OUString(C2U( (sal_Char*)pNsPrefix )), - OUString(C2U( (sal_Char*)pNsHref ))); + +OUString(C2U( reinterpret_cast<char const *>(pNsPrefix) )), + OUString(C2U( reinterpret_cast<char const *>(pNsHref) ))); } pNsDef = pNsDef->next; @@ -252,17 +252,17 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement( OUString ouAttrName; if (pAttrNs == NULL) { - ouAttrName = OUString(C2U( (sal_Char*)pAttrName )); + ouAttrName = OUString(C2U( reinterpret_cast<char const *>(pAttrName) )); } else { - ouAttrName = OUString(C2U( (sal_Char*)pAttrNs->prefix)) - + ":" + OUString(C2U( (sal_Char*)pAttrName )); + ouAttrName = OUString(C2U( reinterpret_cast<char const *>(pAttrNs->prefix))) + + ":" + OUString(C2U( reinterpret_cast<char const *>(pAttrName) )); } pAttributeList->AddAttribute( ouAttrName, - OUString(C2U( (sal_Char*)(pAttr->children->content)))); + OUString(C2U( reinterpret_cast<char*>(pAttr->children->content)))); pAttr = pAttr->next; } @@ -368,23 +368,23 @@ void XMLDocumentWrapper_XmlSecImpl::sendNode( { if (xHandler.is()) { - xHandler->characters(OUString(C2U ( ((sal_Char*)(pNode->content)) ))); + xHandler->characters(OUString(C2U ( reinterpret_cast<char*>(pNode->content) ))); } - xHandler2->characters(OUString(C2U ( ((sal_Char*)(pNode->content)) ))); + xHandler2->characters(OUString(C2U ( reinterpret_cast<char*>(pNode->content) ))); } else if (type == XML_PI_NODE) { if (xHandler.is()) { xHandler->processingInstruction( - OUString(C2U ( ((sal_Char*)(pNode->name)) )), - OUString(C2U ( ((sal_Char*)(pNode->content)) ))); + OUString(C2U ( reinterpret_cast<char const *>(pNode->name) )), + OUString(C2U ( reinterpret_cast<char const *>(pNode->content) ))); } xHandler2->processingInstruction( - OUString(C2U ( ((sal_Char*)(pNode->name)) )), - OUString(C2U ( ((sal_Char*)(pNode->content)) ))); + OUString(C2U ( reinterpret_cast<char const *>(pNode->name) )), + OUString(C2U ( reinterpret_cast<char*>(pNode->content) ))); } } @@ -411,14 +411,14 @@ OString XMLDocumentWrapper_XmlSecImpl::getNodeQName(const xmlNodePtr pNode) cons * Email: michael.mi@sun.com ******************************************************************************/ { - OString sNodeName((const sal_Char*)pNode->name); + OString sNodeName(reinterpret_cast<const char*>(pNode->name)); if (pNode->ns != NULL) { xmlNsPtr pNs = pNode->ns; if (pNs->prefix != NULL) { - OString sPrefix((const sal_Char*)pNs->prefix); + OString sPrefix(reinterpret_cast<const char*>(pNs->prefix)); sNodeName = sPrefix+OString(":")+sNodeName; } } @@ -636,7 +636,7 @@ void XMLDocumentWrapper_XmlSecImpl::removeNode(const xmlNodePtr pNode) const while (pAttr != NULL) { - if (!stricmp((sal_Char*)pAttr->name,"id")) + if (!stricmp(reinterpret_cast<char const *>(pAttr->name), "id")) { xmlRemoveID(m_pDocument, pAttr); } @@ -671,10 +671,10 @@ void XMLDocumentWrapper_XmlSecImpl::buildIDAttr(xmlNodePtr pNode) const * Email: michael.mi@sun.com ******************************************************************************/ { - xmlAttrPtr idAttr = xmlHasProp( pNode, (const unsigned char *)"id" ); + xmlAttrPtr idAttr = xmlHasProp( pNode, reinterpret_cast<const unsigned char *>("id") ); if (idAttr == NULL) { - idAttr = xmlHasProp( pNode, (const unsigned char *)"Id" ); + idAttr = xmlHasProp( pNode, reinterpret_cast<const unsigned char *>("Id") ); } if (idAttr != NULL) @@ -751,7 +751,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::removeCurrentElement( ) saxHelper.endElement( OUString( C2U ( - (sal_Char*)(pOldCurrentElement->name) + reinterpret_cast<char const *>(pOldCurrentElement->name) ))); m_pCurrentElement = saxHelper.getCurrentNode(); @@ -785,7 +785,7 @@ OUString SAL_CALL XMLDocumentWrapper_XmlSecImpl::getNodeName( const cssu::Refere throw (cssu::RuntimeException, std::exception) { xmlNodePtr pNode = checkElement(node); - return OUString(C2U ( (sal_Char*)pNode->name )); + return OUString(C2U ( reinterpret_cast<char const *>(pNode->name) )); } void SAL_CALL XMLDocumentWrapper_XmlSecImpl::clearUselessData( |