Commit Graph

133 Commits

Author SHA1 Message Date
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 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 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
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 1cd9d0f9b7 copyediting: indentation & whitespace 2012-12-15 04:28:19 +00:00
Jordan Lee 89b3c5fc0a when a peer sends us a block and we count it in tr_cpBlockAdd(), don't invalidate cp.sizeWhenDone unless sizeWhenDone wasn't already including that new block. 2012-12-15 03:47:11 +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 624c8ff1cc (trunk, libt) #4932 'crash on magnet links' -- fixed. 2012-09-19 05:11:19 +00:00
Jordan Lee a8468a7b09 (trunk libT) #4684 "tr_cpSizeWhenDone() is slow for huge torrents that we're only partially downloading" -- fixed.
There are actually two different implementations of the byte-counting in that function: a slower implementation was added prior to 2.40 in r12918 to double-check the standard implementation. This checking was added to help smoke out a bug that was fixed in r12920, but I forgot to remove that slower implementation.
2011-12-22 19:35:13 +00:00
Jordan Lee 4857e8ebb1 (trunk libT) add several more tr_completion assertions to smoke out the (sizeWhenDone() < sizeNow()) error reported in the forums 2011-09-26 06:18:48 +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 fdec244f04 (trunk libT) #4336 "availablility nonsense" -- fix bug in tr_cpMissingBytesInPiece() introduced last week by r12515 for #4332. Add assertions to the nightly build to watch for regressions of this fix.
The bug was that I fixed #4332's off-by-one improperly in tr_cpMissingBlocksInPiece(). The piece's last block has to be calculated separately because its byte size may be different than the other blocks, The mistake in r12515 was that the last block could wind up being counted twice.
2011-07-02 13:20:17 +00:00
Jordan Lee 42a49a6c70 (trunk libT) #4332 "countRange/countArray exception" -- fix bug in tr_cpMissingBytesInPiece() 2011-06-25 13:31:25 +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 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 b4d36aeb54 (trunk) #4138 "use stdbool.h instead of tr_bool" -- done. 2011-03-22 15:19:54 +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 f015bafdbf (trunk libT) #4083 "Wrong shades of progress in Inspector pieces view." -- fixed.
The problem was reported by Rolcol and tracked down by livings124. It's flashing orange because the completion in "availability" doesn't match the completion in in "progress", which corresponds with tr_torrentAvailability() and tr_torrentAmountFinished(). tr_cpGetAmountDone() was recently reworked in r12012 for #4048, which caused the problem. Both functions need to sample the torrent using the same methodology so that their results can be used together.
2011-03-05 03:51:57 +00:00
Mitchell Livingston 6092362c1e revert the last commit 2011-02-26 14:59:05 +00:00
Mitchell Livingston 39709abd6e store secondsDownloading and secondsSeeding as ints instead of time_t 2011-02-26 14:56:58 +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 d591767941 (trunk libT) #3656 "endgame could be faster" -- fixed. Patch by harrydb. 2011-02-15 16:04:56 +00:00
Jordan Lee 9ed800c45a (trunk libt) #3968 "tr_cpFileIsComplete could be faster" -- fixed.
Rewriting this function as described in ticket #3968. This rewrite drops it from 1.77% of cpu use to 0.07%.
2011-01-31 16:43:37 +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 254a1f15cb (trunk libT) down the rabbit hole: various minor type correctness changes unearthed by -Wconversion 2010-06-30 16:40:19 +00:00
Charles Kerr 4917cd119b (trunk libT) #3051 "faster startup by adding 'have all' idiom to .resume files" -- implemented in trunk for 2.00 2010-03-15 23:29:56 +00:00
Charles Kerr 5c26afdb52 happy new year! 2010-01-04 21:00:47 +00:00
Charles Kerr ac202f13bb (trunk libT) remove dead code -- tr_assert() 2009-12-28 23:11:26 +00:00
Charles Kerr 78ead8c3dd (trunk) update the copyright notices 2009-12-05 02:19:24 +00:00
Charles Kerr f69e335291 (trunk) #2096: Magnet, BEP #9 support 2009-11-24 02:16:31 +00:00
Charles Kerr f4dde1eb67 (trunk libT) omit some unnecessary tests on the bitfield checks. these seem small, but bitfields are always the top CPU abuser when I profile... 2009-04-11 03:24:36 +00:00
Charles Kerr 29661cf245 (trunk libT) new macro, tr_assert(). use it to help smoke out #1749 2009-01-25 16:14:11 +00:00
Charles Kerr f47cc0cf4d (trunk libT) #1794: possible fix -- better handling of zero-size files 2009-01-25 04:22:11 +00:00
Charles Kerr a13e0755f0 (trunk libT) close open files immediately after they're done downloading 2009-01-12 21:59:53 +00:00
Charles Kerr a1b2af981c (trunk libT) annotate tr_cpBlockBitfieldSet() as suggested by wereHamster. 2009-01-09 17:55:48 +00:00
Charles Kerr 30ebbdaacb (trunk libT) re-enable the completion sanity tests for the benefit of the nightly builds 2009-01-07 17:22:17 +00:00
Charles Kerr 141847b902 (trunk libT) update the copyrights on some files that no longer have old code in them 2009-01-07 06:53:29 +00:00