Commit Graph

14338 Commits

Author SHA1 Message Date
Charles Kerr 4a65956cc9
refactor: extract some file management into tr_files class (#2906) 2022-04-12 10:00:02 -05:00
Charles Kerr 8c51c48472
fix: recent FTBFS in msvc (#2907)
* fix: recent FTBFS in msvc

It's happening a line in qt/WatchDir.cc where an enum named `ERROR` is
declared, so it's probably conflicting with a new `ERROR` name in some
header file. Rename ours and make at an `enum class` for good measure.

* build: fix cmake msvc warning

D9025 : overriding /W3 with /W4
2022-04-12 01:56:09 -05:00
maxz 7c76d40a4d
Improve the documentation (#2900)
* Unify the line endings to the Unix style (LF only).

* Fix (where possible) or remove broken links.

* Improve the documentation.

Fix or remove broken links (depending on whether I could find a
working version of the resource).

Change all links to use HTTPS instead of HTTP.

Unify the capitalizations (e.g. uppercase abbreviations, capitalize
proper names and downcase other words).

Fix or improve some parts of the text, clarifying what is meant.

Improve some parts of the program examples (e.g. only use root
privileges where really required).
2022-04-11 12:38:32 -05:00
Charles Kerr 70fbce71ec
refactor: convert watchdir to C++ (#2899)
* refactor: use new/delete instead of malloc/free

* refactor: use std::string instead of raw c strings
2022-04-09 09:58:02 -05:00
Charles Kerr 205abbbcce
refactor: iwyu string, vector, cstdint (#2898)
* refactor: use cstdint for intX_t types

* refactor: iwyu sstring_view

* refactor: iwyu <cstring>

* refactor: iwyu <vector>
2022-04-07 20:50:26 -05:00
Charles Kerr b256da02e3
refactor: remove unused macros (#2897)
* refactor: remove unused fu nction tr_lowerBound()

* refactor: tr_timerAdd() takes a reference, not a pointer

* refactor: tr_timerAddMsec() takes a reference, not a pointer

* refactor: tr_moveFile() takes a reference, not a pointer

* refactor: tr_wildmat() takes std::string_views

* refactor: remove unused macro TR_GNUC_NONNULL

* refactor: remove unused macro TR_GNUC_PRINTF

* refactor: remove unused macro TR_GNUC_NULL_TERMINATED

* refactor: remove unused macro TR_GNUC_HOT

* refactor: remove unused macro __has_feature

* refactor: remove unused macro __has_attribute

* refactor: remove unused macro TR_DEPRECATED

* refactor: remove unused macro TR_DISABLE_COPY_MOVE
2022-04-07 19:20:29 -05:00
Charles Kerr 31c65eec1f
refactor: remove tr_strvJoin() (#2896) 2022-04-07 17:26:59 -05:00
Charles Kerr ffda5bb68a
refactor: remove tr_strip_positional_args() (#2881)
* refactor: use fmt in gtk/SystemIconTray

* refactor: use fmt in gtk/MakeDialog

* refactor: remove unused tr_strip_positional_args()

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-04-07 08:23:04 -05:00
maxz 8d11f0bc22
Fix typographical errors in the documentation. (#2889) 2022-04-06 17:20:38 -05:00
Charles Kerr f79a75cb21
test: fuzz test tr_variantFromBuf() (#2892)
* test: fuzz test tr_torrent_metainfo.parseBenc()

* fix: better error-checking in benc string parsing

* fix: return benc failure if the parse stack is unbalanced

* fix: stack range error when logging json parse errors

* test: fuzz test tr_variantFromBuf()
2022-04-06 16:39:39 -05:00
Charles Kerr a134445caa
test: fuzz test tr_torrent_metainfo.parseBenc() (#2891)
* test: fuzz test tr_urlParse()

* fix: stack error checking in benc parser

* test: fuzz test tr_torrent_metainfo.parseBenc()
2022-04-06 15:26:13 -05:00
Charles Kerr e88ebbc3e5
test: fuzz test tr_magnet_metainfo.parseMagnet() (#2890) 2022-04-06 13:22:08 -05:00
Charles Kerr eb33b2faf5
fix: tr_clientForId() (#2887)
* fix: memory corruption when parsing negative numbers

* fix: stack-buffer-overflow on escape chars in tr_clientForId

* test: add tr_clientForId() fuzz tests
2022-04-06 12:06:11 -05:00
Charles Kerr 7ff1382503
refactor: remove tr_strcmp0() (#2882) 2022-04-05 12:45:26 -05:00
Charles Kerr 80dd460773
refactor: annotate nodiscard, constexpr, noexcept methods (#2879) 2022-04-04 22:51:56 -05:00
Charles Kerr a71f0c762d
refactor: remove varargs from libtransmission (#2876)
* refactor: do not use va_arg in peer-msgs.cc

* refactor: do not use va_arg in platform.cc

* build: enable cert-dcl50-cpp clang-tidy warning

* refactor: use some tr_pathbuf where sensible
2022-04-04 20:37:12 -05:00
maxz 738431169c
Fix typographical errors in the man pages. (#2875) 2022-04-04 13:37:35 -05:00
Charles Kerr 68bec3f8e3
refactor: remove tr_snprintf() (#2872) 2022-04-04 13:36:48 -05:00
Pierre Carru 32cff69213
torrent-daemon: watchdir can use .magnet files (#1328) 2022-04-03 21:14:44 -05:00
Mitch Livingston d948e49da7
Merge pull request #2870 from nevack/nevack/mojave-infowindow-fix
[macOS] Fix Tab selection in InfoWindow on Mojave
2022-04-03 14:40:59 -04:00
Charles Kerr 7aeb5d8b2f
Merge branch 'main' into nevack/mojave-infowindow-fix 2022-04-03 13:34:31 -05:00
Charles Kerr 1d7d17396f
refactor: remove tr_snprintf() pt 2 (#2871) 2022-04-03 13:23:00 -05:00
Dzmitry Neviadomski 7cf920a020 [macOS] Fix Tab selection in InfoWindow on Mojave
Fixes #2599
2022-04-03 16:41:09 +03:00
Gary Elshaw 57b03114dc
New images for 'Message Log' (#2779) 2022-04-02 20:08:39 -05:00
Charles Kerr 76f44b4b6f
fix: sonarcloud (#2868)
* refactor: make this variable const

* refactor: replace redundant type with auto

* refactor: use the nullptr literal

* refactor: replace declaration by structured binding declaration
2022-04-02 17:42:51 -05:00
Antoine Cœur 748d3c2223
updating googletest (#2858) 2022-04-02 15:58:59 -05:00
Charles Kerr 392e511f7e
refactor: remove tr_snprintf() pt 1 (#2867)
* refactor use fmt instead of tr_snprintf in remote.cc

* refactor use fmt instead of tr_snprintf in daemon.cc

* refactor use fmt instead of tr_snprintf in cli.cc
2022-04-02 14:34:29 -05:00
Charles Kerr 1cc9da26ba
fix: sonarcloud (#2865)
* refactor: implement FileTreeItem::children_ with a std::vector

* fix: std::move should not be called on forwarding reference

* fix: uninitialized scalar variable

* fix: unchecked return value from library

* fix: dereference before null check

* fix: unchecked return value from library

* fix: unchecked return value from library

* fixup! refactor: implement FileTreeItem::children_ with a std::vector

* fix: signed-unsigned comparison in libtransmission tests

* fix: avoid unnecessary copy by using const reference

* fix: function should be declared const

* refactor: use fmt::format to build log timestamps

* fix: use init-statement to reduce variable scope

* fixup! refactor: use fmt::format to build log timestamps

* fix: remove tau_tracker destructor for rule-of-zero

* fix: remove tr_peerIo destructor for rule-of-zero

* Revert "fix: dereference before null check"

This reverts commit cd78967815.

* fix: signed-unsigned comparison in libtransmission tests

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: signed-unsigned comparison in libtransmission tests

* fixup! fix: extract nested code block into separate method

* fix: mark possibly-unused as [[maybe_unused]]

* fix: invalid stack memory reference in tr_found_file_t

* fix: signed-unsigned comparison in libtransmission tests
2022-04-02 09:06:02 -05:00
Charles Kerr 46cc95f72e
refactor: remove unused functions (#2863)
* refactor: annotate nodiscard, constexpr, noexcept methods

* refactor: remove unused tr_blocklistFileExists()

* refactor: remove unused tr_blocklistFileIsEnabled()

* refactor: remove unused tr_ctorGetContents

* refactor: remove unused tr_error_is_set()

* refactor: remove unused tr_handshakeGetAddr()

* refactor: remove unused tr_ctorSetLabels()

* refactor: remove unused tr_http_escape_sha1()

* refactor: remove unused tr_lpdEnabled()

* refactor: remove unused tr_ptrArrayPop()

* refactor: remove unused tr_torrentClearIdleLimitHitCallback()

* refactor: remove unused tr_torrentFindFromHash()

* refactor: remove unused tr_sha1_to_string()

* refactor: remove unused tr_torrents::get()

* refactor: remove unused tr_isEncryptionMode()

* refactor: remove unused tr_isPreallocationMode()

* refactor: remove unused tr_ptrArrayBack()

* refactor: remove unused tr_ptrArrayClear()

* refactor: remove unused tr_torrents::get()

* refactor: remove unused Session::torrentSet()

* refactor: remove unused peer_atom comparison operators

* refactor: remove unused peer_atom::compare()

* refactor: remove unused Qt variantInit(tr_variant*, unsigned)
2022-04-01 21:55:30 -05:00
Charles Kerr ca5799a4a8
refactor: annotate nodiscard, constexpr, noexcept methods (#2862) 2022-04-01 19:48:09 -05:00
Charles Kerr 33cbe33229
refactor: remove varargs from TR_ASSERT_MSG() (#2861) 2022-04-01 18:00:51 -05:00
SweetPPro bfd7797c5e
fix: magnet link metainfo corrupted on restart (#2790) 2022-04-01 15:28:55 -05:00
Charles Kerr a250690f30
fix: sonarcloud (#2860)
* fix: break will never be executed

* fix: rewrite rimraf() to be non-throwing

* fix: conditional operation returns same value whether condition is true or false

* fix: use std::array instead of a C-style array

* fix: remove redundant access specifier

* fix: replace switch with if for readability

* fix: convert integer literal to a bool literal

* fix: replace const std::string reference to std::string_view

* fix: remove redundant access specifier

* fix: replace const std::string reference to std::string_view

* fix: remove unused parameter

* fix: remove redundant access specifier

* fix: use std::array instead of C-style array

* fix: remove redundant access specifier

* fix: replace const std::string reference with std::string_view

* fix: remove redundant access specifier

* fix: use std::array instead of C-style array

* fix: remove redundant access specifier

* fix: replace const std::string reference to std::string_view

* fix: remove redundant access specifier

* fix: merge if statement with enclosing one

* chore: clang-format

* chore: clang-format

* Revert "fix: remove redundant access specifier"

This reverts commit 054e4e7eec.

* Revert "fix: remove redundant access specifier"

This reverts commit 2c92f227e8.

* Revert "fix: remove redundant access specifier"

This reverts commit a0710202a8.

* Revert "fix: remove redundant access specifier"

This reverts commit 54da1d9397.

* Revert "fix: remove redundant access specifier"

This reverts commit f7b1777578.

* Revert "fix: remove redundant access specifier"

This reverts commit ad8e3dfff4.

* chore: revert access specifier change
2022-04-01 14:16:33 -05:00
Charles Kerr 6da591fe57
fixup! refactor: use fmt to build the GTK client's user-visible strings (#2788) (#2859)
fix: formattted speeds and percentages
2022-04-01 11:29:05 -05:00
Charles Kerr 1f15933fda
fix: incorrect magnet size calcuation in tr_completion (#2856) 2022-04-01 08:49:54 -05:00
Charles Kerr e64430941f
refactor: remove tr_strdup_printf() (#2854) 2022-03-31 19:13:37 -05:00
beizmos 995012aaa9
updated docs/Port-Forwarding-Guide.md (#2847)
* Add files via upload

- added guide for Windows
- cleaned up

* Update Port-Forwarding-Guide.md

minor fixes

* Updated Port-Forwarding-Guide.md

added note port router port mapping

* Update Port-Forwarding-Guide.md

added note about opening ports in windows

* Update Port-Forwarding-Guide.md

ip a command for unix

* Update Port-Forwarding-Guide.md

rewording, grammatical fixes, syntax
2022-03-31 15:53:21 -05:00
Charles Kerr 98e8d5a3da
fix: getBandwidthGroup use right group (#2853)
Fixes #2828.
2022-03-31 15:07:01 -05:00
Matan Ziv-Av 946cf04833
Bandwidth group are written to a dict, not to a list. (#2852)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-03-31 13:35:21 -05:00
Charles Kerr 6e91136b53
fix: three asan issues (#2851)
* fixup! feat: add support for adding torrents by raw hash values (#2608)

fix array-bounds-read issue found by asan

* fixup! refactor: tr_completion (#2220)

fix array-bounds-read issue in tests fixtures

* fixup! refactor: tr_torrents (#2722)

fix memory leak in torrent-tests
2022-03-31 12:12:54 -05:00
Mike Gelfand d943f069f5
Fix code_style.sh to include *.mm files after switch to Obj-C++ (#2846) 2022-03-31 00:52:23 +03:00
Charles Kerr e4461c48d7
refactor: prefer FMT_STRING (#2845)
* use FMT_STRING in libtr client on non-i18n strings

This gives compile-time safety checks.
2022-03-30 14:59:13 -05:00
Charles Kerr f4afb76695
perf: replace tr_torrentFindFile2() with tr_torrrent.findFile() (#2839) 2022-03-30 13:25:41 -05:00
Charles Kerr 4dd25d8112
fix: tr_strbuf move op loses zero-termination (#2843) 2022-03-30 12:10:51 -05:00
Charles Kerr 66638cc80c
test: fix race condition in move-test (#2841) 2022-03-30 01:30:39 -05:00
Charles Kerr 3dadeae700
fix: file progress in GTK Details dialog (#2838) 2022-03-29 20:52:24 -05:00
Charles Kerr f1a028bb84 chore: revert 2f677aebb assertion 2022-03-29 10:27:34 -05:00
Charles Kerr 4177e286a1
fix: sonarcloud (#2837)
* fix: rename variable to avoid shadow warning w/UTP

* fix: add default dtor for tr_strbuf

* fix: implicit conversion may lose precision

* fix: use init-statement to reduce variable scope

* fix: implicit conversion may lose precision

* fix: extract the assignment from this expression

* fix: use init-statement to reduce variable scope

* fix: use init-statement to reduce variable scope

* fix: do not mix public and private data members

* fix: add a condition to cv.wait call

* fix: do not throw uncaught exceptions in destructor
2022-03-29 05:57:04 -05:00
Charles Kerr 2f677aebb0
refactor: add tracer assertionf or bug #2727 (#2836) 2022-03-28 23:29:35 -05:00
Charles Kerr 2996e223dd
refactor: strbuf for metainfo files (#2833)
* refactor: tr_ctorSaveContents takes a string_view filename

* refactor: remove tr_ctorSaveMagnetContents

* refactor: announce_list::save takes a std::string_view

* refactor: magnet() takes an OutputIt arg

Generate the magnet link URL into an output iterator

* refactor: remove deprecated calls to tr_http_escape

* refactor: tr_torrent.torrentFile takes an OutputIterator

* refactor: tr_torrent.torrentFile returns a tr_pathbuf

* refactor: tr_torrent_metainfo.makeFilename returns a tr_pathbuf

* refactor: use tr_urlbuf in announcer-http
2022-03-28 17:13:32 -05:00