From 7e6db8d801973bfc62b80f411f14d1d332a1f7aa Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 3 Jul 2013 23:23:22 +0900 Subject: Use std::unique_ptr instead of array_ptr --- src/MessageDigest.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/MessageDigest.cc') diff --git a/src/MessageDigest.cc b/src/MessageDigest.cc index 01189c7f..725c56c8 100644 --- a/src/MessageDigest.cc +++ b/src/MessageDigest.cc @@ -186,10 +186,9 @@ void MessageDigest::digest(unsigned char* md) std::string MessageDigest::digest() { size_t length = pImpl_->getDigestLength(); - array_ptr buf(new unsigned char[length]); - pImpl_->digest(buf); - std::string hd(&buf[0], &buf[length]); - return hd; + auto buf = make_unique(length); + pImpl_->digest(buf.get()); + return std::string(&buf[0], &buf[length]); } } // namespace aria2 -- cgit