Frank Aurich
41b2a802cf
Fix another integer overflow bug on 32-bit platforms with torrents > 4GB ( #2391 )
2022-01-12 22:52:36 -06:00
Frank Aurich
319312596a
fix: integer overflow when calculating `sizeWhenDone` ( #2378 )
...
While the function correctly returns a `uint64_t`, internally a `size_t` variable is used to calculate the accumulated size.
On 32-bit systems (e.g. Raspbian) `size_t` is only 32-bit wide, causing overflow for torrents > 4GB.
2022-01-07 10:48:08 -06:00
Charles Kerr
fd96a9270b
refactor: remove tr_file.offset ( #2347 )
2021-12-26 12:43:27 -06:00
Charles Kerr
37a8046ed5
fix: more sonarcloud warnings ( #2324 )
2021-12-16 23:47:51 -06:00
Charles Kerr
9516e8a923
fixup! refactor: tr_completion ( #2220 )
...
fix: incorrect calculation in amountDone
2021-11-28 22:11:30 -06:00
Charles Kerr
35fe175f2a
refactor: add file-piece-map ( #2246 )
...
* refactor: add file-piece-map
* refactor: use tr_file_priorities
* refactor: use tr_files_wanted
2021-11-28 19:12:54 -06:00
Charles Kerr
f6f0db75e1
fix: sonarcloud warnings / code smells ( #2242 )
...
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1f6EvHJiycnfA7gfrG\&open\=AX1f6EvHJiycnfA7gfrG
* fix replace-use-of-new warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs41ZmlvCveKTzon\&open\=AX1ZNs41ZmlvCveKTzon
* fix has-virtual-functions-but-non-virtual-destructor warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs72ZmlvCveKTzo6\&open\=AX1ZNs72ZmlvCveKTzo6
* fix make-variable-const warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0_a_OVNJn7rAzml_7B\&open\=AX0_a_OVNJn7rAzml_7B
* fix remove-redundant-static-specifiers
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTb\&open\=AX06St-81usi2gyYkPTb
* fix function-should-be-declared-const
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTd\&open\=AX06St-81usi2gyYkPTd
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTc\&open\=AX06St-81usi2gyYkPTc
* fix class-has-virtual-functions-but-non-virtual-destructor warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stz41usi2gyYkPTS\&open\=AX06Stz41usi2gyYkPTS
* fix remove-commented-out-code warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTT\&open\=AX06St241usi2gyYkPTT
* fix remove-commented-out-code warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTV\&open\=AX06St241usi2gyYkPTV
* fix has-virtual-functions-but-non-virtual-destructor warning
https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTW\&open\=AX06St241usi2gyYkPTW
* fix remove-commented-out-code warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06SuCA1usi2gyYkPTh\&open\=AX06SuCA1usi2gyYkPTh
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rAQvnfJ-O-YIDS9xF\&open\=AX0rAQvnfJ-O-YIDS9xF
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rAQvnfJ-O-YIDS9xG\&open\=AX0rAQvnfJ-O-YIDS9xG
* fix remove-redundant-access-specifier warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs5tZmlvCveKTzor\&open\=AX1ZNs5tZmlvCveKTzor
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX01Itl7f_SST5i7BN1l\&open\=AX01Itl7f_SST5i7BN1l
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0wDijI2l89lDvp1C9P\&open\=AX0wDijI2l89lDvp1C9P
* fix use-automatically-managed-memory-instead-of-new warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1f6E6HJiycnfA7gfrI\&open\=AX1f6E6HJiycnfA7gfrI
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0l8vknEafnvRiIHUEv\&open\=AX0l8vknEafnvRiIHUEv
* fixup! fix has-virtual-functions-but-non-virtual-destructor warning
2021-11-27 19:58:35 -06:00
Charles Kerr
742ae6fb00
refactor: minor naming change in block_info ( #2233 )
...
* refactor: rename method as block_info.pieceSize()
* refactor: rename method as block_info.blockSize()
2021-11-26 13:33:56 -06:00
Charles Kerr
de169c7ec3
refactor: tr_completion ( #2220 )
...
* refactor: refactor tr_completion + add test coverage for it
2021-11-25 12:26:51 -06:00
Charles Kerr
843e486d2a
refactor: tr_block_info class ( #2210 )
...
* refactor: add tr_block_info with tests
2021-11-24 08:48:52 -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
d6032f829b
refactor: remove tr_piece struct ( #2059 )
...
* refactor: remove tr_piece struct
2021-10-29 13:24:30 -05:00
Charles Kerr
93d8a03d55
refactor: remove outvar args from tr_torGetFooBlockRange() functions ( #2041 )
2021-10-24 22:39:19 -05:00
Charles Kerr
3008a992ca
fix: Bitfield.getRaw() regression ( #2023 )
...
* fix: Bitfield.getRaw() regression
2021-10-24 15:43:36 -05:00
Charles Kerr
2e50383760
refactor: cppcoreguidelines-init-variables pt. 6 ( #1979 )
...
* refactor: fix uninit var warnings in magnet.cc
* refactor: fix uninit var warnings in completion.cc
* refactor: fix uninit var warnings in session.cc
2021-10-18 07:51:02 -05:00
Dmytro Lytovchenko
953f07375a
Modernize bitfield.cc: Storage changes and refactor ( #1927 )
...
* Modernize bitfield.cc: Storage changed to vector of bytes, return vector from getRaw, new Span readonly memory view
Modernize bitfield.cc: Code style/review notes
Modernize bitfield.cc: Code format
* Modernize bitfield.cc: Swap end and begin in bit counting code assertion
* Modernize bitfield.cc: Rewrite states and simplify code
* Modernize bitfield.cc: Fixing the code and tests
* Modernize bitfield.cc: Fixing tests
* Modernize bitfield.cc: Formatting; +std::size, +const
2021-10-16 09:04:19 -05:00
Charles Kerr
fd5804fbb7
refactor: add readability-else-after-return to clang-tidy ( #1956 )
...
* refactor: add readability-else-after-return to clang-tidy
2021-10-14 14:26:38 -05:00
Dmytro Lytovchenko
39376f2105
Modernize/bitfield.cc: Make into C++ ( #1917 )
...
* Modernize bitfield.cc: Grouped member functions into the struct; C++ construction
* Modernize bitfield.cc: Naming style similar to qt/ C++ source
* Modernize bitfield.cc: Bitfield test updated to new API
* Modernize bitfield.cc: Renames for private functions
* Modernize bitfield.cc: Formatting
* Modernize bitfield.cc: Remove struct in 'struct Bitfield' and update commented code too
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-11 12:29:14 -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