merged fix from RC_0_16

This commit is contained in:
Arvid Norberg 2012-09-30 19:35:08 +00:00
parent 75e0a21e95
commit 32b4b5926a
3 changed files with 21 additions and 11 deletions

View File

@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include <set>
#include <list>
#include <stdarg.h> // for va_start, va_end
#ifndef TORRENT_DISABLE_GEO_IP
#ifdef WITH_SHIPPED_GEOIP_H

View File

@ -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;

View File

@ -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
}