From 6381eaee54225032ff2542eb4a21d4696e65762f Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 24 Nov 2009 18:42:58 +0000 Subject: [PATCH] clean up in magnet_uri.cpp --- src/magnet_uri.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/magnet_uri.cpp b/src/magnet_uri.cpp index e74f39413..b757c0ed6 100644 --- a/src/magnet_uri.cpp +++ b/src/magnet_uri.cpp @@ -44,8 +44,9 @@ namespace libtorrent if (!handle.is_valid()) return ""; char ret[1024]; + sha1_hash const& ih = handle.info_hash(); int num_chars = snprintf(ret, sizeof(ret), "magnet:?xt=urn:btih:%s" - , base32encode(std::string((char*)handle.info_hash().begin(), 20)).c_str()); + , base32encode(std::string((char const*)&ih[0], 20)).c_str()); std::string name = handle.name(); @@ -74,8 +75,9 @@ namespace libtorrent std::string make_magnet_uri(torrent_info const& info) { char ret[1024]; + sha1_hash const& ih = info.info_hash(); int num_chars = snprintf(ret, sizeof(ret), "magnet:?xt=urn:btih:%s" - , base32encode(std::string((char*)info.info_hash().begin(), 20)).c_str()); + , base32encode(std::string((char*)&ih[0], 20)).c_str()); std::string const& name = info.name();