Commit Graph

15 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 e4a172d39c
fix: sonarcloud (#2322)
* fix: sonarcloud warning - redundant cast

* fix: sonarcloud warning - init-statement

* fix: sonarcloud warning - init-statement

* fix: sonarcloud warning - move #include to top of file

* fix: sonarcloud warning - implicit conversion loses precision

* fix: sonarcloud warning - confirm safe use of strlen

* fix: sonarcloud warning - refactor code to not nest more than three deep

* iwyu: cstring

* iwyu: algorithm
2021-12-16 16:58:58 -06:00
Charles Kerr e2b1c71982 fix: unused variable warning when building in release mode 2021-11-28 08:05:44 -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 a127826d76
refactor: cppcoreguidelines-init-variables pt. 11 (#2012)
* refactor: uninit vars in bandwidth.cc

* refactor: uninit vars in cache.cc

* refactor: uninit vars in fdlimit.cc

* refactor: uninit vars in inout.cc

* refactor: uninit vars in platform.cc

* refactor: uninit vars in log.cc

* refactor: uninit vars in tr-utp.cc

* refactor: uninit vars in stats.cc

* refactor: uninit vars in trevent.cc

* refactor: uninit vars in session-id.cc

* fixup! refactor: uninit vars in cache.cc

* refactor: uninit vars in upnp.cc

* refactor: uninit vars in file.cc

* refactor: uninit vars in tr-lpd.cc

* refactor: uninit vars in tr-udp.cc
2021-10-23 10:43:15 -05:00
Charles Kerr 3b019ada3d
refactor: remove redundant assertions (#2009) 2021-10-21 19:02:38 -05: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
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 f876a100a0
refactor: add [[fallthrough]] annotation (#1886) 2021-10-06 12:24:02 -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 312d18281d
C++ modernize: Replace MIN/MAX with type safe std::min/std::max (#1806)
* C++ modernize: Replace MIN/MAX with type safe std::min/std::max

* Template std::min/max invocations now explicitly use largest integer type

* torrent.cc did not have <algorithm> included

* MIN/MAX Changes for subprocess-win32.cc

* Using type{} style cast instead of template parameter in std::min/max

* 32-bit type cast errors with uint64_t versus size_t

* 32-bit type cast errors inout.cc and file.cc

* Missing include in windows code; Type cast error fixed

* Missing macro in win32 daemon; Replaced MIN in commented code with std::min

* Update libtransmission/tr-getopt.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Update libtransmission/file-posix.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Update tests/libtransmission/copy-test.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Update libtransmission/peer-mgr.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Strlen returns size_t, remove cast

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-09-19 15:41:35 -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
Charles Kerr 4c1b627647
refactor: port libtransmission to C++ (#1787)
Port libtransmission to C++. This PR doesn't refactor everything to c++.
Its code changes are only what was necessary to compile and link as c++.
See libtransmission/README.md for details on how to submit modernization 
patches!

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2021-09-12 12:41:49 -05:00
Renamed from libtransmission/bandwidth.c (Browse further)