diff --git a/rak/functional.h b/rak/functional.h index 6e256649..8066555f 100644 --- a/rak/functional.h +++ b/rak/functional.h @@ -72,6 +72,8 @@ accumulate(Type& t, Ftor f) { template struct _equal { + typedef bool result_type; + _equal(Type t, Ftor f) : m_t(t), m_f(f) {} template @@ -91,6 +93,8 @@ equal(Type t, Ftor f) { template struct _less { + typedef bool result_type; + _less(Type t, Ftor f) : m_t(t), m_f(f) {} template @@ -110,6 +114,8 @@ less(Type t, Ftor f) { template struct _greater { + typedef bool result_type; + _greater(Type t, Ftor f) : m_t(t), m_f(f) {} template @@ -129,6 +135,8 @@ greater(Type t, Ftor f) { template struct _less_equal { + typedef bool result_type; + _less_equal(Type t, Ftor f) : m_t(t), m_f(f) {} template @@ -148,6 +156,8 @@ less_equal(Type t, Ftor f) { template struct _greater_equal { + typedef bool result_type; + _greater_equal(Type t, Ftor f) : m_t(t), m_f(f) {} template @@ -166,10 +176,12 @@ greater_equal(Type t, Ftor f) { } template -struct _on : public std::unary_function { +struct _on : public std::unary_function { + typedef typename Dest::result_type result_type; + _on(Src s, Dest d) : m_dest(d), m_src(s) {} - typename Dest::result_type operator () (typename reference_fix::type arg) { + result_type operator () (typename reference_fix::type arg) { return m_dest(m_src(arg)); } @@ -260,6 +272,32 @@ bind1st(const Operation& op, const Type& val) { return bind1st_t(op, val); } +template +class bind2nd_t : public std::unary_function { +protected: + typedef typename reference_fix::type argument_type; + typedef typename reference_fix::type value_type; + + Operation m_op; + value_type m_value; + +public: + bind2nd_t(const Operation& op, const value_type v) : + m_op(op), m_value(v) {} + + typename Operation::result_type + operator () (const argument_type arg) { + return m_op(arg, m_value); + } +}; + +template +inline bind2nd_t +bind2nd(const Operation& op, const Type& val) { + return bind2nd_t(op, val); +} + } #endif diff --git a/src/display/window_peer_list.cc b/src/display/window_peer_list.cc index 0a86b8a2..655cc46e 100644 --- a/src/display/window_peer_list.cc +++ b/src/display/window_peer_list.cc @@ -102,7 +102,7 @@ WindowPeerList::redraw() { m_canvas->print(x, y, "%.1f", (double)p.get_peer_rate().rate() / 1024); x += 7; m_canvas->print(x, y, "%c/%c%c/%c%c", - p.is_incoming() ? 'R' : 'L', + p.is_incoming() ? 'r' : 'l', p.get_remote_choked() ? 'c' : 'u', p.get_remote_interested() ? 'i' : 'n', p.get_local_choked() ? 'c' : 'u', diff --git a/src/display/window_statusbar.cc b/src/display/window_statusbar.cc index 75f20c3b..8e1db8e3 100644 --- a/src/display/window_statusbar.cc +++ b/src/display/window_statusbar.cc @@ -76,7 +76,7 @@ WindowStatusbar::redraw() { buf, (double)torrent::get_write_rate().rate() / 1024.0, (double)torrent::get_read_rate().rate() / 1024.0, - !torrent::get_address().empty() ? torrent::get_address().c_str() : "", + !torrent::get_local_address().empty() ? torrent::get_local_address().c_str() : "", (int)torrent::get_listen_port(), !torrent::get_bind_address().empty() ? (" Bind: " + torrent::get_bind_address()).c_str() : ""); diff --git a/src/option_handler_rules.cc b/src/option_handler_rules.cc index e5981424..82ad997b 100644 --- a/src/option_handler_rules.cc +++ b/src/option_handler_rules.cc @@ -194,7 +194,7 @@ apply_bind(ui::Control* m, const std::string& arg) { void apply_ip(ui::Control* m, const std::string& arg) { - torrent::set_address(arg); + torrent::set_local_address(arg); } // The arg string *must* have been checked with validate_port_range