From 4819162ffaa731f659fbae69f371fd05831116a3 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Sun, 19 Nov 2006 08:27:20 +0000 Subject: [PATCH] * Remove the PeerInfo header dependency inside torrent/data. * Cleaned up BlockTransfer. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@807 e378c898-3ddf-0310-93e7-cc216c733640 --- src/display/utils.cc | 18 ++++++++++++++---- src/display/window_peer_list.cc | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/display/utils.cc b/src/display/utils.cc index aaa1b070..7382939c 100644 --- a/src/display/utils.cc +++ b/src/display/utils.cc @@ -224,10 +224,20 @@ print_download_percentage_done(char* first, char* last, core::Download* d) { char* print_client_version(char* first, char* last, const torrent::ClientInfo& clientInfo) { - return print_buffer(first, last, "%s %hhu.%hhu.%hhu.%hhu", - clientInfo.short_description(), - clientInfo.version()[0], clientInfo.version()[1], - clientInfo.version()[2], clientInfo.version()[3]); + switch (torrent::ClientInfo::version_size(clientInfo.type())) { + case 4: + return print_buffer(first, last, "%s %hhu.%hhu.%hhu.%hhu", + clientInfo.short_description(), + clientInfo.version()[0], clientInfo.version()[1], + clientInfo.version()[2], clientInfo.version()[3]); + case 3: + return print_buffer(first, last, "%s %hhu.%hhu.%hhu", + clientInfo.short_description(), + clientInfo.version()[0], clientInfo.version()[1], + clientInfo.version()[2]); + default: + return print_buffer(first, last, "%s", clientInfo.short_description()); + } } char* diff --git a/src/display/window_peer_list.cc b/src/display/window_peer_list.cc index 7805e379..dd29471d 100644 --- a/src/display/window_peer_list.cc +++ b/src/display/window_peer_list.cc @@ -42,6 +42,7 @@ #include #include #include +#include #include "core/download.h" #include "rak/algorithm.h"