Commit Graph

65 Commits

Author SHA1 Message Date
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
Charles Kerr d3323ddee0
fix: Coverity warnings (#1443)
* fix: coverity warnings
2020-09-10 18:50:46 -05:00
Mike Gelfand 75458d6be3 Make use of TR_UNUSED macro where cast-to-void was used before 2020-08-18 14:34:49 +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 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 1e3d20422a Reduce for loop variables scope 2017-05-14 01:38:31 +03:00
Mike Gelfand fbd8d4c79f Fix a number of other style inconsistencies met along the way 2017-04-30 19:33:55 +03:00
Mike Gelfand a762c770f2 Make conditional expressions explicitly boolean 2017-04-30 19:26:01 +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 f6f15d6937 Use tr_realloc (BSD reallocf-alike) instead of plain realloc 2015-10-25 17:13:14 +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 0f1f84898b silence a small handful of minor gcc compiler warnings in libtransmission 2013-08-17 17:20:31 +00:00
Jordan Lee 297566dc64 (libT) make ptrarray's assertions consume fewer CPU cycles 2013-01-13 22:09:18 +00:00
Jordan Lee c1559f3cc4 (trunk, libT) first drop of the tr_quark patch. 2012-12-22 20:35:19 +00:00
Jordan Lee d74c7e93c8 copyediting: indentation cleanup 2012-12-13 01:47:40 +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 56525f4b80 (trunk libT) Remove the backup implementation of tr_ptrArrayLowerBound() that was added 5 weeks ago in r12512. This was for testing in the nightlies, to use its output against the function's primary implementation. 2011-07-31 14:04:43 +00:00
Jordan Lee dcd7bed20a (trunk libT) fix minor compiler warning when compiling with assertions disabled 2011-07-17 14:33:20 +00:00
Jordan Lee 2d3fdc4235 (trunk libT) the edge condition bug in ptrarray's bsearch code seems to be fixed, so let's commit the fix with lots of assert()ions enabled so that the nightly build users can show me where I'm wrong :) 2011-06-24 18:25:56 +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 6b682f8042 (trunk libT) make tr_ptrArrayNth() an inline function 2011-03-14 14:09:41 +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 e70bebf930 (trunk) #1521 "memory cache to reduce disk IO" -- commit block-cache-rc1.diff to trunk for the nightlies. 2010-06-19 14:25:11 +00:00
Charles Kerr 64a847baf0 (trunk libT) #2958 "Minimize use of tr_ptrArray in critical parts of the code" -- accept patch from sadface to make tr_ptrArrayInsert() a little cleaner 2010-03-10 16:35:12 +00:00
Charles Kerr bdae614636 (trunk libT) instead of growing the ptrArray by a constant fixed amount when it runs out of room, follow exponential growth to minimize the number of realloc()s needed. This speeds up populating large arrays in bencode.c 2010-02-15 16:44:02 +00:00
Mitchell Livingston f239919443 ocd tweaks 2010-02-15 16:15:37 +00:00
Charles Kerr ce5f82f413 (trunk libT) add a "const" to tr_ptrArrayRemove()'s second argument to silence a compiler warning 2010-01-28 13:31:54 +00:00
Charles Kerr 5c26afdb52 happy new year! 2010-01-04 21:00:47 +00:00
Charles Kerr e61e0fcd3d (trunk libT) improved API documentation / commenting for doxygen 2010-01-01 22:13:27 +00:00
Charles Kerr 1eb0cdd7c6 (trunk libT) fix various minor compiler warnings that show up when you build libtransmission with NDEBUG defined 2009-12-28 23:27:17 +00:00
Charles Kerr 78ead8c3dd (trunk) update the copyright notices 2009-12-05 02:19:24 +00:00
Charles Kerr 600e2d26ec (trunk libT) make tr_ptrArrayErase() private 2009-09-07 21:57:15 +00:00
Charles Kerr 0ef34b64b7 (trunk, libT) sibling to r9027, remove more unused code 2009-09-07 06:23:15 +00:00
Charles Kerr e22922f682 (trunk libT) disable the sorted ptrArray assertions in non-mac release builds 2009-09-06 22:52:13 +00:00
Charles Kerr be98310bb5 remove unused code 2009-08-31 23:31:43 +00:00
Charles Kerr fe816d8135 (trunk) update the GPL code's copyright dates 2009-01-10 23:09:07 +00:00
Erick Turnquist 2a6c7dd0fa (trunk libT) Fix an assertion failure in ptrarrays when values are equal.
This bug manifest itself due to a subtle change in tr_compareAddresses(), but
was always there. An assertion would fail if two (obviously adjacent) values
were equal.
2009-01-06 03:22:10 +00:00
Charles Kerr d202c5ecea (trunk libT) inline the ptrarray one-liners 2009-01-02 20:19:10 +00:00
Charles Kerr 427f639664 (trunk libT) avoid some unnecessary memory fragmentation... for composited objects that have a tr_ptrArray, contain the tr_ptrArray directly rather than a pointer to one allocated elsewhere on the heap. 2008-12-29 08:54:36 +00:00
Charles Kerr 9594112d27 updated email address 2008-12-16 00:20:44 +00:00
Charles Kerr 9cb73f8335 (libT) a small, simple memory optimization 2008-10-25 02:15:37 +00:00
Charles Kerr cc89872dd4 run libT, cli, daemon, gtk through the source-code formatter "uncrustify" as promised/threatened 2008-09-23 19:11:04 +00:00
Charles Kerr 419242e36f (libT) change benc's integral type from int to size_t, squashing a couple of minor warnings 2008-09-04 14:42:32 +00:00