mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
refactor: utils naming (#5696)
* chore: rename tr_strvContains to tr_strv_contains * chore: rename tr_strvStartsWith to tr_strv_starts_with * chore: rename tr_strvEndsWith to tr_strv_ends_with * chore: rename tr_strvSep to tr_strv_sep * chore: rename tr_strvStrip to tr_strv_strip * chore: rename tr_strvToBuf to tr_strv_to_buf * refactor: rename tr_saveFile() to tr_file_save() rename tr_loadFile() to tr_file_read() rename tr_moveFile() to tr_file_move() * refactor: rename tr_parseNum() to tr_num_parse() refactor: rename tr_parseNumRange() to tr_num_parse_range() * chore: group related functions together in header
This commit is contained in:
@@ -982,13 +982,13 @@ char const* torrentGet(tr_session* session, tr_variant* args_in, tr_variant* arg
|
||||
continue;
|
||||
}
|
||||
|
||||
label = tr_strvStrip(label);
|
||||
label = tr_strv_strip(label);
|
||||
if (std::empty(label))
|
||||
{
|
||||
return { {}, "labels cannot be empty" };
|
||||
}
|
||||
|
||||
if (tr_strvContains(label, ','))
|
||||
if (tr_strv_contains(label, ','))
|
||||
{
|
||||
return { {}, "labels cannot contain comma (,) character" };
|
||||
}
|
||||
@@ -1398,7 +1398,7 @@ void onPortTested(tr_web::FetchResponse const& web_response)
|
||||
}
|
||||
else /* success */
|
||||
{
|
||||
bool const is_open = tr_strvStartsWith(body, '1');
|
||||
bool const is_open = tr_strv_starts_with(body, '1');
|
||||
tr_variantDictAddBool(data->args_out, TR_KEY_port_is_open, is_open);
|
||||
tr_idle_function_done(data, SuccessResult);
|
||||
}
|
||||
@@ -1466,7 +1466,7 @@ void onBlocklistFetched(tr_web::FetchResponse const& web_response)
|
||||
// tr_blocklistSetContent needs a source file,
|
||||
// so save content into a tmpfile
|
||||
auto const filename = tr_pathbuf{ session->configDir(), "/blocklist.tmp"sv };
|
||||
if (tr_error* error = nullptr; !tr_saveFile(filename, content, &error))
|
||||
if (tr_error* error = nullptr; !tr_file_save(filename, content, &error))
|
||||
{
|
||||
tr_idle_function_done(
|
||||
data,
|
||||
@@ -1773,7 +1773,7 @@ char const* groupSet(tr_session* session, tr_variant* args_in, tr_variant* /*arg
|
||||
{
|
||||
auto name = std::string_view{};
|
||||
(void)tr_variantDictFindStrView(args_in, TR_KEY_name, &name);
|
||||
name = tr_strvStrip(name);
|
||||
name = tr_strv_strip(name);
|
||||
if (std::empty(name))
|
||||
{
|
||||
return "No group name given";
|
||||
@@ -2597,7 +2597,7 @@ void tr_rpc_request_exec_json(
|
||||
*/
|
||||
void tr_rpc_parse_list_str(tr_variant* setme, std::string_view str)
|
||||
{
|
||||
auto const values = tr_parseNumberRange(str);
|
||||
auto const values = tr_num_parse_range(str);
|
||||
auto const value_count = std::size(values);
|
||||
|
||||
if (value_count == 0)
|
||||
|
||||
Reference in New Issue
Block a user