Commit Graph

88 Commits

Author SHA1 Message Date
Mike Gelfand db3d40d0ed Switch to clang-format for code formatting, include Mac client 2021-08-16 00:38:29 +03:00
Charles Kerr 9d313a8816
sonarcloud warnings 9 (#1511)
* refactor: const correctness 

* refactor: fix some implicit conversions

* refactor: make local pointers const if their objects are not modified

* refactor: do not cast away const in torrent-cell-renderer

* refactor: remove call to deprecated gtk_icon_size_lookup_for_settings

* refactor: member functions that do not mutate their objects should be declared const

* chore: do not end comments with a semicolon
2020-11-08 21:31:02 -06:00
Mike Gelfand 1d6d946388 Fixup some formatting leftovers 2019-02-16 10:50:37 +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
Mingye Wang 94ee776113 (squash later) blocklist cidr endianness 2018-10-17 09:41:19 -04:00
Mingye Wang f61306f65f (squash later) fix pflen handling in cidr 2018-10-14 12:44:01 -04:00
Mingye Wang b3129591db Support CIDR-notated blocklists
This commit adds a new blocklist line format, namely individual IPv4
CIDR ranges separated by newlines. Text put after each entry is ignored
by sscanf, so feel free to put any kind of comments there.

Fix #230.
2018-10-13 17:23:45 -04: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 f27596238d Include stdbool.h unconditionally
All the compilers should provide the header file by now. Remove `tr_isBool`
sanity checks along the way as compiler should guarantee that bool (_Bool)
values are 0 or 1 and nothing else.
2017-05-24 22:53:06 +03:00
Mike Gelfand 1e3d20422a Reduce for loop variables scope 2017-05-14 01:38:31 +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 eb8fc35ac6 Remove useless checks and definitions (C99)
Now that MSVC support for C99 is quite good, remove previously needed but
now unused checks and definitions, like PRI* format macros (including
PRIdMAX and TR_PRIuSIZE, replaced with %jd and %zu) and inline macro.
Also, remove ssize_t typedef and replace few occurences with ev_ssize_t.
Also, remove check for stdbool.h availability (guaranteed by C99) and
include it unconditionally (except when in C++ mode).
2015-12-29 19:37:31 +00:00
Jordan Lee 01196c8c4f mikedld patch: 4160-05b-file-fmt.patch 2014-09-21 18:01:36 +00:00
Jordan Lee b33a7d4dc1 (trunk, libt) #4160 - the slow slog to catch trunk up to mike.dld's 4160 diff continues. This step applies 4160-03b-file.patch, which replaces native file operations with the tr_sys_file_*() portability wrappers added in r14321. 2014-07-28 04:13:38 +00:00
Jordan Lee 0323639e57 (trunk, libT) #4160 'foreign character support' -- merge mike.dld's 4160-02b-path.patch, which updates the codebase to use the new tr_sys_path_*() portability wrappers introduced in 4160-02a 2014-07-08 00:08:43 +00:00
Mitchell Livingston 0e01879974 Use built-in _WIN32 macro instead of WIN32 2014-07-04 00:00:07 +00:00
Jordan Lee 02cff80c2d Copyedit the license's revised text: (1) remove unnecessary repitition use of the word 'license' from the top of the header and source files (2) add the standard 'we hope it's useful, but no warranty' clause to COPYING (3) make explicit that linking OpenSSL is allowed (see https://people.gnome.org/~markmc/openssl-and-the-gpl.html for background) (4) sync the Qt and GTK+ clients' license popups with COPYING's revised text 2014-01-21 03:10:30 +00:00
Jordan Lee 4b9626bb83 Licensing changes:
1. add the option the code to be used under GPLv2 or GPLv3; previously only GPLv2 was allowed

2. add the "proxy option" as described in GPLv3 so we can add future licenses without having to bulk-edit everything again :)

3. remove the awkward "exception for MIT code in Mac client" clause; it was unnecessary and confusing.
2014-01-19 01:09:44 +00:00
Jordan Lee 4904b923fb (trunk) restore copyright year as suggested in email by rms 2014-01-18 20:56:57 +00:00
Jordan Lee eff3b75586 blocklist cleanup: use bool instead of int where appropriate, use tr_fileExists() instead of stat() 2013-09-08 21:25:13 +00:00
Jordan Lee 677769a462 remove a few straggling uses of %zu to follow up on the previous TR_PRIuSIZE commit 2013-09-08 17:36:11 +00:00
Jordan Lee 65f15a4ba9 more treating-bools-as-bools 2013-08-24 18:18:38 +00:00
Jordan Lee 445609f690 (trunk) prefer tr_remove() to unlink() or rmdir() 2013-02-04 21:53:19 +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 2d5fe73969 (libT) copyediting: rename the internal tr_blocklist class 'tr_blocklistFile' to distinguish the private per-file API from the public, global API in libtransmission.h 2013-01-21 17:48:36 +00:00
Jordan Lee 1ece2b3f98 (libT) copyediting: reformat blocklist.c to the new indentation style 2013-01-21 17:39:20 +00:00
Jordan Lee a2d2a10226 (trunk, libT) #5165: fix r13625 oops 2012-12-07 01:53:31 +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 1304aa0079 (trunk libT) still fiddling around with #includes -- this time removing unncecessary libT includes from libT .c files 2011-03-25 01:41:57 +00:00
Jordan Lee 375694eda9 (trunk) copyediting: remove some unneeded #includes, and annotate some needed ones 2011-03-24 21:49:42 +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 e187ae58a9 (trunk libT) #4016 "blocklists don't handle overlapping/unsorted rules" -- fixed. 2011-02-13 16:14:31 +00:00
Jordan Lee 8a6f768999 (trunk libT) rename "tr_ip_range" as "tr_ipv4_range" in blocklist.c 2011-02-12 21:20:19 +00:00
Jordan Lee 879a2afcbd Update the copyright year in the source code comments.
The Berne Convention says that the copyright year is moot, so instead of adding another year to each file as in previous years, I've removed the year altogether from the source code comments in libtransmission, gtk, qt, utils, daemon, and cli.

Juliusz's copyright notice in tr-dht and Johannes' copyright notice in tr-lpd have been left alone; it didn't seem appropriate to modify them.
2011-01-19 13:48:47 +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 9335e02e6d (trunk libT) add some new bugs to the code so that it will crash when vraa tries to use it 2010-11-11 15:31:11 +00:00
Charles Kerr d2837efc71 (trunk libT) anal correctness fix in the blocklist comments 2010-11-07 02:53:50 +00:00
Charles Kerr 92620b72b0 (trunk) #3697 "make blocklist URL configurable" -- implemented in GTK+, Qt, and RPC 2010-10-31 17:16:12 +00:00
Charles Kerr 7b3757f6ad (trunk libT) fix compiler warnings on non-glibc systems 2010-08-06 23:28:30 +00:00
Charles Kerr 2c85178f9b (trunk libT) fix a few -Wconversion warnings 2010-07-01 15:14:35 +00:00
Charles Kerr 98cec85e46 (trunk libT) #3311 "MingW build of Transmission" -- apply further win32 diffs from rb07 2010-06-25 20:36:10 +00:00
Charles Kerr 5ad7ed550f (trunk) more win32 fixes from rb07 in #3311 2010-06-22 00:12:52 +00:00
Charles Kerr 3ae99f79ec (trunk libT) #3293 "fggets() is overkill for parsing the blocklist" -- fixed in trunk for 2.00 2010-06-15 00:38:10 +00:00
Charles Kerr 58b5ef9065 (trunk libT) #3247 "add blocklist support for pipfilter file format" -- implemented in trunk for 2.00 2010-05-31 11:38:36 +00:00