Commit Graph

61 Commits

Author SHA1 Message Date
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr 42b1362760
refactor: tidy libtransmission includes (#2316) 2021-12-15 15:25:42 -06:00
Charles Kerr ec457551ab
refactor: make Bandwidth.children a std::vector (#2197) 2021-11-20 10:58:47 -06:00
Charles Kerr d8b57fe4dc
refactor: web_utils (#2121)
* chore: move web utils from web, utils to web-utils
2021-11-08 21:30:03 -06:00
Charles Kerr 62372602b4
refactor: run clang-tidy on bandwidth.h, .cc (#1930)
* chore: allow vararg calls in qt/.clang-tidy

An awkward PR since this isn't intended for the qt/ codebase at all, but
rather for use with libtransmission instead. But libtransmission is *so*
noncompilant at this point that this config can't be promoted higher up
the tree yet. Instead, it needs to be callable on-request by devs.

* refactor: make clang-tidy happy with bandwidth.h, .cc

* refactor: use getFooSpeedBytesPerSecond()
2021-10-12 01:04:22 -05:00
Charles Kerr 02b9e17207
refactor: make tr_peerIo a class (#1928)
* refactor: make tr_peerIo a class

No behavioral changes.

Use `new` and `delete` and change `struct` references to `class`.

* refactor: make some tr_peerIo fields const

* refactor: reorganize tr_peerIo fields to remove padding holes

* refactor: remove redundant field tr_peerIo.isIncoming

* refactor: make tr_peerIo.inbuf, .outbuf fields const*
2021-10-11 16:54:16 -05:00
Charles Kerr 8f8d6e5db2
refactor: remove padding holes from Bandwidth (#1926)
Another pahole patch. No functional changes; just rearranging fields.

old sizeof(Bandwidth): 848
new sizeof(Bandwidth): 816
2021-10-11 13:11:24 -05:00
Dmytro Lytovchenko a4d7e11a14
Bandwidth.cc bring naming closer to C++ style of code in qt/ (#1914)
* Modernize bitfield.cc: Rename tr_bandwidth to Bandwidth; Move dependent structs and consts into it

* Modernize bitfield.cc: Rename internal fields to lower_snake_case_ with suffix underscore

* Modernize bitfield.cc: Remove struct in 'struct Bandwidth' type usages

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-09 20:12:03 -05:00
Dmytro Lytovchenko c287b82c00
Modernize bandwidth.cc: Moved functions inside struct (#1895)
* Modernize bandwidth.cc: Move functions inside struct

* Modernize bandwidth.cc: Review notes - remove extraneous checks, move small functions into .H file, etc

* Modernize bandwidth.cc: Construction and destruction is now via C++ new/delete

* Modernize bandwidth.cc: Rename used() to notifyBandwidthConsumed()

* Modernize bandwidth.cc: Children is now unordered_set

* Modernize bandwidth.cc: Allocation functions for peer bandwidth are now using std::vector instead of ptrArrays

* Modernize bandwidth.cc: Code formatting

* Modernize bandwidth.cc: Private fields after public; Minor review notes

* Modernize bandwidth.cc: Ungroup enums into constants; Docs minor update

* Modernize bitfield.cc: Docs comments changes; Using constexpr instead of const

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-09 07:52:09 -05:00
Charles Kerr 83f21b8e0e
refactor: prefer constexpr functions over static inline ones (#1887)
* refactor: prefer constexpr functions over static inline ones
2021-10-06 17:24:04 -05:00
Charles Kerr cc204e0b2c
refactor: prefer "using" over "typedef" (#1883)
* refactor: prefer "using" over "typedef"
2021-10-06 09:26:07 -05:00
Charles Kerr 396afd8a42
refactor: remove unused tr_variant_string.session (#1881)
This was assigned but never used. Shrinks sizeof(tr_bandwidth) by 8 bytes.
2021-10-05 19:06:18 -05:00
Dmytro Lytovchenko 43d1ece562
C++ modernization: Replace NULLs with typesafe nullptrs (#1799)
Fixing CI errors and build errors
Reverted changes: NULL in EV_SET macro; Clang-formatting
Reverted changes: MacosX *.m files reverted from master
2021-09-14 19:18:09 -05:00
Mike Gelfand db3d40d0ed Switch to clang-format for code formatting, include Mac client 2021-08-16 00:38:29 +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 5b29fe1556 Ensure include guard is the first non-comment line 2017-11-14 23:21:28 +03:00
Mike Gelfand 98695fe3c1 Introduce our own assertion macros with finer control 2017-06-08 10:24:12 +03:00
Mike Gelfand e1d53855f4 Avoid declaring multiple variables on the same line 2017-05-01 18:46:41 +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 1af60ad6ad use '#pragma once' instead of #ifndef..#define..#endif guards 2016-03-29 16:37:21 +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 84aed36ba9 (libT) copyediting: whitespace/indentation 2013-02-02 20:17:52 +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 2362580e0e (trunk libT) add a unique key to each tr_bandwidth object, so that when sorting them arbitrarily we can use that key rather than their pointer address. Apparently comparing pointers that aren't allocated in the same array is undefined behavior. 2011-06-19 18:34:10 +00:00
Jordan Lee 1b02eb8641 (trunk libT) use aggregation for the tr_bandwidth objects owned by tr_session and tr_torrent 2011-03-31 14:53:22 +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 757dac11ef (trunk libT) cpu load improvements based on profiling by gunzip 2011-03-15 18:11:31 +00:00
Jordan Lee 0c36e0c9de (trunk libT) remove the unused tr_ratecontrol code. switch webseed over to using tr_bandwidth. 2011-03-03 18:33:24 +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 01ab067e9c (trunk libT) #3662 "libtransmission cpu optimization: fewer calls to tr_time_msec()" -- fixed. 2010-10-24 01:08:08 +00:00
Charles Kerr cdcc4705aa (trunk) #3045 "make libtransmission's API byte-oriented instead of KiB-oriented." -- implemented. This is a largish commit and will break the mac build for a little while. 2010-07-03 00:25:22 +00:00
Charles Kerr 5c26afdb52 happy new year! 2010-01-04 21:00:47 +00:00
Charles Kerr 6b8fb48d64 (trunk libT) replace the TR_INLINE macro with the standard "inline" keyword, since we require inline functions anyway 2010-01-01 22:26:35 +00:00
Charles Kerr 78ead8c3dd (trunk) update the copyright notices 2009-12-05 02:19:24 +00:00
Charles Kerr 30bc1c6e7a (trunk libT) revision to r8910 for #2162: check to see if a field's value has actually changed before setting the "dirty" flag. 2009-08-14 14:41:59 +00:00
Charles Kerr cb79214854 (trunk) remove trailing spaces 2009-08-10 20:04:08 +00:00
Charles Kerr 683073855e (trunk libT) revert most of r8693 as a quick fix for a possible alignment issue on a NAS 2009-06-16 19:31:17 +00:00
Charles Kerr deb679dab0 (trunk libT) avoid an extra per-torrent malloc/free by aggregating its tr_bandwidth into its struct 2009-06-14 22:19:19 +00:00
Charles Kerr 452cb27f9e (trunk libT) re-start work on making libT doxygen friendly. still a long ways to go on this. 2009-05-29 19:17:12 +00:00
Charles Kerr 03fa0b3e7d (trunk) experimental support for tr_torrentSetPriority() 2009-04-18 23:17:30 +00:00
Charles Kerr 41b0cc8cdd (trunk) libT and gtk+ parts for #1889: per-torrent vs. global speed limit confusion 2009-03-04 19:52:57 +00:00
Charles Kerr 2f6b56671f (trunk libT) win32 portability patch from Alexey 2009-01-11 17:02:04 +00:00
Charles Kerr fe816d8135 (trunk) update the GPL code's copyright dates 2009-01-10 23:09:07 +00:00