Commit Graph

52 Commits

Author SHA1 Message Date
Charles Kerr 7f147c65fb
refactor: fix more sonarcloud warnings (#1508)
* refactor: const correctness

* refactor: use getpwuid_r instead of getpwuid

* chore: simplify dict walking loop logic

* refactor: remove dead store assignment in announcer

* refactor: use std::make_shared
2020-11-05 16:46:21 -06:00
Charles Kerr 0bfbc3eba7
Sonarcloud warnings 4 (#1499)
* chore: fix some sonarcloud html warnings (e.g. deprecated attribute use)

* chore: uppercase literal suffixes

* chore: remove redundant casts

* chore: remove commented-out code

* chore: use qInfo() instead of std::cerr
2020-11-02 09:16:12 -06:00
Charles Kerr efaa66a920
fix: resolve some lgtm warnings (#1444)
* fix: warnings found by LGTM static analyzer
2020-09-11 16:07:45 -05:00
Charles Kerr e127b20c05
chore: fix compiler warnings (#1412)
* chore: fix compiler warnings
2020-08-27 18:41:26 -05:00
Mike Gelfand ff8d0dbf3b Switch from UNUSED macro to TR_UNUSED macro
Since there is no way to mark parameters as [potentially] unused in
standard C and when using MSVC compiler, use the widely accepted
cast-to-void approach instead.
2020-08-18 14:19:55 +03:00
Mike Gelfand eef4799388 Update Uncrustify config to 0.69 2019-07-15 02:30:41 +03:00
Mike Gelfand 82df3a87f4 Update to Uncrustify 0.68.1
Tweak a few rules in the process. Now all code in cli, daemon, gtk,
libtransmission, qt, and utils is properly formatted with no manual
intervention.
2019-02-15 09:21:48 +03:00
Mike Gelfand 13bbaeec76 Use field initializers for readability 2017-06-24 13:30:33 +03:00
Mike Gelfand deea6fc6a2 Bring assertions closer to the beginning of blocks 2017-06-13 07:44:09 +03:00
Mike Gelfand 98695fe3c1 Introduce our own assertion macros with finer control 2017-06-08 10:24:12 +03:00
Mike Gelfand 8f3cb1c68d Wrap sizeof arguments in braces 2017-05-20 19:29:23 +03:00
Mike Gelfand 1e3d20422a Reduce for loop variables scope 2017-05-14 01:38:31 +03:00
Mike Gelfand 14370e5353 Fix a number of other style inconsistencies met along the way (part 2) 2017-05-01 18:47:49 +03:00
Mike Gelfand e1d53855f4 Avoid declaring multiple variables on the same line 2017-05-01 18:46:41 +03:00
Mike Gelfand efaa9d0ddc Compare system function return value to a specific value indicating the error 2017-04-30 19:47:18 +03:00
Mike Gelfand a762c770f2 Make conditional expressions explicitly boolean 2017-04-30 19:26:01 +03:00
Mike Gelfand 4f9d9ad92b Code style change leftovers
For some reason, GTK client wasn't fully processed. All the rest of changes
are mostly in comments.
2017-04-21 10:40:57 +03:00
Mike Gelfand dadffa2c0f Align type qualifiers to the right (code style)
This way all the qualifiers (`const`, `volatile`, `mutable`) are grouped
together, e.g. `T const* const x` vs. `const T* const x`. Also helps reading
types right-to-left, e.g. "constant pointer to constant T" vs. "constant
pointer to T which is constant".
2017-04-20 19:53:20 +03:00
Mike Gelfand d7930984ef Adjust uncrustify config, reformat all but Mac client
There're places where manual intervention is still required as uncrustify
is not ideal (unfortunately), but at least one may rely on it to do the
right thing most of the time (e.g. when sending in a patch).

The style itself is quite different from what we had before but making it
uniform across all the codebase is the key. I also hope that it'll make the
code more readable (YMMV) and less sensitive to further changes.
2017-04-20 10:01:22 +03:00
Mike Gelfand 2248d3670f Get rid of $Id$ SVN keywords in source files 2016-09-02 23:10:15 +03:00
Mike Gelfand a6d4bd35fc Get rid of some more warnings 2015-12-29 00:42:40 +00:00
Mike Gelfand 2e6d5c8bc9 Add more booleans to the picture 2015-05-31 22:13:31 +00:00
Mike Gelfand cdf3cf62f9 Fix some issues revealed by coverity 2015-05-09 11:56:35 +00:00
Mike Gelfand 949e02b933 Define and use tr_socket_t and TR_BAD_SOCKET instead of int and -1.
Test socket validity by comparing to TR_BAD_SOCKET instead of various
(and sometimes wrong) other tests like `x >= 0`, `x != -1`, `x > 0`,
`x > -1`, `x` (valid), and `x < 0`, `x == -1` (invalid).
2015-03-18 07:34:26 +00:00
Mike Gelfand 440f482d01 Replace tabs with spaces; remove trailing spaces 2015-01-02 11:15:31 +00:00
Mike Gelfand 9a3b965ce4 Kill some warnings when compiling on Windows 2015-01-02 04:02:13 +00:00
Mike Gelfand 52a9d774e4 Fix compilation on Windows
This should not affect non-Win32 platforms in any way.
As for Win32 (both MinGW and MSVC), this should hopefully allow for
unpatched compilation. Correct functioning is not yet guaranteed though.
2014-12-13 15:22:39 +00:00
Jordan Lee c1beabfea6 (trunk, libT) #4160 'foreign character support' -- merge mike.dld's 4160-03a-file.platch, which introduces tr_sys_file_*() portability wrappers 2014-07-08 00:15:12 +00:00
Mitchell Livingston 0e01879974 Use built-in _WIN32 macro instead of WIN32 2014-07-04 00:00:07 +00:00
Jordan Lee 0ba7c5f3cf fix a handful of CL warnings & errors in libtransmission. mikedld 2013-09-08 17:58:14 +00:00
Jordan Lee 605e2e89ad use evutil_socket_t instead of int to define socket types. Patch my mikedLd :) 2013-09-08 17:03:11 +00:00
Jordan Lee f75027d5e9 make all the log functions/structs/enums use a single 'tr_log' namespace, such as tr_logGetQueue, tr_logAddInfo, tr_logIsLevelActive 2013-01-25 23:34:20 +00:00
Jordan Lee e2c1a360d4 (libT) replace errant snprintf() calls with tr_snprintf() calls 2013-01-23 04:28:37 +00:00
Jordan Lee 3d38723ad9 Follow more common whitespace style conventions in the C code (libtransmission, daemon, utils, cli, gtk). 2012-12-05 17:29:46 +00:00
Jordan Lee 1b825079be (trunk libT) API cleanup of the tr_address functions to make them more consistent.
This is loosely related to #2910, but only in the sense of laying the groundwork for #2910's fix...
2011-03-25 05:34:26 +00:00
Jordan Lee 324f0f470c (trunk libT) copyediting: '#include "crypto.h"' cleanup 2011-03-25 01:21:31 +00:00
Jordan Lee 87ef45cf3d (trunk libT) copyediting: remove a bunch of seemingly-unneeded network headers in net.[ch].
I'm less certain that these are unneeded because networking APIs seem to have more variation between platforms, but it's better to remove the cruft and then add back whatever headers $PLATFORM users complain about, than to not remove the cruft at all...
2011-03-24 22:57:39 +00:00
Jordan Lee b4d36aeb54 (trunk) #4138 "use stdbool.h instead of tr_bool" -- done. 2011-03-22 15:19:54 +00:00
Jordan Lee 78a4865aa1 (trunk libT) as a followup to r12182, move LPD's periodic upkeep timer into the tr-lpd.c module where it can be started & stopped with the pre-existing tr_lpdInit() and tr_lpdUninit() functions. 2011-03-17 13:16:23 +00:00
Jordan Lee 374ed10f3b (trunk) it's bad form to #include so many system headers in libtransmission/utils.h... 2011-03-16 18:04:23 +00:00
Jordan Lee cdff3aa090 (trunk libT) minor tweak: use evutil_closesocket() instead of the older EVUTIL_CLOSESOCKET() macro. 2011-03-13 19:47:21 +00:00
Jordan Lee 4a4842fea5 (trunk libT) use libevent2's portability wrappers for inet_ntop() and inet_pton().
We currently implement our own versions of these on mingw because that platform doesn't have them... but why reinvent the wheel; libevent has already done the same thing. Let's use libevent2's implementation.
has already done it for us.
2011-03-13 08:15:40 +00:00
Jordan Lee 9024cb29f9 (trunk libT) #3208 "Local Peer Discovery idea: prioritize LPD requests for downloads" -- add patch from Eszet 2011-03-04 17:33:29 +00:00
Charles Kerr e5bb3205a1 (trunk) Join the 21st century and use only 1 space at the end sentences. This commit is nearly as important as the semi-annual ones that remove trailing spaces from the ends of lines of code... :) 2010-12-27 19:18:17 +00:00
Charles Kerr ae84dc70dd (trunk libT) #3836 "libevent2 support" -- finish moving to the libevent2 API mode. don't include the backwards-compatable API headers. 2010-12-24 08:58:41 +00:00
Charles Kerr 345b14adbc (trunk) #3836 "libevent2 support" -- bump libevent2 requirement to 2.0.10. This will break the Mac build for a minute intil BMW applies his Mac patch 2010-12-20 02:07:51 +00:00
Charles Kerr 417f3fd3b0 (trunk libT) #3681 "tr-lpd.c's lpd_configureSocket() function is redundant" -- fixed. 2010-10-28 23:19:53 +00:00
Charles Kerr 8d15c48a3f (trunk libT) #3617 "1000+ warnings of 'inlining failed' in libtransmission when compiled with gcc 4.4.4" -- fixed. 2010-10-11 15:41:27 +00:00
Charles Kerr 954a309d8f (trunk) #3311 "MingW build of Transmission" -- apply more of rb07's diffs, though edited to lessen the inevitable #ifdefs 2010-06-30 21:24:36 +00:00
Charles Kerr 254a1f15cb (trunk libT) down the rabbit hole: various minor type correctness changes unearthed by -Wconversion 2010-06-30 16:40:19 +00:00