Commit Graph

62 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 d3323ddee0
fix: Coverity warnings (#1443)
* fix: coverity warnings
2020-09-10 18:50:46 -05:00
Mike Gelfand 10cdd7f790 Use explicit boolean conversions 2019-07-14 16:25:07 +03:00
Mike Gelfand d3b8982195 Uppercase the literal suffixes
* MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case
* MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a
  literal suffix
* CERT DCL16-C. - Use "L," not "l," to indicate a long value
* CERT, DCL50-J. - Use visually distinct identifiers
2019-03-17 07:07: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 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 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 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 40f3de0572 Loosen bitfield assertions to account for unknown bit counts 2015-12-31 05:22:42 +00:00
Mike Gelfand d0e157eceb Fix bitfield bit removal, add more asserts, extend unit test 2015-12-27 16:34:47 +00:00
Mike Gelfand f6f15d6937 Use tr_realloc (BSD reallocf-alike) instead of plain realloc 2015-10-25 17:13:14 +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 295eade2a6 Don't use ssize_t in bitfield.c (cleaner w/o it anyway) 2015-01-04 15:31:47 +00:00
Jordan Lee b224148ed9 Fix peer communication vulnerability (no known exploits) reported by Ben Hawkes 2014-06-29 01:43:27 +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 a8f965b489 (trunk libT) #5444 'underflow in bitfield.c's set_all_true()' -- fixed 2013-07-29 04:19:15 +00:00
Jordan Lee 104d4aa772 don't inline functions that can't be inlined. 2012-12-13 02:00:45 +00:00
Jordan Lee 0846d3f2ab in bitfield.c, speed up countArray() by about 15% 2012-12-09 19:08:06 +00:00
Jordan Lee 3d5b43b5b4 in bitfield.c's countRange() function, make walk_end an invariant 2012-12-09 18:24:57 +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 0337806b03 #4506 'crash from memory corruption somewhere called from tr_handshakeDone()' -- possible fix. 2011-09-28 16:07:35 +00:00
Jordan Lee 16de40c78d remove redundant assertion 2011-09-27 02:44:07 +00:00
Jordan Lee 18b90f60bc (trunk libt) in tr_bitfieldSetRaw(), add a `bounded' argument for cases where we know how large the final bitfield will be. This can be used ensure that the excess bits at the end of the array are zeroed out and safe for bitfield.c's countArray() function. 2011-09-26 22:50:42 +00:00
Jordan Lee 6f05024dab #4496 'freeze when having a huge torrent' -- remove redundant debug calls to countArray(). This is a second iteration of optimizations based on MechMK1's Shark report. 2011-09-21 20:17:36 +00:00
Jordan Lee 0560b14cfe #4496 'freeze when having a huge torrent' -- add a bitfield helper function to init the bitfield from an array of flags. 2011-09-20 23:39:40 +00:00
Jordan Lee f8c92d06e6 (trunk libT) fix minor compiler warning when compiling with assertions disabled 2011-07-17 14:34:33 +00:00
Jordan Lee 0b11909854 (trunk libT) small CPU optimization in bitfield.c's countRange() 2011-05-10 03:43:06 +00:00
Jordan Lee bcec22eeb6 (trunk libT) remove an assertion from bitfield that doesn't always need to be true 2011-04-06 04:55:57 +00:00
Jordan Lee 85f853f214 (trunk libT) #4165 "crash on startup introduced in r12262" -- experimental commit 2011-04-05 00:29:42 +00:00
Jordan Lee c14b6bdf03 (trunk libT) remove redundant assert()s 2011-04-05 00:26:31 +00:00
Jordan Lee 3660c44934 (trunk libT) handle situations where we don't know the bitfield's upper bound in advance. This comes up sometimes with magnet links. 2011-03-30 04:14:57 +00:00
Jordan Lee 66d60160b3 (trunk libT) fix bitfield.c assertion failure reported by Rolcol 2011-03-29 16:39:30 +00:00
Jordan Lee 5fcec12cfd (trunk libT) fix bitfield assertion failure due to invalid assumption in tr_bitfieldIsValid() 2011-03-29 01:47:17 +00:00
Jordan Lee 947134bbb3 (trunk libT) more completion and bitfield cleanup: (1) fix regression in tr_cpSizeWhenDone() reported by Waldorf, (2) make simple one-liner functions inlined 2011-03-29 01:17:18 +00:00
Jordan Lee 83c0e4f011 (trunk libT) break the mac build and introduce new crashes.
This is partially to address #4145 "Downloads stuck at 100%" by refactoring the bitset, bitfield, and tr_completion; however, the ripple effect is larger than usual so things may get worse in the short term before getting better.

livings124: to fix the mac build, remove bitset.[ch] from xcode
2011-03-28 16:31:05 +00:00
Jordan Lee 9bf2434e14 (trunk) copyediting: remove trailing spaces from source code lines in daemon/ gtk/ libtransmission/ and utils/ 2011-03-04 23:26:10 +00:00
Jordan Lee 2b9db3c242 (trunk libT) #4048 "use bitsets instead of bitfield in tr_completion" -- done.
Excuse the sprawl. Much of this didn't fit into self-contained commits.
2011-02-23 03:54:04 +00:00
Jordan Lee 094b726316 (trunk libT) remove unused code: tr_bitfieldIsEmpty() 2011-02-21 15:43:41 +00:00
Jordan Lee 32237dbdb0 (trunk libT) remove unused functions: tr_bitsetDifference() tr_bitfieldDifference() 2011-02-21 15:36:07 +00:00