mirror of
https://github.com/transmission/transmission.git
synced 2025-12-25 04:45:56 +00:00
refactor: new tr_variant API in transmission-remote and other cleanup (#6798)
* refactor: remove `Arguments` * refactor: replace pointer args with lvalue reference * refactor: use `uint16_t` for port number * chore: housekeeping * refactor: replace `char*` with `std::string_view` * refactor: simplify argument parsing code * refactor: use new `tr_variant` API in remote * chore: rename function to snake_case * chore: move `break` statements in switches outside of compound statements * chore: use `std::string` literals * refactor: extract tor start/stop to `MODE_TORRENT_START_STOP` * refactor: extract tor actions to `MODE_TORRENT_ACTION` * chore: iwyu * fix: msvc build failure * chore: misc cleanup * fix: dereference optional * chore: misc cleanup * ui: fix minor formatting errors * fix: remove redundant if branches for response string * code review: remove `o` prefix for optionals * code review: add condition clause * code review: check `left_until_done` instead * fix: unchecked nullptr * code review: don't reassign method name * code review: revert accidentally renaming `addIdArg` to `get_id_arg` * code review: use `TR_ASSERT` instead of `assert` * refactor: fix static auto constexpr naming * code review: assert array size * code review: assert that `arguments` key exists
This commit is contained in:
@@ -552,7 +552,7 @@ std::string tr_strpercent(double x)
|
||||
return fmt::format("{:.0Lf}", x);
|
||||
}
|
||||
|
||||
std::string tr_strratio(double ratio, char const* infinity)
|
||||
std::string tr_strratio(double ratio, std::string_view infinity)
|
||||
{
|
||||
if ((int)ratio == TR_RATIO_NA)
|
||||
{
|
||||
@@ -561,7 +561,7 @@ std::string tr_strratio(double ratio, char const* infinity)
|
||||
|
||||
if ((int)ratio == TR_RATIO_INF)
|
||||
{
|
||||
return infinity != nullptr ? infinity : "";
|
||||
return std::string{ infinity };
|
||||
}
|
||||
|
||||
return tr_strpercent(ratio);
|
||||
|
||||
Reference in New Issue
Block a user