From e8ce0b8e97466e9fa849da6a8c0a4df77fbd0ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sat, 14 May 2011 00:11:39 +0200 Subject: Removed some explicit new's. diff --git a/Swiften/Chat/ChatStateNotifier.cpp b/Swiften/Chat/ChatStateNotifier.cpp index 498c76d..d507c4d 100644 --- a/Swiften/Chat/ChatStateNotifier.cpp +++ b/Swiften/Chat/ChatStateNotifier.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -68,15 +69,15 @@ bool ChatStateNotifier::contactShouldReceiveStates() { } void ChatStateNotifier::changeState(ChatState::ChatStateType state) { - boost::shared_ptr message(new Message()); + boost::shared_ptr message(boost::make_shared()); message->setTo(contact_); - message->addPayload(boost::shared_ptr(new ChatState(state))); + message->addPayload(boost::make_shared(state)); stanzaChannel_->sendMessage(message); } void ChatStateNotifier::addChatStateRequest(Message::ref message) { if (contactShouldReceiveStates()) { - message->addPayload(boost::shared_ptr(new ChatState(ChatState::Active))); + message->addPayload(boost::make_shared(ChatState::Active)); } } diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp index da81ce4..ed4e165 100644 --- a/Swiften/Client/ClientSession.cpp +++ b/Swiften/Client/ClientSession.cpp @@ -175,11 +175,11 @@ void ClientSession::handleElement(boost::shared_ptr element) { if (streamFeatures->hasStartTLS() && stream->supportsTLSEncryption() && useTLS != NeverUseTLS) { state = WaitingForEncrypt; - stream->writeElement(boost::shared_ptr(new StartTLSRequest())); + stream->writeElement(boost::make_shared()); } else if (useStreamCompression && streamFeatures->hasCompressionMethod("zlib")) { state = Compressing; - stream->writeElement(boost::shared_ptr(new CompressRequest("zlib"))); + stream->writeElement(boost::make_shared("zlib")); } else if (streamFeatures->hasAuthenticationMechanisms()) { if (stream->hasTLSCertificate()) { @@ -250,10 +250,10 @@ void ClientSession::handleElement(boost::shared_ptr element) { finishSession(Error::CompressionFailedError); } else if (boost::dynamic_pointer_cast(element)) { - stanzaAckRequester_ = boost::shared_ptr(new StanzaAckRequester()); + stanzaAckRequester_ = boost::make_shared(); stanzaAckRequester_->onRequestAck.connect(boost::bind(&ClientSession::requestAck, shared_from_this())); stanzaAckRequester_->onStanzaAcked.connect(boost::bind(&ClientSession::handleStanzaAcked, shared_from_this(), _1)); - stanzaAckResponder_ = boost::shared_ptr(new StanzaAckResponder()); + stanzaAckResponder_ = boost::make_shared(); stanzaAckResponder_->onAck.connect(boost::bind(&ClientSession::ack, shared_from_this(), _1)); needAcking = false; continueSessionInitialization(); @@ -308,7 +308,7 @@ void ClientSession::handleElement(boost::shared_ptr element) { void ClientSession::continueSessionInitialization() { if (needResourceBind) { state = BindingResource; - boost::shared_ptr resourceBind(new ResourceBind()); + boost::shared_ptr resourceBind(boost::make_shared()); if (!localJID.getResource().empty()) { resourceBind->setResource(localJID.getResource()); } @@ -316,11 +316,11 @@ void ClientSession::continueSessionInitialization() { } else if (needAcking) { state = EnablingSessionManagement; - stream->writeElement(boost::shared_ptr(new EnableStreamManagement())); + stream->writeElement(boost::make_shared()); } else if (needSessionStart) { state = StartingSession; - sendStanza(IQ::createRequest(IQ::Set, JID(), "session-start", boost::shared_ptr(new StartSession()))); + sendStanza(IQ::createRequest(IQ::Set, JID(), "session-start", boost::make_shared())); } else { state = Initialized; @@ -340,7 +340,7 @@ void ClientSession::sendCredentials(const std::string& password) { assert(WaitingForCredentials); state = Authenticating; authenticator->setCredentials(localJID.getNode(), password); - stream->writeElement(boost::shared_ptr(new AuthRequest(authenticator->getName(), authenticator->getResponse()))); + stream->writeElement(boost::make_shared(authenticator->getName(), authenticator->getResponse())); } void ClientSession::handleTLSEncrypted() { @@ -357,8 +357,7 @@ void ClientSession::handleTLSEncrypted() { continueAfterTLSEncrypted(); } else { - boost::shared_ptr identityError(new CertificateVerificationError(CertificateVerificationError::InvalidServerIdentity)); - checkTrustOrFinish(certificate, identityError); + checkTrustOrFinish(certificate, boost::make_shared(CertificateVerificationError::InvalidServerIdentity)); } } } @@ -410,7 +409,7 @@ void ClientSession::finish() { } void ClientSession::finishSession(Error::Type error) { - finishSession(boost::shared_ptr(new Swift::ClientSession::Error(error))); + finishSession(boost::make_shared(error)); } void ClientSession::finishSession(boost::shared_ptr error) { @@ -422,7 +421,7 @@ void ClientSession::finishSession(boost::shared_ptr error) { } void ClientSession::requestAck() { - stream->writeElement(boost::shared_ptr(new StanzaAckRequest())); + stream->writeElement(boost::make_shared()); } void ClientSession::handleStanzaAcked(boost::shared_ptr stanza) { @@ -430,7 +429,7 @@ void ClientSession::handleStanzaAcked(boost::shared_ptr stanza) { } void ClientSession::ack(unsigned int handledStanzasCount) { - stream->writeElement(boost::shared_ptr(new StanzaAck(handledStanzasCount))); + stream->writeElement(boost::make_shared(handledStanzasCount)); } } diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp index b7500e5..a17696f 100644 --- a/Swiften/Client/CoreClient.cpp +++ b/Swiften/Client/CoreClient.cpp @@ -95,7 +95,7 @@ void CoreClient::handleConnectorFinished(boost::shared_ptr connectio connection_ = connection; assert(!sessionStream_); - sessionStream_ = boost::shared_ptr(new BasicSessionStream(ClientStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), tlsFactories->getTLSContextFactory(), networkFactories->getTimerFactory())); + sessionStream_ = boost::make_shared(ClientStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), tlsFactories->getTLSContextFactory(), networkFactories->getTimerFactory()); if (!certificate_.empty()) { sessionStream_->setTLSCertificate(PKCS12Certificate(certificate_, password_)); } diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp index edd1503..97094bf 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #if defined(SWIFTEN_PLATFORM_MACOSX) && OPENSSL_VERSION_NUMBER < 0x00908000 #include @@ -226,7 +227,7 @@ bool OpenSSLContext::setClientCertificate(const PKCS12Certificate& certificate) Certificate::ref OpenSSLContext::getPeerCertificate() const { boost::shared_ptr x509Cert(SSL_get_peer_certificate(handle_), X509_free); if (x509Cert) { - return Certificate::ref(new OpenSSLCertificate(x509Cert)); + return boost::make_shared(x509Cert); } else { return Certificate::ref(); @@ -236,7 +237,7 @@ Certificate::ref OpenSSLContext::getPeerCertificate() const { boost::shared_ptr OpenSSLContext::getPeerCertificateVerificationError() const { int verifyResult = SSL_get_verify_result(handle_); if (verifyResult != X509_V_OK) { - return boost::shared_ptr(new CertificateVerificationError(getVerificationErrorTypeForResult(verifyResult))); + return boost::make_shared(getVerificationErrorTypeForResult(verifyResult)); } else { return boost::shared_ptr(); -- cgit v0.10.2-6-g49f6