summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-26 15:32:44 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-26 15:33:41 +0100
commitc5f1e8c3bbf6bb534b387cdafd1983204f82dd37 (patch)
tree489056e0c5d332f3eeb948cdd11053330ef5b822 /xmlsecurity
parentf701cce539c58874c07ef7487075b29143cc9ed1 (diff)
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: I42fdc042ed7317b5b6c337e7b38966e616f8e24b
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/framework/buffernode.cxx52
-rw-r--r--xmlsecurity/source/framework/elementmark.cxx2
-rw-r--r--xmlsecurity/source/framework/saxeventkeeperimpl.cxx16
-rw-r--r--xmlsecurity/source/xmlsec/nss/ciphercontext.cxx4
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx8
-rw-r--r--xmlsecurity/source/xmlsec/saxhelper.cxx8
-rw-r--r--xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx8
7 files changed, 49 insertions, 49 deletions
diff --git a/xmlsecurity/source/framework/buffernode.cxx b/xmlsecurity/source/framework/buffernode.cxx
index 1a8ba1dd7ead..7b7b78a9f039 100644
--- a/xmlsecurity/source/framework/buffernode.cxx
+++ b/xmlsecurity/source/framework/buffernode.cxx
@@ -71,7 +71,7 @@ bool BufferNode::isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const
for( ; ii != m_vElementCollectors.end() ; ++ii )
{
- ElementCollector* pElementCollector = (ElementCollector*)*ii;
+ ElementCollector* pElementCollector = const_cast<ElementCollector*>(*ii);
if ((nIgnoredSecurityId == cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID ||
pElementCollector->getSecurityId() != nIgnoredSecurityId) &&
@@ -139,7 +139,7 @@ void BufferNode::addElementCollector(const ElementCollector* pElementCollector)
******************************************************************************/
{
m_vElementCollectors.push_back( pElementCollector );
- ((ElementCollector*)pElementCollector)->setBufferNode(this);
+ const_cast<ElementCollector*>(pElementCollector)->setBufferNode(this);
}
void BufferNode::removeElementCollector(const ElementCollector* pElementCollector)
@@ -173,7 +173,7 @@ void BufferNode::removeElementCollector(const ElementCollector* pElementCollecto
if( *ii == pElementCollector )
{
m_vElementCollectors.erase( ii );
- ((ElementCollector*)pElementCollector)->setBufferNode(NULL);
+ const_cast<ElementCollector*>(pElementCollector)->setBufferNode(NULL);
break;
}
}
@@ -209,7 +209,7 @@ void BufferNode::setBlocker(const ElementMark* pBlocker)
{
OSL_ASSERT(!(m_pBlocker != NULL && pBlocker != NULL));
- m_pBlocker = (ElementMark*)pBlocker;
+ m_pBlocker = const_cast<ElementMark*>(pBlocker);
if (m_pBlocker != NULL)
{
m_pBlocker->setBufferNode(this);
@@ -247,14 +247,14 @@ OUString BufferNode::printChildren() const
rc += OUString( "BufID=" );
rc += OUString::number((*ii)->getBufferId());
- if (((ElementCollector*)(*ii))->getModify())
+ if ((*ii)->getModify())
{
rc += OUString( "[M]" );
}
rc += OUString( ",Pri=" );
- switch (((ElementCollector*)(*ii))->getPriority())
+ switch ((*ii)->getPriority())
{
case cssxc::sax::ElementMarkPriority_BEFOREMODIFY:
rc += OUString( "BEFOREMODIFY" );
@@ -269,7 +269,7 @@ OUString BufferNode::printChildren() const
rc += OUString( "(" );
rc += OUString( "SecID=" );
- rc += OUString::number(((ElementCollector*)(*ii))->getSecurityId());
+ rc += OUString::number(const_cast<ElementCollector*>(*ii)->getSecurityId());
rc += OUString( ")" );
rc += OUString( " " );
}
@@ -364,7 +364,7 @@ const BufferNode* BufferNode::getFirstChild() const
if (!m_vChildren.empty())
{
- rc = (BufferNode*)m_vChildren.front();
+ rc = const_cast<BufferNode*>(m_vChildren.front());
}
return (const BufferNode*)rc;
@@ -524,7 +524,7 @@ sal_Int32 BufferNode::indexOfChild(const BufferNode* pChild) const
void BufferNode::setParent(const BufferNode* pParent)
{
- m_pParent = (BufferNode*)pParent;
+ m_pParent = const_cast<BufferNode*>(pParent);
}
const BufferNode* BufferNode::getNextSibling() const
@@ -554,7 +554,7 @@ const BufferNode* BufferNode::getNextSibling() const
if (m_pParent != NULL)
{
- rc = (BufferNode*)m_pParent->getNextChild(this);
+ rc = const_cast<BufferNode*>(m_pParent->getNextChild(this));
}
return (const BufferNode*)rc;
@@ -593,7 +593,7 @@ const BufferNode* BufferNode::isAncestor(const BufferNode* pDescendant) const
for( ; ii != m_vChildren.end() ; ++ii )
{
- BufferNode* pChild = (BufferNode*)*ii;
+ BufferNode* pChild = const_cast<BufferNode*>(*ii);
if (pChild == pDescendant)
{
@@ -639,7 +639,7 @@ bool BufferNode::isPrevious(const BufferNode* pFollowing) const
{
bool rc = false;
- BufferNode* pNextBufferNode = (BufferNode*)getNextNodeByTreeOrder();
+ BufferNode* pNextBufferNode = const_cast<BufferNode*>(getNextNodeByTreeOrder());
while (pNextBufferNode != NULL)
{
if (pNextBufferNode == pFollowing)
@@ -648,7 +648,7 @@ bool BufferNode::isPrevious(const BufferNode* pFollowing) const
break;
}
- pNextBufferNode = (BufferNode*)(pNextBufferNode->getNextNodeByTreeOrder());
+ pNextBufferNode = const_cast<BufferNode*>(pNextBufferNode->getNextNodeByTreeOrder());
}
return rc;
@@ -700,7 +700,7 @@ const BufferNode* BufferNode::getNextNodeByTreeOrder() const
* Otherwise, it this buffer node has a following sibling,
* then return that sibling.
*/
- BufferNode* pNextSibling = (BufferNode*)getNextSibling();
+ BufferNode* pNextSibling = const_cast<BufferNode*>(getNextSibling());
if (pNextSibling != NULL)
{
return pNextSibling;
@@ -710,7 +710,7 @@ const BufferNode* BufferNode::getNextNodeByTreeOrder() const
* Otherwise, it this buffer node has parent, then return
* its parent's following sibling.
*/
- BufferNode* pNode = (BufferNode*)this;
+ BufferNode* pNode = const_cast<BufferNode*>(this);
BufferNode* pParent;
BufferNode* pNextSiblingParent = NULL;
@@ -721,10 +721,10 @@ const BufferNode* BufferNode::getNextNodeByTreeOrder() const
break;
}
- pParent = (BufferNode*)pNode->getParent();
+ pParent = const_cast<BufferNode*>(pNode->getParent());
if (pParent != NULL)
{
- pNextSiblingParent = (BufferNode*)pParent->getNextSibling();
+ pNextSiblingParent = const_cast<BufferNode*>(pParent->getNextSibling());
}
pNode = pParent;
@@ -767,7 +767,7 @@ void BufferNode::notifyBranch()
for( ; ii != m_vChildren.end() ; ++ii )
{
- BufferNode* pBufferNode = (BufferNode*)*ii;
+ BufferNode* pBufferNode = const_cast<BufferNode*>(*ii);
pBufferNode->elementCollectorNotify();
pBufferNode->notifyBranch();
}
@@ -808,7 +808,7 @@ void BufferNode::elementCollectorNotify()
std::vector< const ElementCollector* >::const_iterator ii = m_vElementCollectors.begin();
for( ; ii != m_vElementCollectors.end() ; ++ii )
{
- ElementCollector* pElementCollector = (ElementCollector*)*ii;
+ ElementCollector* pElementCollector = const_cast<ElementCollector*>(*ii);
nPriority = pElementCollector->getPriority();
if (nPriority > nMaxPriority)
{
@@ -821,7 +821,7 @@ void BufferNode::elementCollectorNotify()
for( ; ii != vElementCollectors.end() ; ++ii )
{
- ElementCollector* pElementCollector = (ElementCollector*)*ii;
+ ElementCollector* pElementCollector = const_cast<ElementCollector*>(*ii);
nPriority = pElementCollector->getPriority();
bool bToModify = pElementCollector->getModify();
@@ -893,7 +893,7 @@ bool BufferNode::isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const
for( ; jj != m_vElementCollectors.end() ; ++jj )
{
- ElementCollector* pElementCollector = (ElementCollector*)*jj;
+ ElementCollector* pElementCollector = const_cast<ElementCollector*>(*jj);
if (nIgnoredSecurityId == cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID ||
pElementCollector->getSecurityId() != nIgnoredSecurityId)
{
@@ -908,7 +908,7 @@ bool BufferNode::isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const
for( ; ii != m_vChildren.end() ; ++ii )
{
- BufferNode* pBufferNode = (BufferNode*)*ii;
+ BufferNode* pBufferNode = const_cast<BufferNode*>(*ii);
if ( pBufferNode->isECInSubTreeIncluded(nIgnoredSecurityId))
{
@@ -962,7 +962,7 @@ bool BufferNode::isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurity
break;
}
- pParentNode = (BufferNode*)pParentNode->getParent();
+ pParentNode = const_cast<BufferNode*>(pParentNode->getParent());
}
return rc;
@@ -1002,7 +1002,7 @@ bool BufferNode::isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const
for( ; ii != m_vChildren.end() ; ++ii )
{
- BufferNode* pBufferNode = (BufferNode*)*ii;
+ BufferNode* pBufferNode = const_cast<BufferNode*>(*ii);
ElementMark* pBlocker = pBufferNode->getBlocker();
if (pBlocker != NULL &&
@@ -1055,7 +1055,7 @@ const BufferNode* BufferNode::getNextChild(const BufferNode* pChild) const
{
if (bChildFound)
{
- rc = (BufferNode*)*ii;
+ rc = const_cast<BufferNode*>(*ii);
break;
}
@@ -1095,7 +1095,7 @@ void BufferNode::freeAllChildren()
std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin();
for( ; ii != m_vChildren.end() ; ++ii )
{
- BufferNode *pChild = (BufferNode *)(*ii);
+ BufferNode *pChild = const_cast<BufferNode *>(*ii);
pChild->freeAllChildren();
delete pChild;
}
diff --git a/xmlsecurity/source/framework/elementmark.cxx b/xmlsecurity/source/framework/elementmark.cxx
index 24edb826a27b..c87e480fecd9 100644
--- a/xmlsecurity/source/framework/elementmark.cxx
+++ b/xmlsecurity/source/framework/elementmark.cxx
@@ -61,7 +61,7 @@ ElementMark::ElementMark(sal_Int32 nSecurityId, sal_Int32 nBufferId)
void ElementMark::setBufferNode(const BufferNode* pBufferNode)
{
- m_pBufferNode = (BufferNode*)pBufferNode;
+ m_pBufferNode = const_cast<BufferNode*>(pBufferNode);
}
diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
index 6013f2dbf369..3d2e397c5a15 100644
--- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
+++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
@@ -242,7 +242,7 @@ ElementMark* SAXEventKeeperImpl::findElementMarkBuffer(sal_Int32 nId) const
{
if ( nId == (*ii)->getBufferId())
{
- pElementMark = (ElementMark*)*ii;
+ pElementMark = const_cast<ElementMark*>(*ii);
break;
}
}
@@ -365,7 +365,7 @@ OUString SAXEventKeeperImpl::printBufferNode(
rc += OUString( " " );
rc += m_xXMLDocument->getNodeName(pBufferNode->getXMLElement());
- BufferNode* pParent = (BufferNode*)pBufferNode->getParent();
+ BufferNode* pParent = const_cast<BufferNode*>(pBufferNode->getParent());
if (pParent != NULL)
{
rc += OUString( "[" );
@@ -392,7 +392,7 @@ OUString SAXEventKeeperImpl::printBufferNode(
std::vector< const BufferNode* >::const_iterator jj = vChildren->begin();
for( ; jj != vChildren->end(); ++jj )
{
- rc += printBufferNode((BufferNode *)*jj, nIndent+4);
+ rc += printBufferNode(const_cast<BufferNode *>(*jj), nIndent+4);
}
delete vChildren;
@@ -485,7 +485,7 @@ void SAXEventKeeperImpl::smashBufferNode(
{
if (!pBufferNode->hasAnything())
{
- BufferNode* pParent = (BufferNode*)pBufferNode->getParent();
+ BufferNode* pParent = const_cast<BufferNode*>(pBufferNode->getParent());
/*
* delete the XML data
@@ -584,7 +584,7 @@ void SAXEventKeeperImpl::smashBufferNode(
std::vector< const BufferNode * >::const_iterator ii = vChildren->begin();
for( ; ii != vChildren->end(); ++ii )
{
- ((BufferNode *)(*ii))->setParent(pParent);
+ const_cast<BufferNode *>(*ii)->setParent(pParent);
pParent->addChild(*ii, nIndex);
nIndex++;
}
@@ -631,7 +631,7 @@ BufferNode* SAXEventKeeperImpl::findNextBlockingBufferNode(
{
pNext = pStartBufferNode;
- while (NULL != (pNext = (BufferNode*)pNext->getNextNodeByTreeOrder()))
+ while (NULL != (pNext = const_cast<BufferNode*>(pNext->getNextNodeByTreeOrder())))
{
if (pNext->getBlocker() != NULL)
{
@@ -674,7 +674,7 @@ void SAXEventKeeperImpl::diffuse(BufferNode* pBufferNode) const
while(pParent->isAllReceived())
{
pParent->elementCollectorNotify();
- pParent = (BufferNode*)pParent->getParent();
+ pParent = const_cast<BufferNode*>(pParent->getParent());
}
}
@@ -1267,7 +1267,7 @@ void SAL_CALL SAXEventKeeperImpl::endElement( const OUString& aName )
if (bIsCurrent && (m_pCurrentBufferNode != m_pRootBufferNode))
{
BufferNode* pOldCurrentBufferNode = m_pCurrentBufferNode;
- m_pCurrentBufferNode = (BufferNode*)m_pCurrentBufferNode->getParent();
+ m_pCurrentBufferNode = const_cast<BufferNode*>(m_pCurrentBufferNode->getParent());
pOldCurrentBufferNode->setReceivedAll();
diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx
index fbf99a799e67..1a5b47319c8f 100644
--- a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx
+++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx
@@ -157,7 +157,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( c
{
int nResultLen = 0;
aResult.realloc( aToConvert.getLength() + m_nBlockSize );
- if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength(), const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( aToConvert.getConstArray() ) ), aToConvert.getLength() ) != SECSuccess )
+ if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength(), reinterpret_cast< const unsigned char* >( aToConvert.getConstArray() ), aToConvert.getLength() ) != SECSuccess )
{
m_bBroken = true;
Dispose();
@@ -221,7 +221,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis
{
int nPrefResLen = 0;
aResult.realloc( m_aLastBlock.getLength() + m_nBlockSize );
- if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nPrefResLen, aResult.getLength(), const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( m_aLastBlock.getConstArray() ) ), m_aLastBlock.getLength() ) != SECSuccess )
+ if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nPrefResLen, aResult.getLength(), reinterpret_cast< const unsigned char* >( m_aLastBlock.getConstArray() ), m_aLastBlock.getLength() ) != SECSuccess )
{
m_bBroken = true;
Dispose();
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index cfa3b8a9a896..0355e27bb7a6 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -437,7 +437,7 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: getCertificate( const O
// Create cert info from issue and serial
OString ostr = OUStringToOString( issuerName , RTL_TEXTENCODING_UTF8 ) ;
- chIssuer = PL_strndup( ( char* )ostr.getStr(), ( int )ostr.getLength() ) ;
+ chIssuer = PL_strndup( ostr.getStr(), ( int )ostr.getLength() ) ;
nmIssuer = CERT_AsciiToName( chIssuer ) ;
if( nmIssuer == NULL ) {
PL_strfree( chIssuer ) ;
@@ -508,7 +508,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl :: buildCerti
//Get the system clock time
timeboundary = PR_Now() ;
- certChain = CERT_GetCertChainFromCert( ( CERTCertificate* )cert, timeboundary, certUsageAnyCA ) ;
+ certChain = CERT_GetCertChainFromCert( const_cast<CERTCertificate*>(cert), timeboundary, certUsageAnyCA ) ;
} else {
certChain = NULL ;
}
@@ -844,13 +844,13 @@ sal_Int32 SecurityEnvironment_NssImpl::getCertificateCharacters(
if (cert->slot != NULL)
{
- priKey = PK11_FindPrivateKeyFromCert( cert->slot, ( CERTCertificate* )cert, NULL ) ;
+ priKey = PK11_FindPrivateKeyFromCert( cert->slot, const_cast<CERTCertificate*>(cert), NULL ) ;
}
if(priKey == NULL)
{
for (CIT_SLOTS is = m_Slots.begin(); is != m_Slots.end(); is++)
{
- priKey = PK11_FindPrivateKeyFromCert(*is, (CERTCertificate*)cert, NULL);
+ priKey = PK11_FindPrivateKeyFromCert(*is, const_cast<CERTCertificate*>(cert), NULL);
if (priKey)
break;
}
diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx
index ee0d950813cc..cd15cc6dbe3e 100644
--- a/xmlsecurity/source/xmlsec/saxhelper.cxx
+++ b/xmlsecurity/source/xmlsec/saxhelper.cxx
@@ -273,7 +273,7 @@ void SAXHelper::startElement(
if( fullName != NULL )
{
- xmlFree( ( xmlChar* )fullName ) ;
+ xmlFree( const_cast<xmlChar*>(fullName) ) ;
fullName = NULL ;
}
@@ -281,7 +281,7 @@ void SAXHelper::startElement(
{
for( int i = 0 ; attrs[i] != NULL ; ++i )
{
- xmlFree( ( xmlChar* )attrs[i] ) ;
+ xmlFree( const_cast<xmlChar*>(attrs[i]) ) ;
attrs[i] = NULL ;
}
@@ -322,7 +322,7 @@ void SAXHelper::characters( const OUString& aChars )
if( chars != NULL )
{
- xmlFree( ( xmlChar* )chars ) ;
+ xmlFree( const_cast<xmlChar*>(chars) ) ;
}
}
@@ -340,7 +340,7 @@ void SAXHelper::ignorableWhitespace( const OUString& aWhitespaces )
if( chars != NULL )
{
- xmlFree( ( xmlChar* )chars ) ;
+ xmlFree( const_cast<xmlChar*>(chars) ) ;
}
}
diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
index 76ea5e393245..062fee4112b1 100644
--- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
+++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
@@ -271,12 +271,12 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement(
if (xHandler.is())
{
xHandler->startElement(
- OUString(C2U ( ((sal_Char*)(sNodeName.getStr())) )),
+ OUString(C2U ( sNodeName.getStr() )),
xAttrList);
}
xHandler2->startElement(
- OUString(C2U ( ((sal_Char*)(sNodeName.getStr())) )),
+ OUString(C2U ( sNodeName.getStr() )),
xAttrList);
}
@@ -318,10 +318,10 @@ void XMLDocumentWrapper_XmlSecImpl::sendEndElement(
if (xHandler.is())
{
- xHandler->endElement(OUString(C2U ( ((sal_Char*)(sNodeName.getStr())) )));
+ xHandler->endElement(OUString(C2U ( sNodeName.getStr() )));
}
- xHandler2->endElement(OUString(C2U ( ((sal_Char*)(sNodeName.getStr())) )));
+ xHandler2->endElement(OUString(C2U ( sNodeName.getStr() )));
}
void XMLDocumentWrapper_XmlSecImpl::sendNode(