This commit is contained in:
arvidn 2017-01-28 14:36:28 -05:00
commit 17ee28d176
15 changed files with 24 additions and 19 deletions

View File

@ -6,7 +6,6 @@ nobase_include_HEADERS = \
alert.hpp \ alert.hpp \
alert_manager.hpp \ alert_manager.hpp \
alert_types.hpp \ alert_types.hpp \
alloca.hpp \
allocator.hpp \ allocator.hpp \
announce_entry.hpp \ announce_entry.hpp \
assert.hpp \ assert.hpp \
@ -196,6 +195,7 @@ nobase_include_HEADERS = \
aux_/storage_utils.hpp \ aux_/storage_utils.hpp \
aux_/numeric_cast.hpp \ aux_/numeric_cast.hpp \
aux_/unique_ptr.hpp \ aux_/unique_ptr.hpp \
aux_/alloca.hpp \
\ \
extensions/smart_ban.hpp \ extensions/smart_ban.hpp \
extensions/ut_metadata.hpp \ extensions/ut_metadata.hpp \

View File

@ -34,27 +34,31 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp" #include "libtorrent/config.hpp"
#include "libtorrent/span.hpp" #include "libtorrent/span.hpp"
#include "libtorrent/aux_/numeric_cast.hpp"
#if defined TORRENT_WINDOWS || defined TORRENT_MINGW #if defined TORRENT_WINDOWS || defined TORRENT_MINGW
#include <malloc.h> #include <malloc.h>
#define TORRENT_ALLOCA(v, t, n) ::libtorrent::span<t> v; { \ #define TORRENT_ALLOCA(v, t, n) ::libtorrent::span<t> v; { \
t* TORRENT_ALLOCA_tmp = static_cast<t*>(_alloca(sizeof(t) * (std::size_t(n)))); \ std::size_t TORRENT_ALLOCA_size = ::libtorrent::aux::numeric_cast<std::size_t>(n); \
v = ::libtorrent::span<t>(TORRENT_ALLOCA_tmp, std::size_t(n)); } t* TORRENT_ALLOCA_tmp = static_cast<t*>(_alloca(sizeof(t) * TORRENT_ALLOCA_size)); \
v = ::libtorrent::span<t>(TORRENT_ALLOCA_tmp, TORRENT_ALLOCA_size); }
#elif defined TORRENT_BSD #elif defined TORRENT_BSD
#include <stdlib.h> #include <stdlib.h>
#define TORRENT_ALLOCA(v, t, n) ::libtorrent::span<t> v; { \ #define TORRENT_ALLOCA(v, t, n) ::libtorrent::span<t> v; { \
t* TORRENT_ALLOCA_tmp = static_cast<t*>(alloca(sizeof(t) * (std::size_t(n)))); \ std::size_t TORRENT_ALLOCA_size = ::libtorrent::aux::numeric_cast<std::size_t>(n); \
v = ::libtorrent::span<t>(TORRENT_ALLOCA_tmp, std::size_t(n)); } t* TORRENT_ALLOCA_tmp = static_cast<t*>(alloca(sizeof(t) * TORRENT_ALLOCA_size)); \
v = ::libtorrent::span<t>(TORRENT_ALLOCA_tmp, TORRENT_ALLOCA_size); }
#else #else
#include <alloca.h> #include <alloca.h>
#define TORRENT_ALLOCA(v, t, n) ::libtorrent::span<t> v; { \ #define TORRENT_ALLOCA(v, t, n) ::libtorrent::span<t> v; { \
t* TORRENT_ALLOCA_tmp = static_cast<t*>(alloca(sizeof(t) * (std::size_t(n)))); \ std::size_t TORRENT_ALLOCA_size = ::libtorrent::aux::numeric_cast<std::size_t>(n); \
v = ::libtorrent::span<t>(TORRENT_ALLOCA_tmp, std::size_t(n)); } t* TORRENT_ALLOCA_tmp = static_cast<t*>(alloca(sizeof(t) * TORRENT_ALLOCA_size)); \
v = ::libtorrent::span<t>(TORRENT_ALLOCA_tmp, TORRENT_ALLOCA_size); }
#endif #endif

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_NUMERIC_CAST_HPP #define TORRENT_NUMERIC_CAST_HPP
#include <type_traits> #include <type_traits>
#include <limits>
#include "libtorrent/assert.hpp" #include "libtorrent/assert.hpp"

View File

@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libtorrent/bdecode.hpp" #include "libtorrent/bdecode.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/aux_/numeric_cast.hpp" #include "libtorrent/aux_/numeric_cast.hpp"
#include <limits> #include <limits>
#include <cstring> // for memset #include <cstring> // for memset

View File

@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/error.hpp" #include "libtorrent/error.hpp"
#include "libtorrent/disk_io_thread.hpp" // disk_operation_failed #include "libtorrent/disk_io_thread.hpp" // disk_operation_failed
#include "libtorrent/invariant_check.hpp" #include "libtorrent/invariant_check.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/performance_counters.hpp" #include "libtorrent/performance_counters.hpp"
#include "libtorrent/aux_/time.hpp" #include "libtorrent/aux_/time.hpp"
#include "libtorrent/aux_/block_cache_reference.hpp" #include "libtorrent/aux_/block_cache_reference.hpp"

View File

@ -64,7 +64,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/broadcast_socket.hpp" #include "libtorrent/broadcast_socket.hpp"
#include "libtorrent/peer_info.hpp" #include "libtorrent/peer_info.hpp"
#include "libtorrent/random.hpp" #include "libtorrent/random.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/socket_type.hpp" #include "libtorrent/socket_type.hpp"
#include "libtorrent/performance_counters.hpp" // for counters #include "libtorrent/performance_counters.hpp" // for counters

View File

@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/disk_io_thread.hpp" #include "libtorrent/disk_io_thread.hpp"
#include "libtorrent/string_util.hpp" // for allocate_string_copy #include "libtorrent/string_util.hpp" // for allocate_string_copy
#include "libtorrent/disk_buffer_holder.hpp" #include "libtorrent/disk_buffer_holder.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/error_code.hpp" #include "libtorrent/error_code.hpp"
#include "libtorrent/error.hpp" #include "libtorrent/error.hpp"
#include "libtorrent/file_pool.hpp" #include "libtorrent/file_pool.hpp"

View File

@ -67,7 +67,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_pop.hpp" #include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/config.hpp" #include "libtorrent/config.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/file.hpp" #include "libtorrent/file.hpp"
#include "libtorrent/string_util.hpp" #include "libtorrent/string_util.hpp"
#include "libtorrent/aux_/max_path.hpp" // for TORRENT_MAX_PATH #include "libtorrent/aux_/max_path.hpp" // for TORRENT_MAX_PATH

View File

@ -50,7 +50,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_pop.hpp" #include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/random.hpp" #include "libtorrent/random.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/pe_crypto.hpp" #include "libtorrent/pe_crypto.hpp"
#include "libtorrent/hasher.hpp" #include "libtorrent/hasher.hpp"

View File

@ -52,7 +52,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/peer_info.hpp" #include "libtorrent/peer_info.hpp"
#include "libtorrent/bt_peer_connection.hpp" #include "libtorrent/bt_peer_connection.hpp"
#include "libtorrent/error.hpp" #include "libtorrent/error.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/disk_interface.hpp" #include "libtorrent/disk_interface.hpp"
#include "libtorrent/bandwidth_manager.hpp" #include "libtorrent/bandwidth_manager.hpp"
#include "libtorrent/request_blocks.hpp" // for request_a_block #include "libtorrent/request_blocks.hpp" // for request_a_block

View File

@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/piece_picker.hpp" #include "libtorrent/piece_picker.hpp"
#include "libtorrent/bitfield.hpp" #include "libtorrent/bitfield.hpp"
#include "libtorrent/random.hpp" #include "libtorrent/random.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/aux_/range.hpp" #include "libtorrent/aux_/range.hpp"
#include "libtorrent/performance_counters.hpp" // for counters #include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/alert_types.hpp" // for picker_log_alert #include "libtorrent/alert_types.hpp" // for picker_log_alert

View File

@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/storage_utils.hpp" #include "libtorrent/aux_/storage_utils.hpp"
#include "libtorrent/file_storage.hpp" #include "libtorrent/file_storage.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/file.hpp" // for count_bufs #include "libtorrent/file.hpp" // for count_bufs
#include "libtorrent/part_file.hpp" #include "libtorrent/part_file.hpp"
#include "libtorrent/session.hpp" // for session::delete_files #include "libtorrent/session.hpp" // for session::delete_files

View File

@ -86,7 +86,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/request_blocks.hpp" #include "libtorrent/request_blocks.hpp"
#include "libtorrent/performance_counters.hpp" // for counters #include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/resolver_interface.hpp" #include "libtorrent/resolver_interface.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/resolve_links.hpp" #include "libtorrent/resolve_links.hpp"
#include "libtorrent/aux_/file_progress.hpp" #include "libtorrent/aux_/file_progress.hpp"
#include "libtorrent/aux_/has_block.hpp" #include "libtorrent/aux_/has_block.hpp"

View File

@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/utp_stream.hpp" #include "libtorrent/utp_stream.hpp"
#include "libtorrent/sliding_average.hpp" #include "libtorrent/sliding_average.hpp"
#include "libtorrent/utp_socket_manager.hpp" #include "libtorrent/utp_socket_manager.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/timestamp_history.hpp" #include "libtorrent/timestamp_history.hpp"
#include "libtorrent/error.hpp" #include "libtorrent/error.hpp"
#include "libtorrent/random.hpp" #include "libtorrent/random.hpp"

View File

@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/socket.hpp" #include "libtorrent/socket.hpp"
#include "libtorrent/io.hpp" #include "libtorrent/io.hpp"
#include "libtorrent/alloca.hpp" #include "libtorrent/aux_/alloca.hpp" // for use of private TORRENT_ALLOCA
#include "libtorrent/time.hpp" #include "libtorrent/time.hpp"
#include "libtorrent/peer_info.hpp" #include "libtorrent/peer_info.hpp"
#include "libtorrent/bdecode.hpp" #include "libtorrent/bdecode.hpp"