forked from premiere/premiere-libtorrent
remove resolve_links disk job left-overs and convert some C-arrays to std::array
This commit is contained in:
parent
48ef3b6bf7
commit
9a19ff344b
|
@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "libtorrent/time.hpp"
|
#include "libtorrent/time.hpp"
|
||||||
#include "libtorrent/error_code.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<job_action_t>(j)), block(b) {}
|
explicit piece_log_t(artificial_jobs j, int b = -1): job(static_cast<job_action_t>(j)), block(b) {}
|
||||||
|
|
||||||
static char const* const job_names[7];
|
static std::array<char const*, 7> const job_names;
|
||||||
};
|
};
|
||||||
|
|
||||||
char const* job_name(job_action_t j);
|
char const* job_name(job_action_t j);
|
||||||
|
@ -104,7 +105,7 @@ namespace aux {
|
||||||
void assert_print_piece(cached_piece_entry const* pe);
|
void assert_print_piece(cached_piece_entry const* pe);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const char* const job_action_name[];
|
extern std::array<const char*, 15> const job_action_name;
|
||||||
|
|
||||||
struct TORRENT_EXTRA_EXPORT partial_hash
|
struct TORRENT_EXTRA_EXPORT partial_hash
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,6 @@ namespace libtorrent {
|
||||||
, trim_cache
|
, trim_cache
|
||||||
, file_priority
|
, file_priority
|
||||||
, clear_piece
|
, clear_piece
|
||||||
, resolve_links
|
|
||||||
, num_job_ids
|
, num_job_ids
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,6 @@ namespace aux {
|
||||||
status_t do_trim_cache(disk_io_job* j, jobqueue_t& completed_jobs);
|
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_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_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();
|
void call_job_handlers();
|
||||||
|
|
||||||
|
|
|
@ -188,8 +188,8 @@ void log_refcounts(cached_piece_entry const* pe)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char* const job_action_name[] =
|
std::array<const char*, 15> const job_action_name =
|
||||||
{
|
{{
|
||||||
"read",
|
"read",
|
||||||
"write",
|
"write",
|
||||||
"hash",
|
"hash",
|
||||||
|
@ -205,17 +205,16 @@ const char* const job_action_name[] =
|
||||||
"trim_cache",
|
"trim_cache",
|
||||||
"set_file_priority",
|
"set_file_priority",
|
||||||
"clear_piece",
|
"clear_piece",
|
||||||
"resolve_links"
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
// make sure the job names array covers all the job IDs
|
// make sure the job names array covers all the job IDs
|
||||||
static_assert(sizeof(job_action_name)/sizeof(job_action_name[0])
|
static_assert(int(job_action_name.size()) == static_cast<int>(job_action_t::num_job_ids)
|
||||||
== static_cast<int>(job_action_t::num_job_ids), "disk-job-action and action-name-array mismatch");
|
, "disk-job-action and action-name-array mismatch");
|
||||||
|
|
||||||
#if TORRENT_USE_ASSERTS || !defined TORRENT_DISABLE_LOGGING
|
#if TORRENT_USE_ASSERTS || !defined TORRENT_DISABLE_LOGGING
|
||||||
|
|
||||||
char const* const piece_log_t::job_names[7] =
|
std::array<char const*, 7> const piece_log_t::job_names =
|
||||||
{
|
{{
|
||||||
"flushing",
|
"flushing",
|
||||||
"flush_expired",
|
"flush_expired",
|
||||||
"try_flush_write_blocks",
|
"try_flush_write_blocks",
|
||||||
|
@ -223,7 +222,7 @@ static_assert(sizeof(job_action_name)/sizeof(job_action_name[0])
|
||||||
"flush_range",
|
"flush_range",
|
||||||
"clear_outstanding_jobs",
|
"clear_outstanding_jobs",
|
||||||
"set_outstanding_jobs",
|
"set_outstanding_jobs",
|
||||||
};
|
}};
|
||||||
|
|
||||||
char const* job_name(job_action_t const job)
|
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";
|
return "unknown";
|
||||||
|
|
||||||
if (j < piece_log_t::flushing)
|
if (j < piece_log_t::flushing)
|
||||||
return job_action_name[j];
|
return job_action_name[static_cast<std::size_t>(j)];
|
||||||
return piece_log_t::job_names[j - piece_log_t::flushing];
|
return piece_log_t::job_names[static_cast<std::size_t>(j - piece_log_t::flushing)];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TORRENT_DISABLE_LOGGING
|
#endif // TORRENT_DISABLE_LOGGING
|
||||||
|
|
Loading…
Reference in New Issue