Make some utility functions return std::string to simplify code (#2368)

* tr_formatter_speed_KBps returns std::string

* tr_formatter_mem_B returns std::string

* tr_formatter_size_B returns std::string

* tr_strpercent/tr_strratio returns std::string
This commit is contained in:
Mike Gelfand
2021-12-31 00:30:21 +00:00
committed by GitHub
parent 26110d5c8e
commit d8d361e491
15 changed files with 146 additions and 252 deletions

View File

@@ -200,11 +200,10 @@ bool tr_metaInfoBuilderSetPieceSize(tr_metainfo_builder* b, uint32_t bytes)
{
if (!isValidPieceSize(bytes))
{
char wanted[32];
char gotten[32];
tr_formatter_mem_B(wanted, bytes, sizeof(wanted));
tr_formatter_mem_B(gotten, b->pieceSize, sizeof(gotten));
tr_logAddError(_("Failed to set piece size to %s, leaving it at %s"), wanted, gotten);
tr_logAddError(
_("Failed to set piece size to %s, leaving it at %s"),
tr_formatter_mem_B(bytes).c_str(),
tr_formatter_mem_B(b->pieceSize).c_str());
return false;
}