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/DefaultPieceStorage.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/DefaultPieceStorage.cc') diff --git a/src/DefaultPieceStorage.cc b/src/DefaultPieceStorage.cc index 811c68b7..cee96df9 100644 --- a/src/DefaultPieceStorage.cc +++ b/src/DefaultPieceStorage.cc @@ -478,8 +478,7 @@ void DefaultPieceStorage::completePiece(const std::shared_ptr& piece) } #ifdef ENABLE_BITTORRENT if(downloadContext_->hasAttribute(CTX_ATTR_BT)) { - auto torrentAttrs = bittorrent::getTorrentAttrs(downloadContext_); - if(!torrentAttrs->metadata.empty()) { + if(!bittorrent::getTorrentAttrs(downloadContext_)->metadata.empty()) { #ifdef __MINGW32__ // On Windows, if aria2 opens files with GENERIC_WRITE access // right, some programs cannot open them aria2 is seeding. To -- cgit