mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +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
@@ -59,7 +59,7 @@ void save(std::string_view filename, address_range_t const* ranges, size_t n_ran
|
||||
if (!out.is_open())
|
||||
{
|
||||
tr_logAddWarn(fmt::format(
|
||||
_("Couldn't read '{path}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't read '{path}': {error} ({error_code})")),
|
||||
fmt::arg("path", filename),
|
||||
fmt::arg("error", tr_strerror(errno)),
|
||||
fmt::arg("error_code", errno)));
|
||||
@@ -70,7 +70,7 @@ void save(std::string_view filename, address_range_t const* ranges, size_t n_ran
|
||||
!out.write(reinterpret_cast<char const*>(ranges), n_ranges * sizeof(*ranges)))
|
||||
{
|
||||
tr_logAddWarn(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", tr_strerror(errno)),
|
||||
fmt::arg("error_code", errno)));
|
||||
@@ -78,7 +78,8 @@ void save(std::string_view filename, address_range_t const* ranges, size_t n_ran
|
||||
else
|
||||
{
|
||||
tr_logAddInfo(fmt::format(
|
||||
tr_ngettext("Blocklist '{path}' has {count} entry", "Blocklist '{path}' has {count} entries", n_ranges),
|
||||
fmt::runtime(
|
||||
tr_ngettext("Blocklist '{path}' has {count} entry", "Blocklist '{path}' has {count} entries", n_ranges)),
|
||||
fmt::arg("path", tr_sys_path_basename(filename)),
|
||||
fmt::arg("count", n_ranges)));
|
||||
}
|
||||
@@ -237,7 +238,7 @@ auto parseFile(std::string_view filename)
|
||||
if (!in.is_open())
|
||||
{
|
||||
tr_logAddWarn(fmt::format(
|
||||
_("Couldn't read '{path}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't read '{path}': {error} ({error_code})")),
|
||||
fmt::arg("path", filename),
|
||||
fmt::arg("error", tr_strerror(errno)),
|
||||
fmt::arg("error_code", errno)));
|
||||
@@ -256,7 +257,7 @@ auto parseFile(std::string_view filename)
|
||||
else
|
||||
{
|
||||
// don't try to display the actual lines - it causes issues
|
||||
tr_logAddWarn(fmt::format(_("Couldn't parse line: '{line}'"), fmt::arg("line", line_number)));
|
||||
tr_logAddWarn(fmt::format(fmt::runtime(_("Couldn't parse line: '{line}'")), fmt::arg("line", line_number)));
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
@@ -335,7 +336,7 @@ void Blocklists::Blocklist::ensureLoaded() const
|
||||
if (error)
|
||||
{
|
||||
tr_logAddWarn(fmt::format(
|
||||
_("Couldn't read '{path}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't read '{path}': {error} ({error_code})")),
|
||||
fmt::arg("path", bin_file_),
|
||||
fmt::arg("error", error.message()),
|
||||
fmt::arg("error_code", error.code())));
|
||||
@@ -350,7 +351,7 @@ void Blocklists::Blocklist::ensureLoaded() const
|
||||
if (!in)
|
||||
{
|
||||
tr_logAddWarn(fmt::format(
|
||||
_("Couldn't read '{path}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't read '{path}': {error} ({error_code})")),
|
||||
fmt::arg("path", bin_file_),
|
||||
fmt::arg("error", tr_strerror(errno)),
|
||||
fmt::arg("error_code", errno)));
|
||||
@@ -400,7 +401,8 @@ void Blocklists::Blocklist::ensureLoaded() const
|
||||
}
|
||||
|
||||
tr_logAddInfo(fmt::format(
|
||||
tr_ngettext("Blocklist '{path}' has {count} entry", "Blocklist '{path}' has {count} entries", std::size(rules_)),
|
||||
fmt::runtime(
|
||||
tr_ngettext("Blocklist '{path}' has {count} entry", "Blocklist '{path}' has {count} entries", std::size(rules_))),
|
||||
fmt::arg("path", tr_sys_path_basename(bin_file_)),
|
||||
fmt::arg("count", std::size(rules_))));
|
||||
}
|
||||
@@ -470,7 +472,7 @@ std::optional<Blocklists::Blocklist> Blocklists::Blocklist::saveNew(
|
||||
if (error)
|
||||
{
|
||||
tr_logAddWarn(fmt::format(
|
||||
_("Couldn't save '{path}': {error} ({error_code})"),
|
||||
fmt::runtime(_("Couldn't save '{path}': {error} ({error_code})")),
|
||||
fmt::arg("path", src_file),
|
||||
fmt::arg("error", error.message()),
|
||||
fmt::arg("error_code", error.code())));
|
||||
|
||||
Reference in New Issue
Block a user