Use appropriate type for index.

This commit is contained in:
Vincent Richard 2014-07-24 21:05:56 +02:00
parent 00e07962e7
commit c3bf86c972
3 changed files with 9 additions and 9 deletions

View File

@ -35,13 +35,13 @@ certificateChain::certificateChain(const std::vector <shared_ptr <certificate> >
} }
unsigned int certificateChain::getCount() const size_t certificateChain::getCount() const
{ {
return static_cast <unsigned int>(m_certs.size()); return m_certs.size();
} }
shared_ptr <certificate> certificateChain::getAt(const unsigned int index) shared_ptr <certificate> certificateChain::getAt(const size_t index)
{ {
return m_certs[index]; return m_certs[index];
} }

View File

@ -53,7 +53,7 @@ public:
* *
* @return number of certificates in the chain * @return number of certificates in the chain
*/ */
unsigned int getCount() const; size_t getCount() const;
/** Return the certificate at the specified position. 0 is the /** Return the certificate at the specified position. 0 is the
* subject certificate, 1 is the issuer's certificate, 2 is * subject certificate, 1 is the issuer's certificate, 2 is
@ -62,7 +62,7 @@ public:
* @param index position at which to retrieve certificate * @param index position at which to retrieve certificate
* @return certificate at the specified position * @return certificate at the specified position
*/ */
shared_ptr <certificate> getAt(const unsigned int index); shared_ptr <certificate> getAt(const size_t index);
protected: protected:

View File

@ -76,7 +76,7 @@ void defaultCertificateVerifier::verifyX509
// has been issued by the next certificate in the chain // has been issued by the next certificate in the chain
if (chain->getCount() >= 2) if (chain->getCount() >= 2)
{ {
for (unsigned int i = 0 ; i < chain->getCount() - 1 ; ++i) for (size_t i = 0 ; i < chain->getCount() - 1 ; ++i)
{ {
shared_ptr <X509Certificate> cert = shared_ptr <X509Certificate> cert =
dynamicCast <X509Certificate>(chain->getAt(i)); dynamicCast <X509Certificate>(chain->getAt(i));
@ -96,7 +96,7 @@ void defaultCertificateVerifier::verifyX509
// For every certificate in the chain, verify that the certificate // For every certificate in the chain, verify that the certificate
// is valid at the current time // is valid at the current time
for (unsigned int i = 0 ; i < chain->getCount() ; ++i) for (size_t i = 0 ; i < chain->getCount() ; ++i)
{ {
shared_ptr <X509Certificate> cert = shared_ptr <X509Certificate> cert =
dynamicCast <X509Certificate>(chain->getAt(i)); dynamicCast <X509Certificate>(chain->getAt(i));
@ -113,7 +113,7 @@ void defaultCertificateVerifier::verifyX509
bool trusted = false; bool trusted = false;
for (unsigned int i = 0 ; !trusted && i < m_x509RootCAs.size() ; ++i) for (size_t i = 0 ; !trusted && i < m_x509RootCAs.size() ; ++i)
{ {
shared_ptr <X509Certificate> rootCa = m_x509RootCAs[i]; shared_ptr <X509Certificate> rootCa = m_x509RootCAs[i];
@ -127,7 +127,7 @@ void defaultCertificateVerifier::verifyX509
shared_ptr <X509Certificate> firstCert = shared_ptr <X509Certificate> firstCert =
dynamicCast <X509Certificate>(chain->getAt(0)); dynamicCast <X509Certificate>(chain->getAt(0));
for (unsigned int i = 0 ; !trusted && i < m_x509TrustedCerts.size() ; ++i) for (size_t i = 0 ; !trusted && i < m_x509TrustedCerts.size() ; ++i)
{ {
shared_ptr <X509Certificate> cert = m_x509TrustedCerts[i]; shared_ptr <X509Certificate> cert = m_x509TrustedCerts[i];