Some cppcheck cleaning
This commit is contained in:
committed by
Caolán McNamara
parent
fd8e6b21a5
commit
2bc5fb3428
@@ -154,21 +154,21 @@ SecurityEnvironment_MSCryptImpl :: ~SecurityEnvironment_MSCryptImpl() {
|
|||||||
if( !m_tSymKeyList.empty() ) {
|
if( !m_tSymKeyList.empty() ) {
|
||||||
std::list< HCRYPTKEY >::iterator symKeyIt ;
|
std::list< HCRYPTKEY >::iterator symKeyIt ;
|
||||||
|
|
||||||
for( symKeyIt = m_tSymKeyList.begin() ; symKeyIt != m_tSymKeyList.end() ; symKeyIt ++ )
|
for( symKeyIt = m_tSymKeyList.begin() ; symKeyIt != m_tSymKeyList.end() ; ++symKeyIt )
|
||||||
CryptDestroyKey( *symKeyIt ) ;
|
CryptDestroyKey( *symKeyIt ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !m_tPubKeyList.empty() ) {
|
if( !m_tPubKeyList.empty() ) {
|
||||||
std::list< HCRYPTKEY >::iterator pubKeyIt ;
|
std::list< HCRYPTKEY >::iterator pubKeyIt ;
|
||||||
|
|
||||||
for( pubKeyIt = m_tPubKeyList.begin() ; pubKeyIt != m_tPubKeyList.end() ; pubKeyIt ++ )
|
for( pubKeyIt = m_tPubKeyList.begin() ; pubKeyIt != m_tPubKeyList.end() ; ++pubKeyIt )
|
||||||
CryptDestroyKey( *pubKeyIt ) ;
|
CryptDestroyKey( *pubKeyIt ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !m_tPriKeyList.empty() ) {
|
if( !m_tPriKeyList.empty() ) {
|
||||||
std::list< HCRYPTKEY >::iterator priKeyIt ;
|
std::list< HCRYPTKEY >::iterator priKeyIt ;
|
||||||
|
|
||||||
for( priKeyIt = m_tPriKeyList.begin() ; priKeyIt != m_tPriKeyList.end() ; priKeyIt ++ )
|
for( priKeyIt = m_tPriKeyList.begin() ; priKeyIt != m_tPriKeyList.end() ; ++priKeyIt )
|
||||||
CryptDestroyKey( *priKeyIt ) ;
|
CryptDestroyKey( *priKeyIt ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,12 +266,6 @@ void SecurityEnvironment_MSCryptImpl :: setCryptoProvider( HCRYPTPROV aProv ) th
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( aProv != NULL ) {
|
if( aProv != NULL ) {
|
||||||
/*- Replaced by direct adopt for WINNT support ----
|
|
||||||
if( !CryptContextAddRef( aProv, NULL, NULL ) )
|
|
||||||
throw Exception() ;
|
|
||||||
else
|
|
||||||
m_hProv = aProv ;
|
|
||||||
----*/
|
|
||||||
m_hProv = aProv ;
|
m_hProv = aProv ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,16 +316,12 @@ void SecurityEnvironment_MSCryptImpl :: adoptSymKey( HCRYPTKEY aSymKey ) throw(
|
|||||||
|
|
||||||
if( aSymKey != NULL ) {
|
if( aSymKey != NULL ) {
|
||||||
//First try to find the key in the list
|
//First try to find the key in the list
|
||||||
for( keyIt = m_tSymKeyList.begin() ; keyIt != m_tSymKeyList.end() ; keyIt ++ ) {
|
for( keyIt = m_tSymKeyList.begin() ; keyIt != m_tSymKeyList.end() ; ++keyIt ) {
|
||||||
if( *keyIt == aSymKey )
|
if( *keyIt == aSymKey )
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If we do not find the key in the list, add a new node
|
//If we do not find the key in the list, add a new node
|
||||||
/*- Replaced with directly adopt for WINNT 4.0 support ----
|
|
||||||
if( !CryptDuplicateKey( aSymKey, NULL, 0, &symkey ) )
|
|
||||||
throw RuntimeException() ;
|
|
||||||
----*/
|
|
||||||
symkey = aSymKey ;
|
symkey = aSymKey ;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -347,7 +337,7 @@ void SecurityEnvironment_MSCryptImpl :: rejectSymKey( HCRYPTKEY aSymKey ) throw(
|
|||||||
std::list< HCRYPTKEY >::iterator keyIt ;
|
std::list< HCRYPTKEY >::iterator keyIt ;
|
||||||
|
|
||||||
if( aSymKey != NULL ) {
|
if( aSymKey != NULL ) {
|
||||||
for( keyIt = m_tSymKeyList.begin() ; keyIt != m_tSymKeyList.end() ; keyIt ++ ) {
|
for( keyIt = m_tSymKeyList.begin() ; keyIt != m_tSymKeyList.end() ; ++keyIt ) {
|
||||||
if( *keyIt == aSymKey ) {
|
if( *keyIt == aSymKey ) {
|
||||||
symkey = *keyIt ;
|
symkey = *keyIt ;
|
||||||
CryptDestroyKey( symkey ) ;
|
CryptDestroyKey( symkey ) ;
|
||||||
@@ -364,7 +354,7 @@ HCRYPTKEY SecurityEnvironment_MSCryptImpl :: getSymKey( unsigned int position )
|
|||||||
unsigned int pos ;
|
unsigned int pos ;
|
||||||
|
|
||||||
symkey = NULL ;
|
symkey = NULL ;
|
||||||
for( pos = 0, keyIt = m_tSymKeyList.begin() ; pos < position && keyIt != m_tSymKeyList.end() ; pos ++ , keyIt ++ ) ;
|
for( pos = 0, keyIt = m_tSymKeyList.begin() ; pos < position && keyIt != m_tSymKeyList.end() ; ++pos , ++keyIt ) ;
|
||||||
|
|
||||||
if( pos == position && keyIt != m_tSymKeyList.end() )
|
if( pos == position && keyIt != m_tSymKeyList.end() )
|
||||||
symkey = *keyIt ;
|
symkey = *keyIt ;
|
||||||
@@ -378,16 +368,12 @@ void SecurityEnvironment_MSCryptImpl :: adoptPubKey( HCRYPTKEY aPubKey ) throw(
|
|||||||
|
|
||||||
if( aPubKey != NULL ) {
|
if( aPubKey != NULL ) {
|
||||||
//First try to find the key in the list
|
//First try to find the key in the list
|
||||||
for( keyIt = m_tPubKeyList.begin() ; keyIt != m_tPubKeyList.end() ; keyIt ++ ) {
|
for( keyIt = m_tPubKeyList.begin() ; keyIt != m_tPubKeyList.end() ; ++keyIt ) {
|
||||||
if( *keyIt == aPubKey )
|
if( *keyIt == aPubKey )
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If we do not find the key in the list, add a new node
|
//If we do not find the key in the list, add a new node
|
||||||
/*- Replaced with directly adopt for WINNT 4.0 support ----
|
|
||||||
if( !CryptDuplicateKey( aPubKey, NULL, 0, &pubkey ) )
|
|
||||||
throw RuntimeException() ;
|
|
||||||
----*/
|
|
||||||
pubkey = aPubKey ;
|
pubkey = aPubKey ;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -403,7 +389,7 @@ void SecurityEnvironment_MSCryptImpl :: rejectPubKey( HCRYPTKEY aPubKey ) throw(
|
|||||||
std::list< HCRYPTKEY >::iterator keyIt ;
|
std::list< HCRYPTKEY >::iterator keyIt ;
|
||||||
|
|
||||||
if( aPubKey != NULL ) {
|
if( aPubKey != NULL ) {
|
||||||
for( keyIt = m_tPubKeyList.begin() ; keyIt != m_tPubKeyList.end() ; keyIt ++ ) {
|
for( keyIt = m_tPubKeyList.begin() ; keyIt != m_tPubKeyList.end() ; ++keyIt ) {
|
||||||
if( *keyIt == aPubKey ) {
|
if( *keyIt == aPubKey ) {
|
||||||
pubkey = *keyIt ;
|
pubkey = *keyIt ;
|
||||||
CryptDestroyKey( pubkey ) ;
|
CryptDestroyKey( pubkey ) ;
|
||||||
@@ -420,7 +406,7 @@ HCRYPTKEY SecurityEnvironment_MSCryptImpl :: getPubKey( unsigned int position )
|
|||||||
unsigned int pos ;
|
unsigned int pos ;
|
||||||
|
|
||||||
pubkey = NULL ;
|
pubkey = NULL ;
|
||||||
for( pos = 0, keyIt = m_tPubKeyList.begin() ; pos < position && keyIt != m_tPubKeyList.end() ; pos ++ , keyIt ++ ) ;
|
for( pos = 0, keyIt = m_tPubKeyList.begin() ; pos < position && keyIt != m_tPubKeyList.end() ; ++pos , ++keyIt ) ;
|
||||||
|
|
||||||
if( pos == position && keyIt != m_tPubKeyList.end() )
|
if( pos == position && keyIt != m_tPubKeyList.end() )
|
||||||
pubkey = *keyIt ;
|
pubkey = *keyIt ;
|
||||||
@@ -434,16 +420,12 @@ void SecurityEnvironment_MSCryptImpl :: adoptPriKey( HCRYPTKEY aPriKey ) throw(
|
|||||||
|
|
||||||
if( aPriKey != NULL ) {
|
if( aPriKey != NULL ) {
|
||||||
//First try to find the key in the list
|
//First try to find the key in the list
|
||||||
for( keyIt = m_tPriKeyList.begin() ; keyIt != m_tPriKeyList.end() ; keyIt ++ ) {
|
for( keyIt = m_tPriKeyList.begin() ; keyIt != m_tPriKeyList.end() ; ++keyIt ) {
|
||||||
if( *keyIt == aPriKey )
|
if( *keyIt == aPriKey )
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If we do not find the key in the list, add a new node
|
//If we do not find the key in the list, add a new node
|
||||||
/*- Replaced with directly adopt for WINNT 4.0 support ----
|
|
||||||
if( !CryptDuplicateKey( aPriKey, NULL, 0, &prikey ) )
|
|
||||||
throw RuntimeException() ;
|
|
||||||
----*/
|
|
||||||
prikey = aPriKey ;
|
prikey = aPriKey ;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -459,7 +441,7 @@ void SecurityEnvironment_MSCryptImpl :: rejectPriKey( HCRYPTKEY aPriKey ) throw(
|
|||||||
std::list< HCRYPTKEY >::iterator keyIt ;
|
std::list< HCRYPTKEY >::iterator keyIt ;
|
||||||
|
|
||||||
if( aPriKey != NULL ) {
|
if( aPriKey != NULL ) {
|
||||||
for( keyIt = m_tPriKeyList.begin() ; keyIt != m_tPriKeyList.end() ; keyIt ++ ) {
|
for( keyIt = m_tPriKeyList.begin() ; keyIt != m_tPriKeyList.end() ; ++keyIt ) {
|
||||||
if( *keyIt == aPriKey ) {
|
if( *keyIt == aPriKey ) {
|
||||||
prikey = *keyIt ;
|
prikey = *keyIt ;
|
||||||
CryptDestroyKey( prikey ) ;
|
CryptDestroyKey( prikey ) ;
|
||||||
@@ -476,7 +458,7 @@ HCRYPTKEY SecurityEnvironment_MSCryptImpl :: getPriKey( unsigned int position )
|
|||||||
unsigned int pos ;
|
unsigned int pos ;
|
||||||
|
|
||||||
prikey = NULL ;
|
prikey = NULL ;
|
||||||
for( pos = 0, keyIt = m_tPriKeyList.begin() ; pos < position && keyIt != m_tPriKeyList.end() ; pos ++ , keyIt ++ ) ;
|
for( pos = 0, keyIt = m_tPriKeyList.begin() ; pos < position && keyIt != m_tPriKeyList.end() ; ++pos , ++keyIt ) ;
|
||||||
|
|
||||||
if( pos == position && keyIt != m_tPriKeyList.end() )
|
if( pos == position && keyIt != m_tPriKeyList.end() )
|
||||||
prikey = *keyIt ;
|
prikey = *keyIt ;
|
||||||
@@ -515,15 +497,6 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl :: getPer
|
|||||||
DWORD dwKeySpec;
|
DWORD dwKeySpec;
|
||||||
HCRYPTPROV hCryptProv;
|
HCRYPTPROV hCryptProv;
|
||||||
|
|
||||||
/*
|
|
||||||
hSystemKeyStore = CertOpenStore(
|
|
||||||
CERT_STORE_PROV_SYSTEM ,
|
|
||||||
0 ,
|
|
||||||
NULL ,
|
|
||||||
CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_READONLY_FLAG | CERT_STORE_OPEN_EXISTING_FLAG ,
|
|
||||||
L"MY"
|
|
||||||
) ;
|
|
||||||
*/
|
|
||||||
hSystemKeyStore = CertOpenSystemStore( 0, "MY" ) ;
|
hSystemKeyStore = CertOpenSystemStore( 0, "MY" ) ;
|
||||||
if( hSystemKeyStore != NULL ) {
|
if( hSystemKeyStore != NULL ) {
|
||||||
pCertContext = CertEnumCertificatesInStore( hSystemKeyStore, pCertContext );
|
pCertContext = CertEnumCertificatesInStore( hSystemKeyStore, pCertContext );
|
||||||
@@ -560,7 +533,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl :: getPer
|
|||||||
std::list< X509Certificate_MSCryptImpl* >::iterator xcertIt ;
|
std::list< X509Certificate_MSCryptImpl* >::iterator xcertIt ;
|
||||||
Sequence< Reference< XCertificate > > certSeq( length ) ;
|
Sequence< Reference< XCertificate > > certSeq( length ) ;
|
||||||
|
|
||||||
for( i = 0, xcertIt = certsList.begin(); xcertIt != certsList.end(); xcertIt ++, i++ ) {
|
for( i = 0, xcertIt = certsList.begin(); xcertIt != certsList.end(); ++xcertIt, ++i ) {
|
||||||
certSeq[i] = *xcertIt ;
|
certSeq[i] = *xcertIt ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,7 +546,6 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl :: getPer
|
|||||||
|
|
||||||
Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( const OUString& issuerName, const Sequence< sal_Int8 >& serialNumber ) throw( SecurityException , RuntimeException ) {
|
Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: getCertificate( const OUString& issuerName, const Sequence< sal_Int8 >& serialNumber ) throw( SecurityException , RuntimeException ) {
|
||||||
unsigned int i ;
|
unsigned int i ;
|
||||||
// sal_Int8 found = 0 ;
|
|
||||||
LPSTR pszName ;
|
LPSTR pszName ;
|
||||||
X509Certificate_MSCryptImpl *xcert = NULL ;
|
X509Certificate_MSCryptImpl *xcert = NULL ;
|
||||||
PCCERT_CONTEXT pCertContext = NULL ;
|
PCCERT_CONTEXT pCertContext = NULL ;
|
||||||
|
@@ -75,7 +75,6 @@ getCertError(PRErrorCode errNum)
|
|||||||
void
|
void
|
||||||
printChainFailure(CERTVerifyLog *log)
|
printChainFailure(CERTVerifyLog *log)
|
||||||
{
|
{
|
||||||
unsigned long errorFlags = 0;
|
|
||||||
unsigned int depth = (unsigned int)-1;
|
unsigned int depth = (unsigned int)-1;
|
||||||
const char * specificError = NULL;
|
const char * specificError = NULL;
|
||||||
const char * issuer = NULL;
|
const char * issuer = NULL;
|
||||||
@@ -84,6 +83,7 @@ printChainFailure(CERTVerifyLog *log)
|
|||||||
if (log->count > 0)
|
if (log->count > 0)
|
||||||
{
|
{
|
||||||
xmlsec_trace("Bad certifcation path:");
|
xmlsec_trace("Bad certifcation path:");
|
||||||
|
unsigned long errorFlags = 0;
|
||||||
for (node = log->head; node; node = node->next)
|
for (node = log->head; node; node = node->next)
|
||||||
{
|
{
|
||||||
if (depth != node->depth)
|
if (depth != node->depth)
|
||||||
|
@@ -347,7 +347,6 @@ bool getMozillaCurrentProfile(
|
|||||||
mozilla::MozillaProductType_Mozilla,
|
mozilla::MozillaProductType_Mozilla,
|
||||||
mozilla::MozillaProductType_Firefox,
|
mozilla::MozillaProductType_Firefox,
|
||||||
mozilla::MozillaProductType_Default };
|
mozilla::MozillaProductType_Default };
|
||||||
int nProduct = 4;
|
|
||||||
|
|
||||||
uno::Reference<uno::XInterface> xInstance = rxMSF->createInstance(
|
uno::Reference<uno::XInterface> xInstance = rxMSF->createInstance(
|
||||||
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
|
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
|
||||||
@@ -359,6 +358,7 @@ bool getMozillaCurrentProfile(
|
|||||||
|
|
||||||
if (xMozillaBootstrap.is())
|
if (xMozillaBootstrap.is())
|
||||||
{
|
{
|
||||||
|
int nProduct = 4;
|
||||||
for (int i=0; i<nProduct; i++)
|
for (int i=0; i<nProduct; i++)
|
||||||
{
|
{
|
||||||
::rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
|
::rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
|
||||||
|
@@ -164,19 +164,8 @@ int xmlStreamClose( void * context )
|
|||||||
|
|
||||||
int xmlEnableStreamInputCallbacks()
|
int xmlEnableStreamInputCallbacks()
|
||||||
{
|
{
|
||||||
int cbs = 0 ;
|
|
||||||
|
|
||||||
if( !( enableXmlStreamIO & XMLSTREAMIO_INITIALIZED ) ) {
|
if( !( enableXmlStreamIO & XMLSTREAMIO_INITIALIZED ) ) {
|
||||||
//Register the callbacks into libxml2
|
|
||||||
//cbs = xmlRegisterInputCallbacks(
|
|
||||||
// xmlStreamMatch,
|
|
||||||
// xmlStreamOpen,
|
|
||||||
// xmlStreamRead,
|
|
||||||
// xmlStreamClose ) ;
|
|
||||||
//if( cbs < 0 ) {
|
|
||||||
// return -1 ;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//Register the callbacks into xmlSec
|
//Register the callbacks into xmlSec
|
||||||
//In order to make the xmlsec io finding the callbacks firstly,
|
//In order to make the xmlsec io finding the callbacks firstly,
|
||||||
//I put the callbacks at the very begining.
|
//I put the callbacks at the very begining.
|
||||||
@@ -186,7 +175,7 @@ int xmlEnableStreamInputCallbacks()
|
|||||||
xmlSecIOCleanupCallbacks() ;
|
xmlSecIOCleanupCallbacks() ;
|
||||||
|
|
||||||
//Register my classbacks.
|
//Register my classbacks.
|
||||||
cbs = xmlSecIORegisterCallbacks(
|
int cbs = xmlSecIORegisterCallbacks(
|
||||||
xmlStreamMatch,
|
xmlStreamMatch,
|
||||||
xmlStreamOpen,
|
xmlStreamOpen,
|
||||||
xmlStreamRead,
|
xmlStreamRead,
|
||||||
|
Reference in New Issue
Block a user