From 59f8e99deb7181862dbc717e2ee74542667e19d0 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Wed, 14 Dec 2011 09:24:44 +0000 Subject: [PATCH] gcc compiler fixes --- m4/boost.m4 | 5 +++++ saml/SAMLConfig.cpp | 3 ++- saml/binding/impl/ArtifactMap.cpp | 15 ++++++++++----- saml/encryption/EncryptedKeyResolver.cpp | 2 +- saml/saml2/metadata/impl/AbstractMetadataProvider.cpp | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/m4/boost.m4 b/m4/boost.m4 index aa53c7f..8d0920a 100644 --- a/m4/boost.m4 +++ b/m4/boost.m4 @@ -644,6 +644,11 @@ BOOST_DEFUN([Numeric_Conversion], BOOST_DEFUN([Optional], [BOOST_FIND_HEADER([boost/optional.hpp])]) +# BOOST_PTR_CONTAINER() +# ---------------- +# Look for Boost.PointerContainer +BOOST_DEFUN([Ptr_Container], +[BOOST_FIND_HEADER([boost/ptr_container/ptr_vector.hpp])]) # BOOST_PREPROCESSOR() # -------------------- diff --git a/saml/SAMLConfig.cpp b/saml/SAMLConfig.cpp index 43deb15..d18d562 100644 --- a/saml/SAMLConfig.cpp +++ b/saml/SAMLConfig.cpp @@ -301,7 +301,8 @@ void opensaml::annotateException(XMLToolingException* e, const EntityDescriptor* if (entity) { const XMLObject* r = find_if( entity->getOrderedChildren(), - (ll_dynamic_cast(_1) != nullptr && lambda::bind(isValid, ll_dynamic_cast(_1), now)) + (ll_dynamic_cast(_1) != ((const RoleDescriptor*)nullptr) && + lambda::bind(isValid, ll_dynamic_cast(_1), now)) ); if (r) role = dynamic_cast(r); diff --git a/saml/binding/impl/ArtifactMap.cpp b/saml/binding/impl/ArtifactMap.cpp index 62a60ad..6dd3fbb 100644 --- a/saml/binding/impl/ArtifactMap.cpp +++ b/saml/binding/impl/ArtifactMap.cpp @@ -64,8 +64,11 @@ namespace opensaml { private: struct SAML_DLLLOCAL Mapping { - Mapping() : m_expires(0) {} - auto_ptr m_xml; + Mapping() : m_xml(nullptr), m_expires(0) {} + ~Mapping() { + delete m_xml; + } + XMLObject* m_xml; string m_relying; time_t m_expires; }; @@ -109,17 +112,18 @@ void ArtifactMappings::storeContent(XMLObject* content, const SAMLArtifact* arti time_t now = time(nullptr); multimap::iterator stop = m_expMap.upper_bound(now); for (multimap::iterator i = m_expMap.begin(); i != stop; m_expMap.erase(i++)) { + delete m_artMap[i->second].m_xml; m_artMap.erase(i->second); } // Key is the hexed handle. string hexed = SAMLArtifact::toHex(artifact->getMessageHandle()); Mapping& m = m_artMap[hexed]; - m.m_xml.reset(content); + m.m_xml = content; if (relyingParty) m.m_relying = relyingParty; m.m_expires = now + TTL; - m_expMap.insert(pair(m.m_expires,hexed)); + m_expMap.insert(pair(m.m_expires, hexed)); } XMLObject* ArtifactMappings::retrieveContent(const SAMLArtifact* artifact, const char* relyingParty) @@ -148,7 +152,8 @@ XMLObject* ArtifactMappings::retrieveContent(const SAMLArtifact* artifact, const } log.debug("resolved artifact for (%s)", relyingParty ? relyingParty : "unknown"); - XMLObject* ret = i->second.m_xml.release(); + XMLObject* ret = i->second.m_xml; + i->second.m_xml = nullptr; // clear member so it doesn't get deleted removeMapping(i); return ret; } diff --git a/saml/encryption/EncryptedKeyResolver.cpp b/saml/encryption/EncryptedKeyResolver.cpp index 32345c5..8c53692 100644 --- a/saml/encryption/EncryptedKeyResolver.cpp +++ b/saml/encryption/EncryptedKeyResolver.cpp @@ -57,7 +57,7 @@ const EncryptedKey* opensaml::EncryptedKeyResolver::resolveKey(const EncryptedDa // Using XMLString::equals allows for both to be NULL and still match. vector::const_iterator k = find_if( m_ref.getEncryptedKeys().begin(), m_ref.getEncryptedKeys().end(), - (lambda::bind(&EncryptedKey::getRecipient, _1) == nullptr || + (lambda::bind(&EncryptedKey::getRecipient, _1) == ((const XMLCh*)nullptr) || lambda::bind(equal_fn, recipient, lambda::bind(&EncryptedKey::getRecipient, _1))) ); return (k != m_ref.getEncryptedKeys().end()) ? (*k) : nullptr; diff --git a/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp b/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp index d97f5ef..40180f4 100644 --- a/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp +++ b/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp @@ -120,7 +120,7 @@ void AbstractMetadataProvider::indexEntity(EntityDescriptor* site, time_t& valid // search for those sites in the entire set of sites tracked by the sources map and // remove them from both places. set existingSites; - pair existingRange = m_sites.equal_range(id.get()); + pair existingRange = m_sites.equal_range(id.get()); static pair::iterator,bool> (set::* ins)(const EntityDescriptor* const &) = &set::insert; for_each( -- 2.1.4