transmission/utils
Charles Kerr 309d97c578
fix: Coverity warnings (#842)
* Silence coverity CHECKED_RETURN on added.f load

The existing code behaved alright since added.f is optional.
However, by testing for success we can both silence the warning
and prevent a useless initialization of NULL/0 to added_f and
added_f_length.

* Silence coverity CHECKED_RETURN on added6.f load

ipv6 variant of previous commit.

* Silence coverity CHECKED_RETURN writing benc strs

saveStringFunc() gets the target string by calling tr_variantGetStr().
It previously didn't check to see if this function succeeded because
saveStringFunc() isn't reached without the type already being known.
However, checking the return value costs nothing and makes Coverity happy.

* Silence coverity CHECKED_RETURN on ut metadata

Like earlier few Coverity commits in this PR, we're handling optional
values by declaring stack locals set to the default (e.g. -1) and then
trying to read the variant.

Unlike the earlier commits, there is a two-part step to thise read:
checking for the metadata, then checking for the individual fields.
The earlier fixes' aproach -- e.g. initializing to -1 only if the reads
failed -- would involve new nested conditionals. I find the new complexity
to outweigh the benefit of removing the dead store, so in this case I'm
casting the return value to `(void)` to tell Coverity to shush.

* Silence coverity CHECKED_RETURN on scrape

Check the return value of tr_variantGetInt() when showing
seeder and leecher counts in transmission-show.

* Silence CHECKED_RETURN on rpc recently-active

When building a list of removed torrent IDs from variants, confirm that
we can read the IDs from the variants before adding them to the list.
I don't _think_ this would have failed before, but Coverity's right that
it's reasonable to add a safeguard here.

* fix: better fix to serializing benc strings

The approach in 33e2ece7e5 was
a little problematic: GetString() shouldn't fail here; but if
it somehow did, we still want to encode a zero-length benc string here.

* chore: make uncrustify happy
2019-02-18 22:38:24 +00:00
..
CMakeLists.txt Move transmission-remote to utils 2018-11-06 20:10:10 +00:00
Makefile.am Move transmission-remote to utils 2018-11-06 20:10:10 +00:00
create.c Don't crash if path passed to tr-create doesn't exist 2018-01-24 23:45:13 +03:00
edit.c Reduce for loop variables scope 2017-05-14 01:38:31 +03:00
remote.c Add labels feature (#822) 2019-02-17 04:33:57 -05:00
show.c fix: Coverity warnings (#842) 2019-02-18 22:38:24 +00:00
transmission-create.1 remove whitespace and a comma in the manuals 2017-11-28 16:58:21 -06:00
transmission-edit.1 remove whitespace and a comma in the manuals 2017-11-28 16:58:21 -06:00
transmission-remote.1 Add labels feature (#822) 2019-02-17 04:33:57 -05:00
transmission-show.1 Add myself to the list of Transmission authors 2017-01-15 01:38:45 +03:00
units.h Adjust uncrustify config, reformat all but Mac client 2017-04-20 10:01:22 +03:00