forked from premiere/premiere-libtorrent
*** empty log message ***
This commit is contained in:
parent
cf9215deec
commit
5cde50ee01
|
@ -59,6 +59,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/fingerprint.hpp"
|
||||
#include "libtorrent/debug.hpp"
|
||||
|
||||
#if defined(_MSC_VER) && !defined(NDEBUG)
|
||||
|
||||
#include <eh.h>
|
||||
|
||||
#endif
|
||||
|
||||
// TODO: if we're a seed and the peer is a seed, close the connections
|
||||
|
||||
|
@ -71,12 +76,13 @@ namespace libtorrent
|
|||
// hardware exceptions that makes
|
||||
// it hard to debug stuff
|
||||
#if defined(_MSC_VER) && !defined(NDEBUG)
|
||||
|
||||
struct eh_initializer
|
||||
{
|
||||
eh_initializer()
|
||||
{ _set_se_translator(straight_to_debugger); }
|
||||
{ ::_set_se_translator(straight_to_debugger); }
|
||||
|
||||
static void straight_to_debugger(unsigned int, EXCEPTION_POINTERS*)
|
||||
static void straight_to_debugger(unsigned int, _EXCEPTION_POINTERS*)
|
||||
{ throw; }
|
||||
};
|
||||
#else
|
||||
|
|
|
@ -33,23 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_SOCKET_HPP_INCLUDED
|
||||
#define TORRENT_SOCKET_HPP_INCLUDED
|
||||
|
||||
// TODO: remove the dependency of
|
||||
// platform specific headers here.
|
||||
// sockaddr_in is hard to get rid of in a nice way
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <fcntl.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <boost/smart_ptr.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
|
|
@ -121,13 +121,26 @@ namespace
|
|||
|
||||
std::string escape_string(const char* str, int len)
|
||||
{
|
||||
static const char special_chars[] = "$-_.+!*'(),";
|
||||
|
||||
std::stringstream ret;
|
||||
ret << std::hex << std::setfill('0');
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
// TODO: should alnum() be replaced with printable()?
|
||||
if (std::isalnum(static_cast<unsigned char>(*str))) ret << *str;
|
||||
else ret << "%" << std::setw(2) << (int)static_cast<unsigned char>(*str);
|
||||
if (std::isalnum(static_cast<unsigned char>(*str))
|
||||
|| std::find(
|
||||
special_chars
|
||||
, special_chars+sizeof(special_chars)-1
|
||||
, *str))
|
||||
{
|
||||
ret << *str;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret << "%"
|
||||
<< std::setw(2)
|
||||
<< (int)static_cast<unsigned char>(*str);
|
||||
}
|
||||
++str;
|
||||
}
|
||||
return ret.str();
|
||||
|
|
Loading…
Reference in New Issue