From f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Thu, 21 Nov 2013 22:16:57 +0100 Subject: Boost/C++11 shared pointers. --- src/security/sasl/SASLSession.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/security/sasl/SASLSession.cpp') diff --git a/src/security/sasl/SASLSession.cpp b/src/security/sasl/SASLSession.cpp index c34bdd7f..1bdd0889 100644 --- a/src/security/sasl/SASLSession.cpp +++ b/src/security/sasl/SASLSession.cpp @@ -43,8 +43,8 @@ namespace security { namespace sasl { -SASLSession::SASLSession(const string& serviceName, ref ctx, - ref auth, ref mech) +SASLSession::SASLSession(const string& serviceName, shared_ptr ctx, + shared_ptr auth, shared_ptr mech) : m_serviceName(serviceName), m_context(ctx), m_auth(auth), m_mech(mech), m_gsaslContext(0), m_gsaslSession(0) { @@ -61,38 +61,38 @@ SASLSession::SASLSession(const string& serviceName, ref ctx, SASLSession::~SASLSession() { gsasl_finish(m_gsaslSession); - m_gsaslSession = 0; + m_gsaslSession = NULL; gsasl_done(m_gsaslContext); - m_gsaslContext = 0; + m_gsaslContext = NULL; } void SASLSession::init() { - ref saslAuth = m_auth.dynamicCast (); + shared_ptr saslAuth = dynamicCast (m_auth); if (saslAuth) { saslAuth->setSASLMechanism(m_mech); - saslAuth->setSASLSession(thisRef().dynamicCast ()); + saslAuth->setSASLSession(dynamicCast (shared_from_this())); } } -ref SASLSession::getAuthenticator() +shared_ptr SASLSession::getAuthenticator() { return m_auth; } -ref SASLSession::getMechanism() +shared_ptr SASLSession::getMechanism() { return m_mech; } -ref SASLSession::getContext() +shared_ptr SASLSession::getContext() { return m_context; } @@ -102,14 +102,14 @@ bool SASLSession::evaluateChallenge (const byte_t* challenge, const long challengeLen, byte_t** response, long* responseLen) { - return m_mech->step(thisRef().dynamicCast (), + return m_mech->step(dynamicCast (shared_from_this()), challenge, challengeLen, response, responseLen); } -ref SASLSession::getSecuredSocket(ref sok) +shared_ptr SASLSession::getSecuredSocket(shared_ptr sok) { - return vmime::create (thisRef().dynamicCast (), sok); + return make_shared (dynamicCast (shared_from_this()), sok); } @@ -126,7 +126,7 @@ int SASLSession::gsaslCallback SASLSession* sess = reinterpret_cast (gsasl_callback_hook_get(ctx)); if (!sess) return GSASL_AUTHENTICATION_ERROR; - ref auth = sess->getAuthenticator(); + shared_ptr auth = sess->getAuthenticator(); try { -- cgit v1.2.3