mirror of
https://github.com/transmission/transmission
synced 2024-12-21 23:32:35 +00:00
chore: remove FMT_STRING macros (#6497)
This commit is contained in:
parent
ea52e75476
commit
3f6969217c
23 changed files with 88 additions and 93 deletions
12
cli/cli.cc
12
cli/cli.cc
|
@ -96,15 +96,15 @@ void sigHandler(int signal);
|
|||
|
||||
if (ratio < 10.0)
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:.2f}"), ratio);
|
||||
return fmt::format("{:.2f}", ratio);
|
||||
}
|
||||
|
||||
if (ratio < 100.0)
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:.1f}"), ratio);
|
||||
return fmt::format("{:.1f}", ratio);
|
||||
}
|
||||
|
||||
return fmt::format(FMT_STRING("{:.0f}"), ratio);
|
||||
return fmt::format("{:.0f}", ratio);
|
||||
}
|
||||
|
||||
bool waitingOnWeb;
|
||||
|
@ -126,7 +126,7 @@ void onTorrentFileDownloaded(tr_web::FetchResponse const& response)
|
|||
if (st->activity == TR_STATUS_CHECK)
|
||||
{
|
||||
return fmt::format(
|
||||
FMT_STRING("Verifying local files ({:.2f}%, {:.2f}% valid)"),
|
||||
"Verifying local files ({:.2f}%, {:.2f}% valid)",
|
||||
tr_truncd(100 * st->recheckProgress, 2),
|
||||
tr_truncd(100 * st->percentDone, 2));
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ void onTorrentFileDownloaded(tr_web::FetchResponse const& response)
|
|||
if (st->activity == TR_STATUS_DOWNLOAD)
|
||||
{
|
||||
return fmt::format(
|
||||
FMT_STRING("Progress: {:.1f}%, dl from {:d} of {:d} peers ({:s}), ul to {:d} ({:s}) [{:s}]"),
|
||||
"Progress: {:.1f}%, dl from {:d} of {:d} peers ({:s}), ul to {:d} ({:s}) [{:s}]",
|
||||
tr_truncd(100 * st->percentDone, 1),
|
||||
st->peersSendingToUs,
|
||||
st->peersConnected,
|
||||
|
@ -147,7 +147,7 @@ void onTorrentFileDownloaded(tr_web::FetchResponse const& response)
|
|||
if (st->activity == TR_STATUS_SEED)
|
||||
{
|
||||
return fmt::format(
|
||||
FMT_STRING("Seeding, uploading to {:d} of {:d} peer(s), {:s} [{:s}]"),
|
||||
"Seeding, uploading to {:d} of {:d} peer(s), {:s} [{:s}]",
|
||||
st->peersGettingFromUs,
|
||||
st->peersConnected,
|
||||
Speed{ st->pieceUploadSpeed_KBps, Speed::Units::KByps }.to_string(),
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
static void set_system_error(tr_error& error, int code, std::string_view message)
|
||||
{
|
||||
error.set(code, fmt::format(FMT_STRING("{:s}: {:s} ({:d}"), message, tr_strerror(code), code));
|
||||
error.set(code, fmt::format("{:s}: {:s} ({:d}", message, tr_strerror(code), code));
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYS_SIGNALFD_H
|
||||
|
|
|
@ -39,7 +39,7 @@ HANDLE service_stop_thread = nullptr;
|
|||
void set_system_error(tr_error& error, DWORD code, char const* message)
|
||||
{
|
||||
auto const system_message = tr_win32_format_message(code);
|
||||
error.set(code, fmt::format(FMT_STRING("{:s} ({:#08x}): {:s})"), message, code, system_message));
|
||||
error.set(code, fmt::format("{:s} ({:#08x}): {:s})", message, code, system_message));
|
||||
}
|
||||
|
||||
void do_log_system_error(char const* file, int line, tr_log_level level, DWORD code, char const* message)
|
||||
|
|
|
@ -1013,7 +1013,7 @@ void Application::Impl::on_app_exit()
|
|||
p->attach(*icon, 0, 0, 1, 2);
|
||||
|
||||
auto* top_label = Gtk::make_managed<Gtk::Label>();
|
||||
top_label->set_markup(fmt::format(FMT_STRING("<b>{:s}</b>"), _("Closing Connections…")));
|
||||
top_label->set_markup(fmt::format("<b>{:s}</b>", _("Closing Connections…")));
|
||||
top_label->set_halign(TR_GTK_ALIGN(START));
|
||||
top_label->set_valign(TR_GTK_ALIGN(CENTER));
|
||||
p->attach(*top_label, 1, 0, 1, 1);
|
||||
|
|
|
@ -608,12 +608,12 @@ void gtr_text_buffer_set_text(Glib::RefPtr<Gtk::TextBuffer> const& b, Glib::ustr
|
|||
|
||||
[[nodiscard]] std::string get_date_string(time_t t)
|
||||
{
|
||||
return t == 0 ? _("N/A") : fmt::format(FMT_STRING("{:%x}"), fmt::localtime(t));
|
||||
return t == 0 ? _("N/A") : fmt::format("{:%x}", fmt::localtime(t));
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string get_date_time_string(time_t t)
|
||||
{
|
||||
return t == 0 ? _("N/A") : fmt::format(FMT_STRING("{:%c}"), fmt::localtime(t));
|
||||
return t == 0 ? _("N/A") : fmt::format("{:%c}", fmt::localtime(t));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -1327,7 +1327,7 @@ void DetailsDialog::Impl::refreshPeerList(std::vector<tr_torrent*> const& torren
|
|||
|
||||
auto make_key = [](tr_torrent const* tor, tr_peer_stat const* ps)
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:d}.{:s}"), tr_torrentId(tor), ps->addr);
|
||||
return fmt::format("{:d}.{:s}", tr_torrentId(tor), ps->addr);
|
||||
};
|
||||
|
||||
/* step 3: add any new peers */
|
||||
|
@ -1395,7 +1395,7 @@ void DetailsDialog::Impl::refreshWebseedList(std::vector<tr_torrent*> const& tor
|
|||
|
||||
auto make_key = [](tr_torrent const* tor, char const* url)
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:d}.{:s}"), tr_torrentId(tor), url);
|
||||
return fmt::format("{:d}.{:s}", tr_torrentId(tor), url);
|
||||
};
|
||||
|
||||
/* step 1: mark all webseeds as not-updated */
|
||||
|
@ -1957,7 +1957,7 @@ void buildTrackerSummary(
|
|||
gstr << text_dir_mark.at(static_cast<int>(direction));
|
||||
gstr << (tracker.isBackup ? "<i>" : "<b>");
|
||||
gstr << Glib::Markup::escape_text(
|
||||
!key.empty() ? fmt::format(FMT_STRING("{:s} - {:s}"), tracker.host_and_port, key) : tracker.host_and_port);
|
||||
!key.empty() ? fmt::format("{:s} - {:s}", tracker.host_and_port, key) : tracker.host_and_port);
|
||||
gstr << (tracker.isBackup ? "</i>" : "</b>");
|
||||
|
||||
if (!tracker.isBackup)
|
||||
|
|
|
@ -285,7 +285,7 @@ bool refreshFilesForeach(
|
|||
if (new_progress != old_progress)
|
||||
{
|
||||
(*iter)[file_cols.prog] = new_progress;
|
||||
(*iter)[file_cols.prog_str] = fmt::format(FMT_STRING("{:d}%"), new_progress);
|
||||
(*iter)[file_cols.prog_str] = fmt::format("{:d}%", new_progress);
|
||||
}
|
||||
|
||||
return false; /* keep walking */
|
||||
|
|
|
@ -53,7 +53,7 @@ bool FreeSpaceLabel::Impl::on_freespace_timer()
|
|||
auto const capacity = tr_sys_path_get_capacity(dir_);
|
||||
auto const text = capacity ? fmt::format(_("{disk_space} free"), fmt::arg("disk_space", tr_strlsize(capacity->free))) :
|
||||
_("Error");
|
||||
label_.set_markup(fmt::format(FMT_STRING("<i>{:s}</i>"), text));
|
||||
label_.set_markup(fmt::format("<i>{:s}</i>", text));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -542,7 +542,7 @@ MakeDialog::Impl::Impl(MakeDialog& dialog, Glib::RefPtr<Gtk::Builder> const& bui
|
|||
file_radio_->signal_toggled().connect([this]() { onSourceToggled(file_radio_, file_chooser_); });
|
||||
file_chooser_->signal_selection_changed().connect([this]() { onChooserChosen(file_chooser_); });
|
||||
|
||||
pieces_lb_->set_markup(fmt::format(FMT_STRING("<i>{:s}</i>"), _("No source selected")));
|
||||
pieces_lb_->set_markup(fmt::format("<i>{:s}</i>", _("No source selected")));
|
||||
|
||||
piece_size_scale_->set_visible(false);
|
||||
piece_size_scale_->signal_value_changed().connect([this]() { onPieceSizeUpdated(); });
|
||||
|
|
|
@ -442,7 +442,7 @@ Glib::ustring Torrent::Impl::get_short_status_text() const
|
|||
case TR_STATUS_DOWNLOAD:
|
||||
case TR_STATUS_SEED:
|
||||
return fmt::format(
|
||||
FMT_STRING("{:s} {:s}"),
|
||||
"{:s} {:s}",
|
||||
get_short_transfer_text(),
|
||||
fmt::format(_("Ratio: {ratio}"), fmt::arg("ratio", tr_strlratio(cache_.ratio))));
|
||||
|
||||
|
@ -548,7 +548,7 @@ Glib::ustring Torrent::Impl::get_long_status_text() const
|
|||
default:
|
||||
if (auto const buf = get_short_transfer_text(); !std::empty(buf))
|
||||
{
|
||||
status_str += fmt::format(FMT_STRING(" - {:s}"), buf);
|
||||
status_str += fmt::format(" - {:s}", buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -420,7 +420,7 @@ void TorrentCellRenderer::Impl::render_compact(
|
|||
icon_renderer_->render(context, widget, icon_area, icon_area, flags);
|
||||
|
||||
progress_renderer_->property_value() = percent_done;
|
||||
progress_renderer_->property_text() = fmt::format(FMT_STRING("{:d}%"), percent_done);
|
||||
progress_renderer_->property_text() = fmt::format("{:d}%", percent_done);
|
||||
progress_renderer_->property_sensitive() = sensitive;
|
||||
render_progress_bar(context, widget, prog_area, flags, progress_color);
|
||||
|
||||
|
|
|
@ -1283,7 +1283,7 @@ void checkMultiscrapeMax(tr_announcer_impl* announcer, tr_scrape_response const&
|
|||
if (multiscrape_max != n)
|
||||
{
|
||||
// don't log the full URL, since that might have a personal announce id
|
||||
tr_logAddDebug(fmt::format(FMT_STRING("Reducing multiscrape max to {:d}"), n), tr_urlTrackerLogName(url));
|
||||
tr_logAddDebug(fmt::format("Reducing multiscrape max to {:d}", n), tr_urlTrackerLogName(url));
|
||||
|
||||
multiscrape_max = n;
|
||||
}
|
||||
|
|
|
@ -564,7 +564,7 @@ tr_sys_file_t tr_sys_file_get_std(tr_std_sys_file_t std_file, tr_error* error)
|
|||
break;
|
||||
|
||||
default:
|
||||
TR_ASSERT_MSG(false, fmt::format(FMT_STRING("unknown standard file {:d}"), static_cast<int>(std_file)));
|
||||
TR_ASSERT_MSG(false, fmt::format("unknown standard file {:d}", static_cast<int>(std_file)));
|
||||
|
||||
if (error != nullptr)
|
||||
{
|
||||
|
@ -1098,7 +1098,7 @@ namespace
|
|||
{
|
||||
if (error != nullptr)
|
||||
{
|
||||
error->set(ENOTDIR, fmt::format(FMT_STRING("File is in the way: {:s}"), path));
|
||||
error->set(ENOTDIR, fmt::format("File is in the way: {:s}", path));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -53,7 +53,7 @@ void set_system_error(tr_error* error, DWORD code)
|
|||
if (error != nullptr)
|
||||
{
|
||||
auto const message = tr_win32_format_message(code);
|
||||
error->set(code, !std::empty(message) ? message : fmt::format(FMT_STRING("Unknown error: {:#08x}"), code));
|
||||
error->set(code, !std::empty(message) ? message : fmt::format("Unknown error: {:#08x}", code));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -838,7 +838,7 @@ tr_sys_file_t tr_sys_file_get_std(tr_std_sys_file_t std_file, tr_error* error)
|
|||
break;
|
||||
|
||||
default:
|
||||
TR_ASSERT_MSG(false, fmt::format(FMT_STRING("unknown standard file {:d}"), std_file));
|
||||
TR_ASSERT_MSG(false, fmt::format("unknown standard file {:d}", std_file));
|
||||
set_system_error(error, ERROR_INVALID_PARAMETER);
|
||||
return TR_BAD_SYS_FILE;
|
||||
}
|
||||
|
|
|
@ -613,9 +613,7 @@ ReadState tr_handshake::can_read(tr_peerIo* peer_io, void* vhandshake, size_t* p
|
|||
break;
|
||||
|
||||
default:
|
||||
TR_ASSERT_MSG(
|
||||
false,
|
||||
fmt::format(FMT_STRING("unhandled handshake state {:d}"), static_cast<int>(handshake->state())));
|
||||
TR_ASSERT_MSG(false, fmt::format("unhandled handshake state {:d}", static_cast<int>(handshake->state())));
|
||||
ret = READ_ERR;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -295,7 +295,7 @@ void updateDesiredRequestCount(tr_peerMsgsImpl* msgs);
|
|||
__FILE__, \
|
||||
__LINE__, \
|
||||
(level), \
|
||||
fmt::format(FMT_STRING("{:s} [{:s}]: {:s}"), (msgs)->io->display_name(), (msgs)->user_agent().sv(), text), \
|
||||
fmt::format("{:s} [{:s}]: {:s}", (msgs)->io->display_name(), (msgs)->user_agent().sv(), text), \
|
||||
(msgs)->torrent->name()); \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -1012,7 +1012,7 @@ void parseLtepHandshake(tr_peerMsgsImpl* msgs, MessageReader& payload)
|
|||
return;
|
||||
}
|
||||
|
||||
logtrace(msgs, fmt::format(FMT_STRING("here is the base64-encoded handshake: [{:s}]"), tr_base64_encode(handshake_sv)));
|
||||
logtrace(msgs, fmt::format("here is the base64-encoded handshake: [{:s}]", tr_base64_encode(handshake_sv)));
|
||||
|
||||
/* does the peer prefer encrypted connections? */
|
||||
auto pex = tr_pex{};
|
||||
|
@ -1037,14 +1037,14 @@ void parseLtepHandshake(tr_peerMsgsImpl* msgs, MessageReader& payload)
|
|||
{
|
||||
msgs->peerSupportsPex = ut_pex != 0;
|
||||
msgs->ut_pex_id = static_cast<uint8_t>(ut_pex);
|
||||
logtrace(msgs, fmt::format(FMT_STRING("msgs->ut_pex is {:d}"), static_cast<int>(msgs->ut_pex_id)));
|
||||
logtrace(msgs, fmt::format("msgs->ut_pex is {:d}", static_cast<int>(msgs->ut_pex_id)));
|
||||
}
|
||||
|
||||
if (auto ut_metadata = int64_t{}; tr_variantDictFindInt(sub, TR_KEY_ut_metadata, &ut_metadata))
|
||||
{
|
||||
msgs->peerSupportsMetadataXfer = ut_metadata != 0;
|
||||
msgs->ut_metadata_id = static_cast<uint8_t>(ut_metadata);
|
||||
logtrace(msgs, fmt::format(FMT_STRING("msgs->ut_metadata_id is {:d}"), static_cast<int>(msgs->ut_metadata_id)));
|
||||
logtrace(msgs, fmt::format("msgs->ut_metadata_id is {:d}", static_cast<int>(msgs->ut_metadata_id)));
|
||||
}
|
||||
|
||||
if (auto ut_holepunch = int64_t{}; tr_variantDictFindInt(sub, TR_KEY_ut_holepunch, &ut_holepunch))
|
||||
|
@ -1089,7 +1089,7 @@ void parseLtepHandshake(tr_peerMsgsImpl* msgs, MessageReader& payload)
|
|||
{
|
||||
port.set_host(p);
|
||||
msgs->publish(tr_peer_event::GotPort(port));
|
||||
logtrace(msgs, fmt::format(FMT_STRING("peer's port is now {:d}"), p));
|
||||
logtrace(msgs, fmt::format("peer's port is now {:d}", p));
|
||||
}
|
||||
|
||||
std::byte const* addr_compact = nullptr;
|
||||
|
@ -1132,9 +1132,7 @@ void parseUtMetadata(tr_peerMsgsImpl* msgs, MessageReader& payload_in)
|
|||
(void)tr_variantDictFindInt(&*var, TR_KEY_total_size, &total_size);
|
||||
}
|
||||
|
||||
logtrace(
|
||||
msgs,
|
||||
fmt::format(FMT_STRING("got ut_metadata msg: type {:d}, piece {:d}, total_size {:d}"), msg_type, piece, total_size));
|
||||
logtrace(msgs, fmt::format("got ut_metadata msg: type {:d}, piece {:d}, total_size {:d}", msg_type, piece, total_size));
|
||||
|
||||
if (msg_type == MetadataMsgType::Reject)
|
||||
{
|
||||
|
@ -1241,7 +1239,7 @@ void parseLtep(tr_peerMsgsImpl* msgs, MessageReader& payload)
|
|||
}
|
||||
else
|
||||
{
|
||||
logtrace(msgs, fmt::format(FMT_STRING("skipping unknown ltep message ({:d})"), static_cast<int>(ltep_msgid)));
|
||||
logtrace(msgs, fmt::format("skipping unknown ltep message ({:d})", static_cast<int>(ltep_msgid)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1407,7 +1405,7 @@ ReadResult process_peer_message(tr_peerMsgsImpl* msgs, uint8_t id, MessageReader
|
|||
|
||||
case BtPeerMsgs::Have:
|
||||
ui32 = payload.to_uint32();
|
||||
logtrace(msgs, fmt::format(FMT_STRING("got Have: {:d}"), ui32));
|
||||
logtrace(msgs, fmt::format("got Have: {:d}", ui32));
|
||||
|
||||
if (msgs->torrent->has_metainfo() && ui32 >= msgs->torrent->piece_count())
|
||||
{
|
||||
|
@ -1439,7 +1437,7 @@ ReadResult process_peer_message(tr_peerMsgsImpl* msgs, uint8_t id, MessageReader
|
|||
r.index = payload.to_uint32();
|
||||
r.offset = payload.to_uint32();
|
||||
r.length = payload.to_uint32();
|
||||
logtrace(msgs, fmt::format(FMT_STRING("got Request: {:d}:{:d}->{:d}"), r.index, r.offset, r.length));
|
||||
logtrace(msgs, fmt::format("got Request: {:d}:{:d}->{:d}", r.index, r.offset, r.length));
|
||||
peerMadeRequest(msgs, &r);
|
||||
break;
|
||||
}
|
||||
|
@ -1451,7 +1449,7 @@ ReadResult process_peer_message(tr_peerMsgsImpl* msgs, uint8_t id, MessageReader
|
|||
r.offset = payload.to_uint32();
|
||||
r.length = payload.to_uint32();
|
||||
msgs->cancels_sent_to_client.add(tr_time(), 1);
|
||||
logtrace(msgs, fmt::format(FMT_STRING("got a Cancel {:d}:{:d}->{:d}"), r.index, r.offset, r.length));
|
||||
logtrace(msgs, fmt::format("got a Cancel {:d}:{:d}->{:d}", r.index, r.offset, r.length));
|
||||
|
||||
auto& requests = msgs->peer_requested_;
|
||||
if (auto iter = std::find(std::begin(requests), std::end(requests), r); iter != std::end(requests))
|
||||
|
@ -1585,7 +1583,7 @@ ReadResult process_peer_message(tr_peerMsgsImpl* msgs, uint8_t id, MessageReader
|
|||
break;
|
||||
|
||||
default:
|
||||
logtrace(msgs, fmt::format(FMT_STRING("peer sent us an UNKNOWN: {:d}"), static_cast<int>(id)));
|
||||
logtrace(msgs, fmt::format("peer sent us an UNKNOWN: {:d}", static_cast<int>(id)));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1612,7 +1610,7 @@ int clientGotBlock(tr_peerMsgsImpl* msgs, std::unique_ptr<Cache::BlockData> bloc
|
|||
return EMSGSIZE;
|
||||
}
|
||||
|
||||
logtrace(msgs, fmt::format(FMT_STRING("got block {:d}"), block));
|
||||
logtrace(msgs, fmt::format("got block {:d}", block));
|
||||
|
||||
if (!tr_peerMgrDidPeerRequest(msgs->torrent, msgs, block))
|
||||
{
|
||||
|
@ -1838,8 +1836,7 @@ namespace peer_pulse_helpers
|
|||
|
||||
if (!ok)
|
||||
{
|
||||
msgs->torrent->error().set_local_error(
|
||||
fmt::format(FMT_STRING("Please Verify Local Data! Piece #{:d} is corrupt."), req.index));
|
||||
msgs->torrent->error().set_local_error(fmt::format("Please Verify Local Data! Piece #{:d} is corrupt.", req.index));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1993,7 +1990,7 @@ void tr_peerMsgsImpl::sendPex()
|
|||
logtrace(
|
||||
this,
|
||||
fmt::format(
|
||||
FMT_STRING("pex: old {:s} peer count {:d}, new peer count {:d}, added {:d}, dropped {:d}"),
|
||||
"pex: old {:s} peer count {:d}, new peer count {:d}, added {:d}, dropped {:d}",
|
||||
tr_ip_protocol_to_sv(ip_type),
|
||||
std::size(old_pex),
|
||||
std::size(new_pex),
|
||||
|
|
|
@ -148,7 +148,7 @@ std::string getXdgEntryFromUserDirs(std::string_view key)
|
|||
{
|
||||
auto const filename = tr_pathbuf{ path, '/', "index.html"sv };
|
||||
bool const found = tr_sys_path_exists(filename);
|
||||
tr_logAddTrace(fmt::format(FMT_STRING("Searching for web interface file '{:s}'"), filename));
|
||||
tr_logAddTrace(fmt::format("Searching for web interface file '{:s}'", filename));
|
||||
return found;
|
||||
}
|
||||
} // namespace
|
||||
|
@ -308,7 +308,7 @@ std::string tr_getWebClientDir([[maybe_unused]] tr_session const* session)
|
|||
{
|
||||
char const* const pkg = PACKAGE_DATA_DIR;
|
||||
auto const xdg = tr_env_get_string("XDG_DATA_DIRS"sv);
|
||||
auto const buf = fmt::format(FMT_STRING("{:s}:{:s}:/usr/local/share:/usr/share"), pkg, xdg);
|
||||
auto const buf = fmt::format("{:s}:{:s}:/usr/local/share:/usr/share", pkg, xdg);
|
||||
|
||||
auto sv = std::string_view{ buf };
|
||||
auto token = std::string_view{};
|
||||
|
|
|
@ -783,7 +783,7 @@ void tr_rpc_server::set_port(tr_port port) noexcept
|
|||
void tr_rpc_server::set_url(std::string_view url)
|
||||
{
|
||||
url_ = url;
|
||||
tr_logAddDebug(fmt::format(FMT_STRING("setting our URL to '{:s}'"), url_));
|
||||
tr_logAddDebug(fmt::format("setting our URL to '{:s}'", url_));
|
||||
}
|
||||
|
||||
void tr_rpc_server::set_whitelist(std::string_view whitelist)
|
||||
|
@ -797,7 +797,7 @@ void tr_rpc_server::set_whitelist(std::string_view whitelist)
|
|||
void tr_rpc_server::set_username(std::string_view username)
|
||||
{
|
||||
username_ = username;
|
||||
tr_logAddDebug(fmt::format(FMT_STRING("setting our username to '{:s}'"), username_));
|
||||
tr_logAddDebug(fmt::format("setting our username to '{:s}'", username_));
|
||||
}
|
||||
|
||||
void tr_rpc_server::set_password(std::string_view password) noexcept
|
||||
|
@ -805,7 +805,7 @@ void tr_rpc_server::set_password(std::string_view password) noexcept
|
|||
auto const is_salted = tr_ssha1_test(password);
|
||||
salted_password_ = is_salted ? password : tr_ssha1(password);
|
||||
|
||||
tr_logAddDebug(fmt::format(FMT_STRING("setting our salted password to '{:s}'"), salted_password_));
|
||||
tr_logAddDebug(fmt::format("setting our salted password to '{:s}'", salted_password_));
|
||||
}
|
||||
|
||||
void tr_rpc_server::set_password_enabled(bool enabled)
|
||||
|
@ -859,7 +859,7 @@ void tr_rpc_server::load(tr_variant const& src)
|
|||
|
||||
if (!tr_strv_ends_with(url_, '/'))
|
||||
{
|
||||
url_ = fmt::format(FMT_STRING("{:s}/"), url_);
|
||||
url_ = fmt::format("{:s}/", url_);
|
||||
}
|
||||
|
||||
this->host_whitelist_ = parse_whitelist(host_whitelist_str_);
|
||||
|
|
|
@ -44,11 +44,11 @@ void set_system_error(tr_error* error, DWORD code, std::string_view what)
|
|||
|
||||
if (auto const message = tr_win32_format_message(code); !std::empty(message))
|
||||
{
|
||||
error->set(code, fmt::format(FMT_STRING("{:s} failed: {:s}"), what, message));
|
||||
error->set(code, fmt::format("{:s} failed: {:s}", what, message));
|
||||
}
|
||||
else
|
||||
{
|
||||
error->set(code, fmt::format(FMT_STRING("{:s} failed: Unknown error: {:#08x}"), what, code));
|
||||
error->set(code, fmt::format("{:s} failed: Unknown error: {:#08x}", what, code));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ auto to_env_string(SortedWideEnv const& wide_env)
|
|||
|
||||
for (auto const& [key, val] : wide_env)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ret), FMT_STRING(L"{:s}={:s}"), key, val);
|
||||
fmt::format_to(std::back_inserter(ret), L"{:s}={:s}", key, val);
|
||||
ret.insert(std::end(ret), L'\0');
|
||||
}
|
||||
|
||||
|
|
|
@ -190,14 +190,14 @@ bool tr_torrent_files::move(
|
|||
|
||||
auto const& old_path = found->filename();
|
||||
auto const path = tr_pathbuf{ parent, '/', found->subpath() };
|
||||
tr_logAddTrace(fmt::format(FMT_STRING("Found file #{:d} '{:s}'"), i, old_path), parent_name);
|
||||
tr_logAddTrace(fmt::format("Found file #{:d} '{:s}'", i, old_path), parent_name);
|
||||
|
||||
if (tr_sys_path_is_same(old_path, path))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
tr_logAddTrace(fmt::format(FMT_STRING("Moving file #{:d} to '{:s}'"), i, old_path, path), parent_name);
|
||||
tr_logAddTrace(fmt::format("Moving file #{:d} to '{:s}'", i, old_path, path), parent_name);
|
||||
if (!tr_file_move(old_path, path, error))
|
||||
{
|
||||
err = true;
|
||||
|
|
|
@ -2405,7 +2405,7 @@ void renameTorrentFileString(tr_torrent* tor, std::string_view oldpath, std::str
|
|||
}
|
||||
else
|
||||
{
|
||||
name = fmt::format(FMT_STRING("{:s}/{:s}"sv), newname, subpath.substr(oldpath_len + 1));
|
||||
name = fmt::format("{:s}/{:s}"sv, newname, subpath.substr(oldpath_len + 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2419,11 +2419,11 @@ void renameTorrentFileString(tr_torrent* tor, std::string_view oldpath, std::str
|
|||
|
||||
if (oldpath_len >= std::size(subpath))
|
||||
{
|
||||
name = fmt::format(FMT_STRING("{:s}/{:s}"sv), tmp, newname);
|
||||
name = fmt::format("{:s}/{:s}"sv, tmp, newname);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = fmt::format(FMT_STRING("{:s}/{:s}/{:s}"sv), tmp, newname, subpath.substr(oldpath_len + 1));
|
||||
name = fmt::format("{:s}/{:s}/{:s}"sv, tmp, newname, subpath.substr(oldpath_len + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
[[noreturn]] bool tr_assert_report(std::string_view file, long line, std::string_view message)
|
||||
{
|
||||
auto const full_text = fmt::format(FMT_STRING("assertion failed: {:s} ({:s}:{:d})"), message, file, line);
|
||||
auto const full_text = fmt::format("assertion failed: {:s} ({:s}:{:d})", message, file, line);
|
||||
[NSException raise:NSInternalInconsistencyException format:@"%s", full_text.c_str()];
|
||||
|
||||
// We should not reach this anyway, but it helps mark the function as property noreturn
|
||||
|
|
|
@ -121,7 +121,7 @@ uint64 utp_callback(utp_callback_arguments* args)
|
|||
{
|
||||
#ifdef TR_UTP_TRACE
|
||||
case UTP_LOG:
|
||||
fmt::print(stderr, FMT_STRING("[µTP] {}\n"), args->buf);
|
||||
fmt::print(stderr, "[µTP] {}\n", args->buf);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -92,32 +92,32 @@ struct RemoteConfig
|
|||
|
||||
if (eta < 60)
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:d} sec"), eta);
|
||||
return fmt::format("{:d} sec", eta);
|
||||
}
|
||||
|
||||
if (eta < (60 * 60))
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:d} min"), eta / 60);
|
||||
return fmt::format("{:d} min", eta / 60);
|
||||
}
|
||||
|
||||
if (eta < (60 * 60 * 24))
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:d} hrs"), eta / (60 * 60));
|
||||
return fmt::format("{:d} hrs", eta / (60 * 60));
|
||||
}
|
||||
|
||||
if (eta < (60 * 60 * 24 * 30))
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:d} days"), eta / (60 * 60 * 24));
|
||||
return fmt::format("{:d} days", eta / (60 * 60 * 24));
|
||||
}
|
||||
|
||||
if (eta < (60 * 60 * 24 * 30 * 12))
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:d} months"), eta / (60 * 60 * 24 * 30));
|
||||
return fmt::format("{:d} months", eta / (60 * 60 * 24 * 30));
|
||||
}
|
||||
|
||||
if (eta < (60 * 60 * 24 * 365 * 1000LL)) // up to 999 years
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:d} years"), eta / (60 * 60 * 24 * 365));
|
||||
return fmt::format("{:d} years", eta / (60 * 60 * 24 * 365));
|
||||
}
|
||||
|
||||
return "∞";
|
||||
|
@ -138,30 +138,30 @@ struct RemoteConfig
|
|||
|
||||
auto tmpstr = std::string{};
|
||||
|
||||
auto const hstr = fmt::format(FMT_STRING("{:d} {:s}"), hours, tr_ngettext("hour", "hours", hours));
|
||||
auto const mstr = fmt::format(FMT_STRING("{:d} {:s}"), minutes, tr_ngettext("minute", "minutes", minutes));
|
||||
auto const sstr = fmt::format(FMT_STRING("{:d} {:s}"), seconds, tr_ngettext("seconds", "seconds", seconds));
|
||||
auto const hstr = fmt::format("{:d} {:s}", hours, tr_ngettext("hour", "hours", hours));
|
||||
auto const mstr = fmt::format("{:d} {:s}", minutes, tr_ngettext("minute", "minutes", minutes));
|
||||
auto const sstr = fmt::format("{:d} {:s}", seconds, tr_ngettext("seconds", "seconds", seconds));
|
||||
|
||||
if (days > 0)
|
||||
{
|
||||
auto const dstr = fmt::format(FMT_STRING("{:d} {:s}"), days, tr_ngettext("day", "days", days));
|
||||
tmpstr = days >= 4 || hours == 0 ? dstr : fmt::format(FMT_STRING("{:s}, {:s}"), dstr, hstr);
|
||||
auto const dstr = fmt::format("{:d} {:s}", days, tr_ngettext("day", "days", days));
|
||||
tmpstr = days >= 4 || hours == 0 ? dstr : fmt::format("{:s}, {:s}", dstr, hstr);
|
||||
}
|
||||
else if (hours > 0)
|
||||
{
|
||||
tmpstr = hours >= 4 || minutes == 0 ? hstr : fmt::format(FMT_STRING("{:s}, {:s}"), hstr, mstr);
|
||||
tmpstr = hours >= 4 || minutes == 0 ? hstr : fmt::format("{:s}, {:s}", hstr, mstr);
|
||||
}
|
||||
else if (minutes > 0)
|
||||
{
|
||||
tmpstr = minutes >= 4 || seconds == 0 ? mstr : fmt::format(FMT_STRING("{:s}, {:s}"), mstr, sstr);
|
||||
tmpstr = minutes >= 4 || seconds == 0 ? mstr : fmt::format("{:s}, {:s}", mstr, sstr);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpstr = sstr;
|
||||
}
|
||||
|
||||
auto const totstr = fmt::format(FMT_STRING("{:d} {:s}"), total_seconds, tr_ngettext("seconds", "seconds", total_seconds));
|
||||
return fmt::format(FMT_STRING("{:s} ({:s})"), tmpstr, totstr);
|
||||
auto const totstr = fmt::format("{:d} {:s}", total_seconds, tr_ngettext("seconds", "seconds", total_seconds));
|
||||
return fmt::format("{:s} ({:s})", tmpstr, totstr);
|
||||
}
|
||||
|
||||
[[nodiscard]] auto strlpercent(double x)
|
||||
|
@ -356,7 +356,7 @@ void showUsage()
|
|||
|
||||
if (*end != '\0')
|
||||
{
|
||||
fmt::print(stderr, FMT_STRING("Not a number: '{:s}'\n"), arg);
|
||||
fmt::print(stderr, "Not a number: '{:s}'\n", arg);
|
||||
showUsage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ enum
|
|||
return MODE_GROUP_GET;
|
||||
|
||||
default:
|
||||
fmt::print(stderr, FMT_STRING("unrecognized argument {:d}\n"), val);
|
||||
fmt::print(stderr, "unrecognized argument {:d}\n", val);
|
||||
assert("unrecognized argument" && 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -848,14 +848,14 @@ auto constexpr ListKeys = std::array<tr_quark, 15>{
|
|||
case TR_STATUS_CHECK_WAIT:
|
||||
if (auto percent = double{}; tr_variantDictFindReal(t, TR_KEY_recheckProgress, &percent))
|
||||
{
|
||||
return fmt::format(FMT_STRING("Will Verify ({:.0f}%)"), floor(percent * 100.0));
|
||||
return fmt::format("Will Verify ({:.0f}%)", floor(percent * 100.0));
|
||||
}
|
||||
return "Will Verify";
|
||||
|
||||
case TR_STATUS_CHECK:
|
||||
if (auto percent = double{}; tr_variantDictFindReal(t, TR_KEY_recheckProgress, &percent))
|
||||
{
|
||||
return fmt::format(FMT_STRING("Verifying ({:.0f}%)"), floor(percent * 100.0));
|
||||
return fmt::format("Verifying ({:.0f}%)", floor(percent * 100.0));
|
||||
}
|
||||
return "Verifying";
|
||||
|
||||
|
@ -1288,7 +1288,7 @@ void printFileList(tr_variant* top)
|
|||
}
|
||||
|
||||
fmt::print(
|
||||
FMT_STRING("{:3d}: {:3.0f}% {:<8s} {:<3s} {:9s} {:s}\n"),
|
||||
"{:3d}: {:3.0f}% {:<8s} {:<3s} {:9s} {:s}\n",
|
||||
j,
|
||||
floor(100.0 * percent),
|
||||
pristr,
|
||||
|
@ -1324,7 +1324,7 @@ void printPeersImpl(tr_variant* peers)
|
|||
tr_variantDictFindInt(d, TR_KEY_rateToPeer, &rateToPeer))
|
||||
{
|
||||
fmt::print(
|
||||
FMT_STRING("{:<40s} {:<12s} {:<5.1f} {:6.1f} {:6.1f} {:s}\n"),
|
||||
"{:<40s} {:<12s} {:<5.1f} {:6.1f} {:6.1f} {:s}\n",
|
||||
address,
|
||||
flagstr,
|
||||
progress * 100.0,
|
||||
|
@ -1502,7 +1502,7 @@ void printTorrentList(tr_variant* top)
|
|||
std::string{ "n/a" };
|
||||
|
||||
fmt::print(
|
||||
FMT_STRING("{:>6d}{:c} {:>5s} {:>9s} {:<9s} {:6.1f} {:6.1f} {:>5s} {:<11s} {:<s}\n"),
|
||||
"{:>6d}{:c} {:>5s} {:>9s} {:<9s} {:6.1f} {:6.1f} {:>5s} {:<11s} {:<s}\n",
|
||||
torId,
|
||||
error_mark,
|
||||
done_str,
|
||||
|
@ -1521,7 +1521,7 @@ void printTorrentList(tr_variant* top)
|
|||
}
|
||||
|
||||
fmt::print(
|
||||
FMT_STRING("Sum: {:>9s} {:6.1f} {:6.1f}\n"),
|
||||
"Sum: {:>9s} {:6.1f} {:6.1f}\n",
|
||||
strlsize(total_size).c_str(),
|
||||
Speed{ total_up, Speed::Units::Byps }.count(Speed::Units::KByps),
|
||||
Speed{ total_down, Speed::Units::Byps }.count(Speed::Units::KByps));
|
||||
|
@ -1838,7 +1838,7 @@ void printSession(tr_variant* top)
|
|||
}
|
||||
|
||||
fmt::print(
|
||||
FMT_STRING(" Upload speed limit: {:s} ({:s} limit: {:s}; {:s} turtle limit: {:s})\n"),
|
||||
" Upload speed limit: {:s} ({:s} limit: {:s}; {:s} turtle limit: {:s})\n",
|
||||
effective_up_limit,
|
||||
upEnabled ? "Enabled" : "Disabled",
|
||||
Speed{ upLimit, Speed::Units::KByps }.to_string(),
|
||||
|
@ -1861,7 +1861,7 @@ void printSession(tr_variant* top)
|
|||
}
|
||||
|
||||
fmt::print(
|
||||
FMT_STRING(" Download speed limit: {:s} ({:s} limit: {:s}; {:s} turtle limit: {:s})\n"),
|
||||
" Download speed limit: {:s} ({:s} limit: {:s}; {:s} turtle limit: {:s})\n",
|
||||
effective_down_limit,
|
||||
downEnabled ? "Enabled" : "Disabled",
|
||||
Speed{ downLimit, Speed::Units::KByps }.to_string(),
|
||||
|
@ -1994,7 +1994,7 @@ void printGroups(tr_variant* top)
|
|||
{
|
||||
fmt::print("{:s}: ", name);
|
||||
fmt::print(
|
||||
FMT_STRING("Upload speed limit: {:s}, Download speed limit: {:s}, {:s} session bandwidth limits\n"),
|
||||
"Upload speed limit: {:s}, Download speed limit: {:s}, {:s} session bandwidth limits\n",
|
||||
upEnabled ? Speed{ upLimit, Speed::Units::KByps }.to_string() : "unlimited"s,
|
||||
downEnabled ? Speed{ downLimit, Speed::Units::KByps }.to_string() : "unlimited"s,
|
||||
honors ? "honors" : "does not honor");
|
||||
|
@ -2249,7 +2249,7 @@ int processResponse(char const* rpcurl, std::string_view response, RemoteConfig&
|
|||
CURL* tr_curl_easy_init(struct evbuffer* writebuf, RemoteConfig& config)
|
||||
{
|
||||
CURL* curl = curl_easy_init();
|
||||
(void)curl_easy_setopt(curl, CURLOPT_USERAGENT, fmt::format(FMT_STRING("{:s}/{:s}"), MyName, LONG_VERSION_STRING).c_str());
|
||||
(void)curl_easy_setopt(curl, CURLOPT_USERAGENT, fmt::format("{:s}/{:s}", MyName, LONG_VERSION_STRING).c_str());
|
||||
(void)curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeFunc);
|
||||
(void)curl_easy_setopt(curl, CURLOPT_WRITEDATA, writebuf);
|
||||
(void)curl_easy_setopt(curl, CURLOPT_HEADERDATA, &config);
|
||||
|
@ -2289,7 +2289,7 @@ CURL* tr_curl_easy_init(struct evbuffer* writebuf, RemoteConfig& config)
|
|||
|
||||
if (auto const& str = config.session_id; !std::empty(str))
|
||||
{
|
||||
auto const h = fmt::format(FMT_STRING("{:s}: {:s}"), TR_RPC_SESSION_ID_HEADER, str);
|
||||
auto const h = fmt::format("{:s}: {:s}", TR_RPC_SESSION_ID_HEADER, str);
|
||||
auto* const custom_headers = curl_slist_append(nullptr, h.c_str());
|
||||
|
||||
(void)curl_easy_setopt(curl, CURLOPT_HTTPHEADER, custom_headers);
|
||||
|
@ -2316,7 +2316,7 @@ int flush(char const* rpcurl, tr_variant* benc, RemoteConfig& config)
|
|||
{
|
||||
auto const json = tr_variant_serde::json().compact().to_string(*benc);
|
||||
auto const scheme = config.use_ssl ? "https"sv : "http"sv;
|
||||
auto const rpcurl_http = fmt::format(FMT_STRING("{:s}://{:s}"), scheme, rpcurl);
|
||||
auto const rpcurl_http = fmt::format("{:s}://{:s}", scheme, rpcurl);
|
||||
|
||||
auto* const buf = evbuffer_new();
|
||||
auto* curl = tr_curl_easy_init(buf, config);
|
||||
|
@ -3246,12 +3246,12 @@ void getHostAndPortAndRpcUrl(int* argc, char** argv, std::string* host, int* por
|
|||
|
||||
if (strncmp(s, "http://", 7) == 0) /* user passed in http rpc url */
|
||||
{
|
||||
*rpcurl = fmt::format(FMT_STRING("{:s}/rpc/"), s + 7);
|
||||
*rpcurl = fmt::format("{:s}/rpc/", s + 7);
|
||||
}
|
||||
else if (strncmp(s, "https://", 8) == 0) /* user passed in https rpc url */
|
||||
{
|
||||
config.use_ssl = true;
|
||||
*rpcurl = fmt::format(FMT_STRING("{:s}/rpc/"), s + 8);
|
||||
*rpcurl = fmt::format("{:s}/rpc/", s + 8);
|
||||
}
|
||||
else if (parsePortString(s, port))
|
||||
{
|
||||
|
@ -3279,7 +3279,7 @@ void getHostAndPortAndRpcUrl(int* argc, char** argv, std::string* host, int* por
|
|||
bool const is_unbracketed_ipv6 = (*s != '[') && (memchr(s, ':', hend - s) != nullptr);
|
||||
|
||||
auto const sv = std::string_view{ s, size_t(hend - s) };
|
||||
*host = is_unbracketed_ipv6 ? fmt::format(FMT_STRING("[{:s}]"), sv) : sv;
|
||||
*host = is_unbracketed_ipv6 ? fmt::format("[{:s}]", sv) : sv;
|
||||
}
|
||||
|
||||
*argc -= 1;
|
||||
|
|
Loading…
Reference in a new issue