From 32b4b5926ab7015f9f9831e49410538c620ddf25 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 30 Sep 2012 19:35:08 +0000 Subject: [PATCH] merged fix from RC_0_16 --- include/libtorrent/aux_/session_impl.hpp | 1 + include/libtorrent/error_code.hpp | 13 ++----------- src/error_code.cpp | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 5676ea8c2..4b81bac09 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include // for va_start, va_end #ifndef TORRENT_DISABLE_GEO_IP #ifdef WITH_SHIPPED_GEOIP_H diff --git a/include/libtorrent/error_code.hpp b/include/libtorrent/error_code.hpp index 1ad8e6e43..a60232ffc 100644 --- a/include/libtorrent/error_code.hpp +++ b/include/libtorrent/error_code.hpp @@ -387,17 +387,8 @@ namespace libtorrent struct TORRENT_EXPORT libtorrent_exception: std::exception { libtorrent_exception(error_code const& s): m_error(s), m_msg(0) {} - virtual const char* what() const throw() - { - if (!m_msg) - { - std::string msg = m_error.message(); - m_msg = allocate_string_copy(msg.c_str()); - } - - return m_msg; - } - virtual ~libtorrent_exception() throw() { free(m_msg); } + virtual const char* what() const throw(); + virtual ~libtorrent_exception() throw(); error_code error() const { return m_error; } private: error_code m_error; diff --git a/src/error_code.cpp b/src/error_code.cpp index ad114de5c..93a896b22 100644 --- a/src/error_code.cpp +++ b/src/error_code.cpp @@ -298,5 +298,23 @@ namespace libtorrent } #endif +#ifndef BOOST_NO_EXCEPTIONS + const char* libtorrent_exception::what() const throw() + { + if (!m_msg) + { + std::string msg = m_error.message(); + m_msg = allocate_string_copy(msg.c_str()); + } + + return m_msg; + } + + libtorrent_exception::~libtorrent_exception() throw() + { + free(m_msg); + } +#endif + }