mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
Fix building transmission with C++23 (#6832)
* fix: operator== should return bool in tr_strbuf Fixes build error with C++20/C++23 error: return type 'auto' of selected 'operator==' function for rewritten '!=' comparison is not 'bool' Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: explicitly specify Blocklist::size() return type as size_t Fixes building with C++20/C++23 error: no matching function for call to 'size' function 'size' with deduced return type cannot be used before it is defined Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: wrap runtime format strings with fmt::runtime in library, daemon and cli fmt::format_string ctor is consteval with C++20 See https://github.com/fmtlib/fmt/issues/2438 Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: wrap runtime format strings with fmt::runtime for GTK client Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: allow to override C and CXX standard via cmdline or env Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: add job to check if transmission compiles with C++23 Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * Address code review by mikedld Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix new found fmt build errors Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * Address code review by tearfur Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: make tr_net_init_mgr singleton buildable with C++23 Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> --------- Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
committed by
GitHub
parent
24f58f70ee
commit
7e87adcd91
@@ -134,7 +134,7 @@ bool tr_torrentSetMetainfoFromFile(tr_torrent* tor, tr_torrent_metainfo const* m
|
||||
if (error)
|
||||
{
|
||||
tor->error().set_local_error(fmt::format(
|
||||
_("Couldn't use metainfo from '{path}' for '{magnet}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't use metainfo from '{path}' for '{magnet}': {error} ({error_code})")),
|
||||
fmt::arg("path", filename),
|
||||
fmt::arg("magnet", tor->magnet()),
|
||||
fmt::arg("error", error.message()),
|
||||
@@ -398,7 +398,7 @@ void torrentCallScript(tr_torrent const* tor, std::string const& script)
|
||||
{ "TR_TORRENT_TRACKERS"sv, trackers_str },
|
||||
};
|
||||
|
||||
tr_logAddInfoTor(tor, fmt::format(_("Calling script '{path}'"), fmt::arg("path", script)));
|
||||
tr_logAddInfoTor(tor, fmt::format(fmt::runtime(_("Calling script '{path}'")), fmt::arg("path", script)));
|
||||
|
||||
auto error = tr_error{};
|
||||
if (!tr_spawn_async(std::data(cmd), env, TR_IF_WIN32("\\", "/"), &error))
|
||||
@@ -406,7 +406,7 @@ void torrentCallScript(tr_torrent const* tor, std::string const& script)
|
||||
tr_logAddWarnTor(
|
||||
tor,
|
||||
fmt::format(
|
||||
_("Couldn't call script '{path}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't call script '{path}': {error} ({error_code})")),
|
||||
fmt::arg("path", script),
|
||||
fmt::arg("error", error.message()),
|
||||
fmt::arg("error_code", error.code())));
|
||||
@@ -717,7 +717,7 @@ void tr_torrentRemoveInSessionThread(
|
||||
tor->is_deleting_ = false;
|
||||
|
||||
tor->error().set_local_error(fmt::format(
|
||||
_("Couldn't remove all torrent files: {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't remove all torrent files: {error} ({error_code})")),
|
||||
fmt::arg("error", error.message()),
|
||||
fmt::arg("error_code", error.code())));
|
||||
tr_torrentStop(tor);
|
||||
@@ -1002,7 +1002,7 @@ void tr_torrent::init(tr_ctor const& ctor)
|
||||
if (error)
|
||||
{
|
||||
this->error().set_local_error(fmt::format(
|
||||
_("Couldn't save '{path}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't save '{path}': {error} ({error_code})")),
|
||||
fmt::arg("path", file_path),
|
||||
fmt::arg("error", error.message()),
|
||||
fmt::arg("error_code", error.code())));
|
||||
@@ -1100,7 +1100,7 @@ void tr_torrent::set_location_in_session_thread(std::string_view const path, boo
|
||||
if (error)
|
||||
{
|
||||
this->error().set_local_error(fmt::format(
|
||||
_("Couldn't move '{old_path}' to '{path}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't move '{old_path}' to '{path}': {error} ({error_code})")),
|
||||
fmt::arg("old_path", current_dir()),
|
||||
fmt::arg("path", path),
|
||||
fmt::arg("error", error.message()),
|
||||
@@ -1606,7 +1606,7 @@ void tr_torrent::update_file_path(tr_file_index_t file, std::optional<bool> has_
|
||||
tr_logAddErrorTor(
|
||||
this,
|
||||
fmt::format(
|
||||
_("Couldn't move '{old_path}' to '{path}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't move '{old_path}' to '{path}': {error} ({error_code})")),
|
||||
fmt::arg("old_path", oldpath),
|
||||
fmt::arg("path", newpath),
|
||||
fmt::arg("error", error.message()),
|
||||
@@ -1991,7 +1991,7 @@ bool tr_torrent::set_announce_list(tr_announce_list announce_list)
|
||||
if (save_error.has_value())
|
||||
{
|
||||
error().set_local_error(fmt::format(
|
||||
_("Couldn't save '{path}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't save '{path}': {error} ({error_code})")),
|
||||
fmt::arg("path", filename),
|
||||
fmt::arg("error", save_error.message()),
|
||||
fmt::arg("error_code", save_error.code())));
|
||||
@@ -2044,7 +2044,7 @@ void tr_torrent::on_tracker_response(tr_tracker_event const* event)
|
||||
tr_logAddWarnTor(
|
||||
this,
|
||||
fmt::format(
|
||||
_("Tracker warning: '{warning}' ({url})"),
|
||||
fmt::runtime(_("Tracker warning: '{warning}' ({url})")),
|
||||
fmt::arg("warning", event->text),
|
||||
fmt::arg("url", tr_urlTrackerLogName(event->announce_url))));
|
||||
error_.set_tracker_warning(event->announce_url, event->text);
|
||||
|
||||
Reference in New Issue
Block a user