forked from premiere/premiere-libtorrent
moved escape_string.hpp into the aux_ directory. moved out the 3 public hex functions into its own public header, hex.hpp
This commit is contained in:
parent
fad1c42970
commit
794de25212
|
@ -48,7 +48,6 @@ nobase_include_HEADERS = \
|
|||
enum_net.hpp \
|
||||
error.hpp \
|
||||
error_code.hpp \
|
||||
escape_string.hpp \
|
||||
export.hpp \
|
||||
extensions.hpp \
|
||||
file.hpp \
|
||||
|
@ -57,6 +56,7 @@ nobase_include_HEADERS = \
|
|||
fingerprint.hpp \
|
||||
gzip.hpp \
|
||||
hasher.hpp \
|
||||
hex.hpp \
|
||||
http_connection.hpp \
|
||||
http_parser.hpp \
|
||||
http_seed_connection.hpp \
|
||||
|
@ -157,6 +157,7 @@ nobase_include_HEADERS = \
|
|||
aux_/session_settings.hpp \
|
||||
aux_/session_interface.hpp \
|
||||
aux_/time.hpp \
|
||||
aux_/escape_string.hpp \
|
||||
\
|
||||
extensions/lt_trackers.hpp \
|
||||
extensions/metadata_transfer.hpp \
|
||||
|
|
|
@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/rss.hpp" // for feed_handle
|
||||
#include "libtorrent/operations.hpp" // for operation_t enum
|
||||
#include "libtorrent/close_reason.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
|
|
@ -34,16 +34,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_ESCAPE_STRING_HPP_INCLUDED
|
||||
|
||||
#include <string>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
TORRENT_EXTRA_EXPORT boost::array<char, 4 + std::numeric_limits<boost::int64_t>::digits10>
|
||||
to_string(boost::int64_t n);
|
||||
|
||||
TORRENT_EXTRA_EXPORT std::string unescape_string(std::string const& s, error_code& ec);
|
||||
// replaces all disallowed URL characters by their %-encoding
|
||||
TORRENT_EXTRA_EXPORT std::string escape_string(const char* str, int len);
|
||||
|
@ -80,22 +75,6 @@ namespace libtorrent
|
|||
|
||||
TORRENT_EXTRA_EXPORT bool is_hex(char const *in, int len);
|
||||
|
||||
// The overload taking a ``std::string`` converts (binary) the string ``s``
|
||||
// to hexadecimal representation and returns it.
|
||||
// The overload taking a ``char const*`` and a length converts the binary
|
||||
// buffer [``in``, ``in`` + len) to hexadecimal and prints it to the buffer
|
||||
// ``out``. The caller is responsible for making sure the buffer pointed to
|
||||
// by ``out`` is large enough, i.e. has at least len * 2 bytes of space.
|
||||
TORRENT_EXPORT std::string to_hex(std::string const& s);
|
||||
TORRENT_EXPORT void to_hex(char const *in, int len, char* out);
|
||||
|
||||
// converts the buffer [``in``, ``in`` + len) from hexadecimal to
|
||||
// binary. The binary output is written to the buffer pointed to
|
||||
// by ``out``. The caller is responsible for making sure the buffer
|
||||
// at ``out`` has enough space for the result to be written to, i.e.
|
||||
// (len + 1) / 2 bytes.
|
||||
TORRENT_EXPORT bool from_hex(char const *in, int len, char* out);
|
||||
|
||||
#if defined TORRENT_WINDOWS && TORRENT_USE_WSTRING
|
||||
TORRENT_EXTRA_EXPORT std::wstring convert_to_wstring(std::string const& s);
|
||||
TORRENT_EXTRA_EXPORT std::string convert_from_wstring(std::wstring const& s);
|
|
@ -90,7 +90,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/config.hpp"
|
||||
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/io.hpp" // for write_string
|
||||
|
||||
namespace libtorrent
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2003-2014, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef TORRENT_HEX_HPP_INCLUDED
|
||||
#define TORRENT_HEX_HPP_INCLUDED
|
||||
|
||||
#include <string>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
// The overload taking a ``std::string`` converts (binary) the string ``s``
|
||||
// to hexadecimal representation and returns it.
|
||||
// The overload taking a ``char const*`` and a length converts the binary
|
||||
// buffer [``in``, ``in`` + len) to hexadecimal and prints it to the buffer
|
||||
// ``out``. The caller is responsible for making sure the buffer pointed to
|
||||
// by ``out`` is large enough, i.e. has at least len * 2 bytes of space.
|
||||
TORRENT_EXPORT std::string to_hex(std::string const& s);
|
||||
TORRENT_EXPORT void to_hex(char const *in, int len, char* out);
|
||||
|
||||
// converts the buffer [``in``, ``in`` + len) from hexadecimal to
|
||||
// binary. The binary output is written to the buffer pointed to
|
||||
// by ``out``. The caller is responsible for making sure the buffer
|
||||
// at ``out`` has enough space for the result to be written to, i.e.
|
||||
// (len + 1) / 2 bytes.
|
||||
TORRENT_EXPORT bool from_hex(char const *in, int len, char* out);
|
||||
|
||||
}
|
||||
|
||||
#endif // TORRENT_HEX_HPP_INCLUDED
|
||||
|
|
@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <boost/function/function1.hpp>
|
||||
#include "libtorrent/proxy_base.hpp"
|
||||
#include "libtorrent/string_util.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/shared_ptr.hpp>
|
||||
#include "libtorrent/proxy_base.hpp"
|
||||
#include "libtorrent/session_settings.hpp"
|
||||
#include "libtorrent/string_util.hpp"
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/io_service_fwd.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include <boost/function/function1.hpp>
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/byteswap.hpp"
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
#include "libtorrent/escape_string.hpp" // to_hex, from_hex
|
||||
#include "libtorrent/hex.hpp" // to_hex, from_hex
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#endif
|
||||
|
|
|
@ -36,11 +36,18 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/config.hpp"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/array.hpp> // for boost::array
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
TORRENT_EXTRA_EXPORT bool is_alpha(char c);
|
||||
|
||||
TORRENT_EXTRA_EXPORT
|
||||
boost::array<char, 4+std::numeric_limits<boost::int64_t>::digits10>
|
||||
to_string(boost::int64_t n);
|
||||
|
||||
// internal
|
||||
inline bool is_digit(char c)
|
||||
{ return c >= '0' && c <= '9'; }
|
||||
|
|
|
@ -65,7 +65,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/alert.hpp"
|
||||
#include "libtorrent/piece_picker.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/bandwidth_limit.hpp"
|
||||
#include "libtorrent/bandwidth_queue_entry.hpp"
|
||||
#include "libtorrent/storage_defs.hpp"
|
||||
|
|
|
@ -38,7 +38,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
|
||||
#include <boost/function.hpp>
|
||||
|
||||
|
|
|
@ -39,10 +39,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/socket_io.hpp"
|
||||
#include "libtorrent/time.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/extensions.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
#include "libtorrent/aux_/time.hpp"
|
||||
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace libtorrent {
|
||||
|
|
|
@ -51,8 +51,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/version.hpp"
|
||||
#include "libtorrent/extensions.hpp"
|
||||
#include "libtorrent/aux_/session_interface.hpp"
|
||||
//#include "libtorrent/aux_/escape_string.hpp"
|
||||
#include "libtorrent/broadcast_socket.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/peer_info.hpp"
|
||||
#include "libtorrent/random.hpp"
|
||||
#include "libtorrent/alloca.hpp"
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/create_torrent.hpp"
|
||||
#include "libtorrent/file_pool.hpp"
|
||||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for convert_to_wstring
|
||||
#include "libtorrent/disk_io_thread.hpp"
|
||||
#include "libtorrent/torrent_info.hpp" // for merkle_*()
|
||||
#include "libtorrent/performance_counters.hpp" // for counters
|
||||
|
|
|
@ -37,12 +37,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/bind.hpp>
|
||||
#include "libtorrent/entry.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#include "libtorrent/lazy_entry.hpp"
|
||||
#endif
|
||||
#include "libtorrent/bdecode.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/hex.hpp"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define for if (false) {} else for
|
||||
|
|
|
@ -34,7 +34,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/escape_string.hpp" // for to_string()
|
||||
#include "libtorrent/string_util.hpp" // for to_string()
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for convert_to_native
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
|
|
@ -42,7 +42,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/parse_url.hpp"
|
||||
#include "libtorrent/random.hpp"
|
||||
|
||||
|
@ -56,6 +55,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/utf8.hpp"
|
||||
#include "libtorrent/thread.hpp"
|
||||
|
||||
#include "libtorrent/aux_/escape_string.hpp"
|
||||
#include "libtorrent/string_util.hpp" // for to_string
|
||||
|
||||
#if TORRENT_USE_ICONV
|
||||
#include <iconv.h>
|
||||
#include <locale.h>
|
||||
|
@ -64,24 +66,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace libtorrent
|
||||
{
|
||||
|
||||
// lexical_cast's result depends on the locale. We need
|
||||
// a well defined result
|
||||
boost::array<char, 4 + std::numeric_limits<boost::int64_t>::digits10> to_string(boost::int64_t n)
|
||||
{
|
||||
boost::array<char, 4 + std::numeric_limits<boost::int64_t>::digits10> ret;
|
||||
char *p = &ret.back();
|
||||
*p = '\0';
|
||||
boost::uint64_t un = n;
|
||||
if (n < 0) un = -un; // TODO: warning C4146: unary minus operator applied to unsigned type, result still unsigned
|
||||
do {
|
||||
*--p = '0' + un % 10;
|
||||
un /= 10;
|
||||
} while (un);
|
||||
if (n < 0) *--p = '-';
|
||||
std::memmove(&ret[0], p, &ret.back() - p + 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string unescape_string(std::string const& s, error_code& ec)
|
||||
{
|
||||
std::string ret;
|
||||
|
@ -217,6 +201,7 @@ namespace libtorrent
|
|||
}
|
||||
#endif
|
||||
|
||||
// TODO: 2 this should probably be moved into string_util.cpp
|
||||
std::string read_until(char const*& str, char delim, char const* end)
|
||||
{
|
||||
TORRENT_ASSERT(str <= end);
|
||||
|
|
|
@ -47,17 +47,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/alloca.hpp"
|
||||
#include "libtorrent/allocator.hpp" // page_size
|
||||
#include "libtorrent/escape_string.hpp" // for string conversion
|
||||
#include "libtorrent/file.hpp"
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
#if TORRENT_DEBUG_FILE_LEAKS
|
||||
#include <set>
|
||||
#include "libtorrent/thread.hpp"
|
||||
#endif
|
||||
|
||||
// for convert_to_wstring and convert_to_native
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp"
|
||||
#include <stdio.h>
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
|
||||
#include "libtorrent/http_connection.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp"
|
||||
#include "libtorrent/instantiate_connection.hpp"
|
||||
#include "libtorrent/gzip.hpp"
|
||||
#include "libtorrent/parse_url.hpp"
|
||||
|
|
|
@ -37,8 +37,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/http_parser.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/parse_url.hpp" // for parse_url_components
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for read_until
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/session_impl.hpp"
|
||||
#include "libtorrent/parse_url.hpp"
|
||||
#include "libtorrent/peer_info.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for is_hex
|
||||
|
||||
using boost::shared_ptr;
|
||||
using libtorrent::aux::session_impl;
|
||||
|
|
|
@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
|
||||
#include "libtorrent/http_stream.hpp"
|
||||
#include "libtorrent/escape_string.hpp" // for base64encode
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for base64encode
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
|
|
|
@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/string_util.hpp"
|
||||
#include "libtorrent/settings_pack.hpp"
|
||||
#include "libtorrent/hex.hpp"
|
||||
|
||||
#if TORRENT_USE_I2P
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/bencode.hpp"
|
||||
#include "libtorrent/io.hpp"
|
||||
#include "libtorrent/version.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/performance_counters.hpp" // for counters
|
||||
|
||||
using boost::ref;
|
||||
|
|
|
@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/buffer.hpp"
|
||||
#include "libtorrent/random.hpp"
|
||||
#include "libtorrent/http_parser.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/socket_io.hpp" // for print_address
|
||||
|
||||
#if defined TORRENT_ASIO_DEBUGGING
|
||||
|
|
|
@ -57,7 +57,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/extensions/lt_trackers.hpp"
|
||||
#include "libtorrent/alert_types.hpp"
|
||||
#include "libtorrent/io.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/parse_url.hpp"
|
||||
|
||||
namespace libtorrent { namespace
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/magnet_uri.hpp"
|
||||
#include "libtorrent/session.hpp"
|
||||
#include "libtorrent/torrent_handle.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
|
||||
#include <string>
|
||||
|
|
|
@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/socket_io.hpp"
|
||||
#include "libtorrent/io_service.hpp"
|
||||
#include "libtorrent/aux_/time.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp"
|
||||
|
||||
#if BOOST_VERSION < 103500
|
||||
#include <asio/ip/host_name.hpp>
|
||||
|
|
|
@ -38,7 +38,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifdef TORRENT_LOGGING
|
||||
#include <stdarg.h> // for va_start, va_end
|
||||
#include <stdio.h> // for vsnprintf
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifdef TORRENT_LOG_HASH_FAILURES
|
||||
|
||||
#include "libtorrent/peer_id.hpp" // sha1_hash
|
||||
#include "libtorrent/escape_string.hpp" // to_hex
|
||||
#include "libtorrent/hex.hpp" // to_hex
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
|
||||
void log_hash_block(FILE** f, libtorrent::torrent const& t, int piece, int block
|
||||
|
|
|
@ -32,7 +32,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
|
|
|
@ -89,7 +89,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
// for convert_to_wstring and convert_to_native
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp"
|
||||
|
||||
#define DEBUG_STORAGE 0
|
||||
#define DEBUG_DELETE_FILES 0
|
||||
|
|
|
@ -40,6 +40,25 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace libtorrent
|
||||
{
|
||||
|
||||
// lexical_cast's result depends on the locale. We need
|
||||
// a well defined result
|
||||
boost::array<char, 4 + std::numeric_limits<boost::int64_t>::digits10>
|
||||
to_string(boost::int64_t n)
|
||||
{
|
||||
boost::array<char, 4 + std::numeric_limits<boost::int64_t>::digits10> ret;
|
||||
char *p = &ret.back();
|
||||
*p = '\0';
|
||||
boost::uint64_t un = n;
|
||||
if (n < 0) un = -un; // TODO: warning C4146: unary minus operator applied to unsigned type, result still unsigned
|
||||
do {
|
||||
*--p = '0' + un % 10;
|
||||
un /= 10;
|
||||
} while (un);
|
||||
if (n < 0) *--p = '-';
|
||||
std::memmove(&ret[0], p, &ret.back() - p + 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool is_alpha(char c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
|
|
|
@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/ConvertUTF.h"
|
||||
#include "libtorrent/torrent_info.hpp"
|
||||
#include "libtorrent/escape_string.hpp" // is_space
|
||||
#include "libtorrent/string_util.hpp" // is_space
|
||||
#include "libtorrent/bencode.hpp"
|
||||
#include "libtorrent/hasher.hpp"
|
||||
#include "libtorrent/entry.hpp"
|
||||
|
@ -51,6 +51,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/time.hpp"
|
||||
#include "libtorrent/invariant_check.hpp"
|
||||
#include "libtorrent/aux_/session_settings.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp" // maybe_url_encode
|
||||
#include "libtorrent/add_torrent_params.hpp"
|
||||
#include "libtorrent/magnet_uri.hpp"
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/parse_url.hpp"
|
||||
#include "libtorrent/udp_tracker_connection.hpp"
|
||||
#include "libtorrent/io.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/hex.hpp"
|
||||
#include "libtorrent/broadcast_socket.hpp" // for is_any
|
||||
#include "libtorrent/random.hpp"
|
||||
#include "libtorrent/aux_/session_settings.hpp"
|
||||
|
|
|
@ -37,9 +37,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/parse_url.hpp"
|
||||
#include "libtorrent/xml_parse.hpp"
|
||||
#include "libtorrent/enum_net.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/random.hpp"
|
||||
#include "libtorrent/aux_/time.hpp" // for aux::time_now()
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
|
||||
|
||||
#if defined TORRENT_ASIO_DEBUGGING
|
||||
#include "libtorrent/debug.hpp"
|
||||
|
|
|
@ -48,6 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/peer_info.hpp"
|
||||
#include "libtorrent/aux_/session_interface.hpp"
|
||||
#include "libtorrent/alert_manager.hpp" // for alert_manageralert_manager
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for is_hex
|
||||
|
||||
using boost::shared_ptr;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
|
||||
#include "libtorrent/xml_parse.hpp"
|
||||
#include "libtorrent/string_util.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/hasher.hpp"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "libtorrent/escape_string.hpp" // from_hex
|
||||
#include "libtorrent/hex.hpp" // from_hex
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/buffer.hpp"
|
||||
#include "libtorrent/entry.hpp"
|
||||
#include "libtorrent/torrent_info.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/broadcast_socket.hpp"
|
||||
#include "libtorrent/identify_client.hpp"
|
||||
#include "libtorrent/file.hpp"
|
||||
|
|
|
@ -31,7 +31,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
|
||||
#include "test.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp"
|
||||
#include "libtorrent/hex.hpp"
|
||||
#include "libtorrent/string_util.hpp"
|
||||
#include <iostream>
|
||||
#include <string.h> // for strcmp
|
||||
|
|
|
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/file_storage.hpp"
|
||||
#include "libtorrent/torrent_info.hpp"
|
||||
#include "libtorrent/create_torrent.hpp"
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for convert_path_to_posix
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
|
@ -587,6 +588,8 @@ void test_resolve_duplicates()
|
|||
std::string p = ti.files().file_path(i);
|
||||
convert_path_to_posix(p);
|
||||
fprintf(stderr, "%s == %s\n", p.c_str(), filenames[i]);
|
||||
|
||||
// TODO: 3 fix duplicate name detection to make this test pass
|
||||
TEST_EQUAL(p, filenames[i]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue