diff --git a/include/libtorrent/block_cache.hpp b/include/libtorrent/block_cache.hpp index 82529253c..3db9c0ca7 100644 --- a/include/libtorrent/block_cache.hpp +++ b/include/libtorrent/block_cache.hpp @@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "libtorrent/time.hpp" #include "libtorrent/error_code.hpp" @@ -92,7 +93,7 @@ namespace aux { }; explicit piece_log_t(artificial_jobs j, int b = -1): job(static_cast(j)), block(b) {} - static char const* const job_names[7]; + static std::array const job_names; }; char const* job_name(job_action_t j); @@ -104,7 +105,7 @@ namespace aux { void assert_print_piece(cached_piece_entry const* pe); #endif - extern const char* const job_action_name[]; + extern std::array const job_action_name; struct TORRENT_EXTRA_EXPORT partial_hash { diff --git a/include/libtorrent/disk_io_job.hpp b/include/libtorrent/disk_io_job.hpp index 84c1ef87d..ac1cdd624 100644 --- a/include/libtorrent/disk_io_job.hpp +++ b/include/libtorrent/disk_io_job.hpp @@ -75,7 +75,6 @@ namespace libtorrent { , trim_cache , file_priority , clear_piece - , resolve_links , num_job_ids }; diff --git a/include/libtorrent/disk_io_thread.hpp b/include/libtorrent/disk_io_thread.hpp index 8cf83c0f4..0c89a5907 100644 --- a/include/libtorrent/disk_io_thread.hpp +++ b/include/libtorrent/disk_io_thread.hpp @@ -382,7 +382,6 @@ namespace aux { status_t do_trim_cache(disk_io_job* j, jobqueue_t& completed_jobs); status_t do_file_priority(disk_io_job* j, jobqueue_t& completed_jobs); status_t do_clear_piece(disk_io_job* j, jobqueue_t& completed_jobs); - status_t do_resolve_links(disk_io_job* j, jobqueue_t& completed_jobs); void call_job_handlers(); diff --git a/src/block_cache.cpp b/src/block_cache.cpp index b21bd28a1..efd95ff1e 100644 --- a/src/block_cache.cpp +++ b/src/block_cache.cpp @@ -188,8 +188,8 @@ void log_refcounts(cached_piece_entry const* pe) } #endif -const char* const job_action_name[] = -{ +std::array const job_action_name = +{{ "read", "write", "hash", @@ -205,17 +205,16 @@ const char* const job_action_name[] = "trim_cache", "set_file_priority", "clear_piece", - "resolve_links" -}; +}}; // make sure the job names array covers all the job IDs -static_assert(sizeof(job_action_name)/sizeof(job_action_name[0]) - == static_cast(job_action_t::num_job_ids), "disk-job-action and action-name-array mismatch"); +static_assert(int(job_action_name.size()) == static_cast(job_action_t::num_job_ids) + , "disk-job-action and action-name-array mismatch"); #if TORRENT_USE_ASSERTS || !defined TORRENT_DISABLE_LOGGING - char const* const piece_log_t::job_names[7] = - { + std::array const piece_log_t::job_names = + {{ "flushing", "flush_expired", "try_flush_write_blocks", @@ -223,7 +222,7 @@ static_assert(sizeof(job_action_name)/sizeof(job_action_name[0]) "flush_range", "clear_outstanding_jobs", "set_outstanding_jobs", - }; + }}; char const* job_name(job_action_t const job) { @@ -232,8 +231,8 @@ static_assert(sizeof(job_action_name)/sizeof(job_action_name[0]) return "unknown"; if (j < piece_log_t::flushing) - return job_action_name[j]; - return piece_log_t::job_names[j - piece_log_t::flushing]; + return job_action_name[static_cast(j)]; + return piece_log_t::job_names[static_cast(j - piece_log_t::flushing)]; } #endif // TORRENT_DISABLE_LOGGING