fix: sonarcloud (#2837)

* fix: rename variable to avoid shadow warning w/UTP

* fix: add default dtor for tr_strbuf

* fix: implicit conversion may lose precision

* fix: use init-statement to reduce variable scope

* fix: implicit conversion may lose precision

* fix: extract the assignment from this expression

* fix: use init-statement to reduce variable scope

* fix: use init-statement to reduce variable scope

* fix: do not mix public and private data members

* fix: add a condition to cv.wait call

* fix: do not throw uncaught exceptions in destructor
This commit is contained in:
Charles Kerr
2022-03-29 05:57:04 -05:00
committed by GitHub
parent 2f677aebb0
commit 4177e286a1
11 changed files with 21 additions and 24 deletions

View File

@@ -560,8 +560,7 @@ static bool UseSSL = false;
static std::string getEncodedMetainfo(std::string_view filename)
{
auto contents = std::vector<char>{};
if (tr_loadFile(filename, contents))
if (auto contents = std::vector<char>{}; tr_loadFile(filename, contents))
{
return tr_base64_encode({ std::data(contents), std::size(contents) });
}
@@ -2020,7 +2019,7 @@ static void printGroups(tr_variant* top)
if (tr_variantDictFindDict(top, TR_KEY_arguments, &args) && tr_variantDictFindList(args, TR_KEY_group, &groups))
{
for (int i = 0, n = tr_variantListSize(groups); i < n; ++i)
for (size_t i = 0, n = tr_variantListSize(groups); i < n; ++i)
{
tr_variant* group = tr_variantListChild(groups, i);
std::string_view name;