From da7400ef5c62ee144fc14ba7ca4745349f0b0c72 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 26 Jun 2013 23:56:43 +0900 Subject: Return std::unique_ptr member as const ref Returning raw pointer has a risk that it may be stolen by std::shared_ptr in accident. --- src/DownloadEngine.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/DownloadEngine.cc') diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc index d845ff1d..8de6a316 100644 --- a/src/DownloadEngine.cc +++ b/src/DownloadEngine.cc @@ -549,14 +549,15 @@ void DownloadEngine::setAuthConfigFactory authConfigFactory_ = std::move(factory); } -AuthConfigFactory* DownloadEngine::getAuthConfigFactory() const +const std::unique_ptr& +DownloadEngine::getAuthConfigFactory() const { - return authConfigFactory_.get(); + return authConfigFactory_; } -CookieStorage* DownloadEngine::getCookieStorage() const +const std::unique_ptr& DownloadEngine::getCookieStorage() const { - return cookieStorage_.get(); + return cookieStorage_; } void DownloadEngine::setRefreshInterval(int64_t interval) -- cgit