From f173b0a535e4d97c3ecd913eafb5e5c40aca2d44 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sat, 18 Aug 2018 16:08:25 +0200 Subject: Avoid copy by passing shared_ptr<> with const reference. --- tests/parser/attachmentHelperTest.cpp | 4 ++-- tests/parser/bodyPartTest.cpp | 2 +- tests/parser/htmlTextPartTest.cpp | 2 +- tests/testUtils.cpp | 2 +- tests/testUtils.hpp | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tests') 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 part) + static const vmime::string getStructure(const vmime::shared_ptr & part) { vmime::shared_ptr bdy = part->getBody(); @@ -63,7 +63,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest) return res + "]"; } - static const vmime::string extractBodyContents(vmime::shared_ptr part) + static const vmime::string extractBodyContents(const vmime::shared_ptr & part) { vmime::shared_ptr 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 cts) + static const vmime::string extractContents(const vmime::shared_ptr & 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 cth) + (const vmime::shared_ptr & 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 testSocket::getTimeoutHandler() } -void testSocket::setTracer(vmime::shared_ptr /* tracer */) +void testSocket::setTracer(const vmime::shared_ptr & /* 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 getTimeoutHandler(); - void setTracer(vmime::shared_ptr tracer); + void setTracer(const vmime::shared_ptr & tracer); vmime::shared_ptr getTracer(); /** Send data to client. @@ -336,7 +336,7 @@ public: return vmime::make_shared (); } - vmime::shared_ptr create(vmime::shared_ptr /* th */) + vmime::shared_ptr create(const vmime::shared_ptr & /* th */) { return vmime::make_shared (); } -- cgit v1.2.3