diff options
217 files changed, 626 insertions, 624 deletions
diff --git a/doc/book/net.tex b/doc/book/net.tex index 361733ed..301e3f11 100644 --- a/doc/book/net.tex +++ b/doc/book/net.tex @@ -360,7 +360,7 @@ class mySASLAuthenticator : public vmime::security::sasl::defaultSASLAuthenticat const std::vector <vmime::shared_ptr <mechanism> > getAcceptableMechanisms (const std::vector <vmime::shared_ptr <mechanism> >& available, - vmime::shared_ptr <mechanism> suggested) const + const vmime::shared_ptr <mechanism>& suggested) const { // Here, you can sort the SASL mechanisms in the order they will be // tried. If no SASL mechanism is acceptable (ie. for example, not @@ -372,7 +372,7 @@ class mySASLAuthenticator : public vmime::security::sasl::defaultSASLAuthenticat getAcceptableMechanisms(available, suggested); } - void setSASLMechanism(vmime::shared_ptr <mechanism> mech) + void setSASLMechanism(const vmime::shared_ptr <mechanism>& mech) { // This is called when the authentication process is going to // try the specified mechanism. @@ -982,7 +982,7 @@ class myCertVerifier : public vmime::security::cert::certificateVerifier { public: - void verify(vmime::shared_ptr <certificateChain> certs) + void verify(const vmime::shared_ptr <certificateChain>& certs) { // Obtain the subject's certificate vmime::shared_ptr <vmime::security::cert::certificate> cert = chain->getAt(0); @@ -1130,7 +1130,7 @@ class myTracerFactory : public vmime::net::tracerFactory public: vmime::shared_ptr <vmime::net::tracer> create - (vmime::shared_ptr <vmime::net::service> serv, + (const vmime::shared_ptr <vmime::net::service>& serv, const int connectionId) { return vmime::make_shared <myTracer> diff --git a/examples/example6_authenticator.hpp b/examples/example6_authenticator.hpp index b46f8ebd..64336e2a 100644 --- a/examples/example6_authenticator.hpp +++ b/examples/example6_authenticator.hpp @@ -7,7 +7,7 @@ class interactiveAuthenticator : public vmime::security::sasl::defaultSASLAuthen { const std::vector <vmime::shared_ptr <vmime::security::sasl::SASLMechanism> > getAcceptableMechanisms (const std::vector <vmime::shared_ptr <vmime::security::sasl::SASLMechanism> >& available, - vmime::shared_ptr <vmime::security::sasl::SASLMechanism> suggested) const + const vmime::shared_ptr <vmime::security::sasl::SASLMechanism>& suggested) const { std::cout << std::endl << "Available SASL mechanisms:" << std::endl; @@ -24,7 +24,7 @@ class interactiveAuthenticator : public vmime::security::sasl::defaultSASLAuthen return defaultSASLAuthenticator::getAcceptableMechanisms(available, suggested); } - void setSASLMechanism(vmime::shared_ptr <vmime::security::sasl::SASLMechanism> mech) + void setSASLMechanism(const vmime::shared_ptr <vmime::security::sasl::SASLMechanism>& mech) { std::cout << "Trying '" << mech->getName() << "' authentication mechanism" << std::endl; diff --git a/examples/example6_certificateVerifier.hpp b/examples/example6_certificateVerifier.hpp index e98f7874..b4b47a2a 100644 --- a/examples/example6_certificateVerifier.hpp +++ b/examples/example6_certificateVerifier.hpp @@ -7,7 +7,7 @@ class interactiveCertificateVerifier : public vmime::security::cert::defaultCert { public: - void verify(vmime::shared_ptr <vmime::security::cert::certificateChain> chain, const vmime::string& hostname) + void verify(const vmime::shared_ptr <vmime::security::cert::certificateChain>& chain, const vmime::string& hostname) { try { diff --git a/examples/example6_tracer.hpp b/examples/example6_tracer.hpp index 19d0f040..8f57f56c 100644 --- a/examples/example6_tracer.hpp +++ b/examples/example6_tracer.hpp @@ -6,8 +6,8 @@ class myTracer : public vmime::net::tracer { public: - myTracer(vmime::shared_ptr <std::ostringstream> stream, - vmime::shared_ptr <vmime::net::service> serv, const int connectionId) + myTracer(const vmime::shared_ptr <std::ostringstream>& stream, + const vmime::shared_ptr <vmime::net::service>& serv, const int connectionId) : m_stream(stream), m_service(serv), m_connectionId(connectionId) { } @@ -35,13 +35,13 @@ class myTracerFactory : public vmime::net::tracerFactory { public: - myTracerFactory(vmime::shared_ptr <std::ostringstream> stream) + myTracerFactory(const vmime::shared_ptr <std::ostringstream>& stream) : m_stream(stream) { } vmime::shared_ptr <vmime::net::tracer> create - (vmime::shared_ptr <vmime::net::service> serv, const int connectionId) + (const vmime::shared_ptr <vmime::net::service>& serv, const int connectionId) { return vmime::make_shared <myTracer>(m_stream, serv, connectionId); } diff --git a/src/vmime/addressList.cpp b/src/vmime/addressList.cpp index 5c7d34ac..23834f6f 100644 --- a/src/vmime/addressList.cpp +++ b/src/vmime/addressList.cpp @@ -139,13 +139,13 @@ shared_ptr <component> addressList::clone() const } -void addressList::appendAddress(shared_ptr <address> addr) +void addressList::appendAddress(const shared_ptr <address> &addr) { m_list.push_back(addr); } -void addressList::insertAddressBefore(shared_ptr <address> beforeAddress, shared_ptr <address> addr) +void addressList::insertAddressBefore(const shared_ptr <address>& beforeAddress, const shared_ptr <address>& addr) { const std::vector <shared_ptr <address> >::iterator it = std::find (m_list.begin(), m_list.end(), beforeAddress); @@ -157,7 +157,7 @@ void addressList::insertAddressBefore(shared_ptr <address> beforeAddress, shared } -void addressList::insertAddressBefore(const size_t pos, shared_ptr <address> addr) +void addressList::insertAddressBefore(const size_t pos, const shared_ptr <address>& addr) { if (pos >= m_list.size()) throw std::out_of_range("Invalid position"); @@ -166,7 +166,7 @@ void addressList::insertAddressBefore(const size_t pos, shared_ptr <address> add } -void addressList::insertAddressAfter(shared_ptr <address> afterAddress, shared_ptr <address> addr) +void addressList::insertAddressAfter(const shared_ptr <address>& afterAddress, const shared_ptr <address>& addr) { const std::vector <shared_ptr <address> >::iterator it = std::find (m_list.begin(), m_list.end(), afterAddress); @@ -178,7 +178,7 @@ void addressList::insertAddressAfter(shared_ptr <address> afterAddress, shared_p } -void addressList::insertAddressAfter(const size_t pos, shared_ptr <address> addr) +void addressList::insertAddressAfter(const size_t pos, const shared_ptr <address>& addr) { if (pos >= m_list.size()) throw std::out_of_range("Invalid position"); @@ -187,7 +187,7 @@ void addressList::insertAddressAfter(const size_t pos, shared_ptr <address> addr } -void addressList::removeAddress(shared_ptr <address> addr) +void addressList::removeAddress(const shared_ptr <address>& addr) { const std::vector <shared_ptr <address> >::iterator it = std::find (m_list.begin(), m_list.end(), addr); diff --git a/src/vmime/addressList.hpp b/src/vmime/addressList.hpp index 0df657d3..c0909069 100644 --- a/src/vmime/addressList.hpp +++ b/src/vmime/addressList.hpp @@ -63,7 +63,7 @@ public: * * @param addr address to append */ - void appendAddress(shared_ptr <address> addr); + void appendAddress(const shared_ptr <address>& addr); /** Insert a new address before the specified address. * @@ -71,7 +71,7 @@ public: * @param addr address to insert * @throw std::out_of_range if the address is not in the list */ - void insertAddressBefore(shared_ptr <address> beforeAddress, shared_ptr <address> addr); + void insertAddressBefore(const shared_ptr <address>& beforeAddress, const shared_ptr <address>& addr); /** Insert a new address before the specified position. * @@ -80,7 +80,7 @@ public: * @param addr address to insert * @throw std::out_of_range if the position is out of range */ - void insertAddressBefore(const size_t pos, shared_ptr <address> addr); + void insertAddressBefore(const size_t pos, const shared_ptr <address>& addr); /** Insert a new address after the specified address. * @@ -88,7 +88,7 @@ public: * @param addr address to insert * @throw std::out_of_range if the address is not in the list */ - void insertAddressAfter(shared_ptr <address> afterAddress, shared_ptr <address> addr); + void insertAddressAfter(const shared_ptr <address>& afterAddress, const shared_ptr <address>& addr); /** Insert a new address after the specified position. * @@ -96,14 +96,14 @@ public: * @param addr address to insert * @throw std::out_of_range if the position is out of range */ - void insertAddressAfter(const size_t pos, shared_ptr <address> addr); + void insertAddressAfter(const size_t pos, const shared_ptr <address>& addr); /** Remove the specified address from the list. * * @param addr address to remove * @throw std::out_of_range if the address is not in the list */ - void removeAddress(shared_ptr <address> addr); + void removeAddress(const shared_ptr <address>& addr); /** Remove the address at the specified position. * diff --git a/src/vmime/attachment.hpp b/src/vmime/attachment.hpp index 9730bc6c..862e5d9e 100644 --- a/src/vmime/attachment.hpp +++ b/src/vmime/attachment.hpp @@ -108,7 +108,7 @@ protected: * * @param parent body part in which to generate the attachment */ - virtual void generateIn(shared_ptr <bodyPart> parent) const = 0; + virtual void generateIn(const shared_ptr <bodyPart>& parent) const = 0; }; diff --git a/src/vmime/attachmentHelper.cpp b/src/vmime/attachmentHelper.cpp index 152daeed..252a0377 100644 --- a/src/vmime/attachmentHelper.cpp +++ b/src/vmime/attachmentHelper.cpp @@ -39,7 +39,7 @@ namespace vmime // static bool attachmentHelper::isBodyPartAnAttachment - (shared_ptr <const bodyPart> part, const unsigned int options) + (const shared_ptr <const bodyPart>& part, const unsigned int options) { // First, try with "Content-Disposition" field. // If not present, we will try with "Content-Type" field. @@ -123,7 +123,7 @@ bool attachmentHelper::isBodyPartAnAttachment // static shared_ptr <const attachment> attachmentHelper::getBodyPartAttachment - (shared_ptr <const bodyPart> part, const unsigned int options) + (const shared_ptr <const bodyPart>& part, const unsigned int options) { if (!isBodyPartAnAttachment(part, options)) return null; @@ -159,7 +159,7 @@ shared_ptr <const attachment> attachmentHelper::getBodyPartAttachment // static const std::vector <shared_ptr <const attachment> > attachmentHelper::findAttachmentsInMessage - (shared_ptr <const message> msg, const unsigned int options) + (const shared_ptr <const message>& msg, const unsigned int options) { return findAttachmentsInBodyPart(msg, options); } @@ -168,7 +168,7 @@ const std::vector <shared_ptr <const attachment> > // static const std::vector <shared_ptr <const attachment> > attachmentHelper::findAttachmentsInBodyPart - (shared_ptr <const bodyPart> part, const unsigned int options) + (const shared_ptr <const bodyPart>& part, const unsigned int options) { std::vector <shared_ptr <const attachment> > atts; @@ -196,7 +196,7 @@ const std::vector <shared_ptr <const attachment> > // static -void attachmentHelper::addAttachment(shared_ptr <message> msg, shared_ptr <attachment> att) +void attachmentHelper::addAttachment(const shared_ptr <message>& msg, const shared_ptr <attachment>& att) { // We simply search for a "multipart/mixed" part. If no one exists, // create it in the root part. This (very simple) algorithm should @@ -279,7 +279,7 @@ void attachmentHelper::addAttachment(shared_ptr <message> msg, shared_ptr <attac // static shared_ptr <bodyPart> attachmentHelper::findBodyPart - (shared_ptr <bodyPart> part, const mediaType& type) + (const shared_ptr <bodyPart>& part, const mediaType& type) { if (part->getBody()->getContentType() == type) return part; @@ -301,7 +301,7 @@ shared_ptr <bodyPart> attachmentHelper::findBodyPart // static -void attachmentHelper::addAttachment(shared_ptr <message> msg, shared_ptr <message> amsg) +void attachmentHelper::addAttachment(const shared_ptr <message>& msg, const shared_ptr <message>& amsg) { shared_ptr <attachment> att = make_shared <parsedMessageAttachment>(amsg); addAttachment(msg, att); diff --git a/src/vmime/attachmentHelper.hpp b/src/vmime/attachmentHelper.hpp index e03a4f7d..f1588fe8 100644 --- a/src/vmime/attachmentHelper.hpp +++ b/src/vmime/attachmentHelper.hpp @@ -59,7 +59,7 @@ public: * @param options search options (see FindOptions) * @return true if the part is an attachment, false otherwise */ - static bool isBodyPartAnAttachment(shared_ptr <const bodyPart> part, const unsigned int options = 0); + static bool isBodyPartAnAttachment(const shared_ptr <const bodyPart>& part, const unsigned int options = 0); /** Return attachment information in the specified body part. * If the specified body part does not contain attachment @@ -70,7 +70,7 @@ public: * @return attachment found in the part, or NULL */ static shared_ptr <const attachment> - getBodyPartAttachment(shared_ptr <const bodyPart> part, const unsigned int options = 0); + getBodyPartAttachment(const shared_ptr <const bodyPart>& part, const unsigned int options = 0); /** Find all attachments contained in the specified part * and all its children parts. @@ -81,7 +81,7 @@ public: * @return a list of attachments found */ static const std::vector <shared_ptr <const attachment> > - findAttachmentsInBodyPart(shared_ptr <const bodyPart> part, const unsigned int options = 0); + findAttachmentsInBodyPart(const shared_ptr <const bodyPart>& part, const unsigned int options = 0); /** Find all attachments contained in the specified message. * This is simply a recursive call to getBodyPartAttachment(). @@ -91,26 +91,26 @@ public: * @return a list of attachments found */ static const std::vector <shared_ptr <const attachment> > - findAttachmentsInMessage(shared_ptr <const message> msg, const unsigned int options = 0); + findAttachmentsInMessage(const shared_ptr <const message>& msg, const unsigned int options = 0); /** Add an attachment to the specified message. * * @param msg message into which to add the attachment * @param att attachment to add */ - static void addAttachment(shared_ptr <message> msg, shared_ptr <attachment> att); + static void addAttachment(const shared_ptr <message>& msg, const shared_ptr <attachment>& att); /** Add a message attachment to the specified message. * * @param msg message into which to add the attachment * @param amsg message to attach */ - static void addAttachment(shared_ptr <message> msg, shared_ptr <message> amsg); + static void addAttachment(const shared_ptr <message>& msg, const shared_ptr <message>& amsg); protected: static shared_ptr <bodyPart> findBodyPart - (shared_ptr <bodyPart> part, const mediaType& type); + (const shared_ptr <bodyPart>& part, const mediaType& type); }; diff --git a/src/vmime/base.hpp b/src/vmime/base.hpp index f6515794..b39ff55e 100644 --- a/src/vmime/base.hpp +++ b/src/vmime/base.hpp @@ -192,7 +192,7 @@ namespace vmime * This is an alias for dynamic_pointer_cast <T>(obj->clone()). */ template <class T> - shared_ptr <T> clone(shared_ptr <T> obj) + shared_ptr <T> clone(const shared_ptr <T>& obj) { return dynamic_pointer_cast <T>(obj->clone()); } @@ -201,7 +201,7 @@ namespace vmime * This is an alias for dynamic_pointer_cast <T>(obj->clone()). */ template <class T> - shared_ptr <T> clone(shared_ptr <const T> obj) + shared_ptr <T> clone(const shared_ptr <const T>& obj) { return dynamic_pointer_cast <T>(obj->clone()); } @@ -220,7 +220,7 @@ namespace vmime * type Type, and DerivedType is derived from Type. */ template <class X, class Y> - shared_ptr <X> dynamicCast(shared_ptr <Y> obj) + shared_ptr <X> dynamicCast(const shared_ptr <Y>& obj) { return dynamic_pointer_cast <X, Y>(obj); } diff --git a/src/vmime/body.cpp b/src/vmime/body.cpp index e5813375..41624b7b 100644 --- a/src/vmime/body.cpp +++ b/src/vmime/body.cpp @@ -56,7 +56,7 @@ body::~body() // static size_t body::findNextBoundaryPosition - (shared_ptr <utility::parserInputStreamAdapter> parser, const string& boundary, + (const shared_ptr <utility::parserInputStreamAdapter>& parser, const string& boundary, const size_t position, const size_t end, size_t* boundaryStart, size_t* boundaryEnd) { @@ -129,7 +129,7 @@ size_t body::findNextBoundaryPosition void body::parseImpl (const parsingContext& ctx, - shared_ptr <utility::parserInputStreamAdapter> parser, + const shared_ptr <utility::parserInputStreamAdapter>& parser, const size_t position, const size_t end, size_t* newPosition) { removeAllParts(); @@ -839,13 +839,13 @@ const shared_ptr <const contentHandler> body::getContents() const } -void body::setContents(shared_ptr <const contentHandler> contents) +void body::setContents(const shared_ptr <const contentHandler>& contents) { m_contents = contents; } -void body::setContents(shared_ptr <const contentHandler> contents, const mediaType& type) +void body::setContents(const shared_ptr <const contentHandler>& contents, const mediaType& type) { m_contents = contents; @@ -853,7 +853,7 @@ void body::setContents(shared_ptr <const contentHandler> contents, const mediaTy } -void body::setContents(shared_ptr <const contentHandler> contents, const mediaType& type, const charset& chset) +void body::setContents(const shared_ptr <const contentHandler>& contents, const mediaType& type, const charset& chset) { m_contents = contents; @@ -861,7 +861,7 @@ void body::setContents(shared_ptr <const contentHandler> contents, const mediaTy } -void body::setContents(shared_ptr <const contentHandler> contents, const mediaType& type, +void body::setContents(const shared_ptr <const contentHandler>& contents, const mediaType& type, const charset& chset, const encoding& enc) { m_contents = contents; @@ -871,7 +871,7 @@ void body::setContents(shared_ptr <const contentHandler> contents, const mediaTy } -void body::initNewPart(shared_ptr <bodyPart> part) +void body::initNewPart(const shared_ptr <bodyPart>& part) { // A part can be in only one body at the same time: if part is // already attached to a parent part, remove it from the current @@ -923,7 +923,7 @@ void body::initNewPart(shared_ptr <bodyPart> part) } -void body::appendPart(shared_ptr <bodyPart> part) +void body::appendPart(const shared_ptr <bodyPart>& part) { initNewPart(part); @@ -931,7 +931,7 @@ void body::appendPart(shared_ptr <bodyPart> part) } -void body::insertPartBefore(shared_ptr <bodyPart> beforePart, shared_ptr <bodyPart> part) +void body::insertPartBefore(const shared_ptr <bodyPart>& beforePart, const shared_ptr <bodyPart>& part) { initNewPart(part); @@ -945,7 +945,7 @@ void body::insertPartBefore(shared_ptr <bodyPart> beforePart, shared_ptr <bodyPa } -void body::insertPartBefore(const size_t pos, shared_ptr <bodyPart> part) +void body::insertPartBefore(const size_t pos, const shared_ptr <bodyPart>& part) { initNewPart(part); @@ -953,7 +953,7 @@ void body::insertPartBefore(const size_t pos, shared_ptr <bodyPart> part) } -void body::insertPartAfter(shared_ptr <bodyPart> afterPart, shared_ptr <bodyPart> part) +void body::insertPartAfter(const shared_ptr <bodyPart>& afterPart, const shared_ptr <bodyPart>& part) { initNewPart(part); @@ -967,7 +967,7 @@ void body::insertPartAfter(shared_ptr <bodyPart> afterPart, shared_ptr <bodyPart } -void body::insertPartAfter(const size_t pos, shared_ptr <bodyPart> part) +void body::insertPartAfter(const size_t pos, const shared_ptr <bodyPart>& part) { initNewPart(part); @@ -975,7 +975,7 @@ void body::insertPartAfter(const size_t pos, shared_ptr <bodyPart> part) } -void body::removePart(shared_ptr <bodyPart> part) +void body::removePart(const shared_ptr <bodyPart>& part) { const std::vector <shared_ptr <bodyPart> >::iterator it = std::find (m_parts.begin(), m_parts.end(), part); diff --git a/src/vmime/body.hpp b/src/vmime/body.hpp index e47f97e9..24f010b4 100644 --- a/src/vmime/body.hpp +++ b/src/vmime/body.hpp @@ -60,7 +60,7 @@ public: * * @param part part to append */ - void appendPart(shared_ptr <bodyPart> part); + void appendPart(const shared_ptr <bodyPart>& part); /** Insert a new part before the specified part. * @@ -68,7 +68,7 @@ public: * @param part part to insert * @throw exceptions::no_such_part if the part is not in the list */ - void insertPartBefore(shared_ptr <bodyPart> beforePart, shared_ptr <bodyPart> part); + void insertPartBefore(const shared_ptr <bodyPart>& beforePart, const shared_ptr <bodyPart>& part); /** Insert a new part before the specified position. * @@ -76,7 +76,7 @@ public: * the beginning of the list) * @param part part to insert */ - void insertPartBefore(const size_t pos, shared_ptr <bodyPart> part); + void insertPartBefore(const size_t pos, const shared_ptr <bodyPart>& part); /** Insert a new part after the specified part. * @@ -84,21 +84,21 @@ public: * @param part part to insert * @throw exceptions::no_such_part if the part is not in the list */ - void insertPartAfter(shared_ptr <bodyPart> afterPart, shared_ptr <bodyPart> part); + void insertPartAfter(const shared_ptr <bodyPart>& afterPart, const shared_ptr <bodyPart>& part); /** Insert a new part after the specified position. * * @param pos position of the part before the new part * @param part part to insert */ - void insertPartAfter(const size_t pos, shared_ptr <bodyPart> part); + void insertPartAfter(const size_t pos, const shared_ptr <bodyPart>& part); /** Remove the specified part from the list. * * @param part part to remove * @throw exceptions::no_such_part if the part is not in the list */ - void removePart(shared_ptr <bodyPart> part); + void removePart(const shared_ptr <bodyPart>& part); /** Remove the part at the specified position. * @@ -182,14 +182,14 @@ public: * * @param contents new body contents */ - void setContents(shared_ptr <const contentHandler> contents); + void setContents(const shared_ptr <const contentHandler>& contents); /** Set the body contents and type. * * @param contents new body contents * @param type type of contents */ - void setContents(shared_ptr <const contentHandler> contents, const mediaType& type); + void setContents(const shared_ptr <const contentHandler>& contents, const mediaType& type); /** Set the body contents, type and charset. * @@ -197,7 +197,7 @@ public: * @param type type of contents * @param chset charset of contents */ - void setContents(shared_ptr <const contentHandler> contents, const mediaType& type, const charset& chset); + void setContents(const shared_ptr <const contentHandler>& contents, const mediaType& type, const charset& chset); /** Set the body contents, type, charset and encoding. * @@ -206,7 +206,7 @@ public: * @param chset charset of contents * @param enc contents encoding */ - void setContents(shared_ptr <const contentHandler> contents, const mediaType& type, + void setContents(const shared_ptr <const contentHandler>& contents, const mediaType& type, const charset& chset, const encoding& enc); /** Set the MIME type and charset of contents. @@ -301,7 +301,7 @@ private: bool isRootPart() const; - void initNewPart(shared_ptr <bodyPart> part); + void initNewPart(const shared_ptr <bodyPart>& part); protected: @@ -318,14 +318,14 @@ protected: * @return the position of the boundary string, or npos if not found */ size_t findNextBoundaryPosition - (shared_ptr <utility::parserInputStreamAdapter> parser, const string& boundary, + (const shared_ptr <utility::parserInputStreamAdapter>& parser, const string& boundary, const size_t position, const size_t end, size_t* boundaryStart, size_t* boundaryEnd); // Component parsing & assembling void parseImpl (const parsingContext& ctx, - shared_ptr <utility::parserInputStreamAdapter> parser, + const shared_ptr <utility::parserInputStreamAdapter>& parser, const size_t position, const size_t end, size_t* newPosition = NULL); diff --git a/src/vmime/bodyPart.cpp b/src/vmime/bodyPart.cpp index 12896f84..c215eb80 100644 --- a/src/vmime/bodyPart.cpp +++ b/src/vmime/bodyPart.cpp @@ -38,7 +38,7 @@ bodyPart::bodyPart() void bodyPart::parseImpl - (const parsingContext& ctx, shared_ptr <utility::parserInputStreamAdapter> parser, + (const parsingContext& ctx, const shared_ptr <utility::parserInputStreamAdapter>& parser, const size_t position, const size_t end, size_t* newPosition) { // Parse the headers @@ -117,7 +117,7 @@ shared_ptr <header> bodyPart::getHeader() } -void bodyPart::setHeader(shared_ptr <header> h) +void bodyPart::setHeader(const shared_ptr <header>& h) { m_header = h; } @@ -135,7 +135,7 @@ shared_ptr <body> bodyPart::getBody() } -void bodyPart::setBody(shared_ptr <body> b) +void bodyPart::setBody(const shared_ptr <body>& b) { bodyPart* oldPart = b->m_part; @@ -169,7 +169,7 @@ shared_ptr <bodyPart> bodyPart::createChildPart() } -void bodyPart::importChildPart(shared_ptr <bodyPart> part) +void bodyPart::importChildPart(const shared_ptr <bodyPart>& part) { part->m_parent = this; } diff --git a/src/vmime/bodyPart.hpp b/src/vmime/bodyPart.hpp index 214cb208..729af253 100644 --- a/src/vmime/bodyPart.hpp +++ b/src/vmime/bodyPart.hpp @@ -63,7 +63,7 @@ public: * * @param header the new header of this part */ - void setHeader(shared_ptr <header> header); + void setHeader(const shared_ptr <header>& header); /** Return the body section of this part. * @@ -81,7 +81,7 @@ public: * * @param body new body section */ - void setBody(shared_ptr <body> body); + void setBody(const shared_ptr <body>& body); /** Return the parent part of this part. * @@ -131,12 +131,12 @@ protected: * * @param part child part to attach */ - void importChildPart(shared_ptr <bodyPart> part); + void importChildPart(const shared_ptr <bodyPart>& part); // Component parsing & assembling void parseImpl (const parsingContext& ctx, - shared_ptr <utility::parserInputStreamAdapter> parser, + const shared_ptr <utility::parserInputStreamAdapter>& parser, const size_t position, const size_t end, size_t* newPosition = NULL); diff --git a/src/vmime/bodyPartAttachment.cpp b/src/vmime/bodyPartAttachment.cpp index 0684a896..07a92d12 100644 --- a/src/vmime/bodyPartAttachment.cpp +++ b/src/vmime/bodyPartAttachment.cpp @@ -28,7 +28,7 @@ namespace vmime { -bodyPartAttachment::bodyPartAttachment(shared_ptr <const bodyPart> part) +bodyPartAttachment::bodyPartAttachment(const shared_ptr <const bodyPart>& part) : m_part(part) { } @@ -136,7 +136,7 @@ shared_ptr <const contentTypeField> bodyPartAttachment::getContentType() const } -void bodyPartAttachment::generateIn(shared_ptr <bodyPart> /* parent */) const +void bodyPartAttachment::generateIn(const shared_ptr <bodyPart>& /* parent */) const { // Not used } diff --git a/src/vmime/bodyPartAttachment.hpp b/src/vmime/bodyPartAttachment.hpp index e1a4a89a..43848bd3 100644 --- a/src/vmime/bodyPartAttachment.hpp +++ b/src/vmime/bodyPartAttachment.hpp @@ -44,7 +44,7 @@ class VMIME_EXPORT bodyPartAttachment : public attachment { public: - bodyPartAttachment(shared_ptr <const bodyPart> part); + bodyPartAttachment(const shared_ptr <const bodyPart>& part); const mediaType getType() const; const word getName() const; @@ -58,7 +58,7 @@ public: private: - void generateIn(shared_ptr <bodyPart> parent) const; + void generateIn(const shared_ptr <bodyPart>& parent) const; shared_ptr <const contentDispositionField> getContentDisposition() const; shared_ptr <const contentTypeField> getContentType() const; diff --git a/src/vmime/component.cpp b/src/vmime/component.cpp index 46ff4036..342d087b 100644 --- a/src/vmime/component.cpp +++ b/src/vmime/component.cpp @@ -47,14 +47,14 @@ component::~component() void component::parse - (shared_ptr <utility::inputStream> inputStream, const size_t length) + (const shared_ptr <utility::inputStream>& inputStream, const size_t length) { parse(inputStream, 0, length, NULL); } void component::parse - (shared_ptr <utility::inputStream> inputStream, const size_t position, + (const shared_ptr <utility::inputStream>& inputStream, const size_t position, const size_t end, size_t* newPosition) { parse(parsingContext::getDefaultContext(), inputStream, position, end, newPosition); @@ -63,7 +63,7 @@ void component::parse void component::parse (const parsingContext& ctx, - shared_ptr <utility::inputStream> inputStream, const size_t position, + const shared_ptr <utility::inputStream>& inputStream, const size_t position, const size_t end, size_t* newPosition) { m_parsedOffset = m_parsedLength = 0; @@ -144,7 +144,7 @@ void component::offsetParsedBounds(const size_t offset) void component::parseImpl - (const parsingContext& ctx, shared_ptr <utility::parserInputStreamAdapter> parser, + (const parsingContext& ctx, const shared_ptr <utility::parserInputStreamAdapter>& parser, const size_t position, const size_t end, size_t* newPosition) { // This is the default implementation for parsing from an input stream: diff --git a/src/vmime/component.hpp b/src/vmime/component.hpp index 87d465e8..6c360746 100644 --- a/src/vmime/component.hpp +++ b/src/vmime/component.hpp @@ -70,7 +70,7 @@ public: * @param inputStream stream from which to read data * @param length data length, in bytes (0 = unknown/not specified) */ - void parse(shared_ptr <utility::inputStream> inputStream, const size_t length); + void parse(const shared_ptr <utility::inputStream>& inputStream, const size_t length); /** Parse RFC-822/MIME data for this component, using the default * parsing context. @@ -112,7 +112,7 @@ public: * @param newPosition will receive the new position in the input stream */ void parse - (shared_ptr <utility::inputStream> inputStream, + (const shared_ptr <utility::inputStream>& inputStream, const size_t position, const size_t end, size_t* newPosition = NULL); @@ -129,7 +129,7 @@ public: */ void parse (const parsingContext& ctx, - shared_ptr <utility::inputStream> inputStream, + const shared_ptr <utility::inputStream>& inputStream, const size_t position, const size_t end, size_t* newPosition = NULL); @@ -224,7 +224,7 @@ protected: // AT LEAST ONE of these parseImpl() functions MUST be implemented in derived class virtual void parseImpl (const parsingContext& ctx, - shared_ptr <utility::parserInputStreamAdapter> parser, + const shared_ptr <utility::parserInputStreamAdapter>& parser, const size_t position, const size_t end, size_t* newPosition = NULL); diff --git a/src/vmime/defaultAttachment.cpp b/src/vmime/defaultAttachment.cpp index 8f8ad453..2eb9289a 100644 --- a/src/vmime/defaultAttachment.cpp +++ b/src/vmime/defaultAttachment.cpp @@ -37,14 +37,14 @@ defaultAttachment::defaultAttachment() } -defaultAttachment::defaultAttachment(shared_ptr <const contentHandler> data, +defaultAttachment::defaultAttachment(const shared_ptr <const contentHandler>& data, const encoding& enc, const mediaType& type, const text& desc, const word& name) : m_type(type), m_desc(desc), m_data(data), m_encoding(enc), m_name(name) { } -defaultAttachment::defaultAttachment(shared_ptr <const contentHandler> data, +defaultAttachment::defaultAttachment(const shared_ptr <const contentHandler>& data, const mediaType& type, const text& desc, const word& name) : m_type(type), m_desc(desc), m_data(data), m_encoding(encoding::decide(data)), m_name(name) @@ -77,7 +77,7 @@ defaultAttachment& defaultAttachment::operator=(const defaultAttachment& attach) } -void defaultAttachment::generateIn(shared_ptr <bodyPart> parent) const +void defaultAttachment::generateIn(const shared_ptr <bodyPart>& parent) const { // Create and append a new part for this attachment shared_ptr <bodyPart> part = make_shared <bodyPart>(); @@ -87,7 +87,7 @@ void defaultAttachment::generateIn(shared_ptr <bodyPart> parent) const } -void defaultAttachment::generatePart(shared_ptr <bodyPart> part) const +void defaultAttachment::generatePart(const shared_ptr <bodyPart>& part) const { // Set header fields part->getHeader()->ContentType()->setValue(m_type); diff --git a/src/vmime/defaultAttachment.hpp b/src/vmime/defaultAttachment.hpp index 6eb0c5b6..817e834b 100644 --- a/src/vmime/defaultAttachment.hpp +++ b/src/vmime/defaultAttachment.hpp @@ -45,8 +45,8 @@ protected: public: - defaultAttachment(shared_ptr <const contentHandler> data, const encoding& enc, const mediaType& type, const text& desc = NULL_TEXT, const word& name = NULL_WORD); - defaultAttachment(shared_ptr <const contentHandler> data, const mediaType& type, const text& desc = NULL_TEXT, const word& name = NULL_WORD); + defaultAttachment(const shared_ptr <const contentHandler>& data, const encoding& enc, const mediaType& type, const text& desc = NULL_TEXT, const word& name = NULL_WORD); + defaultAttachment(const shared_ptr <const contentHandler>& data, const mediaType& type, const text& desc = NULL_TEXT, const word& name = NULL_WORD); defaultAttachment(const defaultAttachment& attach); ~defaultAttachment(); @@ -74,11 +74,11 @@ protected: private: // No need to override "generateIn", use "generatePart" instead (see below). - void generateIn(shared_ptr <bodyPart> parent) const; + void generateIn(const shared_ptr <bodyPart>& parent) const; protected: - virtual void generatePart(shared_ptr <bodyPart> part) const; + virtual void generatePart(const shared_ptr <bodyPart>& part) const; }; diff --git a/src/vmime/encoding.cpp b/src/vmime/encoding.cpp index 26922395..649bee79 100644 --- a/src/vmime/encoding.cpp +++ b/src/vmime/encoding.cpp @@ -200,7 +200,7 @@ bool encoding::shouldReencode() const const encoding encoding::decide - (shared_ptr <const contentHandler> data, const EncodingUsage usage) + (const shared_ptr <const contentHandler>& data, const EncodingUsage usage) { // Do not re-encode data if it is already encoded if (data->isEncoded() && !data->getEncoding().shouldReencode()) @@ -231,7 +231,7 @@ const encoding encoding::decide } -const encoding encoding::decide(shared_ptr <const contentHandler> data, +const encoding encoding::decide(const shared_ptr <const contentHandler>& data, const charset& chset, const EncodingUsage usage) { // Do not re-encode data if it is already encoded diff --git a/src/vmime/encoding.hpp b/src/vmime/encoding.hpp index 90733807..48973daa 100644 --- a/src/vmime/encoding.hpp +++ b/src/vmime/encoding.hpp @@ -99,7 +99,7 @@ public: * @param usage context of use of data * @return suitable encoding for specified data */ - static const encoding decide(shared_ptr <const contentHandler> data, const EncodingUsage usage = USAGE_BINARY_DATA); + static const encoding decide(const shared_ptr <const contentHandler>& data, const EncodingUsage usage = USAGE_BINARY_DATA); /** Decide which encoding to use based on the specified data and charset. * @@ -108,7 +108,7 @@ public: * @param usage context of use of data * @return suitable encoding for specified data and charset */ - static const encoding decide(shared_ptr <const contentHandler> data, const charset& chset, const EncodingUsage usage = USAGE_BINARY_DATA); + static const encoding decide(const shared_ptr <const contentHandler>& data, const charset& chset, const EncodingUsage usage = USAGE_BINARY_DATA); shared_ptr <component> clone() const; diff --git a/src/vmime/fileAttachment.cpp b/src/vmime/fileAttachment.cpp index 25a97fcc..f1697519 100644 --- a/src/vmime/fileAttachment.cpp +++ b/src/vmime/fileAttachment.cpp @@ -79,7 +79,7 @@ fileAttachment::fileAttachment(const string& filepath, const mediaType& type, } -fileAttachment::fileAttachment(shared_ptr <contentHandler> cts, const word& filename, const mediaType& type) +fileAttachment::fileAttachment(const shared_ptr <contentHandler>& cts, const word& filename, const mediaType& type) { if (!filename.isEmpty()) m_fileInfo.setFilename(filename); @@ -92,7 +92,7 @@ fileAttachment::fileAttachment(shared_ptr <contentHandler> cts, const word& file } -fileAttachment::fileAttachment(shared_ptr <contentHandler> cts, const word& filename, +fileAttachment::fileAttachment(const shared_ptr <contentHandler>& cts, const word& filename, const mediaType& type, const text& desc) { if (!filename.isEmpty()) @@ -107,7 +107,7 @@ fileAttachment::fileAttachment(shared_ptr <contentHandler> cts, const word& file } -fileAttachment::fileAttachment(shared_ptr <contentHandler> cts, const word& filename, +fileAttachment::fileAttachment(const shared_ptr <contentHandler>& cts, const word& filename, const mediaType& type, const text& desc, const encoding& enc) { if (!filename.isEmpty()) @@ -139,7 +139,7 @@ void fileAttachment::setData(const string& filepath) } -void fileAttachment::setData(shared_ptr <contentHandler> cts) +void fileAttachment::setData(const shared_ptr <contentHandler>& cts) { m_data = cts; @@ -147,7 +147,7 @@ void fileAttachment::setData(shared_ptr <contentHandler> cts) } -void fileAttachment::generatePart(shared_ptr <bodyPart> part) const +void fileAttachment::generatePart(const shared_ptr <bodyPart>& part) const { defaultAttachment::generatePart(part); diff --git a/src/vmime/fileAttachment.hpp b/src/vmime/fileAttachment.hpp index 3c6ca398..03e3e283 100644 --- a/src/vmime/fileAttachment.hpp +++ b/src/vmime/fileAttachment.hpp @@ -52,9 +52,9 @@ public: fileAttachment(const string& filepath, const mediaType& type, const text& desc); fileAttachment(const string& filepath, const mediaType& type, const text& desc, const encoding& enc); - fileAttachment(shared_ptr <contentHandler> cts, const word& filename, const mediaType& type); - fileAttachment(shared_ptr <contentHandler> cts, const word& filename, const mediaType& type, const text& desc); - fileAttachment(shared_ptr <contentHandler> cts, const word& filename, const mediaType& type, const text& desc, const encoding& enc); + fileAttachment(const shared_ptr <contentHandler>& cts, const word& filename, const mediaType& type); + fileAttachment(const shared_ptr <contentHandler>& cts, const word& filename, const mediaType& type, const text& desc); + fileAttachment(const shared_ptr <contentHandler>& cts, const word& filename, const mediaType& type, const text& desc, const encoding& enc); /** Stores information about a file attachment. */ @@ -181,11 +181,11 @@ public: private: void setData(const string& filepath); - void setData(shared_ptr <contentHandler> cts); + void setData(const shared_ptr <contentHandler>& cts); fileInfo m_fileInfo; - void generatePart(shared_ptr <bodyPart> part) const; + void generatePart(const shared_ptr <bodyPart>& part) const; }; diff --git a/src/vmime/fileContentHandler.cpp b/src/vmime/fileContentHandler.cpp index df788d7d..531151b4 100644 --- a/src/vmime/fileContentHandler.cpp +++ b/src/vmime/fileContentHandler.cpp @@ -41,7 +41,7 @@ fileContentHandler::fileContentHandler() fileContentHandler::fileContentHandler - (shared_ptr <utility::file> file, const vmime::encoding& enc) + (const shared_ptr <utility::file>& file, const vmime::encoding& enc) { setData(file, enc); } @@ -74,7 +74,7 @@ shared_ptr <contentHandler> fileContentHandler::clone() const void fileContentHandler::setData - (shared_ptr <utility::file> file, const vmime::encoding& enc) + (const shared_ptr <utility::file>& file, const vmime::encoding& enc) { m_file = file; m_encoding = enc; diff --git a/src/vmime/fileContentHandler.hpp b/src/vmime/fileContentHandler.hpp index 5b01fb8b..1436a002 100644 --- a/src/vmime/fileContentHandler.hpp +++ b/src/vmime/fileContentHandler.hpp @@ -62,7 +62,7 @@ public: * @return a reference to a new content handler */ fileContentHandler - (shared_ptr <utility::file> file, + (const shared_ptr <utility::file>& file, const vmime::encoding& enc = NO_ENCODING); ~fileContentHandler(); @@ -79,7 +79,7 @@ public: * in the file is already encoded with the specified encoding */ void setData - (shared_ptr <utility::file> file, + (const shared_ptr <utility::file>& file, const vmime::encoding& enc = NO_ENCODING); private: diff --git a/src/vmime/generatedMessageAttachment.cpp b/src/vmime/generatedMessageAttachment.cpp index 0473d247..b58b56d8 100644 --- a/src/vmime/generatedMessageAttachment.cpp +++ b/src/vmime/generatedMessageAttachment.cpp @@ -30,7 +30,7 @@ namespace vmime { -generatedMessageAttachment::generatedMessageAttachment(shared_ptr <const bodyPart> part) +generatedMessageAttachment::generatedMessageAttachment(const shared_ptr <const bodyPart>& part) : m_bpa(make_shared <bodyPartAttachment>(part)) { } @@ -97,7 +97,7 @@ shared_ptr <message> generatedMessageAttachment::getMessage() const } -void generatedMessageAttachment::generateIn(shared_ptr <bodyPart> /* parent */) const +void generatedMessageAttachment::generateIn(const shared_ptr <bodyPart>& /* parent */) const { // Not used (see 'parsedMessageAttachment') } diff --git a/src/vmime/generatedMessageAttachment.hpp b/src/vmime/generatedMessageAttachment.hpp index 7137b22b..e1e00cc7 100644 --- a/src/vmime/generatedMessageAttachment.hpp +++ b/src/vmime/generatedMessageAttachment.hpp @@ -42,7 +42,7 @@ class VMIME_EXPORT generatedMessageAttachment : public messageAttachment { public: - generatedMessageAttachment(shared_ptr <const bodyPart> part); + generatedMessageAttachment(const shared_ptr <const bodyPart>& part); const mediaType getType() const; const text getDescription() const; @@ -60,7 +60,7 @@ public: protected: - void generateIn(shared_ptr <bodyPart> parent) const; + void generateIn(const shared_ptr <bodyPart>& parent) const; private: diff --git a/src/vmime/header.cpp b/src/vmime/header.cpp index 34b5fa6e..cd2a6f7e 100644 --- a/src/vmime/header.cpp +++ b/src/vmime/header.cpp @@ -219,13 +219,13 @@ shared_ptr <headerField> header::getField(const string& fieldName) } -void header::appendField(shared_ptr <headerField> field) +void header::appendField(const shared_ptr <headerField>& field) { m_fields.push_back(field); } -void header::insertFieldBefore(shared_ptr <headerField> beforeField, shared_ptr <headerField> field) +void header::insertFieldBefore(const shared_ptr <headerField>& beforeField, const shared_ptr <headerField>& field) { const std::vector <shared_ptr <headerField> >::iterator it = std::find (m_fields.begin(), m_fields.end(), beforeField); @@ -237,13 +237,13 @@ void header::insertFieldBefore(shared_ptr <headerField> beforeField, shared_ptr } -void header::insertFieldBefore(const size_t pos, shared_ptr <headerField> field) +void header::insertFieldBefore(const size_t pos, const shared_ptr <headerField>& field) { m_fields.insert(m_fields.begin() + pos, field); } -void header::insertFieldAfter(shared_ptr <headerField> afterField, shared_ptr <headerField> field) +void header::insertFieldAfter(const shared_ptr <headerField>& afterField, const shared_ptr <headerField>& field) { const std::vector <shared_ptr <headerField> >::iterator it = std::find (m_fields.begin(), m_fields.end(), afterField); @@ -255,13 +255,13 @@ void header::insertFieldAfter(shared_ptr <headerField> afterField, shared_ptr <h } -void header::insertFieldAfter(const size_t pos, shared_ptr <headerField> field) +void header::insertFieldAfter(const size_t pos, const shared_ptr <headerField>& field) { m_fields.insert(m_fields.begin() + pos + 1, field); } -void header::removeField(shared_ptr <headerField> field) +void header::removeField(const shared_ptr <headerField>& field) { const std::vector <shared_ptr <headerField> >::iterator it = std::find (m_fields.begin(), m_fields.end(), field); @@ -281,7 +281,7 @@ void header::removeField(const size_t pos) } -void header::replaceField(shared_ptr <headerField> field, shared_ptr <headerField> newField) +void header::replaceField(const shared_ptr <headerField>& field, const shared_ptr <headerField>& newField) { insertFieldBefore(field, newField); removeField(field); diff --git a/src/vmime/header.hpp b/src/vmime/header.hpp index d2d20727..f2fd0666 100644 --- a/src/vmime/header.hpp +++ b/src/vmime/header.hpp @@ -185,7 +185,7 @@ public: * * @param field field to append */ - void appendField(shared_ptr <headerField> field); + void appendField(const shared_ptr <headerField>& field); /** Insert a new field before the specified field. * @@ -193,7 +193,7 @@ public: * @param field field to insert * @throw exceptions::no_such_field if the field is not in the list */ - void insertFieldBefore(shared_ptr <headerField> beforeField, shared_ptr <headerField> field); + void insertFieldBefore(const shared_ptr <headerField>& beforeField, const shared_ptr <headerField>& field); /** Insert a new field before the specified position. * @@ -201,7 +201,7 @@ public: * the beginning of the list) * @param field field to insert */ - void insertFieldBefore(const size_t pos, shared_ptr <headerField> field); + void insertFieldBefore(const size_t pos, const shared_ptr <headerField>& field); /** Insert a new field after the specified field. * @@ -209,21 +209,21 @@ public: * @param field field to insert * @throw exceptions::no_such_field if the field is not in the list */ - void insertFieldAfter(shared_ptr <headerField> afterField, shared_ptr <headerField> field); + void insertFieldAfter(const shared_ptr <headerField>& afterField, const shared_ptr <headerField>& field); /** Insert a new field after the specified position. * * @param pos position of the field before the new field * @param field field to insert */ - void insertFieldAfter(const size_t pos, shared_ptr <headerField> field); + void insertFieldAfter(const size_t pos, const shared_ptr <headerField>& field); /** Remove the specified field from the list. * * @param field field to remove * @throw exceptions::no_such_field if the field is not in the list */ - void removeField(shared_ptr <headerField> field); + void removeField(const shared_ptr <headerField>& field); /** Remove the field at the specified position. * @@ -237,7 +237,7 @@ public: * @param newField field to replace with * @throw exceptions::no_such_field if the field is not in the list */ - void replaceField(shared_ptr <headerField> field, shared_ptr <headerField> newField); + void replaceField(const shared_ptr <headerField>& field, const shared_ptr <headerField>& newField); /** Remove all fields from the list. */ diff --git a/src/vmime/headerField.cpp b/src/vmime/headerField.cpp index 40611a45..05f5b046 100644 --- a/src/vmime/headerField.cpp +++ b/src/vmime/headerField.cpp @@ -300,7 +300,7 @@ shared_ptr <headerFieldValue> headerField::getValue() } -void headerField::setValue(shared_ptr <headerFieldValue> value) +void headerField::setValue(const shared_ptr <headerFieldValue>& value) { if (!headerFieldFactory::getInstance()->isValueTypeValid(*this, *value)) throw exceptions::bad_field_value_type(getName()); @@ -310,7 +310,7 @@ void headerField::setValue(shared_ptr <headerFieldValue> value) } -void headerField::setValueConst(shared_ptr <const headerFieldValue> value) +void headerField::setValueConst(const shared_ptr <const headerFieldValue>& value) { if (!headerFieldFactory::getInstance()->isValueTypeValid(*this, *value)) throw exceptions::bad_field_value_type(getName()); diff --git a/src/vmime/headerField.hpp b/src/vmime/headerField.hpp index 555805db..9c49235c 100644 --- a/src/vmime/headerField.hpp +++ b/src/vmime/headerField.hpp @@ -118,7 +118,7 @@ public: * valid for this header field * @param value new value */ - virtual void setValue(shared_ptr <headerFieldValue> value); + virtual void setValue(const shared_ptr <headerFieldValue>& value); /** Set the value of this field by cloning the specified value. * @@ -126,7 +126,7 @@ public: * valid for this header field * @param value new value */ - virtual void setValueConst(shared_ptr <const headerFieldValue> value); + virtual void setValueConst(const shared_ptr <const headerFieldValue>& value); /** Set the value of this field (reference version). * The value will be cloned. diff --git a/src/vmime/htmlTextPart.cpp b/src/vmime/htmlTextPart.cpp index cd7d6204..bda33cc0 100644 --- a/src/vmime/htmlTextPart.cpp +++ b/src/vmime/htmlTextPart.cpp @@ -62,7 +62,7 @@ size_t htmlTextPart::getPartCount() const } -void htmlTextPart::generateIn(shared_ptr <bodyPart> /* message */, shared_ptr <bodyPart> parent) const +void htmlTextPart::generateIn(const shared_ptr <bodyPart>& /* message */, const shared_ptr <bodyPart>& parent) const { // Plain text if (!m_plainText->isEmpty()) @@ -182,7 +182,7 @@ void htmlTextPart::addEmbeddedObject(const bodyPart& part, const string& id, } -void htmlTextPart::parse(shared_ptr <const bodyPart> message, shared_ptr <const bodyPart> parent, shared_ptr <const bodyPart> textPart) +void htmlTextPart::parse(const shared_ptr <const bodyPart>& message, const shared_ptr <const bodyPart>& parent, const shared_ptr <const bodyPart>& textPart) { // Search for possible embedded objects in the _whole_ message. std::vector <shared_ptr <const bodyPart> > cidParts; @@ -348,7 +348,7 @@ shared_ptr <const contentHandler> htmlTextPart::getPlainText() const } -void htmlTextPart::setPlainText(shared_ptr <contentHandler> plainText) +void htmlTextPart::setPlainText(const shared_ptr <contentHandler>& plainText) { m_plainText = plainText->clone(); } @@ -360,7 +360,7 @@ const shared_ptr <const contentHandler> htmlTextPart::getText() const } -void htmlTextPart::setText(shared_ptr <contentHandler> text) +void htmlTextPart::setText(const shared_ptr <contentHandler>& text) { m_text = text->clone(); } @@ -405,7 +405,7 @@ bool htmlTextPart::hasObject(const string& id) const shared_ptr <const htmlTextPart::embeddedObject> htmlTextPart::addObject - (shared_ptr <contentHandler> data, const vmime::encoding& enc, const mediaType& type) + (const shared_ptr <contentHandler>& data, const vmime::encoding& enc, const mediaType& type) { const messageId mid(messageId::generateId()); @@ -419,7 +419,7 @@ shared_ptr <const htmlTextPart::embeddedObject> htmlTextPart::addObject shared_ptr <const htmlTextPart::embeddedObject> htmlTextPart::addObject - (shared_ptr <contentHandler> data, const mediaType& type) + (const shared_ptr <contentHandler>& data, const mediaType& type) { return addObject(data, encoding::decide(data), type); } @@ -439,7 +439,7 @@ shared_ptr <const htmlTextPart::embeddedObject> htmlTextPart::addObject // htmlTextPart::embeddedObject::embeddedObject - (shared_ptr <contentHandler> data, const encoding& enc, + (const shared_ptr <contentHandler>& data, const encoding& enc, const string& id, const mediaType& type, const ReferenceType refType) : m_data(vmime::clone(data)), m_encoding(enc), m_id(id), m_type(type), m_refType(refType) diff --git a/src/vmime/htmlTextPart.hpp b/src/vmime/htmlTextPart.hpp index a7fe6aab..5ccdf4fa 100644 --- a/src/vmime/htmlTextPart.hpp +++ b/src/vmime/htmlTextPart.hpp @@ -52,10 +52,10 @@ public: void setCharset(const charset& ch); shared_ptr <const contentHandler> getPlainText() const; - void setPlainText(shared_ptr <contentHandler> plainText); + void setPlainText(const shared_ptr <contentHandler>& plainText); const shared_ptr <const contentHandler> getText() const; - void setText(shared_ptr <contentHandler> text); + void setText(const shared_ptr <contentHandler>& text); /** Embedded object (eg: image for <IMG> tag). */ @@ -79,7 +79,7 @@ public: * @param refType reference type * @return a reference to a new embedded object */ - embeddedObject(shared_ptr <contentHandler> data, const encoding& enc, + embeddedObject(const shared_ptr <contentHandler>& data, const encoding& enc, const string& id, const mediaType& type, const ReferenceType refType); @@ -196,7 +196,7 @@ public: * @return an unique object identifier used to identify the new * object among all other embedded objects */ - shared_ptr <const embeddedObject> addObject(shared_ptr <contentHandler> data, const mediaType& type); + shared_ptr <const embeddedObject> addObject(const shared_ptr <contentHandler>& data, const mediaType& type); /** Embed an object and returns a string which identifies it. * The returned identifier is suitable for use in the 'src' attribute @@ -208,13 +208,13 @@ public: * @return an unique object identifier used to identify the new * object among all other embedded objects */ - shared_ptr <const embeddedObject> addObject(shared_ptr <contentHandler> data, const encoding& enc, const mediaType& type); + shared_ptr <const embeddedObject> addObject(const shared_ptr <contentHandler>& data, const encoding& enc, const mediaType& type); size_t getPartCount() const; - void generateIn(shared_ptr <bodyPart> message, shared_ptr <bodyPart> parent) const; - void parse(shared_ptr <const bodyPart> message, shared_ptr <const bodyPart> parent, shared_ptr <const bodyPart> textPart); + void generateIn(const shared_ptr <bodyPart>& message, const shared_ptr <bodyPart>& parent) const; + void parse(const shared_ptr <const bodyPart>& message, const shared_ptr <const bodyPart>& parent, const shared_ptr <const bodyPart>& textPart); private: diff --git a/src/vmime/mailboxGroup.cpp b/src/vmime/mailboxGroup.cpp index 5e8d6b1b..99ca8282 100644 --- a/src/vmime/mailboxGroup.cpp +++ b/src/vmime/mailboxGroup.cpp @@ -246,13 +246,13 @@ bool mailboxGroup::isEmpty() const } -void mailboxGroup::appendMailbox(shared_ptr <mailbox> mbox) +void mailboxGroup::appendMailbox(const shared_ptr <mailbox>& mbox) { m_list.push_back(mbox); } -void mailboxGroup::insertMailboxBefore(shared_ptr <mailbox> beforeMailbox, shared_ptr <mailbox> mbox) +void mailboxGroup::insertMailboxBefore(const shared_ptr <mailbox>& beforeMailbox, const shared_ptr <mailbox>& mbox) { const std::vector <shared_ptr <mailbox> >::iterator it = std::find (m_list.begin(), m_list.end(), beforeMailbox); @@ -264,7 +264,7 @@ void mailboxGroup::insertMailboxBefore(shared_ptr <mailbox> beforeMailbox, share } -void mailboxGroup::insertMailboxBefore(const size_t pos, shared_ptr <mailbox> mbox) +void mailboxGroup::insertMailboxBefore(const size_t pos, const shared_ptr <mailbox>& mbox) { if (pos >= m_list.size()) throw std::out_of_range("Invalid position"); @@ -273,7 +273,7 @@ void mailboxGroup::insertMailboxBefore(const size_t pos, shared_ptr <mailbox> mb } -void mailboxGroup::insertMailboxAfter(shared_ptr <mailbox> afterMailbox, shared_ptr <mailbox> mbox) +void mailboxGroup::insertMailboxAfter(const shared_ptr <mailbox>& afterMailbox, const shared_ptr <mailbox>& mbox) { const std::vector <shared_ptr <mailbox> >::iterator it = std::find (m_list.begin(), m_list.end(), afterMailbox); @@ -285,7 +285,7 @@ void mailboxGroup::insertMailboxAfter(shared_ptr <mailbox> afterMailbox, shared_ } -void mailboxGroup::insertMailboxAfter(const size_t pos, shared_ptr <mailbox> mbox) +void mailboxGroup::insertMailboxAfter(const size_t pos, const shared_ptr <mailbox>& mbox) { if (pos >= m_list.size()) throw std::out_of_range("Invalid position"); @@ -294,7 +294,7 @@ void mailboxGroup::insertMailboxAfter(const size_t pos, shared_ptr <mailbox> mbo } -void mailboxGroup::removeMailbox(shared_ptr <mailbox> mbox) +void mailboxGroup::removeMailbox(const shared_ptr <mailbox>& mbox) { const std::vector <shared_ptr <mailbox> >::iterator it = std::find (m_list.begin(), m_list.end(), mbox); diff --git a/src/vmime/mailboxGroup.hpp b/src/vmime/mailboxGroup.hpp index b264cf60..7ae8fd9a 100644 --- a/src/vmime/mailboxGroup.hpp +++ b/src/vmime/mailboxGroup.hpp @@ -70,7 +70,7 @@ public: * * @param mbox mailbox to append */ - void appendMailbox(shared_ptr <mailbox> mbox); + void appendMailbox(const shared_ptr <mailbox>& mbox); /** Insert a new mailbox before the specified mailbox. * @@ -78,7 +78,7 @@ public: * @param mbox mailbox to insert * @throw std::out_of_range if the mailbox is not in the list */ - void insertMailboxBefore(shared_ptr <mailbox> beforeMailbox, shared_ptr <mailbox> mbox); + void insertMailboxBefore(const shared_ptr <mailbox>& beforeMailbox, const shared_ptr <mailbox>& mbox); /** Insert a new mailbox before the specified position. * @@ -87,7 +87,7 @@ public: * @param mbox mailbox to insert * @throw std::out_of_range if the position is out of range */ - void insertMailboxBefore(const size_t pos, shared_ptr <mailbox> mbox); + void insertMailboxBefore(const size_t pos, const shared_ptr <mailbox>& mbox); /** Insert a new mailbox after the specified mailbox. * @@ -95,7 +95,7 @@ public: * @param mbox mailbox to insert * @throw std::out_of_range if the mailbox is not in the list */ - void insertMailboxAfter(shared_ptr <mailbox> afterMailbox, shared_ptr <mailbox> mbox); + void insertMailboxAfter(const shared_ptr <mailbox>& afterMailbox, const shared_ptr <mailbox>& mbox); /** Insert a new mailbox after the specified position. * @@ -103,14 +103,14 @@ public: * @param mbox mailbox to insert * @throw std::out_of_range if the position is out of range */ - void insertMailboxAfter(const size_t pos, shared_ptr <mailbox> mbox); + void insertMailboxAfter(const size_t pos, const shared_ptr <mailbox>& mbox); /** Remove the specified mailbox from the list. * * @param mbox mailbox to remove * @throw std::out_of_range if the mailbox is not in the list */ - void removeMailbox(shared_ptr <mailbox> mbox); + void removeMailbox(const shared_ptr <mailbox>& mbox); /** Remove the mailbox at the specified position. * diff --git a/src/vmime/mailboxList.cpp b/src/vmime/mailboxList.cpp index b356a1e7..bc99818b 100644 --- a/src/vmime/mailboxList.cpp +++ b/src/vmime/mailboxList.cpp @@ -41,37 +41,37 @@ mailboxList::mailboxList(const mailboxList& mboxList) } -void mailboxList::appendMailbox(shared_ptr <mailbox> mbox) +void mailboxList::appendMailbox(const shared_ptr <mailbox>& mbox) { m_list.appendAddress(mbox); } -void mailboxList::insertMailboxBefore(shared_ptr <mailbox> beforeMailbox, shared_ptr <mailbox> mbox) +void mailboxList::insertMailboxBefore(const shared_ptr <mailbox>& beforeMailbox, const shared_ptr <mailbox>& mbox) { m_list.insertAddressBefore(beforeMailbox, mbox); } -void mailboxList::insertMailboxBefore(const size_t pos, shared_ptr <mailbox> mbox) +void mailboxList::insertMailboxBefore(const size_t pos, const shared_ptr <mailbox>& mbox) { m_list.insertAddressBefore(pos, mbox); } -void mailboxList::insertMailboxAfter(shared_ptr <mailbox> afterMailbox, shared_ptr <mailbox> mbox) +void mailboxList::insertMailboxAfter(const shared_ptr <mailbox>& afterMailbox, const shared_ptr <mailbox>& mbox) { m_list.insertAddressAfter(afterMailbox, mbox); } -void mailboxList::insertMailboxAfter(const size_t pos, shared_ptr <mailbox> mbox) +void mailboxList::insertMailboxAfter(const size_t pos, const shared_ptr <mailbox>& mbox) { m_list.insertAddressAfter(pos, mbox); } -void mailboxList::removeMailbox(shared_ptr <mailbox> mbox) +void mailboxList::removeMailbox(const shared_ptr <mailbox>& mbox) { m_list.removeAddress(mbox); } diff --git a/src/vmime/mailboxList.hpp b/src/vmime/mailboxList.hpp index 125c238e..aca39136 100644 --- a/src/vmime/mailboxList.hpp +++ b/src/vmime/mailboxList.hpp @@ -57,7 +57,7 @@ public: * * @param mbox mailbox to append */ - void appendMailbox(shared_ptr <mailbox> mbox); + void appendMailbox(const shared_ptr <mailbox>& mbox); /** Insert a new mailbox before the specified mailbox. * @@ -65,7 +65,7 @@ public: * @param mbox mailbox to insert * @throw std::out_of_range if the mailbox is not in the list */ - void insertMailboxBefore(shared_ptr <mailbox> beforeMailbox, shared_ptr <mailbox> mbox); + void insertMailboxBefore(const shared_ptr <mailbox>& beforeMailbox, const shared_ptr <mailbox>& mbox); /** Insert a new mailbox before the specified position. * @@ -74,7 +74,7 @@ public: * @param mbox mailbox to insert * @throw std::out_of_range if the position is out of range */ - void insertMailboxBefore(const size_t pos, shared_ptr <mailbox> mbox); + void insertMailboxBefore(const size_t pos, const shared_ptr <mailbox>& mbox); /** Insert a new mailbox after the specified mailbox. * @@ -82,7 +82,7 @@ public: * @param mbox mailbox to insert * @throw std::out_of_range if the mailbox is not in the list */ - void insertMailboxAfter(shared_ptr <mailbox> afterMailbox, shared_ptr <mailbox> mbox); + void insertMailboxAfter(const shared_ptr <mailbox>& afterMailbox, const shared_ptr <mailbox>& mbox); /** Insert a new mailbox after the specified position. * @@ -90,14 +90,14 @@ public: * @param mbox mailbox to insert * @throw std::out_of_range if the position is out of range */ - void insertMailboxAfter(const size_t pos, shared_ptr <mailbox> mbox); + void insertMailboxAfter(const size_t pos, const shared_ptr <mailbox>& mbox); /** Remove the specified mailbox from the list. * * @param mbox mailbox to remove * @throw std::out_of_range if the mailbox is not in the list */ - void removeMailbox(shared_ptr <mailbox> mbox); + void removeMailbox(const shared_ptr <mailbox>& mbox); /** Remove the mailbox at the specified position. * diff --git a/src/vmime/mdn/MDNHelper.cpp b/src/vmime/mdn/MDNHelper.cpp index 1205aef2..d416532e 100644 --- a/src/vmime/mdn/MDNHelper.cpp +++ b/src/vmime/mdn/MDNHelper.cpp @@ -38,7 +38,7 @@ namespace vmime { namespace mdn { -void MDNHelper::attachMDNRequest(shared_ptr <message> msg, const mailboxList& mailboxes) +void MDNHelper::attachMDNRequest(const shared_ptr <message>& msg, const mailboxList& mailboxes) { shared_ptr <header> hdr = msg->getHeader(); @@ -46,7 +46,7 @@ void MDNHelper::attachMDNRequest(shared_ptr <message> msg, const mailboxList& ma } -void MDNHelper::attachMDNRequest(shared_ptr <message> msg, const mailbox& mbox) +void MDNHelper::attachMDNRequest(const shared_ptr <message>& msg, const mailbox& mbox) { mailboxList mboxList; mboxList.appendMailbox(vmime::clone(mbox)); @@ -55,7 +55,7 @@ void MDNHelper::attachMDNRequest(shared_ptr <message> msg, const mailbox& mbox) } -const std::vector <sendableMDNInfos> MDNHelper::getPossibleMDNs(const shared_ptr <const message> msg) +const std::vector <sendableMDNInfos> MDNHelper::getPossibleMDNs(const shared_ptr <const message>& msg) { std::vector <sendableMDNInfos> result; @@ -74,7 +74,7 @@ const std::vector <sendableMDNInfos> MDNHelper::getPossibleMDNs(const shared_ptr } -bool MDNHelper::isMDN(const shared_ptr <const message> msg) +bool MDNHelper::isMDN(const shared_ptr <const message>& msg) { const shared_ptr <const header> hdr = msg->getHeader(); @@ -103,7 +103,7 @@ bool MDNHelper::isMDN(const shared_ptr <const message> msg) } -receivedMDNInfos MDNHelper::getReceivedMDN(const shared_ptr <const message> msg) +receivedMDNInfos MDNHelper::getReceivedMDN(const shared_ptr <const message>& msg) { if (!isMDN(msg)) throw exceptions::invalid_argument(); @@ -112,7 +112,7 @@ receivedMDNInfos MDNHelper::getReceivedMDN(const shared_ptr <const message> msg) } -bool MDNHelper::needConfirmation(const shared_ptr <const message> msg) +bool MDNHelper::needConfirmation(const shared_ptr <const message>& msg) { shared_ptr <const header> hdr = msg->getHeader(); diff --git a/src/vmime/mdn/MDNHelper.hpp b/src/vmime/mdn/MDNHelper.hpp index 2584978f..d7ba2487 100644 --- a/src/vmime/mdn/MDNHelper.hpp +++ b/src/vmime/mdn/MDNHelper.hpp @@ -48,14 +48,14 @@ public: * @param msg message in which to add a MDN request * @param mailboxes list of mailboxes to which the MDN will be sent */ - static void attachMDNRequest(shared_ptr <message> msg, const mailboxList& mailboxes); + static void attachMDNRequest(const shared_ptr <message>& msg, const mailboxList& mailboxes); /** Attach a MDN request to the specified message. * * @param msg message in which to add a MDN request * @param mbox mailbox to which the MDN will be sent */ - static void attachMDNRequest(shared_ptr <message> msg, const mailbox& mbox); + static void attachMDNRequest(const shared_ptr <message>& msg, const mailbox& mbox); /** Return a list of possible MDNs that can be generated * for the specified message. @@ -63,14 +63,14 @@ public: * @param msg message for which to send a MDN * @return list of possible MDNs */ - static const std::vector <sendableMDNInfos> getPossibleMDNs(const shared_ptr <const message> msg); + static const std::vector <sendableMDNInfos> getPossibleMDNs(const shared_ptr <const message>& msg); /** Test whether the specified message is a MDN. * * @param msg message * @return true if the message is a MDN, false otherwise */ - static bool isMDN(const shared_ptr <const message> msg); + static bool isMDN(const shared_ptr <const message>& msg); /** If the specified message is a MDN, return information * about it. @@ -79,7 +79,7 @@ public: * @throw exceptions::invalid_argument if the message is not a MDN * @return information about the MDN */ - static receivedMDNInfos getReceivedMDN(const shared_ptr <const message> msg); + static receivedMDNInfos getReceivedMDN(const shared_ptr <const message>& msg); /** Check whether we need user confirmation for sending a MDN even * if he/she explicitely allowed automatic send of MDNs. This can @@ -88,7 +88,7 @@ public: * @param msg message for which to send a MDN * @return true if user confirmation should be asked, false otherwise */ - static bool needConfirmation(const shared_ptr <const message> msg); + static bool needConfirmation(const shared_ptr <const message>& msg); /** Build a new MDN for the message. The resulting MDN can then be * sent over SMTP transport service. diff --git a/src/vmime/mdn/receivedMDNInfos.cpp b/src/vmime/mdn/receivedMDNInfos.cpp index 53b2281e..6036fcec 100644 --- a/src/vmime/mdn/receivedMDNInfos.cpp +++ b/src/vmime/mdn/receivedMDNInfos.cpp @@ -30,7 +30,7 @@ namespace vmime { namespace mdn { -receivedMDNInfos::receivedMDNInfos(const shared_ptr <const message> msg) +receivedMDNInfos::receivedMDNInfos(const shared_ptr <const message>& msg) : m_msg(msg) { extract(); diff --git a/src/vmime/mdn/receivedMDNInfos.hpp b/src/vmime/mdn/receivedMDNInfos.hpp index c6953a24..f849a58e 100644 --- a/src/vmime/mdn/receivedMDNInfos.hpp +++ b/src/vmime/mdn/receivedMDNInfos.hpp @@ -44,7 +44,7 @@ class VMIME_EXPORT receivedMDNInfos : public MDNInfos { public: - receivedMDNInfos(const shared_ptr <const message> msg); + receivedMDNInfos(const shared_ptr <const message>& msg); receivedMDNInfos(const receivedMDNInfos& other); receivedMDNInfos& operator=(const receivedMDNInfos& other); diff --git a/src/vmime/mdn/sendableMDNInfos.cpp b/src/vmime/mdn/sendableMDNInfos.cpp index c145c3b6..85232c1f 100644 --- a/src/vmime/mdn/sendableMDNInfos.cpp +++ b/src/vmime/mdn/sendableMDNInfos.cpp @@ -28,7 +28,7 @@ namespace vmime { namespace mdn { -sendableMDNInfos::sendableMDNInfos(const shared_ptr <const message> msg, const mailbox& mbox) +sendableMDNInfos::sendableMDNInfos(const shared_ptr <const message>& msg, const mailbox& mbox) : m_msg(msg), m_mailbox(mbox) { } diff --git a/src/vmime/mdn/sendableMDNInfos.hpp b/src/vmime/mdn/sendableMDNInfos.hpp index e4f6d20d..2c40c3a8 100644 --- a/src/vmime/mdn/sendableMDNInfos.hpp +++ b/src/vmime/mdn/sendableMDNInfos.hpp @@ -42,7 +42,7 @@ class VMIME_EXPORT sendableMDNInfos : public MDNInfos { public: - sendableMDNInfos(const shared_ptr <const message> msg, const mailbox& mbox); + sendableMDNInfos(const shared_ptr <const message>& msg, const mailbox& mbox); sendableMDNInfos(const sendableMDNInfos& other); sendableMDNInfos& operator=(const sendableMDNInfos& other); diff --git a/src/vmime/messageBuilder.cpp b/src/vmime/messageBuilder.cpp index 64880483..445758c9 100644 --- a/src/vmime/messageBuilder.cpp +++ b/src/vmime/messageBuilder.cpp @@ -167,13 +167,13 @@ shared_ptr <message> messageBuilder::construct() const } -void messageBuilder::attach(shared_ptr <attachment> attach) +void messageBuilder::attach(const shared_ptr <attachment>& attach) { appendAttachment(attach); } -void messageBuilder::appendAttachment(shared_ptr <attachment> attach) +void messageBuilder::appendAttachment(const shared_ptr <attachment>& attach) { m_attach.push_back(attach); } diff --git a/src/vmime/messageBuilder.hpp b/src/vmime/messageBuilder.hpp index af86e826..4b5e15ce 100644 --- a/src/vmime/messageBuilder.hpp +++ b/src/vmime/messageBuilder.hpp @@ -136,13 +136,13 @@ public: * * @param attach new attachment */ - void attach(shared_ptr <attachment> attach); + void attach(const shared_ptr <attachment>& attach); /** Attach a new object to the message. * * @param attach new attachment */ - void appendAttachment(shared_ptr <attachment> attach); + void appendAttachment(const shared_ptr <attachment>& attach); /** Remove the attachment at the specified position. * diff --git a/src/vmime/messageIdSequence.cpp b/src/vmime/messageIdSequence.cpp index 23b12773..4365fa3c 100644 --- a/src/vmime/messageIdSequence.cpp +++ b/src/vmime/messageIdSequence.cpp @@ -135,13 +135,13 @@ void messageIdSequence::generateImpl } -void messageIdSequence::appendMessageId(shared_ptr <messageId> mid) +void messageIdSequence::appendMessageId(const shared_ptr <messageId>& mid) { m_list.push_back(mid); } -void messageIdSequence::insertMessageIdBefore(shared_ptr <messageId> beforeMid, shared_ptr <messageId> mid) +void messageIdSequence::insertMessageIdBefore(const shared_ptr <messageId>& beforeMid, const shared_ptr <messageId>& mid) { const std::vector <shared_ptr <messageId> >::iterator it = std::find (m_list.begin(), m_list.end(), beforeMid); @@ -153,13 +153,13 @@ void messageIdSequence::insertMessageIdBefore(shared_ptr <messageId> beforeMid, } -void messageIdSequence::insertMessageIdBefore(const size_t pos, shared_ptr <messageId> mid) +void messageIdSequence::insertMessageIdBefore(const size_t pos, const shared_ptr <messageId>& mid) { m_list.insert(m_list.begin() + pos, mid); } -void messageIdSequence::insertMessageIdAfter(shared_ptr <messageId> afterMid, shared_ptr <messageId> mid) +void messageIdSequence::insertMessageIdAfter(const shared_ptr <messageId>& afterMid, const shared_ptr <messageId>& mid) { const std::vector <shared_ptr <messageId> >::iterator it = std::find (m_list.begin(), m_list.end(), afterMid); @@ -171,13 +171,13 @@ void messageIdSequence::insertMessageIdAfter(shared_ptr <messageId> afterMid, sh } -void messageIdSequence::insertMessageIdAfter(const size_t pos, shared_ptr <messageId> mid) +void messageIdSequence::insertMessageIdAfter(const size_t pos, const shared_ptr <messageId>& mid) { m_list.insert(m_list.begin() + pos + 1, mid); } -void messageIdSequence::removeMessageId(shared_ptr <messageId> mid) +void messageIdSequence::removeMessageId(const shared_ptr <messageId>& mid) { const std::vector <shared_ptr <messageId> >::iterator it = std::find (m_list.begin(), m_list.end(), mid); diff --git a/src/vmime/messageIdSequence.hpp b/src/vmime/messageIdSequence.hpp index 07f0c422..b0eea464 100644 --- a/src/vmime/messageIdSequence.hpp +++ b/src/vmime/messageIdSequence.hpp @@ -56,7 +56,7 @@ public: * * @param mid message-id to append */ - void appendMessageId(shared_ptr <messageId> mid); + void appendMessageId(const shared_ptr <messageId>& mid); /** Insert a new message-id before the specified message-id. * @@ -64,7 +64,7 @@ public: * @param mid message-id to insert * @throw exceptions::no_such_messageid if the message-id is not in the list */ - void insertMessageIdBefore(shared_ptr <messageId> beforeMid, shared_ptr <messageId> mid); + void insertMessageIdBefore(const shared_ptr <messageId>& beforeMid, const shared_ptr <messageId>& mid); /** Insert a new message-id before the specified position. * @@ -72,7 +72,7 @@ public: * the beginning of the list) * @param mid message-id to insert */ - void insertMessageIdBefore(const size_t pos, shared_ptr <messageId> mid); + void insertMessageIdBefore(const size_t pos, const shared_ptr <messageId>& mid); /** Insert a new message-id after the specified message-id. * @@ -80,21 +80,21 @@ public: * @param mid message-id to insert * @throw exceptions::no_such_message_id if the message-id is not in the list */ - void insertMessageIdAfter(shared_ptr <messageId> afterMid, shared_ptr <messageId> mid); + void insertMessageIdAfter(const shared_ptr <messageId>& afterMid, const shared_ptr <messageId>& mid); /** Insert a new message-id after the specified position. * * @param pos position of the message-id before the new message-id * @param mid message-id to insert */ - void insertMessageIdAfter(const size_t pos, shared_ptr <messageId> mid); + void insertMessageIdAfter(const size_t pos, const shared_ptr <messageId>& mid); /** Remove the specified message-id from the list. * * @param mid message-id to remove * @throw exceptions::no_such_message_id if the message-id is not in the list */ - void removeMessageId(shared_ptr <messageId> mid); + void removeMessageId(const shared_ptr <messageId>& mid); /** Remove the message-id at the specified position. * diff --git a/src/vmime/messageParser.cpp b/src/vmime/messageParser.cpp index 5fe219f3..c5295504 100644 --- a/src/vmime/messageParser.cpp +++ b/src/vmime/messageParser.cpp @@ -46,7 +46,7 @@ messageParser::messageParser(const string& buffer) } -messageParser::messageParser(shared_ptr <const message> msg) +messageParser::messageParser(const shared_ptr <const message>& msg) { parse(msg); } @@ -57,7 +57,7 @@ messageParser::~messageParser() } -void messageParser::parse(shared_ptr <const message> msg) +void messageParser::parse(const shared_ptr <const message>& msg) { // Header fields (if field is present, copy its value, else do nothing) #ifndef VMIME_BUILDING_DOC @@ -106,13 +106,13 @@ void messageParser::parse(shared_ptr <const message> msg) } -void messageParser::findAttachments(shared_ptr <const message> msg) +void messageParser::findAttachments(const shared_ptr <const message>& msg) { m_attach = attachmentHelper::findAttachmentsInMessage(msg); } -void messageParser::findTextParts(shared_ptr <const bodyPart> msg, shared_ptr <const bodyPart> part) +void messageParser::findTextParts(const shared_ptr <const bodyPart>& msg, const shared_ptr <const bodyPart>& part) { // Handle the case in which the message is not multipart: if the body part is // "text/*", take this part. @@ -156,7 +156,7 @@ void messageParser::findTextParts(shared_ptr <const bodyPart> msg, shared_ptr <c } -bool messageParser::findSubTextParts(shared_ptr <const bodyPart> msg, shared_ptr <const bodyPart> part) +bool messageParser::findSubTextParts(const shared_ptr <const bodyPart>& msg, const shared_ptr <const bodyPart>& part) { // In general, all the text parts are contained in parallel in the same // parent part (or message). diff --git a/src/vmime/messageParser.hpp b/src/vmime/messageParser.hpp index c3a48f11..5413862d 100644 --- a/src/vmime/messageParser.hpp +++ b/src/vmime/messageParser.hpp @@ -49,7 +49,7 @@ class VMIME_EXPORT messageParser public: messageParser(const string& buffer); - messageParser(shared_ptr <const message> msg); + messageParser(const shared_ptr <const message>& msg); ~messageParser(); public: @@ -144,12 +144,12 @@ private: std::vector <shared_ptr <textPart> > m_textParts; - void parse(shared_ptr <const message> msg); + void parse(const shared_ptr <const message>& msg); - void findAttachments(shared_ptr <const message> msg); + void findAttachments(const shared_ptr <const message>& msg); - void findTextParts(shared_ptr <const bodyPart> msg, shared_ptr <const bodyPart> part); - bool findSubTextParts(shared_ptr <const bodyPart> msg, shared_ptr <const bodyPart> part); + void findTextParts(const shared_ptr <const bodyPart>& msg, const shared_ptr <const bodyPart>& part); + bool findSubTextParts(const shared_ptr <const bodyPart>& msg, const shared_ptr <const bodyPart>& part); }; diff --git a/src/vmime/misc/importanceHelper.cpp b/src/vmime/misc/importanceHelper.cpp index e1228ee1..ac298619 100644 --- a/src/vmime/misc/importanceHelper.cpp +++ b/src/vmime/misc/importanceHelper.cpp @@ -31,13 +31,13 @@ namespace vmime { namespace misc { -void importanceHelper::resetImportance(shared_ptr <message> msg) +void importanceHelper::resetImportance(const shared_ptr <message>& msg) { resetImportanceHeader(msg->getHeader()); } -void importanceHelper::resetImportanceHeader(shared_ptr <header> hdr) +void importanceHelper::resetImportanceHeader(const shared_ptr <header>& hdr) { shared_ptr <headerField> fld; @@ -49,13 +49,13 @@ void importanceHelper::resetImportanceHeader(shared_ptr <header> hdr) } -importanceHelper::Importance importanceHelper::getImportance(shared_ptr <const message> msg) +importanceHelper::Importance importanceHelper::getImportance(const shared_ptr <const message>& msg) { return getImportanceHeader(msg->getHeader()); } -importanceHelper::Importance importanceHelper::getImportanceHeader(shared_ptr <const header> hdr) +importanceHelper::Importance importanceHelper::getImportanceHeader(const shared_ptr <const header>& hdr) { // Try "X-Priority" field shared_ptr <const headerField> fld = hdr->findField("X-Priority"); @@ -113,13 +113,13 @@ importanceHelper::Importance importanceHelper::getImportanceHeader(shared_ptr <c } -void importanceHelper::setImportance(shared_ptr <message> msg, const Importance i) +void importanceHelper::setImportance(const shared_ptr <message>& msg, const Importance i) { setImportanceHeader(msg->getHeader(), i); } -void importanceHelper::setImportanceHeader(shared_ptr <header> hdr, const Importance i) +void importanceHelper::setImportanceHeader(const shared_ptr <header>& hdr, const Importance i) { // "X-Priority:" Field shared_ptr <headerField> fld = hdr->getField("X-Priority"); diff --git a/src/vmime/misc/importanceHelper.hpp b/src/vmime/misc/importanceHelper.hpp index ae8297fc..18dc2364 100644 --- a/src/vmime/misc/importanceHelper.hpp +++ b/src/vmime/misc/importanceHelper.hpp @@ -58,13 +58,13 @@ public: * * @param msg message on which to reset importance */ - static void resetImportance(shared_ptr <message> msg); + static void resetImportance(const shared_ptr <message>& msg); /** Reset the importance of a message to the default importance. * * @param hdr message header on which to reset importance */ - static void resetImportanceHeader(shared_ptr <header> hdr); + static void resetImportanceHeader(const shared_ptr <header>& hdr); /** Return the importance of the specified message. * @@ -72,7 +72,7 @@ public: * @return importance of the message, or default importance is no * information about importance is given in the message */ - static Importance getImportance(shared_ptr <const message> msg); + static Importance getImportance(const shared_ptr <const message>& msg); /** Return the importance of a message, given its header. * @@ -80,21 +80,21 @@ public: * @return importance of the message, or default importance is no * information about importance is given in the message */ - static Importance getImportanceHeader(shared_ptr <const header> hdr); + static Importance getImportanceHeader(const shared_ptr <const header>& hdr); /** Set the importance of the specified message. * * @param msg message on which to set importance * @param i new message importance */ - static void setImportance(shared_ptr <message> msg, const Importance i); + static void setImportance(const shared_ptr <message>& msg, const Importance i); /** Set the importance of a message, given its header. * * @param hdr message header on which to set importance * @param i new message importance */ - static void setImportanceHeader(shared_ptr <header> hdr, const Importance i); + static void setImportanceHeader(const shared_ptr <header>& hdr, const Importance i); }; diff --git a/src/vmime/net/events.cpp b/src/vmime/net/events.cpp index 45f7f98e..6d056ae6 100644 --- a/src/vmime/net/events.cpp +++ b/src/vmime/net/events.cpp @@ -60,7 +60,7 @@ const char* messageCountEvent::EVENT_CLASS = "messageCountEvent"; messageCountEvent::messageCountEvent - (shared_ptr <folder> folder, const Types type, const std::vector <size_t>& nums) + (const shared_ptr <folder>& folder, const Types type, const std::vector <size_t>& nums) : m_folder(folder), m_type(type) { m_nums.resize(nums.size()); @@ -96,7 +96,7 @@ const char* messageChangedEvent::EVENT_CLASS = "messageChangedEvent"; messageChangedEvent::messageChangedEvent - (shared_ptr <folder> folder, const Types type, const std::vector <size_t>& nums) + (const shared_ptr <folder>& folder, const Types type, const std::vector <size_t>& nums) : m_folder(folder), m_type(type) { m_nums.resize(nums.size()); @@ -129,7 +129,7 @@ const char* folderEvent::EVENT_CLASS = "folderEvent"; folderEvent::folderEvent - (shared_ptr <folder> folder, const Types type, + (const shared_ptr <folder>& folder, const Types type, const utility::path& oldPath, const utility::path& newPath) : m_folder(folder), m_type(type), m_oldPath(oldPath), m_newPath(newPath) { diff --git a/src/vmime/net/events.hpp b/src/vmime/net/events.hpp index 60d15bd9..772c4d9d 100644 --- a/src/vmime/net/events.hpp +++ b/src/vmime/net/events.hpp @@ -75,7 +75,7 @@ public: }; - messageCountEvent(shared_ptr <folder> folder, const Types type, const std::vector <size_t>& nums); + messageCountEvent(const shared_ptr <folder>& folder, const Types type, const std::vector <size_t>& nums); /** Return the folder in which messages have been added/removed. * @@ -123,8 +123,8 @@ protected: public: - virtual void messagesAdded(shared_ptr <messageCountEvent> event) = 0; - virtual void messagesRemoved(shared_ptr <messageCountEvent> event) = 0; + virtual void messagesAdded(const shared_ptr <messageCountEvent>& event) = 0; + virtual void messagesRemoved(const shared_ptr <messageCountEvent>& event) = 0; }; @@ -144,7 +144,7 @@ public: }; - messageChangedEvent(shared_ptr <folder> folder, const Types type, const std::vector <size_t>& nums); + messageChangedEvent(const shared_ptr <folder>& folder, const Types type, const std::vector <size_t>& nums); /** Return the folder in which messages have changed. * @@ -192,7 +192,7 @@ protected: public: - virtual void messageChanged(shared_ptr <messageChangedEvent> event) = 0; + virtual void messageChanged(const shared_ptr <messageChangedEvent>& event) = 0; }; @@ -214,7 +214,7 @@ public: }; - folderEvent(shared_ptr <folder> folder, const Types type, const utility::path& oldPath, const utility::path& newPath); + folderEvent(const shared_ptr <folder>& folder, const Types type, const utility::path& oldPath, const utility::path& newPath); /** Return the folder on which the event occurred. * @@ -257,9 +257,9 @@ protected: public: - virtual void folderCreated(shared_ptr <folderEvent> event) = 0; - virtual void folderRenamed(shared_ptr <folderEvent> event) = 0; - virtual void folderDeleted(shared_ptr <folderEvent> event) = 0; + virtual void folderCreated(const shared_ptr <folderEvent>& event) = 0; + virtual void folderRenamed(const shared_ptr <folderEvent>& event) = 0; + virtual void folderDeleted(const shared_ptr <folderEvent>& event) = 0; }; diff --git a/src/vmime/net/folder.cpp b/src/vmime/net/folder.cpp index 78ed5131..38f60523 100644 --- a/src/vmime/net/folder.cpp +++ b/src/vmime/net/folder.cpp @@ -60,7 +60,7 @@ void folder::removeMessageChangedListener(events::messageChangedListener* l) } -void folder::notifyMessageChanged(shared_ptr <events::messageChangedEvent> event) +void folder::notifyMessageChanged(const shared_ptr <events::messageChangedEvent>& event) { for (std::list <events::messageChangedListener*>::iterator it = m_messageChangedListeners.begin() ; it != m_messageChangedListeners.end() ; ++it) @@ -82,7 +82,7 @@ void folder::removeMessageCountListener(events::messageCountListener* l) } -void folder::notifyMessageCount(shared_ptr <events::messageCountEvent> event) +void folder::notifyMessageCount(const shared_ptr <events::messageCountEvent>& event) { for (std::list <events::messageCountListener*>::iterator it = m_messageCountListeners.begin() ; it != m_messageCountListeners.end() ; ++it) @@ -104,7 +104,7 @@ void folder::removeFolderListener(events::folderListener* l) } -void folder::notifyFolder(shared_ptr <events::folderEvent> event) +void folder::notifyFolder(const shared_ptr <events::folderEvent>& event) { for (std::list <events::folderListener*>::iterator it = m_folderListeners.begin() ; it != m_folderListeners.end() ; ++it) @@ -114,7 +114,7 @@ void folder::notifyFolder(shared_ptr <events::folderEvent> event) } -void folder::notifyEvent(shared_ptr <events::event> event) +void folder::notifyEvent(const shared_ptr <events::event>& event) { if (event->getClass() == events::messageCountEvent::EVENT_CLASS) { diff --git a/src/vmime/net/folder.hpp b/src/vmime/net/folder.hpp index 5186bae0..8117d7d1 100644 --- a/src/vmime/net/folder.hpp +++ b/src/vmime/net/folder.hpp @@ -274,7 +274,7 @@ public: * @throw exceptions::net_exception if an error occurs */ virtual messageSet addMessage - (shared_ptr <vmime::message> msg, + (const shared_ptr <vmime::message>& msg, const int flags = -1, vmime::datetime* date = NULL, utility::progressListener* progress = NULL) = 0; @@ -366,7 +366,7 @@ public: * @param attribs set of attributes to fetch * @throw exceptions::net_exception if an error occurs */ - virtual void fetchMessage(shared_ptr <message> msg, const fetchAttributes& attribs) = 0; + virtual void fetchMessage(const shared_ptr <message>& msg, const fetchAttributes& attribs) = 0; /** Get new references to messages in this folder, given either their * sequence numbers or UIDs, and fetch objects for them at the same time. @@ -408,10 +408,10 @@ public: protected: - void notifyMessageChanged(shared_ptr <events::messageChangedEvent> event); - void notifyMessageCount(shared_ptr <events::messageCountEvent> event); - void notifyFolder(shared_ptr <events::folderEvent> event); - void notifyEvent(shared_ptr <events::event> event); + void notifyMessageChanged(const shared_ptr <events::messageChangedEvent>& event); + void notifyMessageCount(const shared_ptr <events::messageCountEvent>& event); + void notifyFolder(const shared_ptr <events::folderEvent>& event); + void notifyEvent(const shared_ptr <events::event>& event); private: diff --git a/src/vmime/net/imap/IMAPCommand.cpp b/src/vmime/net/imap/IMAPCommand.cpp index b1840d8d..908b9152 100644 --- a/src/vmime/net/imap/IMAPCommand.cpp +++ b/src/vmime/net/imap/IMAPCommand.cpp @@ -396,7 +396,7 @@ const string IMAPCommand::getTraceText() const } -void IMAPCommand::send(shared_ptr <IMAPConnection> conn) +void IMAPCommand::send(const shared_ptr <IMAPConnection>& conn) { conn->sendCommand(dynamicCast <IMAPCommand>(shared_from_this())); } diff --git a/src/vmime/net/imap/IMAPCommand.hpp b/src/vmime/net/imap/IMAPCommand.hpp index dd499859..09f34c66 100644 --- a/src/vmime/net/imap/IMAPCommand.hpp +++ b/src/vmime/net/imap/IMAPCommand.hpp @@ -85,7 +85,7 @@ public: * * @param conn connection onto which the command will be sent */ - virtual void send(shared_ptr <IMAPConnection> conn); + virtual void send(const shared_ptr <IMAPConnection>& conn); /** Returns the full text of the command, including command name * and parameters (if any). This is the text that will be sent diff --git a/src/vmime/net/imap/IMAPConnection.cpp b/src/vmime/net/imap/IMAPConnection.cpp index 0cc08178..7fc86188 100644 --- a/src/vmime/net/imap/IMAPConnection.cpp +++ b/src/vmime/net/imap/IMAPConnection.cpp @@ -66,7 +66,7 @@ namespace net { namespace imap { -IMAPConnection::IMAPConnection(shared_ptr <IMAPStore> store, shared_ptr <security::authenticator> auth) +IMAPConnection::IMAPConnection(const shared_ptr <IMAPStore>& store, const shared_ptr <security::authenticator>& auth) : m_store(store), m_auth(auth), m_socket(null), m_parser(null), m_tag(null), m_hierarchySeparator('\0'), m_state(STATE_NONE), m_timeoutHandler(null), m_secured(false), m_firstTag(true), m_capabilitiesFetched(false), m_noModSeq(false) @@ -754,7 +754,7 @@ void IMAPConnection::initHierarchySeparator() } -void IMAPConnection::sendCommand(shared_ptr <IMAPCommand> cmd) +void IMAPConnection::sendCommand(const shared_ptr <IMAPCommand>& cmd) { if (!m_firstTag) ++(*m_tag); @@ -830,7 +830,7 @@ shared_ptr <const socket> IMAPConnection::getSocket() const } -void IMAPConnection::setSocket(shared_ptr <socket> sok) +void IMAPConnection::setSocket(const shared_ptr <socket>& sok) { m_socket = sok; m_parser->setSocket(sok); diff --git a/src/vmime/net/imap/IMAPConnection.hpp b/src/vmime/net/imap/IMAPConnection.hpp index 0ce9092d..9a277f7c 100644 --- a/src/vmime/net/imap/IMAPConnection.hpp +++ b/src/vmime/net/imap/IMAPConnection.hpp @@ -56,7 +56,7 @@ class VMIME_EXPORT IMAPConnection : public object, public enable_shared_from_thi { public: - IMAPConnection(shared_ptr <IMAPStore> store, shared_ptr <security::authenticator> auth); + IMAPConnection(const shared_ptr <IMAPStore>& store, const shared_ptr <security::authenticator>& auth); ~IMAPConnection(); @@ -81,7 +81,7 @@ public: char hierarchySeparator() const; - void sendCommand(shared_ptr <IMAPCommand> cmd); + void sendCommand(const shared_ptr <IMAPCommand>& cmd); void sendRaw(const byte_t* buffer, const size_t count); IMAPParser::response* readResponse(IMAPParser::literalHandler* lh = NULL); @@ -104,7 +104,7 @@ public: shared_ptr <connectionInfos> getConnectionInfos() const; shared_ptr <const socket> getSocket() const; - void setSocket(shared_ptr <socket> sok); + void setSocket(const shared_ptr <socket>& sok); shared_ptr <tracer> getTracer(); diff --git a/src/vmime/net/imap/IMAPFolder.cpp b/src/vmime/net/imap/IMAPFolder.cpp index 1fbe1331..a142f7f5 100644 --- a/src/vmime/net/imap/IMAPFolder.cpp +++ b/src/vmime/net/imap/IMAPFolder.cpp @@ -52,7 +52,7 @@ namespace net { namespace imap { -IMAPFolder::IMAPFolder(const folder::path& path, shared_ptr <IMAPStore> store, shared_ptr <folderAttributes> attribs) +IMAPFolder::IMAPFolder(const folder::path& path, const shared_ptr <IMAPStore>& store, const shared_ptr <folderAttributes>& attribs) : m_store(store), m_connection(store->connection()), m_path(path), m_name(path.isEmpty() ? folder::path::component("") : path.getLastComponent()), m_mode(-1), m_open(false), m_attribs(attribs) @@ -837,7 +837,7 @@ void IMAPFolder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f } -void IMAPFolder::fetchMessage(shared_ptr <message> msg, const fetchAttributes& options) +void IMAPFolder::fetchMessage(const shared_ptr <message>& msg, const fetchAttributes& options) { std::vector <shared_ptr <message> > msgs; msgs.push_back(msg); @@ -1044,7 +1044,7 @@ void IMAPFolder::setMessageFlags(const messageSet& msgs, const int flags, const messageSet IMAPFolder::addMessage - (shared_ptr <vmime::message> msg, const int flags, + (const shared_ptr <vmime::message>& msg, const int flags, vmime::datetime* date, utility::progressListener* progress) { std::ostringstream oss; diff --git a/src/vmime/net/imap/IMAPFolder.hpp b/src/vmime/net/imap/IMAPFolder.hpp index d4e1c34a..15663232 100644 --- a/src/vmime/net/imap/IMAPFolder.hpp +++ b/src/vmime/net/imap/IMAPFolder.hpp @@ -63,7 +63,7 @@ private: friend class IMAPMessage; IMAPFolder(const IMAPFolder&); - IMAPFolder(const folder::path& path, shared_ptr <IMAPStore> store, shared_ptr <folderAttributes> attribs); + IMAPFolder(const folder::path& path, const shared_ptr <IMAPStore>& store, const shared_ptr <folderAttributes>& attribs); public: @@ -103,7 +103,7 @@ public: void setMessageFlags(const messageSet& msgs, const int flags, const int mode = message::FLAG_MODE_SET); messageSet addMessage - (shared_ptr <vmime::message> msg, + (const shared_ptr <vmime::message>& msg, const int flags = -1, vmime::datetime* date = NULL, utility::progressListener* progress = NULL); @@ -131,7 +131,7 @@ public: void fetchMessages(std::vector <shared_ptr <message> >& msg, const fetchAttributes& options, utility::progressListener* progress = NULL); - void fetchMessage(shared_ptr <message> msg, const fetchAttributes& options); + void fetchMessage(const shared_ptr <message>& msg, const fetchAttributes& options); std::vector <shared_ptr <message> > getAndFetchMessages (const messageSet& msgs, const fetchAttributes& attribs); diff --git a/src/vmime/net/imap/IMAPMessage.cpp b/src/vmime/net/imap/IMAPMessage.cpp index 123a94a9..f0d2ebd3 100644 --- a/src/vmime/net/imap/IMAPMessage.cpp +++ b/src/vmime/net/imap/IMAPMessage.cpp @@ -101,7 +101,7 @@ private: // -IMAPMessage::IMAPMessage(shared_ptr <IMAPFolder> folder, const size_t num) +IMAPMessage::IMAPMessage(const shared_ptr <IMAPFolder>& folder, const size_t num) : m_folder(folder), m_num(num), m_size(-1U), m_flags(FLAG_UNDEFINED), m_expunged(false), m_modseq(0), m_structure(null) { @@ -109,7 +109,7 @@ IMAPMessage::IMAPMessage(shared_ptr <IMAPFolder> folder, const size_t num) } -IMAPMessage::IMAPMessage(shared_ptr <IMAPFolder> folder, const size_t num, const uid& uid) +IMAPMessage::IMAPMessage(const shared_ptr <IMAPFolder>& folder, const size_t num, const uid& uid) : m_folder(folder), m_num(num), m_size(-1), m_flags(FLAG_UNDEFINED), m_expunged(false), m_uid(uid), m_modseq(0), m_structure(null) { @@ -225,7 +225,7 @@ void IMAPMessage::extract void IMAPMessage::extractPart - (shared_ptr <const messagePart> p, + (const shared_ptr <const messagePart>& p, utility::outputStream& os, utility::progressListener* progress, const size_t start, const size_t length, @@ -241,7 +241,7 @@ void IMAPMessage::extractPart } -void IMAPMessage::fetchPartHeader(shared_ptr <messagePart> p) +void IMAPMessage::fetchPartHeader(const shared_ptr <messagePart>& p) { shared_ptr <IMAPFolder> folder = m_folder.lock(); @@ -257,7 +257,7 @@ void IMAPMessage::fetchPartHeader(shared_ptr <messagePart> p) } -void IMAPMessage::fetchPartHeaderForStructure(shared_ptr <messageStructure> str) +void IMAPMessage::fetchPartHeaderForStructure(const shared_ptr <messageStructure>& str) { for (size_t i = 0, n = str->getPartCount() ; i < n ; ++i) { @@ -273,7 +273,7 @@ void IMAPMessage::fetchPartHeaderForStructure(shared_ptr <messageStructure> str) size_t IMAPMessage::extractImpl - (shared_ptr <const messagePart> p, + (const shared_ptr <const messagePart>& p, utility::outputStream& os, utility::progressListener* progress, const size_t start, const size_t length, @@ -611,7 +611,7 @@ void IMAPMessage::setFlags(const int flags, const int mode) void IMAPMessage::constructParsedMessage - (shared_ptr <bodyPart> parentPart, shared_ptr <messageStructure> str, int level) + (const shared_ptr <bodyPart>& parentPart, const shared_ptr <messageStructure>& str, int level) { if (level == 0) { diff --git a/src/vmime/net/imap/IMAPMessage.hpp b/src/vmime/net/imap/IMAPMessage.hpp index 93545f22..48722127 100644 --- a/src/vmime/net/imap/IMAPMessage.hpp +++ b/src/vmime/net/imap/IMAPMessage.hpp @@ -59,8 +59,8 @@ private: public: - IMAPMessage(shared_ptr <IMAPFolder> folder, const size_t num); - IMAPMessage(shared_ptr <IMAPFolder> folder, const size_t num, const uid& uid); + IMAPMessage(const shared_ptr <IMAPFolder>& folder, const size_t num); + IMAPMessage(const shared_ptr <IMAPFolder>& folder, const size_t num, const uid& uid); ~IMAPMessage(); @@ -99,13 +99,13 @@ public: const bool peek = false) const; void extractPart - (shared_ptr <const messagePart> p, + (const shared_ptr <const messagePart>& p, utility::outputStream& os, utility::progressListener* progress = NULL, const size_t start = 0, const size_t length = -1, const bool peek = false) const; - void fetchPartHeader(shared_ptr <messagePart> p); + void fetchPartHeader(const shared_ptr <messagePart>& p); shared_ptr <vmime::message> getParsedMessage(); @@ -135,7 +135,7 @@ private: * * @param str structure for which to fetch parts headers */ - void fetchPartHeaderForStructure(shared_ptr <messageStructure> str); + void fetchPartHeaderForStructure(const shared_ptr <messageStructure>& str); /** Recursively contruct parsed message from structure. * Called by getParsedMessage(). @@ -144,7 +144,7 @@ private: * @param str structure for which to construct part * @param level current nesting level (0 is root) */ - void constructParsedMessage(shared_ptr <bodyPart> parentPart, shared_ptr <messageStructure> str, int level = 0); + void constructParsedMessage(const shared_ptr <bodyPart>& parentPart, const shared_ptr <messageStructure>& str, int level = 0); enum ExtractFlags @@ -155,7 +155,7 @@ private: }; size_t extractImpl - (shared_ptr <const messagePart> p, + (const shared_ptr <const messagePart>& p, utility::outputStream& os, utility::progressListener* progress, const size_t start, const size_t length, diff --git a/src/vmime/net/imap/IMAPMessagePart.cpp b/src/vmime/net/imap/IMAPMessagePart.cpp index 1539f2ca..08e6f92b 100644 --- a/src/vmime/net/imap/IMAPMessagePart.cpp +++ b/src/vmime/net/imap/IMAPMessagePart.cpp @@ -36,7 +36,7 @@ namespace net { namespace imap { -IMAPMessagePart::IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body_type_mpart* mpart) +IMAPMessagePart::IMAPMessagePart(const shared_ptr <IMAPMessagePart>& parent, const size_t number, const IMAPParser::body_type_mpart* mpart) : m_parent(parent), m_header(null), m_number(number), m_size(0) { m_mediaType = vmime::mediaType @@ -44,7 +44,7 @@ IMAPMessagePart::IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const size } -IMAPMessagePart::IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body_type_1part* part) +IMAPMessagePart::IMAPMessagePart(const shared_ptr <IMAPMessagePart>& parent, const size_t number, const IMAPParser::body_type_1part* part) : m_parent(parent), m_header(null), m_number(number), m_size(0) { if (part->body_type_text()) @@ -127,7 +127,7 @@ shared_ptr <const header> IMAPMessagePart::getHeader() const // static shared_ptr <IMAPMessagePart> IMAPMessagePart::create - (shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body* body) + (const shared_ptr <IMAPMessagePart>& parent, const size_t number, const IMAPParser::body* body) { if (body->body_type_mpart()) { diff --git a/src/vmime/net/imap/IMAPMessagePart.hpp b/src/vmime/net/imap/IMAPMessagePart.hpp index 3b00887b..ab0d1a6f 100644 --- a/src/vmime/net/imap/IMAPMessagePart.hpp +++ b/src/vmime/net/imap/IMAPMessagePart.hpp @@ -48,8 +48,8 @@ class VMIME_EXPORT IMAPMessagePart : public messagePart { public: - IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body_type_mpart* mpart); - IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body_type_1part* part); + IMAPMessagePart(const shared_ptr <IMAPMessagePart>& parent, const size_t number, const IMAPParser::body_type_mpart* mpart); + IMAPMessagePart(const shared_ptr <IMAPMessagePart>& parent, const size_t number, const IMAPParser::body_type_1part* part); shared_ptr <const messageStructure> getStructure() const; shared_ptr <messageStructure> getStructure(); @@ -64,7 +64,7 @@ public: static shared_ptr <IMAPMessagePart> create - (shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body* body); + (const shared_ptr <IMAPMessagePart>& parent, const size_t number, const IMAPParser::body* body); header& getOrCreateHeader(); diff --git a/src/vmime/net/imap/IMAPMessagePartContentHandler.cpp b/src/vmime/net/imap/IMAPMessagePartContentHandler.cpp index 1f53f082..32a2a75b 100644 --- a/src/vmime/net/imap/IMAPMessagePartContentHandler.cpp +++ b/src/vmime/net/imap/IMAPMessagePartContentHandler.cpp @@ -43,7 +43,7 @@ namespace imap { IMAPMessagePartContentHandler::IMAPMessagePartContentHandler - (shared_ptr <IMAPMessage> msg, shared_ptr <messagePart> part, const vmime::encoding& encoding) + (const shared_ptr <IMAPMessage>& msg, const shared_ptr <messagePart>& part, const vmime::encoding& encoding) : m_message(msg), m_part(part), m_encoding(encoding) { } diff --git a/src/vmime/net/imap/IMAPMessagePartContentHandler.hpp b/src/vmime/net/imap/IMAPMessagePartContentHandler.hpp index cb52b2e3..8314fa95 100644 --- a/src/vmime/net/imap/IMAPMessagePartContentHandler.hpp +++ b/src/vmime/net/imap/IMAPMessagePartContentHandler.hpp @@ -44,7 +44,7 @@ class VMIME_EXPORT IMAPMessagePartContentHandler : public contentHandler { public: - IMAPMessagePartContentHandler(shared_ptr <IMAPMessage> msg, shared_ptr <messagePart> part, const vmime::encoding& encoding); + IMAPMessagePartContentHandler(const shared_ptr <IMAPMessage>& msg, const shared_ptr <messagePart>& part, const vmime::encoding& encoding); shared_ptr <contentHandler> clone() const; diff --git a/src/vmime/net/imap/IMAPMessageStructure.cpp b/src/vmime/net/imap/IMAPMessageStructure.cpp index 689c495d..1e6c1b32 100644 --- a/src/vmime/net/imap/IMAPMessageStructure.cpp +++ b/src/vmime/net/imap/IMAPMessageStructure.cpp @@ -47,7 +47,7 @@ IMAPMessageStructure::IMAPMessageStructure(const IMAPParser::body* body) } -IMAPMessageStructure::IMAPMessageStructure(shared_ptr <IMAPMessagePart> parent, const std::vector <IMAPParser::body*>& list) +IMAPMessageStructure::IMAPMessageStructure(const shared_ptr <IMAPMessagePart>& parent, const std::vector <IMAPParser::body*>& list) { size_t number = 0; diff --git a/src/vmime/net/imap/IMAPMessageStructure.hpp b/src/vmime/net/imap/IMAPMessageStructure.hpp index 44b6d6f0..f24e518c 100644 --- a/src/vmime/net/imap/IMAPMessageStructure.hpp +++ b/src/vmime/net/imap/IMAPMessageStructure.hpp @@ -50,7 +50,7 @@ public: IMAPMessageStructure(); IMAPMessageStructure(const IMAPParser::body* body); - IMAPMessageStructure(shared_ptr <IMAPMessagePart> parent, const std::vector <IMAPParser::body*>& list); + IMAPMessageStructure(const shared_ptr <IMAPMessagePart>& parent, const std::vector <IMAPParser::body*>& list); shared_ptr <const messagePart> getPartAt(const size_t x) const; shared_ptr <messagePart> getPartAt(const size_t x); diff --git a/src/vmime/net/imap/IMAPParser.hpp b/src/vmime/net/imap/IMAPParser.hpp index bad87769..33d091cc 100644 --- a/src/vmime/net/imap/IMAPParser.hpp +++ b/src/vmime/net/imap/IMAPParser.hpp @@ -273,7 +273,7 @@ public: * * @param tag IMAP command tag */ - void setTag(shared_ptr <IMAPTag> tag) + void setTag(const shared_ptr <IMAPTag>& tag) { m_tag = tag; } @@ -292,7 +292,7 @@ public: * * @param sok socket */ - void setSocket(shared_ptr <socket> sok) + void setSocket(const shared_ptr <socket>& sok) { m_socket = sok; } @@ -301,7 +301,7 @@ public: * * @param toh timeout handler */ - void setTimeoutHandler(shared_ptr <timeoutHandler> toh) + void setTimeoutHandler(const shared_ptr <timeoutHandler>& toh) { m_timeoutHandler = toh; } @@ -310,7 +310,7 @@ public: * * @param tr tracer */ - void setTracer(shared_ptr <tracer> tr) + void setTracer(const shared_ptr <tracer>& tr) { m_tracer = tr; } diff --git a/src/vmime/net/imap/IMAPSStore.cpp b/src/vmime/net/imap/IMAPSStore.cpp index c9e64f5b..f70c0915 100644 --- a/src/vmime/net/imap/IMAPSStore.cpp +++ b/src/vmime/net/imap/IMAPSStore.cpp @@ -35,7 +35,7 @@ namespace net { namespace imap { -IMAPSStore::IMAPSStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth) +IMAPSStore::IMAPSStore(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth) : IMAPStore(sess, auth, true) { } diff --git a/src/vmime/net/imap/IMAPSStore.hpp b/src/vmime/net/imap/IMAPSStore.hpp index 9d27bdd0..8d6896d7 100644 --- a/src/vmime/net/imap/IMAPSStore.hpp +++ b/src/vmime/net/imap/IMAPSStore.hpp @@ -46,7 +46,7 @@ class VMIME_EXPORT IMAPSStore : public IMAPStore { public: - IMAPSStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth); + IMAPSStore(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth); ~IMAPSStore(); const string getProtocolName() const; diff --git a/src/vmime/net/imap/IMAPStore.cpp b/src/vmime/net/imap/IMAPStore.cpp index bf93f284..7abfe8ae 100644 --- a/src/vmime/net/imap/IMAPStore.cpp +++ b/src/vmime/net/imap/IMAPStore.cpp @@ -44,7 +44,7 @@ namespace net { namespace imap { -IMAPStore::IMAPStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth, const bool secured) +IMAPStore::IMAPStore(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth, const bool secured) : store(sess, getInfosInstance(), auth), m_connection(null), m_isIMAPS(secured) { } diff --git a/src/vmime/net/imap/IMAPStore.hpp b/src/vmime/net/imap/IMAPStore.hpp index f854fadf..80932af4 100644 --- a/src/vmime/net/imap/IMAPStore.hpp +++ b/src/vmime/net/imap/IMAPStore.hpp @@ -60,7 +60,7 @@ class VMIME_EXPORT IMAPStore : public store public: - IMAPStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth, const bool secured = false); + IMAPStore(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth, const bool secured = false); ~IMAPStore(); const string getProtocolName() const; diff --git a/src/vmime/net/imap/IMAPUtils.cpp b/src/vmime/net/imap/IMAPUtils.cpp index 3e6b2677..bffc2c78 100644 --- a/src/vmime/net/imap/IMAPUtils.cpp +++ b/src/vmime/net/imap/IMAPUtils.cpp @@ -381,7 +381,7 @@ const folder::path::component IMAPUtils::fromModifiedUTF7(const string& text) // static void IMAPUtils::mailboxFlagsToFolderAttributes - (shared_ptr <const IMAPConnection> cnt, const IMAPParser::mailbox_flag_list* list, + (const shared_ptr <const IMAPConnection>& cnt, const IMAPParser::mailbox_flag_list* list, folderAttributes& attribs) { int specialUse = folderAttributes::SPECIALUSE_NONE; @@ -594,7 +594,7 @@ const string IMAPUtils::dateTime(const vmime::datetime& date) // static shared_ptr <IMAPCommand> IMAPUtils::buildFetchCommand - (shared_ptr <IMAPConnection> cnt, const messageSet& msgs, const fetchAttributes& options) + (const shared_ptr <IMAPConnection>& cnt, const messageSet& msgs, const fetchAttributes& options) { // Example: // C: A654 FETCH 2:4 (FLAGS BODY[HEADER.FIELDS (DATE FROM)]) diff --git a/src/vmime/net/imap/IMAPUtils.hpp b/src/vmime/net/imap/IMAPUtils.hpp index 6140855d..a7daf736 100644 --- a/src/vmime/net/imap/IMAPUtils.hpp +++ b/src/vmime/net/imap/IMAPUtils.hpp @@ -74,7 +74,7 @@ public: * @param attribs reference to an object holding folder attributes */ static void mailboxFlagsToFolderAttributes - (shared_ptr <const IMAPConnection> cnt, + (const shared_ptr <const IMAPConnection>& cnt, const IMAPParser::mailbox_flag_list* list, folderAttributes& attribs); @@ -98,7 +98,7 @@ public: * @return fetch request */ static shared_ptr <IMAPCommand> buildFetchCommand - (shared_ptr <IMAPConnection> cnt, const messageSet& msgs, const fetchAttributes& options); + (const shared_ptr <IMAPConnection>& cnt, const messageSet& msgs, const fetchAttributes& options); /** Convert a parser-style address list to a mailbox list. * @@ -124,7 +124,7 @@ public: private: static const string buildFetchRequestImpl - (shared_ptr <IMAPConnection> cnt, const string& mode, const string& set, const int options); + (const shared_ptr <IMAPConnection>& cnt, const string& mode, const string& set, const int options); }; diff --git a/src/vmime/net/maildir/format/courierMaildirFormat.cpp b/src/vmime/net/maildir/format/courierMaildirFormat.cpp index 6d460d5e..78753796 100644 --- a/src/vmime/net/maildir/format/courierMaildirFormat.cpp +++ b/src/vmime/net/maildir/format/courierMaildirFormat.cpp @@ -41,7 +41,7 @@ namespace maildir { namespace format { -courierMaildirFormat::courierMaildirFormat(shared_ptr <context> ctx) +courierMaildirFormat::courierMaildirFormat(const shared_ptr <context>& ctx) : maildirFormat(ctx) { } diff --git a/src/vmime/net/maildir/format/courierMaildirFormat.hpp b/src/vmime/net/maildir/format/courierMaildirFormat.hpp index b8443426..6b6841e2 100644 --- a/src/vmime/net/maildir/format/courierMaildirFormat.hpp +++ b/src/vmime/net/maildir/format/courierMaildirFormat.hpp @@ -47,7 +47,7 @@ class VMIME_EXPORT courierMaildirFormat : public maildirFormat { public: - courierMaildirFormat(shared_ptr <context> ctx); + courierMaildirFormat(const shared_ptr <context>& ctx); /* Folder types: diff --git a/src/vmime/net/maildir/format/kmailMaildirFormat.cpp b/src/vmime/net/maildir/format/kmailMaildirFormat.cpp index 975752a5..c52a2f45 100644 --- a/src/vmime/net/maildir/format/kmailMaildirFormat.cpp +++ b/src/vmime/net/maildir/format/kmailMaildirFormat.cpp @@ -41,7 +41,7 @@ namespace maildir { namespace format { -kmailMaildirFormat::kmailMaildirFormat(shared_ptr <context> ctx) +kmailMaildirFormat::kmailMaildirFormat(const shared_ptr <context>& ctx) : maildirFormat(ctx) { } diff --git a/src/vmime/net/maildir/format/kmailMaildirFormat.hpp b/src/vmime/net/maildir/format/kmailMaildirFormat.hpp index 98ca212e..854e60be 100644 --- a/src/vmime/net/maildir/format/kmailMaildirFormat.hpp +++ b/src/vmime/net/maildir/format/kmailMaildirFormat.hpp @@ -47,7 +47,7 @@ class VMIME_EXPORT kmailMaildirFormat : public maildirFormat { public: - kmailMaildirFormat(shared_ptr <context> ctx); + kmailMaildirFormat(const shared_ptr <context>& ctx); /* Folder types: diff --git a/src/vmime/net/maildir/maildirFolder.cpp b/src/vmime/net/maildir/maildirFolder.cpp index 8951cb1c..fec1294b 100644 --- a/src/vmime/net/maildir/maildirFolder.cpp +++ b/src/vmime/net/maildir/maildirFolder.cpp @@ -49,7 +49,7 @@ namespace net { namespace maildir { -maildirFolder::maildirFolder(const folder::path& path, shared_ptr <maildirStore> store) +maildirFolder::maildirFolder(const folder::path& path, const shared_ptr <maildirStore>& store) : m_store(store), m_path(path), m_name(path.isEmpty() ? folder::path::component("") : path.getLastComponent()), m_mode(-1), m_open(false), m_unreadMessageCount(0), m_messageCount(0) @@ -708,7 +708,7 @@ void maildirFolder::setMessageFlags messageSet maildirFolder::addMessage - (shared_ptr <vmime::message> msg, const int flags, + (const shared_ptr <vmime::message>& msg, const int flags, vmime::datetime* date, utility::progressListener* progress) { std::ostringstream oss; @@ -1221,7 +1221,7 @@ void maildirFolder::fetchMessages(std::vector <shared_ptr <message> >& msg, } -void maildirFolder::fetchMessage(shared_ptr <message> msg, const fetchAttributes& options) +void maildirFolder::fetchMessage(const shared_ptr <message>& msg, const fetchAttributes& options) { shared_ptr <maildirStore> store = m_store.lock(); diff --git a/src/vmime/net/maildir/maildirFolder.hpp b/src/vmime/net/maildir/maildirFolder.hpp index d6bdb7e8..ff0cff61 100644 --- a/src/vmime/net/maildir/maildirFolder.hpp +++ b/src/vmime/net/maildir/maildirFolder.hpp @@ -61,7 +61,7 @@ private: friend class maildirMessage; maildirFolder(const maildirFolder&) : folder() { } - maildirFolder(const folder::path& path, shared_ptr <maildirStore> store); + maildirFolder(const folder::path& path, const shared_ptr <maildirStore>& store); public: @@ -99,7 +99,7 @@ public: void setMessageFlags(const messageSet& msgs, const int flags, const int mode = message::FLAG_MODE_SET); - messageSet addMessage(shared_ptr <vmime::message> msg, const int flags = -1, vmime::datetime* date = NULL, utility::progressListener* progress = NULL); + messageSet addMessage(const shared_ptr <vmime::message>& msg, const int flags = -1, vmime::datetime* date = NULL, utility::progressListener* progress = NULL); messageSet addMessage(utility::inputStream& is, const size_t size, const int flags = -1, vmime::datetime* date = NULL, utility::progressListener* progress = NULL); messageSet copyMessages(const folder::path& dest, const messageSet& msgs); @@ -116,7 +116,7 @@ public: void fetchMessages(std::vector <shared_ptr <message> >& msg, const fetchAttributes& options, utility::progressListener* progress = NULL); - void fetchMessage(shared_ptr <message> msg, const fetchAttributes& options); + void fetchMessage(const shared_ptr <message>& msg, const fetchAttributes& options); std::vector <shared_ptr <message> > getAndFetchMessages (const messageSet& msgs, const fetchAttributes& attribs); diff --git a/src/vmime/net/maildir/maildirFormat.cpp b/src/vmime/net/maildir/maildirFormat.cpp index f7a3c8fe..5b0b3c2b 100644 --- a/src/vmime/net/maildir/maildirFormat.cpp +++ b/src/vmime/net/maildir/maildirFormat.cpp @@ -50,7 +50,7 @@ const utility::file::path::component maildirFormat::NEW_DIR("new", vmime::charse // maildirFormat::context // -maildirFormat::context::context(shared_ptr <maildirStore> store) +maildirFormat::context::context(const shared_ptr <maildirStore>& store) : m_store(store) { } @@ -66,7 +66,7 @@ shared_ptr <maildirStore> maildirFormat::context::getStore() const // maildirFormat // -maildirFormat::maildirFormat(shared_ptr <context> ctx) +maildirFormat::maildirFormat(const shared_ptr <context>& ctx) : m_context(ctx) { } @@ -85,7 +85,7 @@ shared_ptr <const maildirFormat::context> maildirFormat::getContext() const // static -shared_ptr <maildirFormat> maildirFormat::detect(shared_ptr <maildirStore> store) +shared_ptr <maildirFormat> maildirFormat::detect(const shared_ptr <maildirStore>& store) { shared_ptr <context> ctx = make_shared <context>(store); diff --git a/src/vmime/net/maildir/maildirFormat.hpp b/src/vmime/net/maildir/maildirFormat.hpp index c0daf288..7a95caf4 100644 --- a/src/vmime/net/maildir/maildirFormat.hpp +++ b/src/vmime/net/maildir/maildirFormat.hpp @@ -55,7 +55,7 @@ public: { public: - context(shared_ptr <maildirStore> store); + context(const shared_ptr <maildirStore>& store); shared_ptr <maildirStore> getStore() const; @@ -146,7 +146,7 @@ public: * @param store of which to detect format * @return a Maildir format implementation for the specified store */ - static shared_ptr <maildirFormat> detect(shared_ptr <maildirStore> store); + static shared_ptr <maildirFormat> detect(const shared_ptr <maildirStore>& store); protected: @@ -155,7 +155,7 @@ protected: static const utility::file::path::component NEW_DIR; /**< Unread messages. */ - maildirFormat(shared_ptr <context> ctx); + maildirFormat(const shared_ptr <context>& ctx); /** Returns the current context. diff --git a/src/vmime/net/maildir/maildirMessage.cpp b/src/vmime/net/maildir/maildirMessage.cpp index faf00f6a..ea3d05a6 100644 --- a/src/vmime/net/maildir/maildirMessage.cpp +++ b/src/vmime/net/maildir/maildirMessage.cpp @@ -48,7 +48,7 @@ namespace net { namespace maildir { -maildirMessage::maildirMessage(shared_ptr <maildirFolder> folder, const size_t num) +maildirMessage::maildirMessage(const shared_ptr <maildirFolder>& folder, const size_t num) : m_folder(folder), m_num(num), m_size(-1), m_flags(FLAG_UNDEFINED), m_expunged(false), m_structure(null) { @@ -160,7 +160,7 @@ void maildirMessage::extract(utility::outputStream& os, } -void maildirMessage::extractPart(shared_ptr <const messagePart> p, utility::outputStream& os, +void maildirMessage::extractPart(const shared_ptr <const messagePart>& p, utility::outputStream& os, utility::progressListener* progress, const size_t start, const size_t length, const bool peek) const { @@ -217,7 +217,7 @@ void maildirMessage::extractImpl(utility::outputStream& os, utility::progressLis } -void maildirMessage::fetchPartHeader(shared_ptr <messagePart> p) +void maildirMessage::fetchPartHeader(const shared_ptr <messagePart>& p) { shared_ptr <maildirFolder> folder = m_folder.lock(); @@ -252,7 +252,7 @@ void maildirMessage::fetchPartHeader(shared_ptr <messagePart> p) } -void maildirMessage::fetch(shared_ptr <maildirFolder> msgFolder, const fetchAttributes& options) +void maildirMessage::fetch(const shared_ptr <maildirFolder>& msgFolder, const fetchAttributes& options) { shared_ptr <maildirFolder> folder = m_folder.lock(); diff --git a/src/vmime/net/maildir/maildirMessage.hpp b/src/vmime/net/maildir/maildirMessage.hpp index 5cdabfc9..3e97a981 100644 --- a/src/vmime/net/maildir/maildirMessage.hpp +++ b/src/vmime/net/maildir/maildirMessage.hpp @@ -54,7 +54,7 @@ class VMIME_EXPORT maildirMessage : public message public: - maildirMessage(shared_ptr <maildirFolder> folder, const size_t num); + maildirMessage(const shared_ptr <maildirFolder>& folder, const size_t num); ~maildirMessage(); @@ -76,15 +76,15 @@ public: void setFlags(const int flags, const int mode = FLAG_MODE_SET); void extract(utility::outputStream& os, utility::progressListener* progress = NULL, const size_t start = 0, const size_t length = -1, const bool peek = false) const; - void extractPart(shared_ptr <const messagePart> p, utility::outputStream& os, utility::progressListener* progress = NULL, const size_t start = 0, const size_t length = -1, const bool peek = false) const; + void extractPart(const shared_ptr <const messagePart>& p, utility::outputStream& os, utility::progressListener* progress = NULL, const size_t start = 0, const size_t length = -1, const bool peek = false) const; - void fetchPartHeader(shared_ptr <messagePart> p); + void fetchPartHeader(const shared_ptr <messagePart>& p); shared_ptr <vmime::message> getParsedMessage(); private: - void fetch(shared_ptr <maildirFolder> folder, const fetchAttributes& options); + void fetch(const shared_ptr <maildirFolder>& folder, const fetchAttributes& options); void onFolderClosed(); diff --git a/src/vmime/net/maildir/maildirMessagePart.cpp b/src/vmime/net/maildir/maildirMessagePart.cpp index 0b813749..787c0198 100644 --- a/src/vmime/net/maildir/maildirMessagePart.cpp +++ b/src/vmime/net/maildir/maildirMessagePart.cpp @@ -36,7 +36,7 @@ namespace net { namespace maildir { -maildirMessagePart::maildirMessagePart(shared_ptr <maildirMessagePart> parent, const size_t number, const bodyPart& part) +maildirMessagePart::maildirMessagePart(const shared_ptr <maildirMessagePart>& parent, const size_t number, const bodyPart& part) : m_parent(parent), m_header(null), m_number(number) { m_headerParsedOffset = part.getHeader()->getParsedOffset(); diff --git a/src/vmime/net/maildir/maildirMessagePart.hpp b/src/vmime/net/maildir/maildirMessagePart.hpp index db1aeb75..6aa80019 100644 --- a/src/vmime/net/maildir/maildirMessagePart.hpp +++ b/src/vmime/net/maildir/maildirMessagePart.hpp @@ -46,7 +46,7 @@ class maildirMessagePart : public messagePart { public: - maildirMessagePart(shared_ptr <maildirMessagePart> parent, const size_t number, const bodyPart& part); + maildirMessagePart(const shared_ptr <maildirMessagePart>& parent, const size_t number, const bodyPart& part); ~maildirMessagePart(); diff --git a/src/vmime/net/maildir/maildirMessageStructure.cpp b/src/vmime/net/maildir/maildirMessageStructure.cpp index 54eba981..e01c2a92 100644 --- a/src/vmime/net/maildir/maildirMessageStructure.cpp +++ b/src/vmime/net/maildir/maildirMessageStructure.cpp @@ -44,7 +44,7 @@ maildirMessageStructure::maildirMessageStructure() } -maildirMessageStructure::maildirMessageStructure(shared_ptr <maildirMessagePart> parent, const bodyPart& part) +maildirMessageStructure::maildirMessageStructure(const shared_ptr <maildirMessagePart>& parent, const bodyPart& part) { shared_ptr <maildirMessagePart> mpart = make_shared <maildirMessagePart>(parent, 0, part); mpart->initStructure(part); @@ -53,7 +53,7 @@ maildirMessageStructure::maildirMessageStructure(shared_ptr <maildirMessagePart> } -maildirMessageStructure::maildirMessageStructure(shared_ptr <maildirMessagePart> parent, const std::vector <shared_ptr <const vmime::bodyPart> >& list) +maildirMessageStructure::maildirMessageStructure(const shared_ptr <maildirMessagePart>& parent, const std::vector <shared_ptr <const vmime::bodyPart> >& list) { for (size_t i = 0 ; i < list.size() ; ++i) { diff --git a/src/vmime/net/maildir/maildirMessageStructure.hpp b/src/vmime/net/maildir/maildirMessageStructure.hpp index a43fc15c..fce5db6f 100644 --- a/src/vmime/net/maildir/maildirMessageStructure.hpp +++ b/src/vmime/net/maildir/maildirMessageStructure.hpp @@ -47,8 +47,8 @@ class maildirMessageStructure : public messageStructure public: maildirMessageStructure(); - maildirMessageStructure(shared_ptr <maildirMessagePart> parent, const bodyPart& part); - maildirMessageStructure(shared_ptr <maildirMessagePart> parent, const std::vector <shared_ptr <const vmime::bodyPart> >& list); + maildirMessageStructure(const shared_ptr <maildirMessagePart>& parent, const bodyPart& part); + maildirMessageStructure(const shared_ptr <maildirMessagePart>& parent, const std::vector <shared_ptr <const vmime::bodyPart> >& list); shared_ptr <const messagePart> getPartAt(const size_t x) const; diff --git a/src/vmime/net/maildir/maildirStore.cpp b/src/vmime/net/maildir/maildirStore.cpp index 3c777551..4029eb7d 100644 --- a/src/vmime/net/maildir/maildirStore.cpp +++ b/src/vmime/net/maildir/maildirStore.cpp @@ -52,7 +52,7 @@ namespace net { namespace maildir { -maildirStore::maildirStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth) +maildirStore::maildirStore(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth) : store(sess, getInfosInstance(), auth), m_connected(false) { } diff --git a/src/vmime/net/maildir/maildirStore.hpp b/src/vmime/net/maildir/maildirStore.hpp index efadfdfe..ba7b8c13 100644 --- a/src/vmime/net/maildir/maildirStore.hpp +++ b/src/vmime/net/maildir/maildirStore.hpp @@ -60,7 +60,7 @@ class VMIME_EXPORT maildirStore : public store public: - maildirStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth); + maildirStore(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth); ~maildirStore(); const string getProtocolName() const; diff --git a/src/vmime/net/maildir/maildirUtils.cpp b/src/vmime/net/maildir/maildirUtils.cpp index b31eb931..1c75805a 100644 --- a/src/vmime/net/maildir/maildirUtils.cpp +++ b/src/vmime/net/maildir/maildirUtils.cpp @@ -175,7 +175,7 @@ const utility::file::path::component maildirUtils::generateId() } -void maildirUtils::recursiveFSDelete(shared_ptr <utility::file> dir) +void maildirUtils::recursiveFSDelete(const shared_ptr <utility::file>& dir) { shared_ptr <utility::fileIterator> files = dir->getFiles(); diff --git a/src/vmime/net/maildir/maildirUtils.hpp b/src/vmime/net/maildir/maildirUtils.hpp index 8899bdd7..6f120636 100644 --- a/src/vmime/net/maildir/maildirUtils.hpp +++ b/src/vmime/net/maildir/maildirUtils.hpp @@ -130,7 +130,7 @@ public: * * @param dir directory to delete */ - static void recursiveFSDelete(shared_ptr <utility::file> dir); + static void recursiveFSDelete(const shared_ptr <utility::file>& dir); /** Returns a list of message numbers given a message set. * diff --git a/src/vmime/net/message.hpp b/src/vmime/net/message.hpp index 4c64a1cf..80c9b974 100644 --- a/src/vmime/net/message.hpp +++ b/src/vmime/net/message.hpp @@ -321,7 +321,7 @@ public: * an exception if not supported. */ virtual void extractPart - (shared_ptr <const messagePart> p, + (const shared_ptr <const messagePart>& p, utility::outputStream& os, utility::progressListener* progress = NULL, const size_t start = 0, @@ -332,7 +332,7 @@ public: * * @param p the part for which to fetch the header */ - virtual void fetchPartHeader(shared_ptr <messagePart> p) = 0; + virtual void fetchPartHeader(const shared_ptr <messagePart>& p) = 0; /** Get the RFC-822 message for this abstract message. * Warning: This may require getting some data (ie: structure and headers) from diff --git a/src/vmime/net/pop3/POP3Command.cpp b/src/vmime/net/pop3/POP3Command.cpp index 9dfaf17a..528746e0 100644 --- a/src/vmime/net/pop3/POP3Command.cpp +++ b/src/vmime/net/pop3/POP3Command.cpp @@ -245,7 +245,7 @@ const string POP3Command::getTraceText() const } -void POP3Command::send(shared_ptr <POP3Connection> conn) +void POP3Command::send(const shared_ptr <POP3Connection>& conn) { conn->getSocket()->send(m_text + "\r\n"); diff --git a/src/vmime/net/pop3/POP3Command.hpp b/src/vmime/net/pop3/POP3Command.hpp index 45aff661..7718ccb2 100644 --- a/src/vmime/net/pop3/POP3Command.hpp +++ b/src/vmime/net/pop3/POP3Command.hpp @@ -85,7 +85,7 @@ public: * * @param conn connection onto which the command will be sent */ - virtual void send(shared_ptr <POP3Connection> conn); + virtual void send(const shared_ptr <POP3Connection>& conn); /** Returns the full text of the command, including command name * and parameters (if any). diff --git a/src/vmime/net/pop3/POP3Connection.cpp b/src/vmime/net/pop3/POP3Connection.cpp index 27ab7aa2..ed098656 100644 --- a/src/vmime/net/pop3/POP3Connection.cpp +++ b/src/vmime/net/pop3/POP3Connection.cpp @@ -63,7 +63,7 @@ namespace pop3 { -POP3Connection::POP3Connection(shared_ptr <POP3Store> store, shared_ptr <security::authenticator> auth) +POP3Connection::POP3Connection(const shared_ptr <POP3Store>& store, const shared_ptr <security::authenticator>& auth) : m_store(store), m_auth(auth), m_socket(null), m_timeoutHandler(null), m_authenticated(false), m_secured(false), m_capabilitiesFetched(false) { diff --git a/src/vmime/net/pop3/POP3Connection.hpp b/src/vmime/net/pop3/POP3Connection.hpp index f40f1193..032be5cc 100644 --- a/src/vmime/net/pop3/POP3Connection.hpp +++ b/src/vmime/net/pop3/POP3Connection.hpp @@ -65,7 +65,7 @@ class VMIME_EXPORT POP3Connection : public object, public enable_shared_from_thi { public: - POP3Connection(shared_ptr <POP3Store> store, shared_ptr <security::authenticator> auth); + POP3Connection(const shared_ptr <POP3Store>& store, const shared_ptr <security::authenticator>& auth); virtual ~POP3Connection(); diff --git a/src/vmime/net/pop3/POP3Folder.cpp b/src/vmime/net/pop3/POP3Folder.cpp index 0e232c1a..8c34676e 100644 --- a/src/vmime/net/pop3/POP3Folder.cpp +++ b/src/vmime/net/pop3/POP3Folder.cpp @@ -45,7 +45,7 @@ namespace net { namespace pop3 { -POP3Folder::POP3Folder(const folder::path& path, shared_ptr <POP3Store> store) +POP3Folder::POP3Folder(const folder::path& path, const shared_ptr <POP3Store>& store) : m_store(store), m_path(path), m_name(path.isEmpty() ? folder::path::component("") : path.getLastComponent()), m_mode(-1), m_open(false) @@ -420,7 +420,7 @@ void POP3Folder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f } -void POP3Folder::fetchMessage(shared_ptr <message> msg, const fetchAttributes& options) +void POP3Folder::fetchMessage(const shared_ptr <message>& msg, const fetchAttributes& options) { shared_ptr <POP3Store> store = m_store.lock(); @@ -625,7 +625,7 @@ void POP3Folder::rename(const folder::path& /* newPath */) messageSet POP3Folder::addMessage - (shared_ptr <vmime::message> /* msg */, const int /* flags */, + (const shared_ptr <vmime::message>& /* msg */, const int /* flags */, vmime::datetime* /* date */, utility::progressListener* /* progress */) { throw exceptions::operation_not_supported(); diff --git a/src/vmime/net/pop3/POP3Folder.hpp b/src/vmime/net/pop3/POP3Folder.hpp index 339399d8..92be088b 100644 --- a/src/vmime/net/pop3/POP3Folder.hpp +++ b/src/vmime/net/pop3/POP3Folder.hpp @@ -59,7 +59,7 @@ private: friend class POP3Message; POP3Folder(const POP3Folder&); - POP3Folder(const folder::path& path, shared_ptr <POP3Store> store); + POP3Folder(const folder::path& path, const shared_ptr <POP3Store>& store); public: @@ -96,7 +96,7 @@ public: void setMessageFlags(const messageSet& msgs, const int flags, const int mode = message::FLAG_MODE_SET); - messageSet addMessage(shared_ptr <vmime::message> msg, const int flags = -1, vmime::datetime* date = NULL, utility::progressListener* progress = NULL); + messageSet addMessage(const shared_ptr <vmime::message>& msg, const int flags = -1, vmime::datetime* date = NULL, utility::progressListener* progress = NULL); messageSet addMessage(utility::inputStream& is, const size_t size, const int flags = -1, vmime::datetime* date = NULL, utility::progressListener* progress = NULL); messageSet copyMessages(const folder::path& dest, const messageSet& msgs); @@ -113,7 +113,7 @@ public: void fetchMessages(std::vector <shared_ptr <message> >& msg, const fetchAttributes& options, utility::progressListener* progress = NULL); - void fetchMessage(shared_ptr <message> msg, const fetchAttributes& options); + void fetchMessage(const shared_ptr <message>& msg, const fetchAttributes& options); std::vector <shared_ptr <message> > getAndFetchMessages (const messageSet& msgs, const fetchAttributes& attribs); diff --git a/src/vmime/net/pop3/POP3Message.cpp b/src/vmime/net/pop3/POP3Message.cpp index 67ad6d16..24d211a4 100644 --- a/src/vmime/net/pop3/POP3Message.cpp +++ b/src/vmime/net/pop3/POP3Message.cpp @@ -44,7 +44,7 @@ namespace net { namespace pop3 { -POP3Message::POP3Message(shared_ptr <POP3Folder> folder, const size_t num) +POP3Message::POP3Message(const shared_ptr <POP3Folder>& folder, const size_t num) : m_folder(folder), m_num(num), m_size(-1), m_deleted(false) { folder->registerMessage(this); @@ -166,7 +166,7 @@ void POP3Message::extract void POP3Message::extractPart - (shared_ptr <const messagePart> /* p */, + (const shared_ptr <const messagePart>& /* p */, utility::outputStream& /* os */, utility::progressListener* /* progress */, const size_t /* start */, const size_t /* length */, @@ -176,13 +176,13 @@ void POP3Message::extractPart } -void POP3Message::fetchPartHeader(shared_ptr <messagePart> /* p */) +void POP3Message::fetchPartHeader(const shared_ptr <messagePart>& /* p */) { throw exceptions::operation_not_supported(); } -void POP3Message::fetch(shared_ptr <POP3Folder> msgFolder, const fetchAttributes& options) +void POP3Message::fetch(const shared_ptr <POP3Folder>& msgFolder, const fetchAttributes& options) { shared_ptr <POP3Folder> folder = m_folder.lock(); diff --git a/src/vmime/net/pop3/POP3Message.hpp b/src/vmime/net/pop3/POP3Message.hpp index e4e3b079..7ac86a1b 100644 --- a/src/vmime/net/pop3/POP3Message.hpp +++ b/src/vmime/net/pop3/POP3Message.hpp @@ -56,7 +56,7 @@ private: public: - POP3Message(shared_ptr <POP3Folder> folder, const size_t num); + POP3Message(const shared_ptr <POP3Folder>& folder, const size_t num); ~POP3Message(); @@ -84,19 +84,19 @@ public: const bool peek = false) const; void extractPart - (shared_ptr <const messagePart> p, + (const shared_ptr <const messagePart>& p, utility::outputStream& os, utility::progressListener* progress = NULL, const size_t start = 0, const size_t length = -1, const bool peek = false) const; - void fetchPartHeader(shared_ptr <messagePart> p); + void fetchPartHeader(const shared_ptr <messagePart>& p); shared_ptr <vmime::message> getParsedMessage(); private: - void fetch(shared_ptr <POP3Folder> folder, const fetchAttributes& options); + void fetch(const shared_ptr <POP3Folder>& folder, const fetchAttributes& options); void onFolderClosed(); diff --git a/src/vmime/net/pop3/POP3Response.cpp b/src/vmime/net/pop3/POP3Response.cpp index de3c2cf3..1d510fb3 100644 --- a/src/vmime/net/pop3/POP3Response.cpp +++ b/src/vmime/net/pop3/POP3Response.cpp @@ -46,14 +46,14 @@ namespace net { namespace pop3 { -POP3Response::POP3Response(shared_ptr <socket> sok, shared_ptr <timeoutHandler> toh, shared_ptr <tracer> tracer) +POP3Response::POP3Response(const shared_ptr <socket>& sok, const shared_ptr <timeoutHandler>& toh, const shared_ptr <tracer>& tracer) : m_socket(sok), m_timeoutHandler(toh), m_tracer(tracer) { } // static -shared_ptr <POP3Response> POP3Response::readResponse(shared_ptr <POP3Connection> conn) +shared_ptr <POP3Response> POP3Response::readResponse(const shared_ptr <POP3Connection>& conn) { shared_ptr <POP3Response> resp = shared_ptr <POP3Response> (new POP3Response(conn->getSocket(), conn->getTimeoutHandler(), conn->getTracer())); @@ -73,7 +73,7 @@ shared_ptr <POP3Response> POP3Response::readResponse(shared_ptr <POP3Connection> // static -shared_ptr <POP3Response> POP3Response::readMultilineResponse(shared_ptr <POP3Connection> conn) +shared_ptr <POP3Response> POP3Response::readMultilineResponse(const shared_ptr <POP3Connection>& conn) { shared_ptr <POP3Response> resp = shared_ptr <POP3Response> (new POP3Response(conn->getSocket(), conn->getTimeoutHandler(), conn->getTracer())); @@ -112,7 +112,7 @@ shared_ptr <POP3Response> POP3Response::readMultilineResponse(shared_ptr <POP3Co // static shared_ptr <POP3Response> POP3Response::readLargeResponse - (shared_ptr <POP3Connection> conn, utility::outputStream& os, + (const shared_ptr <POP3Connection>& conn, utility::outputStream& os, utility::progressListener* progress, const size_t predictedSize) { shared_ptr <POP3Response> resp = shared_ptr <POP3Response> diff --git a/src/vmime/net/pop3/POP3Response.hpp b/src/vmime/net/pop3/POP3Response.hpp index d85b5405..4f0221e6 100644 --- a/src/vmime/net/pop3/POP3Response.hpp +++ b/src/vmime/net/pop3/POP3Response.hpp @@ -77,7 +77,7 @@ public: * @throws exceptions::operation_timed_out if no data * has been received within the granted time */ - static shared_ptr <POP3Response> readResponse(shared_ptr <POP3Connection> conn); + static shared_ptr <POP3Response> readResponse(const shared_ptr <POP3Connection>& conn); /** Receive and parse a multiline POP3 response from * the specified connection. @@ -87,7 +87,7 @@ public: * @throws exceptions::operation_timed_out if no data * has been received within the granted time */ - static shared_ptr <POP3Response> readMultilineResponse(shared_ptr <POP3Connection> conn); + static shared_ptr <POP3Response> readMultilineResponse(const shared_ptr <POP3Connection>& conn); /** Receive and parse a large POP3 response (eg. message data) * from the specified connection. @@ -101,7 +101,7 @@ public: * has been received within the granted time */ static shared_ptr <POP3Response> readLargeResponse - (shared_ptr <POP3Connection> conn, utility::outputStream& os, + (const shared_ptr <POP3Connection>& conn, utility::outputStream& os, utility::progressListener* progress, const size_t predictedSize); @@ -144,7 +144,7 @@ public: private: - POP3Response(shared_ptr <socket> sok, shared_ptr <timeoutHandler> toh, shared_ptr <tracer> tracer); + POP3Response(const shared_ptr <socket>& sok, const shared_ptr <timeoutHandler>& toh, const shared_ptr <tracer>& tracer); void readResponseImpl(string& buffer, const bool multiLine); size_t readResponseImpl diff --git a/src/vmime/net/pop3/POP3SStore.cpp b/src/vmime/net/pop3/POP3SStore.cpp index f1c3da74..51e58f0e 100644 --- a/src/vmime/net/pop3/POP3SStore.cpp +++ b/src/vmime/net/pop3/POP3SStore.cpp @@ -35,7 +35,7 @@ namespace net { namespace pop3 { -POP3SStore::POP3SStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth) +POP3SStore::POP3SStore(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth) : POP3Store(sess, auth, true) { } diff --git a/src/vmime/net/pop3/POP3SStore.hpp b/src/vmime/net/pop3/POP3SStore.hpp index e60b4ef8..ad88fa10 100644 --- a/src/vmime/net/pop3/POP3SStore.hpp +++ b/src/vmime/net/pop3/POP3SStore.hpp @@ -46,7 +46,7 @@ class VMIME_EXPORT POP3SStore : public POP3Store { public: - POP3SStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth); + POP3SStore(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth); ~POP3SStore(); const string getProtocolName() const; diff --git a/src/vmime/net/pop3/POP3Store.cpp b/src/vmime/net/pop3/POP3Store.cpp index 4d1bb432..020cc55e 100644 --- a/src/vmime/net/pop3/POP3Store.cpp +++ b/src/vmime/net/pop3/POP3Store.cpp @@ -42,7 +42,7 @@ namespace net { namespace pop3 { -POP3Store::POP3Store(shared_ptr <session> sess, shared_ptr <security::authenticator> auth, const bool secured) +POP3Store::POP3Store(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth, const bool secured) : store(sess, getInfosInstance(), auth), m_isPOP3S(secured) { } diff --git a/src/vmime/net/pop3/POP3Store.hpp b/src/vmime/net/pop3/POP3Store.hpp index b35659a0..4737715a 100644 --- a/src/vmime/net/pop3/POP3Store.hpp +++ b/src/vmime/net/pop3/POP3Store.hpp @@ -59,7 +59,7 @@ class VMIME_EXPORT POP3Store : public store public: - POP3Store(shared_ptr <session> sess, shared_ptr <security::authenticator> auth, const bool secured = false); + POP3Store(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth, const bool secured = false); ~POP3Store(); const string getProtocolName() const; diff --git a/src/vmime/net/pop3/POP3Utils.cpp b/src/vmime/net/pop3/POP3Utils.cpp index 0649fb79..cb17ea9b 100644 --- a/src/vmime/net/pop3/POP3Utils.cpp +++ b/src/vmime/net/pop3/POP3Utils.cpp @@ -39,7 +39,7 @@ namespace pop3 { // static -void POP3Utils::parseMultiListOrUidlResponse(shared_ptr <POP3Response> response, std::map <size_t, string>& result) +void POP3Utils::parseMultiListOrUidlResponse(const shared_ptr <POP3Response>& response, std::map <size_t, string>& result) { std::map <size_t, string> ids; diff --git a/src/vmime/net/pop3/POP3Utils.hpp b/src/vmime/net/pop3/POP3Utils.hpp index c7d15b07..b9b2d555 100644 --- a/src/vmime/net/pop3/POP3Utils.hpp +++ b/src/vmime/net/pop3/POP3Utils.hpp @@ -64,7 +64,7 @@ public: * number to its corresponding data (either UID or size) */ static void parseMultiListOrUidlResponse - (shared_ptr <POP3Response> response, std::map <size_t, string>& result); + (const shared_ptr <POP3Response>& response, std::map <size_t, string>& result); /** Returns a list of message numbers given a message set. * diff --git a/src/vmime/net/sendmail/sendmailTransport.cpp b/src/vmime/net/sendmail/sendmailTransport.cpp index 822e1114..b911b129 100644 --- a/src/vmime/net/sendmail/sendmailTransport.cpp +++ b/src/vmime/net/sendmail/sendmailTransport.cpp @@ -58,7 +58,7 @@ namespace net { namespace sendmail { -sendmailTransport::sendmailTransport(shared_ptr <session> sess, shared_ptr <security::authenticator> auth) +sendmailTransport::sendmailTransport(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth) : transport(sess, getInfosInstance(), auth), m_connected(false) { } @@ -175,7 +175,7 @@ void sendmailTransport::send void sendmailTransport::internalSend - (const std::vector <string> args, utility::inputStream& is, + (const std::vector <string>& args, utility::inputStream& is, const size_t size, utility::progressListener* progress) { const utility::file::path path = vmime::platform::getHandler()-> diff --git a/src/vmime/net/sendmail/sendmailTransport.hpp b/src/vmime/net/sendmail/sendmailTransport.hpp index d1c6aec0..da419f95 100644 --- a/src/vmime/net/sendmail/sendmailTransport.hpp +++ b/src/vmime/net/sendmail/sendmailTransport.hpp @@ -50,7 +50,7 @@ class VMIME_EXPORT sendmailTransport : public transport { public: - sendmailTransport(shared_ptr <session> sess, shared_ptr <security::authenticator> auth); + sendmailTransport(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth); ~sendmailTransport(); const string getProtocolName() const; @@ -79,7 +79,7 @@ private: void internalDisconnect(); - void internalSend(const std::vector <string> args, utility::inputStream& is, + void internalSend(const std::vector <string>& args, utility::inputStream& is, const size_t size, utility::progressListener* progress); diff --git a/src/vmime/net/service.cpp b/src/vmime/net/service.cpp index 3cf94d5e..055f34fa 100644 --- a/src/vmime/net/service.cpp +++ b/src/vmime/net/service.cpp @@ -48,8 +48,8 @@ namespace vmime { namespace net { -service::service(shared_ptr <session> sess, const serviceInfos& /* infos */, - shared_ptr <security::authenticator> auth) +service::service(const shared_ptr <session>& sess, const serviceInfos& /* infos */, + const shared_ptr <security::authenticator>& auth) : m_session(sess), m_auth(auth) { if (!auth) @@ -102,7 +102,7 @@ shared_ptr <security::authenticator> service::getAuthenticator() } -void service::setAuthenticator(shared_ptr <security::authenticator> auth) +void service::setAuthenticator(const shared_ptr <security::authenticator>& auth) { m_auth = auth; } @@ -110,7 +110,7 @@ void service::setAuthenticator(shared_ptr <security::authenticator> auth) #if VMIME_HAVE_TLS_SUPPORT -void service::setCertificateVerifier(shared_ptr <security::cert::certificateVerifier> cv) +void service::setCertificateVerifier(const shared_ptr <security::cert::certificateVerifier>& cv) { m_certVerifier = cv; } @@ -124,7 +124,7 @@ shared_ptr <security::cert::certificateVerifier> service::getCertificateVerifier #endif // VMIME_HAVE_TLS_SUPPORT -void service::setSocketFactory(shared_ptr <socketFactory> sf) +void service::setSocketFactory(const shared_ptr <socketFactory>& sf) { m_socketFactory = sf; } @@ -136,7 +136,7 @@ shared_ptr <socketFactory> service::getSocketFactory() } -void service::setTracerFactory(shared_ptr <tracerFactory> tf) +void service::setTracerFactory(const shared_ptr <tracerFactory>& tf) { m_tracerFactory = tf; } @@ -148,7 +148,7 @@ shared_ptr <tracerFactory> service::getTracerFactory() } -void service::setTimeoutHandlerFactory(shared_ptr <timeoutHandlerFactory> thf) +void service::setTimeoutHandlerFactory(const shared_ptr <timeoutHandlerFactory>& thf) { m_toHandlerFactory = thf; } diff --git a/src/vmime/net/service.hpp b/src/vmime/net/service.hpp index 8d144aec..1fa120d3 100644 --- a/src/vmime/net/service.hpp +++ b/src/vmime/net/service.hpp @@ -60,7 +60,7 @@ class VMIME_EXPORT service : public object, public enable_shared_from_this <serv { protected: - service(shared_ptr <session> sess, const serviceInfos& infos, shared_ptr <security::authenticator> auth); + service(const shared_ptr <session>& sess, const serviceInfos& infos, const shared_ptr <security::authenticator>& auth); public: @@ -139,14 +139,14 @@ public: * * @param auth authenticator object */ - void setAuthenticator(shared_ptr <security::authenticator> auth); + void setAuthenticator(const shared_ptr <security::authenticator>& auth); #if VMIME_HAVE_TLS_SUPPORT /** Set the object responsible for verifying certificates when * using secured connections (TLS/SSL). */ - void setCertificateVerifier(shared_ptr <security::cert::certificateVerifier> cv); + void setCertificateVerifier(const shared_ptr <security::cert::certificateVerifier>& cv); /** Get the object responsible for verifying certificates when * using secured connections (TLS/SSL). @@ -160,7 +160,7 @@ public: * * @param sf socket factory */ - void setSocketFactory(shared_ptr <socketFactory> sf); + void setSocketFactory(const shared_ptr <socketFactory>& sf); /** Return the factory used to create socket objects for this * service. @@ -175,7 +175,7 @@ public: * * @param thf timeoutHandler factory */ - void setTimeoutHandlerFactory(shared_ptr <timeoutHandlerFactory> thf); + void setTimeoutHandlerFactory(const shared_ptr <timeoutHandlerFactory>& thf); /** Return the factory used to create timeoutHandler objects for * this service. @@ -185,7 +185,7 @@ public: shared_ptr <timeoutHandlerFactory> getTimeoutHandlerFactory(); - void setTracerFactory(shared_ptr <tracerFactory> tf); + void setTracerFactory(const shared_ptr <tracerFactory>& tf); shared_ptr <tracerFactory> getTracerFactory(); diff --git a/src/vmime/net/serviceFactory.cpp b/src/vmime/net/serviceFactory.cpp index b6f90eb2..dc129c63 100644 --- a/src/vmime/net/serviceFactory.cpp +++ b/src/vmime/net/serviceFactory.cpp @@ -57,8 +57,8 @@ shared_ptr <serviceFactory> serviceFactory::getInstance() shared_ptr <service> serviceFactory::create - (shared_ptr <session> sess, const string& protocol, - shared_ptr <security::authenticator> auth) + (const shared_ptr <session>& sess, const string& protocol, + const shared_ptr <security::authenticator>& auth) { shared_ptr <const registeredService> rserv = getServiceByProtocol(protocol); @@ -70,8 +70,8 @@ shared_ptr <service> serviceFactory::create shared_ptr <service> serviceFactory::create - (shared_ptr <session> sess, const utility::url& u, - shared_ptr <security::authenticator> auth) + (const shared_ptr <session>& sess, const utility::url& u, + const shared_ptr <security::authenticator>& auth) { shared_ptr <service> serv = create(sess, u.getProtocol(), auth); @@ -136,7 +136,7 @@ const std::vector <shared_ptr <const serviceFactory::registeredService> > servic } -void serviceFactory::registerService(shared_ptr <registeredService> reg) +void serviceFactory::registerService(const shared_ptr <registeredService>& reg) { m_services.push_back(reg); } diff --git a/src/vmime/net/serviceFactory.hpp b/src/vmime/net/serviceFactory.hpp index 9295b345..cb778b91 100644 --- a/src/vmime/net/serviceFactory.hpp +++ b/src/vmime/net/serviceFactory.hpp @@ -81,8 +81,8 @@ public: public: virtual shared_ptr <service> create - (shared_ptr <session> sess, - shared_ptr <security::authenticator> auth) const = 0; + (const shared_ptr <session>& sess, + const shared_ptr <security::authenticator>& auth) const = 0; virtual int getType() const = 0; virtual const string& getName() const = 0; @@ -94,7 +94,7 @@ public: * * @param reg service registration infos */ - void registerService(shared_ptr <registeredService> reg); + void registerService(const shared_ptr <registeredService>& reg); /** Create a new service instance from a protocol name. * @@ -105,9 +105,9 @@ public: * is registered for this protocol */ shared_ptr <service> create - (shared_ptr <session> sess, + (const shared_ptr <session>& sess, const string& protocol, - shared_ptr <security::authenticator> auth = null); + const shared_ptr <security::authenticator>& auth = null); /** Create a new service instance from a URL. * @@ -119,9 +119,9 @@ public: * is registered for this protocol */ shared_ptr <service> create - (shared_ptr <session> sess, + (const shared_ptr <session>& sess, const utility::url& u, - shared_ptr <security::authenticator> auth = null); + const shared_ptr <security::authenticator>& auth = null); /** Return information about a registered protocol. * diff --git a/src/vmime/net/serviceInfos.cpp b/src/vmime/net/serviceInfos.cpp index c5d0124a..b3fa7d03 100644 --- a/src/vmime/net/serviceInfos.cpp +++ b/src/vmime/net/serviceInfos.cpp @@ -88,7 +88,7 @@ serviceInfos::~serviceInfos() } -bool serviceInfos::hasProperty(shared_ptr <session> s, const property& p) const +bool serviceInfos::hasProperty(const shared_ptr <session>& s, const property& p) const { return s->getProperties().hasProperty(getPropertyPrefix() + p.getName()); } diff --git a/src/vmime/net/serviceInfos.hpp b/src/vmime/net/serviceInfos.hpp index 5c3909b2..63261867 100644 --- a/src/vmime/net/serviceInfos.hpp +++ b/src/vmime/net/serviceInfos.hpp @@ -221,7 +221,7 @@ public: * @return value of the property */ template <typename TYPE> - const TYPE getPropertyValue(shared_ptr <session> s, const property& p) const + const TYPE getPropertyValue(const shared_ptr <session>& s, const property& p) const { if (p.getFlags() & property::FLAG_REQUIRED) return s->getProperties()[getPropertyPrefix() + p.getName()].template getValue <TYPE>(); @@ -237,7 +237,7 @@ public: * @param p property to test * @return true if the property is set, false otherwise */ - bool hasProperty(shared_ptr <session> s, const property& p) const; + bool hasProperty(const shared_ptr <session>& s, const property& p) const; }; diff --git a/src/vmime/net/serviceRegistration.inl b/src/vmime/net/serviceRegistration.inl index 2366fe01..5a897594 100644 --- a/src/vmime/net/serviceRegistration.inl +++ b/src/vmime/net/serviceRegistration.inl @@ -42,8 +42,8 @@ public: } shared_ptr <service> create - (shared_ptr <session> sess, - shared_ptr <security::authenticator> auth) const + (const shared_ptr <session>& sess, + const shared_ptr <security::authenticator>& auth) const { return make_shared <S>(sess, auth); } diff --git a/src/vmime/net/session.cpp b/src/vmime/net/session.cpp index 7e335899..9da2fc69 100644 --- a/src/vmime/net/session.cpp +++ b/src/vmime/net/session.cpp @@ -78,14 +78,14 @@ shared_ptr <session> session::create(const propertySet& props) } -shared_ptr <transport> session::getTransport(shared_ptr <security::authenticator> auth) +shared_ptr <transport> session::getTransport(const shared_ptr <security::authenticator>& auth) { return (getTransport(m_props["transport.protocol"], auth)); } shared_ptr <transport> session::getTransport - (const string& protocol, shared_ptr <security::authenticator> auth) + (const string& protocol, const shared_ptr <security::authenticator>& auth) { shared_ptr <session> sess(dynamicCast <session>(shared_from_this())); shared_ptr <service> sv = serviceFactory::getInstance()->create(sess, protocol, auth); @@ -98,7 +98,7 @@ shared_ptr <transport> session::getTransport shared_ptr <transport> session::getTransport - (const utility::url& url, shared_ptr <security::authenticator> auth) + (const utility::url& url, const shared_ptr <security::authenticator>& auth) { shared_ptr <session> sess(dynamicCast <session>(shared_from_this())); shared_ptr <service> sv = serviceFactory::getInstance()->create(sess, url, auth); @@ -110,14 +110,14 @@ shared_ptr <transport> session::getTransport } -shared_ptr <store> session::getStore(shared_ptr <security::authenticator> auth) +shared_ptr <store> session::getStore(const shared_ptr <security::authenticator>& auth) { return (getStore(m_props["store.protocol"], auth)); } shared_ptr <store> session::getStore - (const string& protocol, shared_ptr <security::authenticator> auth) + (const string& protocol, const shared_ptr <security::authenticator>& auth) { shared_ptr <session> sess(dynamicCast <session>(shared_from_this())); shared_ptr <service> sv = serviceFactory::getInstance()->create(sess, protocol, auth); @@ -130,7 +130,7 @@ shared_ptr <store> session::getStore shared_ptr <store> session::getStore - (const utility::url& url, shared_ptr <security::authenticator> auth) + (const utility::url& url, const shared_ptr <security::authenticator>& auth) { shared_ptr <session> sess(dynamicCast <session>(shared_from_this())); shared_ptr <service> sv = serviceFactory::getInstance()->create(sess, url, auth); @@ -156,7 +156,7 @@ propertySet& session::getProperties() #if VMIME_HAVE_TLS_SUPPORT -void session::setTLSProperties(shared_ptr <tls::TLSProperties> tlsProps) +void session::setTLSProperties(const shared_ptr <tls::TLSProperties>& tlsProps) { m_tlsProps = make_shared <tls::TLSProperties>(*tlsProps); } diff --git a/src/vmime/net/session.hpp b/src/vmime/net/session.hpp index 3165e1ce..75858ef2 100644 --- a/src/vmime/net/session.hpp +++ b/src/vmime/net/session.hpp @@ -85,7 +85,7 @@ public: * protocol or is not a transport protocol */ shared_ptr <transport> getTransport - (shared_ptr <security::authenticator> auth = null); + (const shared_ptr <security::authenticator>& auth = null); /** Return a transport service instance for the specified protocol. * @@ -98,7 +98,7 @@ public: */ shared_ptr <transport> getTransport (const string& protocol, - shared_ptr <security::authenticator> auth = null); + const shared_ptr <security::authenticator>& auth = null); /** Return a transport service instance for the specified URL. * @@ -111,7 +111,7 @@ public: */ shared_ptr <transport> getTransport (const utility::url& url, - shared_ptr <security::authenticator> auth = null); + const shared_ptr <security::authenticator>& auth = null); /** Return a transport service instance for the protocol specified * in the session properties. @@ -124,7 +124,7 @@ public: * @return a new store service, or NULL if no service is registered for this * protocol or is not a store protocol */ - shared_ptr <store> getStore(shared_ptr <security::authenticator> auth = null); + shared_ptr <store> getStore(const shared_ptr <security::authenticator>& auth = null); /** Return a store service instance for the specified protocol. * @@ -137,7 +137,7 @@ public: */ shared_ptr <store> getStore (const string& protocol, - shared_ptr <security::authenticator> auth = null); + const shared_ptr <security::authenticator>& auth = null); /** Return a store service instance for the specified URL. * @@ -150,7 +150,7 @@ public: */ shared_ptr <store> getStore (const utility::url& url, - shared_ptr <security::authenticator> auth = null); + const shared_ptr <security::authenticator>& auth = null); /** Properties for the session and for the services. */ @@ -166,7 +166,7 @@ public: * * @param tlsProps SSL/TLS properties */ - void setTLSProperties(shared_ptr <tls::TLSProperties> tlsProps); + void setTLSProperties(const shared_ptr <tls::TLSProperties>& tlsProps); /** Get properties for SSL/TLS secured connections in this session. * diff --git a/src/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.cpp b/src/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.cpp index f6ecc54d..d1d58e4c 100644 --- a/src/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.cpp +++ b/src/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.cpp @@ -41,7 +41,7 @@ namespace smtp { SMTPChunkingOutputStreamAdapter::SMTPChunkingOutputStreamAdapter - (shared_ptr <SMTPConnection> conn, const size_t size, utility::progressListener* progress) + (const shared_ptr <SMTPConnection>& conn, const size_t size, utility::progressListener* progress) : m_connection(conn), m_bufferSize(0), m_chunkCount(0), m_totalSize(size), m_totalSent(0), m_progress(progress) { diff --git a/src/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.hpp b/src/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.hpp index 56d72fb1..7bda1e73 100644 --- a/src/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.hpp +++ b/src/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.hpp @@ -49,7 +49,7 @@ class VMIME_EXPORT SMTPChunkingOutputStreamAdapter : public utility::outputStrea { public: - SMTPChunkingOutputStreamAdapter(shared_ptr <SMTPConnection> conn, + SMTPChunkingOutputStreamAdapter(const shared_ptr <SMTPConnection>& conn, const size_t size, utility::progressListener* progress); void flush(); diff --git a/src/vmime/net/smtp/SMTPCommand.cpp b/src/vmime/net/smtp/SMTPCommand.cpp index 27c8ec1b..acf59830 100644 --- a/src/vmime/net/smtp/SMTPCommand.cpp +++ b/src/vmime/net/smtp/SMTPCommand.cpp @@ -221,7 +221,7 @@ const string SMTPCommand::getTraceText() const } -void SMTPCommand::writeToSocket(shared_ptr <socket> sok, shared_ptr <tracer> tr) +void SMTPCommand::writeToSocket(const shared_ptr <socket>& sok, shared_ptr <tracer> tr) { sok->send(m_text + "\r\n"); diff --git a/src/vmime/net/smtp/SMTPCommand.hpp b/src/vmime/net/smtp/SMTPCommand.hpp index 7c00d156..bb52dbc4 100644 --- a/src/vmime/net/smtp/SMTPCommand.hpp +++ b/src/vmime/net/smtp/SMTPCommand.hpp @@ -84,7 +84,7 @@ public: * @param sok socket to which the command will be written * @param tr tracer */ - virtual void writeToSocket(shared_ptr <socket> sok, shared_ptr <tracer> tr); + virtual void writeToSocket(const shared_ptr <socket>& sok, shared_ptr <tracer> tr); /** Returns the full text of the command, including command name * and parameters (if any). diff --git a/src/vmime/net/smtp/SMTPCommandSet.cpp b/src/vmime/net/smtp/SMTPCommandSet.cpp index 85f58fed..425b3535 100644 --- a/src/vmime/net/smtp/SMTPCommandSet.cpp +++ b/src/vmime/net/smtp/SMTPCommandSet.cpp @@ -55,7 +55,7 @@ shared_ptr <SMTPCommandSet> SMTPCommandSet::create(const bool pipeline) } -void SMTPCommandSet::addCommand(shared_ptr <SMTPCommand> cmd) +void SMTPCommandSet::addCommand(const shared_ptr <SMTPCommand>& cmd) { if (m_started) { @@ -67,7 +67,7 @@ void SMTPCommandSet::addCommand(shared_ptr <SMTPCommand> cmd) } -void SMTPCommandSet::writeToSocket(shared_ptr <socket> sok, shared_ptr <tracer> tr) +void SMTPCommandSet::writeToSocket(const shared_ptr <socket>& sok, const shared_ptr <tracer>& tr) { if (m_pipeline) { diff --git a/src/vmime/net/smtp/SMTPCommandSet.hpp b/src/vmime/net/smtp/SMTPCommandSet.hpp index 83c7fe46..af69366e 100644 --- a/src/vmime/net/smtp/SMTPCommandSet.hpp +++ b/src/vmime/net/smtp/SMTPCommandSet.hpp @@ -61,7 +61,7 @@ public: * * @param cmd command to add */ - void addCommand(shared_ptr <SMTPCommand> cmd); + void addCommand(const shared_ptr <SMTPCommand>& cmd); /** Tests whether all commands have been sent. * @@ -78,7 +78,7 @@ public: shared_ptr <SMTPCommand> getLastCommandSent() const; - void writeToSocket(shared_ptr <socket> sok, shared_ptr <tracer> tr); + void writeToSocket(const shared_ptr <socket>& sok, const shared_ptr <tracer>& tr); const string getText() const; const string getTraceText() const; diff --git a/src/vmime/net/smtp/SMTPConnection.cpp b/src/vmime/net/smtp/SMTPConnection.cpp index 8709efe4..cad107cb 100644 --- a/src/vmime/net/smtp/SMTPConnection.cpp +++ b/src/vmime/net/smtp/SMTPConnection.cpp @@ -67,7 +67,7 @@ namespace smtp { -SMTPConnection::SMTPConnection(shared_ptr <SMTPTransport> transport, shared_ptr <security::authenticator> auth) +SMTPConnection::SMTPConnection(const shared_ptr <SMTPTransport>& transport, const shared_ptr <security::authenticator>& auth) : m_transport(transport), m_auth(auth), m_socket(null), m_timeoutHandler(null), m_authenticated(false), m_secured(false), m_extendedSMTP(false) { @@ -605,7 +605,7 @@ void SMTPConnection::internalDisconnect() } -void SMTPConnection::sendRequest(shared_ptr <SMTPCommand> cmd) +void SMTPConnection::sendRequest(const shared_ptr <SMTPCommand>& cmd) { cmd->writeToSocket(m_socket, m_tracer); } diff --git a/src/vmime/net/smtp/SMTPConnection.hpp b/src/vmime/net/smtp/SMTPConnection.hpp index c7614920..50f5daf2 100644 --- a/src/vmime/net/smtp/SMTPConnection.hpp +++ b/src/vmime/net/smtp/SMTPConnection.hpp @@ -65,7 +65,7 @@ class VMIME_EXPORT SMTPConnection : public object { public: - SMTPConnection(shared_ptr <SMTPTransport> transport, shared_ptr <security::authenticator> auth); + SMTPConnection(const shared_ptr <SMTPTransport>& transport, const shared_ptr <security::authenticator>& auth); virtual ~SMTPConnection(); @@ -83,7 +83,7 @@ public: virtual shared_ptr <session> getSession(); virtual shared_ptr <tracer> getTracer(); - void sendRequest(shared_ptr <SMTPCommand> cmd); + void sendRequest(const shared_ptr <SMTPCommand>& cmd); shared_ptr <SMTPResponse> readResponse(); bool hasExtension(const std::string& extName, std::vector <string>* params = NULL) const; diff --git a/src/vmime/net/smtp/SMTPResponse.cpp b/src/vmime/net/smtp/SMTPResponse.cpp index b4b2c542..d1c25cf8 100644 --- a/src/vmime/net/smtp/SMTPResponse.cpp +++ b/src/vmime/net/smtp/SMTPResponse.cpp @@ -45,8 +45,8 @@ namespace smtp { SMTPResponse::SMTPResponse - (shared_ptr <tracer> tr, shared_ptr <socket> sok, - shared_ptr <timeoutHandler> toh, const state& st) + (const shared_ptr <tracer>& tr, const shared_ptr <socket>& sok, + const shared_ptr <timeoutHandler>& toh, const state& st) : m_socket(sok), m_timeoutHandler(toh), m_tracer(tr), m_responseBuffer(st.responseBuffer), m_responseContinues(false) { @@ -98,8 +98,8 @@ const string SMTPResponse::getText() const // static shared_ptr <SMTPResponse> SMTPResponse::readResponse - (shared_ptr <tracer> tr, shared_ptr <socket> sok, - shared_ptr <timeoutHandler> toh, const state& st) + (const shared_ptr <tracer>& tr, const shared_ptr <socket>& sok, + const shared_ptr <timeoutHandler>& toh, const state& st) { shared_ptr <SMTPResponse> resp = shared_ptr <SMTPResponse>(new SMTPResponse(tr, sok, toh, st)); diff --git a/src/vmime/net/smtp/SMTPResponse.hpp b/src/vmime/net/smtp/SMTPResponse.hpp index 4d88b6b5..fa19a1db 100644 --- a/src/vmime/net/smtp/SMTPResponse.hpp +++ b/src/vmime/net/smtp/SMTPResponse.hpp @@ -105,8 +105,8 @@ public: * has been received within the granted time */ static shared_ptr <SMTPResponse> readResponse - (shared_ptr <tracer> tr, shared_ptr <socket> sok, - shared_ptr <timeoutHandler> toh, const state& st); + (const shared_ptr <tracer>& tr, const shared_ptr <socket>& sok, + const shared_ptr <timeoutHandler>& toh, const state& st); /** Return the SMTP response code. * @@ -154,7 +154,7 @@ public: private: - SMTPResponse(shared_ptr <tracer> tr, shared_ptr <socket> sok, shared_ptr <timeoutHandler> toh, const state& st); + SMTPResponse(const shared_ptr <tracer>& tr, const shared_ptr <socket>& sok, const shared_ptr <timeoutHandler>& toh, const state& st); SMTPResponse(const SMTPResponse&); void readResponse(); diff --git a/src/vmime/net/smtp/SMTPSTransport.cpp b/src/vmime/net/smtp/SMTPSTransport.cpp index ab64d49d..1a8a0804 100644 --- a/src/vmime/net/smtp/SMTPSTransport.cpp +++ b/src/vmime/net/smtp/SMTPSTransport.cpp @@ -35,7 +35,7 @@ namespace net { namespace smtp { -SMTPSTransport::SMTPSTransport(shared_ptr <session> sess, shared_ptr <security::authenticator> auth) +SMTPSTransport::SMTPSTransport(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth) : SMTPTransport(sess, auth, true) { } diff --git a/src/vmime/net/smtp/SMTPSTransport.hpp b/src/vmime/net/smtp/SMTPSTransport.hpp index 7782f711..52dce1f2 100644 --- a/src/vmime/net/smtp/SMTPSTransport.hpp +++ b/src/vmime/net/smtp/SMTPSTransport.hpp @@ -46,7 +46,7 @@ class VMIME_EXPORT SMTPSTransport : public SMTPTransport { public: - SMTPSTransport(shared_ptr <session> sess, shared_ptr <security::authenticator> auth); + SMTPSTransport(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth); ~SMTPSTransport(); const string getProtocolName() const; diff --git a/src/vmime/net/smtp/SMTPTransport.cpp b/src/vmime/net/smtp/SMTPTransport.cpp index 25eb72a7..27afcf6f 100644 --- a/src/vmime/net/smtp/SMTPTransport.cpp +++ b/src/vmime/net/smtp/SMTPTransport.cpp @@ -51,7 +51,7 @@ namespace net { namespace smtp { -SMTPTransport::SMTPTransport(shared_ptr <session> sess, shared_ptr <security::authenticator> auth, const bool secured) +SMTPTransport::SMTPTransport(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth, const bool secured) : transport(sess, getInfosInstance(), auth), m_isSMTPS(secured), m_needReset(false) { } @@ -377,7 +377,7 @@ void SMTPTransport::send void SMTPTransport::send - (shared_ptr <vmime::message> msg, const mailbox& expeditor, const mailboxList& recipients, + (const shared_ptr <vmime::message>& msg, const mailbox& expeditor, const mailboxList& recipients, utility::progressListener* progress, const mailbox& sender) { if (!isConnected()) diff --git a/src/vmime/net/smtp/SMTPTransport.hpp b/src/vmime/net/smtp/SMTPTransport.hpp index 7b266d3d..a5f15ca6 100644 --- a/src/vmime/net/smtp/SMTPTransport.hpp +++ b/src/vmime/net/smtp/SMTPTransport.hpp @@ -54,7 +54,7 @@ class VMIME_EXPORT SMTPTransport : public transport { public: - SMTPTransport(shared_ptr <session> sess, shared_ptr <security::authenticator> auth, const bool secured = false); + SMTPTransport(const shared_ptr <session>& sess, const shared_ptr <security::authenticator>& auth, const bool secured = false); ~SMTPTransport(); const string getProtocolName() const; @@ -77,7 +77,7 @@ public: const mailbox& sender = mailbox()); void send - (shared_ptr <vmime::message> msg, + (const shared_ptr <vmime::message>& msg, const mailbox& expeditor, const mailboxList& recipients, utility::progressListener* progress = NULL, diff --git a/src/vmime/net/socket.hpp b/src/vmime/net/socket.hpp index 2de83dd1..4de45ca9 100644 --- a/src/vmime/net/socket.hpp +++ b/src/vmime/net/socket.hpp @@ -175,7 +175,7 @@ public: * * @param tracer tracer to use */ - virtual void setTracer(shared_ptr <tracer> tracer) = 0; + virtual void setTracer(const shared_ptr <tracer>& tracer) = 0; /** Return the tracer used by this socket. * @@ -213,7 +213,7 @@ public: * @param th timeout handler * @return a new socket */ - virtual shared_ptr <socket> create(shared_ptr <timeoutHandler> th) = 0; + virtual shared_ptr <socket> create(const shared_ptr <timeoutHandler>& th) = 0; }; diff --git a/src/vmime/net/store.hpp b/src/vmime/net/store.hpp index 37dcadbc..dfeb9a53 100644 --- a/src/vmime/net/store.hpp +++ b/src/vmime/net/store.hpp @@ -47,7 +47,7 @@ class VMIME_EXPORT store : public service { protected: - store(shared_ptr <session> sess, const serviceInfos& infos, shared_ptr <security::authenticator> auth) + store(const shared_ptr <session>& sess, const serviceInfos& infos, const shared_ptr <security::authenticator>& auth) : service(sess, infos, auth) { } public: diff --git a/src/vmime/net/tls/TLSSecuredConnectionInfos.cpp b/src/vmime/net/tls/TLSSecuredConnectionInfos.cpp index 4856e9af..45b9527e 100644 --- a/src/vmime/net/tls/TLSSecuredConnectionInfos.cpp +++ b/src/vmime/net/tls/TLSSecuredConnectionInfos.cpp @@ -38,7 +38,7 @@ namespace tls { TLSSecuredConnectionInfos::TLSSecuredConnectionInfos (const string& host, const port_t port, - shared_ptr <TLSSession> tlsSession, shared_ptr <TLSSocket> tlsSocket) + const shared_ptr <TLSSession>& tlsSession, const shared_ptr <TLSSocket>& tlsSocket) : m_host(host), m_port(port), m_tlsSession(tlsSession), m_tlsSocket(tlsSocket) { diff --git a/src/vmime/net/tls/TLSSecuredConnectionInfos.hpp b/src/vmime/net/tls/TLSSecuredConnectionInfos.hpp index e552d6f9..19e7a064 100644 --- a/src/vmime/net/tls/TLSSecuredConnectionInfos.hpp +++ b/src/vmime/net/tls/TLSSecuredConnectionInfos.hpp @@ -52,7 +52,7 @@ class VMIME_EXPORT TLSSecuredConnectionInfos : public securedConnectionInfos public: TLSSecuredConnectionInfos(const string& host, const port_t port, - shared_ptr <TLSSession> tlsSession, shared_ptr <TLSSocket> tlsSocket); + const shared_ptr <TLSSession>& tlsSession, const shared_ptr <TLSSocket>& tlsSocket); const string getHost() const; port_t getPort() const; diff --git a/src/vmime/net/tls/TLSSession.hpp b/src/vmime/net/tls/TLSSession.hpp index 8951ffa4..83a1623c 100644 --- a/src/vmime/net/tls/TLSSession.hpp +++ b/src/vmime/net/tls/TLSSession.hpp @@ -57,7 +57,7 @@ public: * @param props TLS properties for this session * @return a new TLS session */ - static shared_ptr <TLSSession> create(shared_ptr <security::cert::certificateVerifier> cv, shared_ptr <TLSProperties> props); + static shared_ptr <TLSSession> create(const shared_ptr <security::cert::certificateVerifier>& cv, const shared_ptr <TLSProperties>& props); /** Create a new socket that adds a TLS security layer around * an existing socket. You should create only one socket @@ -66,7 +66,7 @@ public: * @param sok socket to wrap * @return TLS socket wrapper */ - virtual shared_ptr <TLSSocket> getSocket(shared_ptr <socket> sok) = 0; + virtual shared_ptr <TLSSocket> getSocket(const shared_ptr <socket>& sok) = 0; /** Get the object responsible for verifying certificates when * using secured connections (TLS/SSL). diff --git a/src/vmime/net/tls/TLSSocket.hpp b/src/vmime/net/tls/TLSSocket.hpp index be27d1d0..75b80116 100644 --- a/src/vmime/net/tls/TLSSocket.hpp +++ b/src/vmime/net/tls/TLSSocket.hpp @@ -59,7 +59,7 @@ public: * @param session TLS session * @param sok socket to wrap */ - static shared_ptr <TLSSocket> wrap(shared_ptr <TLSSession> session, shared_ptr <socket> sok); + static shared_ptr <TLSSocket> wrap(const shared_ptr <TLSSession>& session, const shared_ptr <socket>& sok); /** Starts a TLS handshake on this connection. * diff --git a/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.cpp b/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.cpp index 2a6450eb..dccfb5ec 100644 --- a/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.cpp +++ b/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.cpp @@ -134,13 +134,13 @@ static TLSGlobal g_gnutlsGlobal; // static -shared_ptr <TLSSession> TLSSession::create(shared_ptr <security::cert::certificateVerifier> cv, shared_ptr <TLSProperties> props) +shared_ptr <TLSSession> TLSSession::create(const shared_ptr <security::cert::certificateVerifier>& cv, const shared_ptr <TLSProperties>& props) { return make_shared <TLSSession_GnuTLS>(cv, props); } -TLSSession_GnuTLS::TLSSession_GnuTLS(shared_ptr <security::cert::certificateVerifier> cv, shared_ptr <TLSProperties> props) +TLSSession_GnuTLS::TLSSession_GnuTLS(const shared_ptr <security::cert::certificateVerifier>& cv, const shared_ptr <TLSProperties>& props) : m_certVerifier(cv), m_props(props) { int res; @@ -274,7 +274,7 @@ TLSSession_GnuTLS::~TLSSession_GnuTLS() } -shared_ptr <TLSSocket> TLSSession_GnuTLS::getSocket(shared_ptr <socket> sok) +shared_ptr <TLSSocket> TLSSession_GnuTLS::getSocket(const shared_ptr <socket>& sok) { return TLSSocket::wrap(dynamicCast <TLSSession>(shared_from_this()), sok); } diff --git a/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.hpp b/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.hpp index 14172ee0..dd096ff3 100644 --- a/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.hpp +++ b/src/vmime/net/tls/gnutls/TLSSession_GnuTLS.hpp @@ -52,11 +52,11 @@ class TLSSession_GnuTLS : public TLSSession public: - TLSSession_GnuTLS(shared_ptr <security::cert::certificateVerifier> cv, shared_ptr <TLSProperties> props); + TLSSession_GnuTLS(const shared_ptr <security::cert::certificateVerifier>& cv, const shared_ptr <TLSProperties>& props); ~TLSSession_GnuTLS(); - shared_ptr <TLSSocket> getSocket(shared_ptr <socket> sok); + shared_ptr <TLSSocket> getSocket(const shared_ptr <socket>& sok); shared_ptr <security::cert::certificateVerifier> getCertificateVerifier(); diff --git a/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp b/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp index 16dabb66..31753590 100644 --- a/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp +++ b/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp @@ -50,14 +50,14 @@ namespace tls { // static -shared_ptr <TLSSocket> TLSSocket::wrap(shared_ptr <TLSSession> session, shared_ptr <socket> sok) +shared_ptr <TLSSocket> TLSSocket::wrap(const shared_ptr <TLSSession>& session, const shared_ptr <socket>& sok) { return make_shared <TLSSocket_GnuTLS> (dynamicCast <TLSSession_GnuTLS>(session), sok); } -TLSSocket_GnuTLS::TLSSocket_GnuTLS(shared_ptr <TLSSession_GnuTLS> session, shared_ptr <socket> sok) +TLSSocket_GnuTLS::TLSSocket_GnuTLS(const shared_ptr <TLSSession_GnuTLS>& session, const shared_ptr <socket>& sok) : m_session(session), m_wrapped(sok), m_connected(false), m_ex(NULL), m_status(0), m_errno(0) { @@ -143,7 +143,7 @@ shared_ptr <timeoutHandler> TLSSocket_GnuTLS::getTimeoutHandler() } -void TLSSocket_GnuTLS::setTracer(shared_ptr <net::tracer> tracer) +void TLSSocket_GnuTLS::setTracer(const shared_ptr <net::tracer>& tracer) { m_wrapped->setTracer(tracer); } diff --git a/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp b/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp index 931cb993..a1d78e99 100644 --- a/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp +++ b/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp @@ -50,7 +50,7 @@ class TLSSocket_GnuTLS : public TLSSocket { public: - TLSSocket_GnuTLS(shared_ptr <TLSSession_GnuTLS> session, shared_ptr <socket> sok); + TLSSocket_GnuTLS(const shared_ptr <TLSSession_GnuTLS>& session, const shared_ptr <socket>& sok); ~TLSSocket_GnuTLS(); @@ -83,7 +83,7 @@ public: shared_ptr <timeoutHandler> getTimeoutHandler(); - void setTracer(shared_ptr <net::tracer> tracer); + void setTracer(const shared_ptr <net::tracer>& tracer); shared_ptr <net::tracer> getTracer(); private: diff --git a/src/vmime/net/tls/openssl/TLSSession_OpenSSL.cpp b/src/vmime/net/tls/openssl/TLSSession_OpenSSL.cpp index 7892de65..961f6517 100644 --- a/src/vmime/net/tls/openssl/TLSSession_OpenSSL.cpp +++ b/src/vmime/net/tls/openssl/TLSSession_OpenSSL.cpp @@ -46,13 +46,13 @@ static OpenSSLInitializer::autoInitializer openSSLInitializer; // static -shared_ptr <TLSSession> TLSSession::create(shared_ptr <security::cert::certificateVerifier> cv, shared_ptr <TLSProperties> props) +shared_ptr <TLSSession> TLSSession::create(const shared_ptr <security::cert::certificateVerifier>& cv, const shared_ptr <TLSProperties>& props) { return make_shared <TLSSession_OpenSSL>(cv, props); } -TLSSession_OpenSSL::TLSSession_OpenSSL(shared_ptr <vmime::security::cert::certificateVerifier> cv, shared_ptr <TLSProperties> props) +TLSSession_OpenSSL::TLSSession_OpenSSL(const shared_ptr <vmime::security::cert::certificateVerifier>& cv, const shared_ptr <TLSProperties>& props) : m_sslctx(0), m_certVerifier(cv), m_props(props) { m_sslctx = SSL_CTX_new(SSLv23_client_method()); @@ -76,7 +76,7 @@ TLSSession_OpenSSL::~TLSSession_OpenSSL() } -shared_ptr <TLSSocket> TLSSession_OpenSSL::getSocket(shared_ptr <socket> sok) +shared_ptr <TLSSocket> TLSSession_OpenSSL::getSocket(const shared_ptr <socket>& sok) { return TLSSocket::wrap(dynamicCast <TLSSession>(shared_from_this()), sok); } diff --git a/src/vmime/net/tls/openssl/TLSSession_OpenSSL.hpp b/src/vmime/net/tls/openssl/TLSSession_OpenSSL.hpp index 5a2b60a8..c5c5da39 100644 --- a/src/vmime/net/tls/openssl/TLSSession_OpenSSL.hpp +++ b/src/vmime/net/tls/openssl/TLSSession_OpenSSL.hpp @@ -55,11 +55,11 @@ class TLSSession_OpenSSL : public TLSSession public: - TLSSession_OpenSSL(const shared_ptr <security::cert::certificateVerifier> cv, shared_ptr <TLSProperties> props); + TLSSession_OpenSSL(const shared_ptr <security::cert::certificateVerifier>& cv, const shared_ptr <TLSProperties>& props); ~TLSSession_OpenSSL(); - shared_ptr <TLSSocket> getSocket(shared_ptr <socket> sok); + shared_ptr <TLSSocket> getSocket(const shared_ptr <socket>& sok); shared_ptr <security::cert::certificateVerifier> getCertificateVerifier(); diff --git a/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.cpp b/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.cpp index 827dcf1b..afc7e514 100644 --- a/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.cpp +++ b/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.cpp @@ -87,14 +87,14 @@ BIO_METHOD TLSSocket_OpenSSL::sm_customBIOMethod = // static -shared_ptr <TLSSocket> TLSSocket::wrap(shared_ptr <TLSSession> session, shared_ptr <socket> sok) +shared_ptr <TLSSocket> TLSSocket::wrap(const shared_ptr <TLSSession>& session, const shared_ptr <socket>& sok) { return make_shared <TLSSocket_OpenSSL> (dynamicCast <TLSSession_OpenSSL>(session), sok); } -TLSSocket_OpenSSL::TLSSocket_OpenSSL(shared_ptr <TLSSession_OpenSSL> session, shared_ptr <socket> sok) +TLSSocket_OpenSSL::TLSSocket_OpenSSL(const shared_ptr <TLSSession_OpenSSL>& session, const shared_ptr <socket>& sok) : m_session(session), m_wrapped(sok), m_connected(false), m_ssl(0), m_status(0), m_ex() { } @@ -242,7 +242,7 @@ shared_ptr <timeoutHandler> TLSSocket_OpenSSL::getTimeoutHandler() } -void TLSSocket_OpenSSL::setTracer(shared_ptr <net::tracer> tracer) +void TLSSocket_OpenSSL::setTracer(const shared_ptr <net::tracer>& tracer) { m_wrapped->setTracer(tracer); } diff --git a/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.hpp b/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.hpp index 34324b8c..9f395051 100644 --- a/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.hpp +++ b/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.hpp @@ -54,7 +54,7 @@ class TLSSocket_OpenSSL : public TLSSocket { public: - TLSSocket_OpenSSL(shared_ptr <TLSSession_OpenSSL> session, shared_ptr <socket> sok); + TLSSocket_OpenSSL(const shared_ptr <TLSSession_OpenSSL>& session, const shared_ptr <socket>& sok); ~TLSSocket_OpenSSL(); @@ -87,7 +87,7 @@ public: shared_ptr <timeoutHandler> getTimeoutHandler(); - void setTracer(shared_ptr <net::tracer> tracer); + void setTracer(const shared_ptr <net::tracer>& tracer); shared_ptr <net::tracer> getTracer(); private: diff --git a/src/vmime/net/tracer.hpp b/src/vmime/net/tracer.hpp index e30c823c..853455a3 100644 --- a/src/vmime/net/tracer.hpp +++ b/src/vmime/net/tracer.hpp @@ -96,7 +96,7 @@ public: * different connections used by a service * @return a new tracer */ - virtual shared_ptr <tracer> create(shared_ptr <service> serv, const int connectionId) = 0; + virtual shared_ptr <tracer> create(const shared_ptr <service>& serv, const int connectionId) = 0; }; diff --git a/src/vmime/net/transport.cpp b/src/vmime/net/transport.cpp index dd7281d0..1b69995c 100644 --- a/src/vmime/net/transport.cpp +++ b/src/vmime/net/transport.cpp @@ -43,13 +43,13 @@ namespace vmime { namespace net { -transport::transport(shared_ptr <session> sess, const serviceInfos& infos, shared_ptr <security::authenticator> auth) +transport::transport(const shared_ptr <session>& sess, const serviceInfos& infos, const shared_ptr <security::authenticator>& auth) : service(sess, infos, auth) { } -shared_ptr <headerField> transport::processHeaderField(shared_ptr <headerField> field) +shared_ptr <headerField> transport::processHeaderField(const shared_ptr <headerField>& field) { if (utility::stringUtils::isStringEqualNoCase(field->getName(), fields::BCC)) { @@ -77,7 +77,7 @@ shared_ptr <headerField> transport::processHeaderField(shared_ptr <headerField> } -void transport::processHeader(shared_ptr <header> header) +void transport::processHeader(const shared_ptr <header>& header) { if (header->getFieldCount() == 0) return; @@ -122,7 +122,7 @@ static void extractMailboxes } -void transport::send(shared_ptr <vmime::message> msg, utility::progressListener* progress) +void transport::send(const shared_ptr <vmime::message>& msg, utility::progressListener* progress) { // Extract expeditor shared_ptr <mailbox> fromMbox = @@ -179,8 +179,8 @@ void transport::send(shared_ptr <vmime::message> msg, utility::progressListener* // Revert it back to original header after. struct XChangeMsgHeader { - XChangeMsgHeader(shared_ptr <vmime::message> _msg, - shared_ptr <vmime::header> _hdr) + XChangeMsgHeader(const shared_ptr <vmime::message>& _msg, + const shared_ptr <vmime::header>& _hdr) : msg(_msg), hdr(msg->getHeader()) { // Set new header @@ -204,7 +204,7 @@ void transport::send(shared_ptr <vmime::message> msg, utility::progressListener* void transport::send - (shared_ptr <vmime::message> msg, const mailbox& expeditor, const mailboxList& recipients, + (const shared_ptr <vmime::message>& msg, const mailbox& expeditor, const mailboxList& recipients, utility::progressListener* progress, const mailbox& sender) { // Generate the message, "stream" it and delegate the sending diff --git a/src/vmime/net/transport.hpp b/src/vmime/net/transport.hpp index 6c405cbb..a54f041e 100644 --- a/src/vmime/net/transport.hpp +++ b/src/vmime/net/transport.hpp @@ -56,7 +56,7 @@ class VMIME_EXPORT transport : public service { protected: - transport(shared_ptr <session> sess, const serviceInfos& infos, shared_ptr <security::authenticator> auth); + transport(const shared_ptr <session>& sess, const serviceInfos& infos, const shared_ptr <security::authenticator>& auth); public: @@ -67,7 +67,7 @@ public: * @param msg message to send * @param progress progress listener, or NULL if not used */ - virtual void send(shared_ptr <vmime::message> msg, utility::progressListener* progress = NULL); + virtual void send(const shared_ptr <vmime::message>& msg, utility::progressListener* progress = NULL); /** Send a message over this transport service. * @@ -97,7 +97,7 @@ public: * @param sender envelope sender (if empty, expeditor will be used) */ virtual void send - (shared_ptr <vmime::message> msg, + (const shared_ptr <vmime::message>& msg, const mailbox& expeditor, const mailboxList& recipients, utility::progressListener* progress = NULL, @@ -115,7 +115,7 @@ protected: * if the field is to be replaced, or a reference to the same headerField * that was passed if the field should be left as is */ - shared_ptr <headerField> processHeaderField(shared_ptr <headerField> field); + shared_ptr <headerField> processHeaderField(const shared_ptr <headerField>& field); /** Prepares the header before transmitting the message. * Removes headers that should not be present (eg. "Bcc", "Return-Path"), @@ -124,7 +124,7 @@ protected: * * @param header headers to process */ - void processHeader(shared_ptr <header> header); + void processHeader(const shared_ptr <header>& header); }; diff --git a/src/vmime/parameterizedHeaderField.cpp b/src/vmime/parameterizedHeaderField.cpp index c299ff65..0d90692b 100644 --- a/src/vmime/parameterizedHeaderField.cpp +++ b/src/vmime/parameterizedHeaderField.cpp @@ -457,13 +457,13 @@ shared_ptr <parameter> parameterizedHeaderField::getParameter(const string& para } -void parameterizedHeaderField::appendParameter(shared_ptr <parameter> param) +void parameterizedHeaderField::appendParameter(const shared_ptr <parameter>& param) { m_params.push_back(param); } -void parameterizedHeaderField::insertParameterBefore(shared_ptr <parameter> beforeParam, shared_ptr <parameter> param) +void parameterizedHeaderField::insertParameterBefore(const shared_ptr <parameter>& beforeParam, const shared_ptr <parameter>& param) { const std::vector <shared_ptr <parameter> >::iterator it = std::find (m_params.begin(), m_params.end(), beforeParam); @@ -475,7 +475,7 @@ void parameterizedHeaderField::insertParameterBefore(shared_ptr <parameter> befo } -void parameterizedHeaderField::insertParameterBefore(const size_t pos, shared_ptr <parameter> param) +void parameterizedHeaderField::insertParameterBefore(const size_t pos, const shared_ptr <parameter>& param) { if (pos >= m_params.size()) throw std::out_of_range("Invalid position"); @@ -484,7 +484,7 @@ void parameterizedHeaderField::insertParameterBefore(const size_t pos, shared_pt } -void parameterizedHeaderField::insertParameterAfter(shared_ptr <parameter> afterParam, shared_ptr <parameter> param) +void parameterizedHeaderField::insertParameterAfter(const shared_ptr <parameter>& afterParam, const shared_ptr <parameter>& param) { const std::vector <shared_ptr <parameter> >::iterator it = std::find (m_params.begin(), m_params.end(), afterParam); @@ -496,7 +496,7 @@ void parameterizedHeaderField::insertParameterAfter(shared_ptr <parameter> after } -void parameterizedHeaderField::insertParameterAfter(const size_t pos, shared_ptr <parameter> param) +void parameterizedHeaderField::insertParameterAfter(const size_t pos, const shared_ptr <parameter>& param) { if (pos >= m_params.size()) throw std::out_of_range("Invalid position"); @@ -505,7 +505,7 @@ void parameterizedHeaderField::insertParameterAfter(const size_t pos, shared_ptr } -void parameterizedHeaderField::removeParameter(shared_ptr <parameter> param) +void parameterizedHeaderField::removeParameter(const shared_ptr <parameter>& param) { const std::vector <shared_ptr <parameter> >::iterator it = std::find (m_params.begin(), m_params.end(), param); diff --git a/src/vmime/parameterizedHeaderField.hpp b/src/vmime/parameterizedHeaderField.hpp index 47c53562..113df16d 100644 --- a/src/vmime/parameterizedHeaderField.hpp +++ b/src/vmime/parameterizedHeaderField.hpp @@ -89,7 +89,7 @@ public: * * @param param parameter to append */ - void appendParameter(shared_ptr <parameter> param); + void appendParameter(const shared_ptr <parameter>& param); /** Insert a new parameter before the specified parameter. * @@ -97,7 +97,7 @@ public: * @param param parameter to insert * @throw std::out_of_range if the parameter is not in the list */ - void insertParameterBefore(shared_ptr <parameter> beforeParam, shared_ptr <parameter> param); + void insertParameterBefore(const shared_ptr <parameter>& beforeParam, const shared_ptr <parameter>& param); /** Insert a new parameter before the specified position. * @@ -106,7 +106,7 @@ public: * @param param parameter to insert * @throw std::out_of_range if the position is out of range */ - void insertParameterBefore(const size_t pos, shared_ptr <parameter> param); + void insertParameterBefore(const size_t pos, const shared_ptr <parameter>& param); /** Insert a new parameter after the specified parameter. * @@ -114,7 +114,7 @@ public: * @param param parameter to insert * @throw std::out_of_range if the parameter is not in the list */ - void insertParameterAfter(shared_ptr <parameter> afterParam, shared_ptr <parameter> param); + void insertParameterAfter(const shared_ptr <parameter>& afterParam, const shared_ptr <parameter>& param); /** Insert a new parameter after the specified position. * @@ -122,14 +122,14 @@ public: * @param param parameter to insert * @throw std::out_of_range if the position is out of range */ - void insertParameterAfter(const size_t pos, shared_ptr <parameter> param); + void insertParameterAfter(const size_t pos, const shared_ptr <parameter>& param); /** Remove the specified parameter from the list. * * @param param parameter to remove * @throw std::out_of_range if the parameter is not in the list */ - void removeParameter(shared_ptr <parameter> param); + void removeParameter(const shared_ptr <parameter>& param); /** Remove the parameter at the specified position. * diff --git a/src/vmime/parsedMessageAttachment.cpp b/src/vmime/parsedMessageAttachment.cpp index 242bfde0..efe4a5b2 100644 --- a/src/vmime/parsedMessageAttachment.cpp +++ b/src/vmime/parsedMessageAttachment.cpp @@ -33,7 +33,7 @@ namespace vmime { -parsedMessageAttachment::parsedMessageAttachment(shared_ptr <message> msg) +parsedMessageAttachment::parsedMessageAttachment(const shared_ptr <message>& msg) : m_msg(msg) { } @@ -97,7 +97,7 @@ shared_ptr <message> parsedMessageAttachment::getMessage() const } -void parsedMessageAttachment::generateIn(shared_ptr <bodyPart> parent) const +void parsedMessageAttachment::generateIn(const shared_ptr <bodyPart>& parent) const { // Create and append a new part for this attachment shared_ptr <bodyPart> part = make_shared <bodyPart>(); diff --git a/src/vmime/parsedMessageAttachment.hpp b/src/vmime/parsedMessageAttachment.hpp index 6c96f80a..330cf869 100644 --- a/src/vmime/parsedMessageAttachment.hpp +++ b/src/vmime/parsedMessageAttachment.hpp @@ -41,7 +41,7 @@ class VMIME_EXPORT parsedMessageAttachment : public messageAttachment { public: - parsedMessageAttachment(shared_ptr <message> msg); + parsedMessageAttachment(const shared_ptr <message>& msg); const mediaType getType() const; const text getDescription() const; @@ -59,7 +59,7 @@ public: protected: - void generateIn(shared_ptr <bodyPart> parent) const; + void generateIn(const shared_ptr <bodyPart>& parent) const; private: diff --git a/src/vmime/plainTextPart.cpp b/src/vmime/plainTextPart.cpp index 7a1542d7..a9a245f4 100644 --- a/src/vmime/plainTextPart.cpp +++ b/src/vmime/plainTextPart.cpp @@ -57,7 +57,7 @@ size_t plainTextPart::getPartCount() const } -void plainTextPart::generateIn(shared_ptr <bodyPart> /* message */, shared_ptr <bodyPart> parent) const +void plainTextPart::generateIn(const shared_ptr <bodyPart>& /* message */, const shared_ptr <bodyPart>& parent) const { // Create a new part shared_ptr <bodyPart> part = make_shared <bodyPart>(); @@ -70,8 +70,8 @@ void plainTextPart::generateIn(shared_ptr <bodyPart> /* message */, shared_ptr < } -void plainTextPart::parse(shared_ptr <const bodyPart> /* message */, - shared_ptr <const bodyPart> /* parent */, shared_ptr <const bodyPart> textPart) +void plainTextPart::parse(const shared_ptr <const bodyPart>& /* message */, + const shared_ptr <const bodyPart>& /* parent */, const shared_ptr <const bodyPart>& textPart) { m_text = vmime::clone(textPart->getBody()->getContents()); @@ -103,7 +103,7 @@ const shared_ptr <const contentHandler> plainTextPart::getText() const } -void plainTextPart::setText(shared_ptr <contentHandler> text) +void plainTextPart::setText(const shared_ptr <contentHandler>& text) { m_text = vmime::clone(text); } diff --git a/src/vmime/plainTextPart.hpp b/src/vmime/plainTextPart.hpp index 72a8a71c..8640dc48 100644 --- a/src/vmime/plainTextPart.hpp +++ b/src/vmime/plainTextPart.hpp @@ -48,12 +48,12 @@ public: void setCharset(const charset& ch); const shared_ptr <const contentHandler> getText() const; - void setText(shared_ptr <contentHandler> text); + void setText(const shared_ptr <contentHandler>& text); size_t getPartCount() const; - void generateIn(shared_ptr <bodyPart> message, shared_ptr <bodyPart> parent) const; - void parse(shared_ptr <const bodyPart> message, shared_ptr <const bodyPart> parent, shared_ptr <const bodyPart> textPart); + void generateIn(const shared_ptr <bodyPart>& message, const shared_ptr <bodyPart>& parent) const; + void parse(const shared_ptr <const bodyPart>& message, const shared_ptr <const bodyPart>& parent, const shared_ptr <const bodyPart>& textPart); private: diff --git a/src/vmime/platforms/posix/posixChildProcess.cpp b/src/vmime/platforms/posix/posixChildProcess.cpp index 275cacfd..c498b7ca 100644 --- a/src/vmime/platforms/posix/posixChildProcess.cpp +++ b/src/vmime/platforms/posix/posixChildProcess.cpp @@ -245,7 +245,7 @@ posixChildProcess::~posixChildProcess() // Original authors: Dan Winship <[email protected]> // Copyright 2000 Ximian, Inc. (www.ximian.com) -void posixChildProcess::start(const std::vector <string> args, const int flags) +void posixChildProcess::start(const std::vector <string>& args, const int flags) { if (m_started) return; diff --git a/src/vmime/platforms/posix/posixChildProcess.hpp b/src/vmime/platforms/posix/posixChildProcess.hpp index 5b9fa021..33f166f2 100644 --- a/src/vmime/platforms/posix/posixChildProcess.hpp +++ b/src/vmime/platforms/posix/posixChildProcess.hpp @@ -49,7 +49,7 @@ public: posixChildProcess(const utility::file::path& path); ~posixChildProcess(); - void start(const std::vector <string> args, const int flags = 0); + void start(const std::vector <string>& args, const int flags = 0); shared_ptr <utility::outputStream> getStdIn(); shared_ptr <utility::inputStream> getStdOut(); diff --git a/src/vmime/platforms/posix/posixSocket.cpp b/src/vmime/platforms/posix/posixSocket.cpp index 012e8842..e2bdd4b8 100644 --- a/src/vmime/platforms/posix/posixSocket.cpp +++ b/src/vmime/platforms/posix/posixSocket.cpp @@ -923,7 +923,7 @@ shared_ptr <net::timeoutHandler> posixSocket::getTimeoutHandler() } -void posixSocket::setTracer(shared_ptr <net::tracer> tracer) +void posixSocket::setTracer(const shared_ptr <net::tracer>& tracer) { m_tracer = tracer; } @@ -947,7 +947,7 @@ shared_ptr <vmime::net::socket> posixSocketFactory::create() } -shared_ptr <vmime::net::socket> posixSocketFactory::create(shared_ptr <vmime::net::timeoutHandler> th) +shared_ptr <vmime::net::socket> posixSocketFactory::create(const shared_ptr <vmime::net::timeoutHandler>& th) { return make_shared <posixSocket>(th); } diff --git a/src/vmime/platforms/posix/posixSocket.hpp b/src/vmime/platforms/posix/posixSocket.hpp index ebcb1a04..f253c17b 100644 --- a/src/vmime/platforms/posix/posixSocket.hpp +++ b/src/vmime/platforms/posix/posixSocket.hpp @@ -73,7 +73,7 @@ public: shared_ptr <net::timeoutHandler> getTimeoutHandler(); - void setTracer(shared_ptr <net::tracer> tracer); + void setTracer(const shared_ptr <net::tracer>& tracer); shared_ptr <net::tracer> getTracer(); protected: @@ -104,7 +104,7 @@ class posixSocketFactory : public vmime::net::socketFactory public: shared_ptr <vmime::net::socket> create(); - shared_ptr <vmime::net::socket> create(shared_ptr <vmime::net::timeoutHandler> th); + shared_ptr <vmime::net::socket> create(const shared_ptr <vmime::net::timeoutHandler>& th); }; diff --git a/src/vmime/platforms/windows/windowsSocket.cpp b/src/vmime/platforms/windows/windowsSocket.cpp index cb731443..2fadc36e 100644 --- a/src/vmime/platforms/windows/windowsSocket.cpp +++ b/src/vmime/platforms/windows/windowsSocket.cpp @@ -502,7 +502,7 @@ shared_ptr <net::timeoutHandler> windowsSocket::getTimeoutHandler() } -void windowsSocket::setTracer(shared_ptr <net::tracer> tracer) +void windowsSocket::setTracer(const shared_ptr <net::tracer>& tracer) { m_tracer = tracer; } @@ -525,7 +525,7 @@ shared_ptr <vmime::net::socket> windowsSocketFactory::create() return make_shared <windowsSocket>(th); } -shared_ptr <vmime::net::socket> windowsSocketFactory::create(shared_ptr <vmime::net::timeoutHandler> th) +shared_ptr <vmime::net::socket> windowsSocketFactory::create(const shared_ptr <vmime::net::timeoutHandler>& th) { return make_shared <windowsSocket>(th); } diff --git a/src/vmime/platforms/windows/windowsSocket.hpp b/src/vmime/platforms/windows/windowsSocket.hpp index f2d2f550..84fbdfc0 100644 --- a/src/vmime/platforms/windows/windowsSocket.hpp +++ b/src/vmime/platforms/windows/windowsSocket.hpp @@ -59,7 +59,7 @@ public: void receive(vmime::string& buffer); size_t receiveRaw(byte_t* buffer, const size_t count); - + void send(const vmime::string& buffer); void send(const char* str); void sendRaw(const byte_t* buffer, const size_t count); @@ -75,7 +75,7 @@ public: shared_ptr <net::timeoutHandler> getTimeoutHandler(); shared_ptr <net::tracer> m_tracer; - void setTracer(shared_ptr <net::tracer> tracer); + void setTracer(const shared_ptr <net::tracer>& tracer); shared_ptr <net::tracer> getTracer(); protected: @@ -103,7 +103,7 @@ class windowsSocketFactory : public vmime::net::socketFactory public: shared_ptr <vmime::net::socket> create(); - shared_ptr <vmime::net::socket> create(shared_ptr <vmime::net::timeoutHandler> th); + shared_ptr <vmime::net::socket> create(const shared_ptr <vmime::net::timeoutHandler>& th); }; diff --git a/src/vmime/propertySet.hpp b/src/vmime/propertySet.hpp index bf1c39bf..fb22b437 100644 --- a/src/vmime/propertySet.hpp +++ b/src/vmime/propertySet.hpp @@ -341,7 +341,7 @@ private: propFinder(const string& name) : m_name(utility::stringUtils::toLower(name)) { } - bool operator()(shared_ptr <property> p) const + bool operator()(const shared_ptr <property>& p) const { return (utility::stringUtils::toLower(p->getName()) == m_name); } diff --git a/src/vmime/security/authenticator.hpp b/src/vmime/security/authenticator.hpp index fc6bf5d5..c73229dd 100644 --- a/src/vmime/security/authenticator.hpp +++ b/src/vmime/security/authenticator.hpp @@ -123,7 +123,7 @@ public: * * @param serv messaging service instance */ - virtual void setService(shared_ptr <net::service> serv) = 0; + virtual void setService(const shared_ptr <net::service>& serv) = 0; }; diff --git a/src/vmime/security/cert/X509Certificate.hpp b/src/vmime/security/cert/X509Certificate.hpp index d816646b..3aca9dd6 100644 --- a/src/vmime/security/cert/X509Certificate.hpp +++ b/src/vmime/security/cert/X509Certificate.hpp @@ -114,14 +114,14 @@ public: * @return true if this certificate was issued by the given issuer, * false otherwise */ - virtual bool checkIssuer(shared_ptr <const X509Certificate> issuer) const = 0; + virtual bool checkIssuer(const shared_ptr <const X509Certificate>& issuer) const = 0; /** Verifies this certificate against a given trusted one. * * @param caCert a certificate that is considered to be trusted one * @return true if the verification succeeded, false otherwise */ - virtual bool verify(shared_ptr <const X509Certificate> caCert) const = 0; + virtual bool verify(const shared_ptr <const X509Certificate>& caCert) const = 0; /** Verify certificate's subject name against the given hostname. * diff --git a/src/vmime/security/cert/certificate.hpp b/src/vmime/security/cert/certificate.hpp index 58e0638a..9d17ad8b 100644 --- a/src/vmime/security/cert/certificate.hpp +++ b/src/vmime/security/cert/certificate.hpp @@ -64,7 +64,7 @@ public: * @return true if the two certificates are the same, * false otherwise */ - virtual bool equals(shared_ptr <const certificate> other) const = 0; + virtual bool equals(const shared_ptr <const certificate>& other) const = 0; /** Returns a pointer to internal binary data for this certificate. * The actual type of data depends on the library used for TLS support. diff --git a/src/vmime/security/cert/certificateChain.cpp b/src/vmime/security/cert/certificateChain.cpp index f1154768..1731f873 100644 --- a/src/vmime/security/cert/certificateChain.cpp +++ b/src/vmime/security/cert/certificateChain.cpp @@ -41,7 +41,7 @@ size_t certificateChain::getCount() const } -shared_ptr <certificate> certificateChain::getAt(const size_t index) +const shared_ptr <certificate>& certificateChain::getAt(const size_t index) { return m_certs[index]; } diff --git a/src/vmime/security/cert/certificateChain.hpp b/src/vmime/security/cert/certificateChain.hpp index 38bf6254..7846a200 100644 --- a/src/vmime/security/cert/certificateChain.hpp +++ b/src/vmime/security/cert/certificateChain.hpp @@ -62,7 +62,7 @@ public: * @param index position at which to retrieve certificate * @return certificate at the specified position */ - shared_ptr <certificate> getAt(const size_t index); + const shared_ptr <certificate>& getAt(const size_t index); protected: diff --git a/src/vmime/security/cert/certificateException.cpp b/src/vmime/security/cert/certificateException.cpp index 9cd81055..c28a13fe 100644 --- a/src/vmime/security/cert/certificateException.cpp +++ b/src/vmime/security/cert/certificateException.cpp @@ -58,7 +58,7 @@ exception* certificateException::clone() const } -void certificateException::setCertificate(shared_ptr <certificate> cert) +void certificateException::setCertificate(const shared_ptr <certificate>& cert) { m_cert = cert; } diff --git a/src/vmime/security/cert/certificateException.hpp b/src/vmime/security/cert/certificateException.hpp index c6c76127..fc4ea520 100644 --- a/src/vmime/security/cert/certificateException.hpp +++ b/src/vmime/security/cert/certificateException.hpp @@ -65,7 +65,7 @@ public: * * @param cert certificate */ - void setCertificate(shared_ptr <certificate> cert); + void setCertificate(const shared_ptr <certificate>& cert); /** Returns the certificate on which the problem occured. * diff --git a/src/vmime/security/cert/certificateVerifier.hpp b/src/vmime/security/cert/certificateVerifier.hpp index ae1ee312..eb6ff5eb 100644 --- a/src/vmime/security/cert/certificateVerifier.hpp +++ b/src/vmime/security/cert/certificateVerifier.hpp @@ -63,7 +63,7 @@ public: * @throw serverIdentityException if the subject name of the certificate * does not match the hostname of the server */ - virtual void verify(shared_ptr <certificateChain> chain, const string& hostname) = 0; + virtual void verify(const shared_ptr <certificateChain>& chain, const string& hostname) = 0; }; diff --git a/src/vmime/security/cert/defaultCertificateVerifier.cpp b/src/vmime/security/cert/defaultCertificateVerifier.cpp index 6c3e1128..39391231 100644 --- a/src/vmime/security/cert/defaultCertificateVerifier.cpp +++ b/src/vmime/security/cert/defaultCertificateVerifier.cpp @@ -57,7 +57,7 @@ defaultCertificateVerifier::defaultCertificateVerifier(const defaultCertificateV void defaultCertificateVerifier::verify - (shared_ptr <certificateChain> chain, const string& hostname) + (const shared_ptr <certificateChain>& chain, const string& hostname) { if (chain->getCount() == 0) return; @@ -72,7 +72,7 @@ void defaultCertificateVerifier::verify void defaultCertificateVerifier::verifyX509 - (shared_ptr <certificateChain> chain, const string& hostname) + (const shared_ptr <certificateChain>& chain, const string& hostname) { // For every certificate in the chain, verify that the certificate // has been issued by the next certificate in the chain diff --git a/src/vmime/security/cert/defaultCertificateVerifier.hpp b/src/vmime/security/cert/defaultCertificateVerifier.hpp index 8de43714..cd57c5c1 100644 --- a/src/vmime/security/cert/defaultCertificateVerifier.hpp +++ b/src/vmime/security/cert/defaultCertificateVerifier.hpp @@ -69,7 +69,7 @@ public: // Implementation of 'certificateVerifier' - void verify(shared_ptr <certificateChain> chain, const string& hostname); + void verify(const shared_ptr <certificateChain>& chain, const string& hostname); private: @@ -78,7 +78,7 @@ private: * @param chain list of X.509 certificates * @param hostname server hostname */ - void verifyX509(shared_ptr <certificateChain> chain, const string& hostname); + void verifyX509(const shared_ptr <certificateChain>& chain, const string& hostname); std::vector <shared_ptr <X509Certificate> > m_x509RootCAs; diff --git a/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.cpp b/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.cpp index 85cfb1de..478c1418 100644 --- a/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.cpp +++ b/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.cpp @@ -161,7 +161,7 @@ const byteArray X509Certificate_GnuTLS::getSerialNumber() const } -bool X509Certificate_GnuTLS::checkIssuer(shared_ptr <const X509Certificate> issuer_) const +bool X509Certificate_GnuTLS::checkIssuer(const shared_ptr <const X509Certificate>& issuer_) const { shared_ptr <const X509Certificate_GnuTLS> issuer = dynamicCast <const X509Certificate_GnuTLS>(issuer_); @@ -171,7 +171,7 @@ bool X509Certificate_GnuTLS::checkIssuer(shared_ptr <const X509Certificate> issu } -bool X509Certificate_GnuTLS::verify(shared_ptr <const X509Certificate> caCert_) const +bool X509Certificate_GnuTLS::verify(const shared_ptr <const X509Certificate>& caCert_) const { shared_ptr <const X509Certificate_GnuTLS> caCert = dynamicCast <const X509Certificate_GnuTLS>(caCert_); @@ -306,7 +306,7 @@ int X509Certificate_GnuTLS::getVersion() const } -bool X509Certificate_GnuTLS::equals(shared_ptr <const certificate> other) const +bool X509Certificate_GnuTLS::equals(const shared_ptr <const certificate>& other) const { shared_ptr <const X509Certificate_GnuTLS> otherX509 = dynamicCast <const X509Certificate_GnuTLS>(other); diff --git a/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.hpp b/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.hpp index d7d72338..f06955bf 100644 --- a/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.hpp +++ b/src/vmime/security/cert/gnutls/X509Certificate_GnuTLS.hpp @@ -57,9 +57,9 @@ public: const byteArray getSerialNumber() const; const string getIssuerString() const; - bool checkIssuer(shared_ptr <const X509Certificate> issuer) const; + bool checkIssuer(const shared_ptr <const X509Certificate>& issuer) const; - bool verify(shared_ptr <const X509Certificate> caCert) const; + bool verify(const shared_ptr <const X509Certificate>& caCert) const; bool verifyHostName (const string& hostname, @@ -75,7 +75,7 @@ public: const byteArray getEncoded() const; const string getType() const; int getVersion() const; - bool equals(shared_ptr <const certificate> other) const; + bool equals(const shared_ptr <const certificate>& other) const; void* getInternalData(); private: diff --git a/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.cpp b/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.cpp index a05e61d4..45481861 100644 --- a/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.cpp +++ b/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.cpp @@ -285,7 +285,7 @@ const byteArray X509Certificate_OpenSSL::getSerialNumber() const } -bool X509Certificate_OpenSSL::checkIssuer(shared_ptr <const X509Certificate> cert_) const +bool X509Certificate_OpenSSL::checkIssuer(const shared_ptr <const X509Certificate>& cert_) const { shared_ptr <const X509Certificate_OpenSSL> cert = dynamicCast <const X509Certificate_OpenSSL>(cert_); @@ -312,7 +312,7 @@ bool X509Certificate_OpenSSL::checkIssuer(shared_ptr <const X509Certificate> cer } -bool X509Certificate_OpenSSL::verify(shared_ptr <const X509Certificate> caCert_) const +bool X509Certificate_OpenSSL::verify(const shared_ptr <const X509Certificate>& caCert_) const { shared_ptr <const X509Certificate_OpenSSL> caCert = dynamicCast <const X509Certificate_OpenSSL>(caCert_); @@ -572,7 +572,7 @@ int X509Certificate_OpenSSL::getVersion() const } -bool X509Certificate_OpenSSL::equals(shared_ptr <const certificate> other) const +bool X509Certificate_OpenSSL::equals(const shared_ptr <const certificate>& other) const { shared_ptr <const X509Certificate_OpenSSL> otherX509 = dynamicCast <const X509Certificate_OpenSSL>(other); diff --git a/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp b/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp index dbb1b03c..89b54a9a 100644 --- a/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp +++ b/src/vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp @@ -60,9 +60,9 @@ public: const byteArray getSerialNumber() const; const string getIssuerString() const; - bool checkIssuer(shared_ptr <const X509Certificate> issuer) const; + bool checkIssuer(const shared_ptr <const X509Certificate>& issuer) const; - bool verify(shared_ptr <const X509Certificate> caCert) const; + bool verify(const shared_ptr <const X509Certificate>& caCert) const; bool verifyHostName (const string& hostname, @@ -81,7 +81,7 @@ public: const byteArray getEncoded() const; const string getType() const; int getVersion() const; - bool equals(shared_ptr <const certificate> other) const; + bool equals(const shared_ptr <const certificate>& other) const; void* getInternalData(); private: diff --git a/src/vmime/security/defaultAuthenticator.cpp b/src/vmime/security/defaultAuthenticator.cpp index 1c66b6c6..5503de5f 100644 --- a/src/vmime/security/defaultAuthenticator.cpp +++ b/src/vmime/security/defaultAuthenticator.cpp @@ -109,7 +109,7 @@ const string defaultAuthenticator::getServiceName() const } -void defaultAuthenticator::setService(shared_ptr <net::service> serv) +void defaultAuthenticator::setService(const shared_ptr <net::service>& serv) { m_service = serv; } diff --git a/src/vmime/security/defaultAuthenticator.hpp b/src/vmime/security/defaultAuthenticator.hpp index 645d026e..d5b4d787 100644 --- a/src/vmime/security/defaultAuthenticator.hpp +++ b/src/vmime/security/defaultAuthenticator.hpp @@ -55,7 +55,7 @@ public: const string getServiceName() const; const string getAccessToken() const; - void setService(shared_ptr <net::service> serv); + void setService(const shared_ptr <net::service>& serv); weak_ptr <net::service> getService() const; private: diff --git a/src/vmime/security/sasl/SASLAuthenticator.hpp b/src/vmime/security/sasl/SASLAuthenticator.hpp index 9f1881f5..d4dc113c 100644 --- a/src/vmime/security/sasl/SASLAuthenticator.hpp +++ b/src/vmime/security/sasl/SASLAuthenticator.hpp @@ -66,13 +66,13 @@ public: */ virtual const std::vector <shared_ptr <SASLMechanism> > getAcceptableMechanisms (const std::vector <shared_ptr <SASLMechanism> >& available, - shared_ptr <SASLMechanism> suggested) const = 0; + const shared_ptr <SASLMechanism>& suggested) const = 0; /** Set the SASL session which is using this authenticator. * * @param sess SASL session */ - virtual void setSASLSession(shared_ptr <SASLSession> sess) = 0; + virtual void setSASLSession(const shared_ptr <SASLSession>& sess) = 0; /** Set the SASL mechanism which has been selected for the * SASL authentication process. This may be called several times @@ -81,7 +81,7 @@ public: * * @param mech SASL mechanism */ - virtual void setSASLMechanism(shared_ptr <SASLMechanism> mech) = 0; + virtual void setSASLMechanism(const shared_ptr <SASLMechanism>& mech) = 0; }; diff --git a/src/vmime/security/sasl/SASLContext.cpp b/src/vmime/security/sasl/SASLContext.cpp index fc474129..09ffed05 100644 --- a/src/vmime/security/sasl/SASLContext.cpp +++ b/src/vmime/security/sasl/SASLContext.cpp @@ -71,7 +71,7 @@ shared_ptr <SASLContext> SASLContext::create() shared_ptr <SASLSession> SASLContext::createSession (const string& serviceName, - shared_ptr <authenticator> auth, shared_ptr <SASLMechanism> mech) + const shared_ptr <authenticator>& auth, const shared_ptr <SASLMechanism>& mech) { return SASLSession::create (serviceName, dynamicCast <SASLContext>(shared_from_this()), auth, mech); diff --git a/src/vmime/security/sasl/SASLContext.hpp b/src/vmime/security/sasl/SASLContext.hpp index 7e1fff4a..58d6a932 100644 --- a/src/vmime/security/sasl/SASLContext.hpp +++ b/src/vmime/security/sasl/SASLContext.hpp @@ -68,7 +68,7 @@ public: */ shared_ptr <SASLSession> createSession (const string& serviceName, - shared_ptr <authenticator> auth, shared_ptr <SASLMechanism> mech); + const shared_ptr <authenticator>& auth, const shared_ptr <SASLMechanism>& mech); /** Create an instance of an SASL mechanism. * diff --git a/src/vmime/security/sasl/SASLMechanism.hpp b/src/vmime/security/sasl/SASLMechanism.hpp index 03749b50..8e842c4f 100644 --- a/src/vmime/security/sasl/SASLMechanism.hpp +++ b/src/vmime/security/sasl/SASLMechanism.hpp @@ -74,7 +74,7 @@ public: * 'responseLen' are undetermined) */ virtual bool step - (shared_ptr <SASLSession> sess, + (const shared_ptr <SASLSession>& sess, const byte_t* challenge, const size_t challengeLen, byte_t** response, size_t* responseLen) = 0; @@ -109,7 +109,7 @@ public: * the encoding of data (in this case, the values in 'output' and * 'outputLen' are undetermined) */ - virtual void encode(shared_ptr <SASLSession> sess, + virtual void encode(const shared_ptr <SASLSession>& sess, const byte_t* input, const size_t inputLen, byte_t** output, size_t* outputLen) = 0; @@ -126,7 +126,7 @@ public: * the encoding of data (in this case, the values in 'output' and * 'outputLen' are undetermined) */ - virtual void decode(shared_ptr <SASLSession> sess, + virtual void decode(const shared_ptr <SASLSession>& sess, const byte_t* input, const size_t inputLen, byte_t** output, size_t* outputLen) = 0; }; diff --git a/src/vmime/security/sasl/SASLMechanismFactory.cpp b/src/vmime/security/sasl/SASLMechanismFactory.cpp index 7ccdce8d..5ded627a 100644 --- a/src/vmime/security/sasl/SASLMechanismFactory.cpp +++ b/src/vmime/security/sasl/SASLMechanismFactory.cpp @@ -69,7 +69,7 @@ SASLMechanismFactory* SASLMechanismFactory::getInstance() shared_ptr <SASLMechanism> SASLMechanismFactory::create - (shared_ptr <SASLContext> ctx, const string& name_) + (const shared_ptr <SASLContext>& ctx, const string& name_) { const string name(utility::stringUtils::toUpper(name_)); diff --git a/src/vmime/security/sasl/SASLMechanismFactory.hpp b/src/vmime/security/sasl/SASLMechanismFactory.hpp index 6d328f01..d83b37a1 100644 --- a/src/vmime/security/sasl/SASLMechanismFactory.hpp +++ b/src/vmime/security/sasl/SASLMechanismFactory.hpp @@ -62,7 +62,7 @@ private: public: virtual shared_ptr <SASLMechanism> create - (shared_ptr <SASLContext> ctx, const string& name) = 0; + (const shared_ptr <SASLContext>& ctx, const string& name) = 0; }; template <typename T> @@ -70,7 +70,7 @@ private: { public: - shared_ptr <SASLMechanism> create(shared_ptr <SASLContext> ctx, const string& name) + shared_ptr <SASLMechanism> create(const shared_ptr <SASLContext>& ctx, const string& name) { return vmime::make_shared <T>(ctx, name); } @@ -103,7 +103,7 @@ public: * @throw exceptions::no_such_mechanism if no mechanism is * registered for the specified name */ - shared_ptr <SASLMechanism> create(shared_ptr <SASLContext> ctx, const string& name); + shared_ptr <SASLMechanism> create(const shared_ptr <SASLContext>& ctx, const string& name); /** Return a list of supported mechanisms. This includes mechanisms * registered using registerMechanism() as well as the ones that diff --git a/src/vmime/security/sasl/SASLSession.cpp b/src/vmime/security/sasl/SASLSession.cpp index c7e4b2f9..28446fe3 100644 --- a/src/vmime/security/sasl/SASLSession.cpp +++ b/src/vmime/security/sasl/SASLSession.cpp @@ -43,8 +43,8 @@ namespace security { namespace sasl { -SASLSession::SASLSession(const string& serviceName, shared_ptr <SASLContext> ctx, - shared_ptr <authenticator> auth, shared_ptr <SASLMechanism> mech) +SASLSession::SASLSession(const string& serviceName, const shared_ptr <SASLContext>& ctx, + const shared_ptr <authenticator>& auth, const shared_ptr <SASLMechanism>& mech) : m_serviceName(serviceName), m_context(ctx), m_auth(auth), m_mech(mech), m_gsaslContext(0), m_gsaslSession(0) { @@ -70,8 +70,8 @@ SASLSession::~SASLSession() // static shared_ptr <SASLSession> SASLSession::create - (const string& serviceName, shared_ptr <SASLContext> ctx, - shared_ptr <authenticator> auth, shared_ptr <SASLMechanism> mech) + (const string& serviceName, const shared_ptr <SASLContext>& ctx, + const shared_ptr <authenticator>& auth, const shared_ptr <SASLMechanism>& mech) { return shared_ptr <SASLSession>(new SASLSession(serviceName, ctx, auth, mech)); } @@ -116,7 +116,7 @@ bool SASLSession::evaluateChallenge } -shared_ptr <net::socket> SASLSession::getSecuredSocket(shared_ptr <net::socket> sok) +shared_ptr <net::socket> SASLSession::getSecuredSocket(const shared_ptr <net::socket>& sok) { return make_shared <SASLSocket>(dynamicCast <SASLSession>(shared_from_this()), sok); } diff --git a/src/vmime/security/sasl/SASLSession.hpp b/src/vmime/security/sasl/SASLSession.hpp index a915a901..65387bd3 100644 --- a/src/vmime/security/sasl/SASLSession.hpp +++ b/src/vmime/security/sasl/SASLSession.hpp @@ -66,8 +66,8 @@ public: * @param mech SASL mechanism */ static shared_ptr <SASLSession> create - (const string& serviceName, shared_ptr <SASLContext> ctx, - shared_ptr <authenticator> auth, shared_ptr <SASLMechanism> mech); + (const string& serviceName, const shared_ptr <SASLContext>& ctx, + const shared_ptr <authenticator>& auth, const shared_ptr <SASLMechanism>& mech); /** Initialize this SASL session. This must be called before * calling any other method on this object (except accessors). @@ -123,7 +123,7 @@ public: * @param sok socket to wrap * @return secured socket */ - shared_ptr <net::socket> getSecuredSocket(shared_ptr <net::socket> sok); + shared_ptr <net::socket> getSecuredSocket(const shared_ptr <net::socket>& sok); /** Return the name of the service which is using this * SASL session (eg. "imap"). This value should be returned @@ -136,8 +136,8 @@ public: private: SASLSession - (const string& serviceName, shared_ptr <SASLContext> ctx, - shared_ptr <authenticator> auth, shared_ptr <SASLMechanism> mech); + (const string& serviceName, const shared_ptr <SASLContext>& ctx, + const shared_ptr <authenticator>& auth, const shared_ptr <SASLMechanism>& mech); const string m_serviceName; diff --git a/src/vmime/security/sasl/SASLSocket.cpp b/src/vmime/security/sasl/SASLSocket.cpp index ef7ed6da..4312ab35 100644 --- a/src/vmime/security/sasl/SASLSocket.cpp +++ b/src/vmime/security/sasl/SASLSocket.cpp @@ -46,7 +46,7 @@ namespace sasl { -SASLSocket::SASLSocket(shared_ptr <SASLSession> sess, shared_ptr <net::socket> wrapped) +SASLSocket::SASLSocket(const shared_ptr <SASLSession>& sess, const shared_ptr <net::socket>& wrapped) : m_session(sess), m_wrapped(wrapped), m_pendingBuffer(0), m_pendingPos(0), m_pendingLen(0) { @@ -102,7 +102,7 @@ shared_ptr <net::timeoutHandler> SASLSocket::getTimeoutHandler() } -void SASLSocket::setTracer(shared_ptr <net::tracer> tracer) +void SASLSocket::setTracer(const shared_ptr <net::tracer>& tracer) { m_wrapped->setTracer(tracer); } diff --git a/src/vmime/security/sasl/SASLSocket.hpp b/src/vmime/security/sasl/SASLSocket.hpp index a280d8a8..7a732394 100644 --- a/src/vmime/security/sasl/SASLSocket.hpp +++ b/src/vmime/security/sasl/SASLSocket.hpp @@ -50,7 +50,7 @@ class VMIME_EXPORT SASLSocket : public net::socket { public: - SASLSocket(shared_ptr <SASLSession> sess, shared_ptr <net::socket> wrapped); + SASLSocket(const shared_ptr <SASLSession>& sess, const shared_ptr <net::socket>& wrapped); ~SASLSocket(); void connect(const string& address, const port_t port); @@ -78,7 +78,7 @@ public: shared_ptr <net::timeoutHandler> getTimeoutHandler(); - void setTracer(shared_ptr <net::tracer> tracer); + void setTracer(const shared_ptr <net::tracer>& tracer); shared_ptr <net::tracer> getTracer(); private: diff --git a/src/vmime/security/sasl/XOAuth2SASLAuthenticator.cpp b/src/vmime/security/sasl/XOAuth2SASLAuthenticator.cpp index 01371dea..fe36bbab 100644 --- a/src/vmime/security/sasl/XOAuth2SASLAuthenticator.cpp +++ b/src/vmime/security/sasl/XOAuth2SASLAuthenticator.cpp @@ -53,7 +53,7 @@ XOAuth2SASLAuthenticator::~XOAuth2SASLAuthenticator() const std::vector <shared_ptr <SASLMechanism> > XOAuth2SASLAuthenticator::getAcceptableMechanisms (const std::vector <shared_ptr <SASLMechanism> >& available, - shared_ptr <SASLMechanism> suggested) const + const shared_ptr <SASLMechanism>& suggested) const { if (m_mode == MODE_EXCLUSIVE) { @@ -74,6 +74,8 @@ const std::vector <shared_ptr <SASLMechanism> > } else { + shared_ptr <SASLMechanism> newSuggested(suggested); + for (size_t i = available.size() ; i != 0 ; --i) { shared_ptr <SASLMechanism> mech = available[i - 1]; @@ -81,11 +83,11 @@ const std::vector <shared_ptr <SASLMechanism> > if ("XOAUTH2" == mech->getName()) { // Suggest using XOAuth2 - suggested = mech; + newSuggested = mech; } } - return defaultSASLAuthenticator::getAcceptableMechanisms(available, suggested); + return defaultSASLAuthenticator::getAcceptableMechanisms(available, newSuggested); } } diff --git a/src/vmime/security/sasl/XOAuth2SASLAuthenticator.hpp b/src/vmime/security/sasl/XOAuth2SASLAuthenticator.hpp index cbccf0f5..84fa8917 100644 --- a/src/vmime/security/sasl/XOAuth2SASLAuthenticator.hpp +++ b/src/vmime/security/sasl/XOAuth2SASLAuthenticator.hpp @@ -59,7 +59,7 @@ public: const std::vector <shared_ptr <SASLMechanism> > getAcceptableMechanisms (const std::vector <shared_ptr <SASLMechanism> >& available, - shared_ptr <SASLMechanism> suggested) const; + const shared_ptr <SASLMechanism>& suggested) const; private: diff --git a/src/vmime/security/sasl/XOAuth2SASLMechanism.cpp b/src/vmime/security/sasl/XOAuth2SASLMechanism.cpp index a1150667..c699fa83 100644 --- a/src/vmime/security/sasl/XOAuth2SASLMechanism.cpp +++ b/src/vmime/security/sasl/XOAuth2SASLMechanism.cpp @@ -42,7 +42,7 @@ namespace security { namespace sasl { -XOAuth2SASLMechanism::XOAuth2SASLMechanism(shared_ptr <SASLContext> ctx, const string& /* name */) +XOAuth2SASLMechanism::XOAuth2SASLMechanism(const shared_ptr <SASLContext>& ctx, const string& /* name */) : m_context(ctx), m_complete(false) { } @@ -60,7 +60,7 @@ const string XOAuth2SASLMechanism::getName() const bool XOAuth2SASLMechanism::step - (shared_ptr <SASLSession> sess, + (const shared_ptr <SASLSession>& sess, const byte_t* /* challenge */, const size_t /* challengeLen */, byte_t** response, size_t* responseLen) { @@ -107,7 +107,7 @@ bool XOAuth2SASLMechanism::hasInitialResponse() const void XOAuth2SASLMechanism::encode - (shared_ptr <SASLSession> /* sess */, + (const shared_ptr <SASLSession>& /* sess */, const byte_t* input, const size_t inputLen, byte_t** output, size_t* outputLen) { @@ -121,7 +121,7 @@ void XOAuth2SASLMechanism::encode void XOAuth2SASLMechanism::decode - (shared_ptr <SASLSession> /* sess */, + (const shared_ptr <SASLSession>& /* sess */, const byte_t* input, const size_t inputLen, byte_t** output, size_t* outputLen) { diff --git a/src/vmime/security/sasl/XOAuth2SASLMechanism.hpp b/src/vmime/security/sasl/XOAuth2SASLMechanism.hpp index 37dbdae5..5a49267e 100644 --- a/src/vmime/security/sasl/XOAuth2SASLMechanism.hpp +++ b/src/vmime/security/sasl/XOAuth2SASLMechanism.hpp @@ -48,13 +48,13 @@ class VMIME_EXPORT XOAuth2SASLMechanism : public SASLMechanism { public: - XOAuth2SASLMechanism(shared_ptr <SASLContext> ctx, const string& name); + XOAuth2SASLMechanism(const shared_ptr <SASLContext>& ctx, const string& name); ~XOAuth2SASLMechanism(); const string getName() const; - bool step(shared_ptr <SASLSession> sess, + bool step(const shared_ptr <SASLSession>& sess, const byte_t* challenge, const size_t challengeLen, byte_t** response, size_t* responseLen); @@ -62,11 +62,11 @@ public: bool hasInitialResponse() const; - void encode(shared_ptr <SASLSession> sess, + void encode(const shared_ptr <SASLSession>& sess, const byte_t* input, const size_t inputLen, byte_t** output, size_t* outputLen); - void decode(shared_ptr <SASLSession> sess, + void decode(const shared_ptr <SASLSession>& sess, const byte_t* input, const size_t inputLen, byte_t** output, size_t* outputLen); diff --git a/src/vmime/security/sasl/builtinSASLMechanism.cpp b/src/vmime/security/sasl/builtinSASLMechanism.cpp index 9e352334..cbbb98c3 100644 --- a/src/vmime/security/sasl/builtinSASLMechanism.cpp +++ b/src/vmime/security/sasl/builtinSASLMechanism.cpp @@ -45,7 +45,7 @@ namespace security { namespace sasl { -builtinSASLMechanism::builtinSASLMechanism(shared_ptr <SASLContext> ctx, const string& name) +builtinSASLMechanism::builtinSASLMechanism(const shared_ptr <SASLContext>& ctx, const string& name) : m_context(ctx), m_name(name), m_complete(false) { } @@ -63,7 +63,7 @@ const string builtinSASLMechanism::getName() const bool builtinSASLMechanism::step - (shared_ptr <SASLSession> sess, const byte_t* challenge, const size_t challengeLen, + (const shared_ptr <SASLSession>& sess, const byte_t* challenge, const size_t challengeLen, byte_t** response, size_t* responseLen) { char* output = 0; @@ -128,7 +128,7 @@ bool builtinSASLMechanism::hasInitialResponse() const void builtinSASLMechanism::encode - (shared_ptr <SASLSession> sess, const byte_t* input, const size_t inputLen, + (const shared_ptr <SASLSession>& sess, const byte_t* input, const size_t inputLen, byte_t** output, size_t* outputLen) { char* coutput = 0; @@ -161,7 +161,7 @@ void builtinSASLMechanism::encode void builtinSASLMechanism::decode - (shared_ptr <SASLSession> sess, const byte_t* input, const size_t inputLen, + (const shared_ptr <SASLSession>& sess, const byte_t* input, const size_t inputLen, byte_t** output, size_t* outputLen) { char* coutput = 0; diff --git a/src/vmime/security/sasl/builtinSASLMechanism.hpp b/src/vmime/security/sasl/builtinSASLMechanism.hpp index 6cecd1b9..a82c74af 100644 --- a/src/vmime/security/sasl/builtinSASLMechanism.hpp +++ b/src/vmime/security/sasl/builtinSASLMechanism.hpp @@ -49,13 +49,13 @@ class VMIME_EXPORT builtinSASLMechanism : public SASLMechanism { public: - builtinSASLMechanism(shared_ptr <SASLContext> ctx, const string& name); + builtinSASLMechanism(const shared_ptr <SASLContext>& ctx, const string& name); ~builtinSASLMechanism(); const string getName() const; - bool step(shared_ptr <SASLSession> sess, + bool step(const shared_ptr <SASLSession>& sess, const byte_t* challenge, const size_t challengeLen, byte_t** response, size_t* responseLen); @@ -63,11 +63,11 @@ public: bool hasInitialResponse() const; - void encode(shared_ptr <SASLSession> sess, + void encode(const shared_ptr <SASLSession>& sess, const byte_t* input, const size_t inputLen, byte_t** output, size_t* outputLen); - void decode(shared_ptr <SASLSession> sess, + void decode(const shared_ptr <SASLSession>& sess, const byte_t* input, const size_t inputLen, byte_t** output, size_t* outputLen); diff --git a/src/vmime/security/sasl/defaultSASLAuthenticator.cpp b/src/vmime/security/sasl/defaultSASLAuthenticator.cpp index 124f5c3f..44d4e18c 100644 --- a/src/vmime/security/sasl/defaultSASLAuthenticator.cpp +++ b/src/vmime/security/sasl/defaultSASLAuthenticator.cpp @@ -54,7 +54,7 @@ defaultSASLAuthenticator::~defaultSASLAuthenticator() const std::vector <shared_ptr <SASLMechanism> > defaultSASLAuthenticator::getAcceptableMechanisms (const std::vector <shared_ptr <SASLMechanism> >& available, - shared_ptr <SASLMechanism> suggested) const + const shared_ptr <SASLMechanism>& suggested) const { if (suggested) { @@ -113,7 +113,7 @@ const string defaultSASLAuthenticator::getServiceName() const } -void defaultSASLAuthenticator::setService(shared_ptr <net::service> serv) +void defaultSASLAuthenticator::setService(const shared_ptr <net::service>& serv) { m_service = serv; m_default.setService(serv); @@ -126,7 +126,7 @@ weak_ptr <net::service> defaultSASLAuthenticator::getService() const } -void defaultSASLAuthenticator::setSASLSession(shared_ptr <SASLSession> sess) +void defaultSASLAuthenticator::setSASLSession(const shared_ptr <SASLSession>& sess) { m_saslSession = sess; } @@ -138,7 +138,7 @@ shared_ptr <SASLSession> defaultSASLAuthenticator::getSASLSession() const } -void defaultSASLAuthenticator::setSASLMechanism(shared_ptr <SASLMechanism> mech) +void defaultSASLAuthenticator::setSASLMechanism(const shared_ptr <SASLMechanism>& mech) { m_saslMech = mech; } diff --git a/src/vmime/security/sasl/defaultSASLAuthenticator.hpp b/src/vmime/security/sasl/defaultSASLAuthenticator.hpp index 07baf975..f73849be 100644 --- a/src/vmime/security/sasl/defaultSASLAuthenticator.hpp +++ b/src/vmime/security/sasl/defaultSASLAuthenticator.hpp @@ -52,7 +52,7 @@ public: const std::vector <shared_ptr <SASLMechanism> > getAcceptableMechanisms (const std::vector <shared_ptr <SASLMechanism> >& available, - shared_ptr <SASLMechanism> suggested) const; + const shared_ptr <SASLMechanism>& suggested) const; const string getUsername() const; const string getPassword() const; @@ -61,13 +61,13 @@ public: const string getServiceName() const; const string getAccessToken() const; - void setService(shared_ptr <net::service> serv); + void setService(const shared_ptr <net::service>& serv); weak_ptr <net::service> getService() const; - void setSASLSession(shared_ptr <SASLSession> sess); + void setSASLSession(const shared_ptr <SASLSession>& sess); shared_ptr <SASLSession> getSASLSession() const; - void setSASLMechanism(shared_ptr <SASLMechanism> mech); + void setSASLMechanism(const shared_ptr <SASLMechanism>& mech); shared_ptr <SASLMechanism> getSASLMechanism() const; private: diff --git a/src/vmime/streamContentHandler.cpp b/src/vmime/streamContentHandler.cpp index 8676cc34..230a802a 100644 --- a/src/vmime/streamContentHandler.cpp +++ b/src/vmime/streamContentHandler.cpp @@ -39,7 +39,7 @@ streamContentHandler::streamContentHandler() } -streamContentHandler::streamContentHandler(shared_ptr <utility::inputStream> is, +streamContentHandler::streamContentHandler(const shared_ptr <utility::inputStream>& is, const size_t length, const vmime::encoding& enc) { setData(is, length, enc); @@ -76,7 +76,7 @@ streamContentHandler& streamContentHandler::operator=(const streamContentHandler } -void streamContentHandler::setData(shared_ptr <utility::inputStream> is, +void streamContentHandler::setData(const shared_ptr <utility::inputStream>& is, const size_t length, const vmime::encoding& enc) { m_encoding = enc; diff --git a/src/vmime/streamContentHandler.hpp b/src/vmime/streamContentHandler.hpp index 9b72c073..db1e8052 100644 --- a/src/vmime/streamContentHandler.hpp +++ b/src/vmime/streamContentHandler.hpp @@ -58,7 +58,7 @@ public: * @return a reference to a new content handler */ streamContentHandler - (shared_ptr <utility::inputStream> is, + (const shared_ptr <utility::inputStream>& is, const size_t length, const vmime::encoding& enc = NO_ENCODING); @@ -79,7 +79,7 @@ public: * from the stream is already encoded with the specified encoding */ void setData - (shared_ptr <utility::inputStream> is, + (const shared_ptr <utility::inputStream>& is, const size_t length, const vmime::encoding& enc = NO_ENCODING); diff --git a/src/vmime/text.cpp b/src/vmime/text.cpp index 939f4f81..28fda3ad 100644 --- a/src/vmime/text.cpp +++ b/src/vmime/text.cpp @@ -155,19 +155,19 @@ const string text::getConvertedText(const charset& dest, const charsetConverterO } -void text::appendWord(shared_ptr <word> w) +void text::appendWord(const shared_ptr <word>& w) { m_words.push_back(w); } -void text::insertWordBefore(const size_t pos, shared_ptr <word> w) +void text::insertWordBefore(const size_t pos, const shared_ptr <word>& w) { m_words.insert(m_words.begin() + pos, w); } -void text::insertWordAfter(const size_t pos, shared_ptr <word> w) +void text::insertWordAfter(const size_t pos, const shared_ptr <word>& w) { m_words.insert(m_words.begin() + pos + 1, w); } diff --git a/src/vmime/text.hpp b/src/vmime/text.hpp index d8c4571a..b11454cb 100644 --- a/src/vmime/text.hpp +++ b/src/vmime/text.hpp @@ -64,7 +64,7 @@ public: * * @param w word to append */ - void appendWord(shared_ptr <word> w); + void appendWord(const shared_ptr <word>& w); /** Insert a new word before the specified position. * @@ -72,14 +72,14 @@ public: * the beginning of the list) * @param w word to insert */ - void insertWordBefore(const size_t pos, shared_ptr <word> w); + void insertWordBefore(const size_t pos, const shared_ptr <word>& w); /** Insert a new word after the specified position. * * @param pos position of the word before the new word * @param w word to insert */ - void insertWordAfter(const size_t pos, shared_ptr <word> w); + void insertWordAfter(const size_t pos, const shared_ptr <word>& w); /** Remove the word at the specified position. * diff --git a/src/vmime/textPart.hpp b/src/vmime/textPart.hpp index 6348f8d7..4be0535d 100644 --- a/src/vmime/textPart.hpp +++ b/src/vmime/textPart.hpp @@ -79,7 +79,7 @@ public: * * @param text text of the part */ - virtual void setText(shared_ptr <contentHandler> text) = 0; + virtual void setText(const shared_ptr <contentHandler>& text) = 0; /** Return the actual body parts this text part is composed of. * For example, HTML parts are composed of two parts: one "text/html" @@ -94,7 +94,7 @@ public: * @param message the message * @param parent body part into which generate this part */ - virtual void generateIn(shared_ptr <bodyPart> message, shared_ptr <bodyPart> parent) const = 0; + virtual void generateIn(const shared_ptr <bodyPart>& message, const shared_ptr <bodyPart>& parent) const = 0; /** Parse the text part(s) from the specified message. * @@ -102,7 +102,7 @@ public: * @param parent part containing the text part * @param textPart actual text part */ - virtual void parse(shared_ptr <const bodyPart> message, shared_ptr <const bodyPart> parent, shared_ptr <const bodyPart> textPart) = 0; + virtual void parse(const shared_ptr <const bodyPart>& message, const shared_ptr <const bodyPart>& parent, const shared_ptr <const bodyPart>& textPart) = 0; }; diff --git a/src/vmime/utility/childProcess.hpp b/src/vmime/utility/childProcess.hpp index ebefcf0a..4898e3f7 100644 --- a/src/vmime/utility/childProcess.hpp +++ b/src/vmime/utility/childProcess.hpp @@ -59,7 +59,7 @@ public: * @throws exceptions::system_error if the an error occurs * before the process can be started */ - virtual void start(const std::vector <string> args, const int flags = 0) = 0; + virtual void start(const std::vector <string>& args, const int flags = 0) = 0; /** Return a wrapper to the child process standard input. * diff --git a/src/vmime/utility/parserInputStreamAdapter.cpp b/src/vmime/utility/parserInputStreamAdapter.cpp index f1eb0e70..ee6a58dd 100644 --- a/src/vmime/utility/parserInputStreamAdapter.cpp +++ b/src/vmime/utility/parserInputStreamAdapter.cpp @@ -28,7 +28,7 @@ namespace vmime { namespace utility { -parserInputStreamAdapter::parserInputStreamAdapter(shared_ptr <seekableInputStream> stream) +parserInputStreamAdapter::parserInputStreamAdapter(const shared_ptr <seekableInputStream>& stream) : m_stream(stream) { } diff --git a/src/vmime/utility/parserInputStreamAdapter.hpp b/src/vmime/utility/parserInputStreamAdapter.hpp index 9b0639b1..f6e360cb 100644 --- a/src/vmime/utility/parserInputStreamAdapter.hpp +++ b/src/vmime/utility/parserInputStreamAdapter.hpp @@ -43,7 +43,7 @@ public: /** @param stream input stream to wrap */ - parserInputStreamAdapter(shared_ptr <seekableInputStream> stream); + parserInputStreamAdapter(const shared_ptr <seekableInputStream>& stream); shared_ptr <seekableInputStream> getUnderlyingStream(); diff --git a/src/vmime/utility/seekableInputStreamRegionAdapter.cpp b/src/vmime/utility/seekableInputStreamRegionAdapter.cpp index cede1ba9..6306d3dc 100644 --- a/src/vmime/utility/seekableInputStreamRegionAdapter.cpp +++ b/src/vmime/utility/seekableInputStreamRegionAdapter.cpp @@ -29,7 +29,7 @@ namespace utility { seekableInputStreamRegionAdapter::seekableInputStreamRegionAdapter - (shared_ptr <seekableInputStream> stream, const size_t begin, const size_t length) + (const shared_ptr <seekableInputStream>& stream, const size_t begin, const size_t length) : m_stream(stream), m_begin(begin), m_length(length), m_position(0) { } diff --git a/src/vmime/utility/seekableInputStreamRegionAdapter.hpp b/src/vmime/utility/seekableInputStreamRegionAdapter.hpp index 4716d2de..70ab8ff3 100644 --- a/src/vmime/utility/seekableInputStreamRegionAdapter.hpp +++ b/src/vmime/utility/seekableInputStreamRegionAdapter.hpp @@ -45,7 +45,7 @@ public: * @param begin start position in source stream * @param length region length in source stream */ - seekableInputStreamRegionAdapter(shared_ptr <seekableInputStream> stream, + seekableInputStreamRegionAdapter(const shared_ptr <seekableInputStream>& stream, const size_t begin, const size_t length); bool eof() const; diff --git a/src/vmime/utility/sync/autoLock.hpp b/src/vmime/utility/sync/autoLock.hpp index c058429d..a0ac90f6 100644 --- a/src/vmime/utility/sync/autoLock.hpp +++ b/src/vmime/utility/sync/autoLock.hpp @@ -41,7 +41,7 @@ class VMIME_EXPORT autoLock : public object { public: - autoLock(shared_ptr <M> mutex) + autoLock(const shared_ptr <M>& mutex) : m_mutex(mutex) { m_mutex->lock(); diff --git a/tests/parser/attachmentHelperTest.cpp b/tests/parser/attachmentHelperTest.cpp index 4d4a2623..6bd3b7db 100644 --- a/tests/parser/attachmentHelperTest.cpp +++ b/tests/parser/attachmentHelperTest.cpp @@ -39,7 +39,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest) VMIME_TEST_LIST_END - static const vmime::string getStructure(vmime::shared_ptr <vmime::bodyPart> part) + static const vmime::string getStructure(const vmime::shared_ptr <vmime::bodyPart>& part) { vmime::shared_ptr <vmime::body> bdy = part->getBody(); @@ -63,7 +63,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest) return res + "]"; } - static const vmime::string extractBodyContents(vmime::shared_ptr <const vmime::bodyPart> part) + static const vmime::string extractBodyContents(const vmime::shared_ptr <const vmime::bodyPart>& part) { vmime::shared_ptr <const vmime::contentHandler> cth = part->getBody()->getContents(); diff --git a/tests/parser/bodyPartTest.cpp b/tests/parser/bodyPartTest.cpp index 4dc5d670..e6ff737a 100644 --- a/tests/parser/bodyPartTest.cpp +++ b/tests/parser/bodyPartTest.cpp @@ -49,7 +49,7 @@ VMIME_TEST_SUITE_BEGIN(bodyPartTest) buffer.begin() + c.getParsedOffset() + c.getParsedLength()); } - static const vmime::string extractContents(const vmime::shared_ptr <const vmime::contentHandler> cts) + static const vmime::string extractContents(const vmime::shared_ptr <const vmime::contentHandler>& cts) { std::ostringstream oss; vmime::utility::outputStreamAdapter os(oss); diff --git a/tests/parser/htmlTextPartTest.cpp b/tests/parser/htmlTextPartTest.cpp index 278a87c1..9eef5e84 100644 --- a/tests/parser/htmlTextPartTest.cpp +++ b/tests/parser/htmlTextPartTest.cpp @@ -35,7 +35,7 @@ VMIME_TEST_SUITE_BEGIN(htmlTextPartTest) static const vmime::string extractContent - (vmime::shared_ptr <const vmime::contentHandler> cth) + (const vmime::shared_ptr <const vmime::contentHandler>& cth) { std::ostringstream oss; vmime::utility::outputStreamAdapter osa(oss); diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp index 1e8e0c99..6e31d93f 100644 --- a/tests/testUtils.cpp +++ b/tests/testUtils.cpp @@ -90,7 +90,7 @@ vmime::shared_ptr <vmime::net::timeoutHandler> testSocket::getTimeoutHandler() } -void testSocket::setTracer(vmime::shared_ptr <vmime::net::tracer> /* tracer */) +void testSocket::setTracer(const vmime::shared_ptr <vmime::net::tracer>& /* tracer */) { } diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp index 367be623..d17c38b2 100644 --- a/tests/testUtils.hpp +++ b/tests/testUtils.hpp @@ -275,7 +275,7 @@ public: vmime::shared_ptr <vmime::net::timeoutHandler> getTimeoutHandler(); - void setTracer(vmime::shared_ptr <vmime::net::tracer> tracer); + void setTracer(const vmime::shared_ptr <vmime::net::tracer>& tracer); vmime::shared_ptr <vmime::net::tracer> getTracer(); /** Send data to client. @@ -336,7 +336,7 @@ public: return vmime::make_shared <T>(); } - vmime::shared_ptr <vmime::net::socket> create(vmime::shared_ptr <vmime::net::timeoutHandler> /* th */) + vmime::shared_ptr <vmime::net::socket> create(const vmime::shared_ptr <vmime::net::timeoutHandler>& /* th */) { return vmime::make_shared <T>(); } |