Commit Graph

79 Commits

Author SHA1 Message Date
Charles Kerr efd6790973
refactor: remove tr_sys_file_flush() (#6647) 2024-03-03 23:29:38 -06:00
Charles Kerr 1855cdb731
refactor: replace tr_sys_file_write_line() with fmt::print("...\n") (#6619)
* refactor: use fmt::print in log.cc

https://github.com/fmtlib/fmt/issues/428#issuecomment-395442159
> You can use fmt::print("...\n") on Windows as well.

Use this mechanism instead of tr_sys_file_write_line()

* refactor: use FILE* in daemon

* refactor: remove unused tr_sys_file_flush_possible()

* refactor: remove unused tr_sys_file_write_line()

* refactor: remove unused tr_sys_file_get_std()

* refactor: remove unused tr_std_sys_file_t
2024-02-25 16:12:08 -06:00
Charles Kerr eeea3c540f
fix: clang-tidy-19 warnings (#6597)
* fix: readability-redundant-casting warnings in libtransmission

* fix: readability-avoid-return-with-void-value warnings in libtransmission

* fix: readability-redundant-member-init warnings in libtransmission

* fix: readability-redundant-inline-specifier warnings in libtransmission

* fix: performance-avoid-endl warnings in libtransmission

* fix: bugprone-multi-level-implicit-pointer-conversion warnings in libtransmission

* fix: bugprone-switch-missing-default-case warnings in libtransmission

* fix: readability-redundant-string-cstr warnings in libtransmission

* fixup! fix: bugprone-multi-level-implicit-pointer-conversion warnings in libtransmission
2024-02-13 10:42:19 -06:00
Charles Kerr 468de87076
refactor: fix cppcoreguidelines-avoid-do-while warnings (#6527)
* fix: avoid do-while in tr_sys_file_lock()

* fix: avoid do-while in BitfieldTest

* chore: set cppcoreguidelines-avoid-do-while.IgnoreMacros

* fix: avoid do-while in FileList::Impl::onRowActivated()

* fix: avoid do-while in tr_spawn_async_in_parent()

* fix: avoid do-while in handle_sigchld()

* fixup! fix: avoid do-while in tr_spawn_async_in_parent()

* fixup! fix: avoid do-while in FileList::Impl::onRowActivated()

* fixup! fix: avoid do-while in tr_spawn_async_in_parent()

fix fd leak regression

* fixup! fix: avoid do-while in tr_spawn_async_in_parent()
2024-01-20 16:56:42 -06:00
Charles Kerr 3f6969217c
chore: remove FMT_STRING macros (#6497) 2024-01-06 14:05:18 -06:00
Charles Kerr 3cd66899fe
refactor: remove prefetch (#6332) 2023-12-04 11:45:37 -06:00
Charles Kerr a952a0731f
refactor: remove the tr_error** idiom (#6198)
* refactor: remove the tr_error** idiom

* fix: tr_error::message() is only constexpr in c++20 and up

* chore: silence a couple of g++-12 Wshadow warnings
2023-11-04 11:39:41 -05:00
Yat Ho a2b547fb50
chore: iwyu (#6201) 2023-11-03 12:03:26 -05:00
Julien 8ac323d5d6
chore: removed copyright timespans in headers (#4850) 2023-11-01 16:11:11 -05:00
hgy59 cf426d8f81
fix: tr_sys_path_copy in file-posix.cc for some Synology Devices (#5966) (#5974) 2023-09-29 19:34:51 -05:00
tearfur 5ec4ca550e
chore: iwyu (#5746) 2023-07-08 10:24:03 -05:00
Charles Kerr ce66e5c442
iwyu: remove, add std headers where used (#5694)
* chore: remove unused #include <array>

* chore: remove unused #include <chrono>

* chore: remove unused #include <set>

* chore: remove unused #include <algorithm>

* chore: remove unused #include "interned-string.h"

* chore: remove unused #include <list>

* chore: remove unused #include <optional>

* chore: iwyu <cstddef>

* chore: iwyu <ctime>

* chore: remove unused #include <cerrno>

* chore: remove unused #include <deque>

* chore: remove unused #include <vector>

* chore: remove unused #include <memory>

* chore: remove unused #include <unordered_set>

* chore: remove unused #include <array>

* chore: remove unused #include <mutex>

* chore: remove unused #include <functional>

* chore: remove unused #include <cmath>
2023-06-29 23:51:55 -05:00
Charles Kerr fd583ac878
deps: bump libfmt to v10.0.0 (#5635)
seems to be semver/minor safe for our API use

Fixes #5511.

Possibly fixes #5627.
2023-06-18 17:36:39 -05:00
Charles Kerr 7d86d67bc7
chore: prefer fmt/core.h over fmt/format.h (#5404) 2023-04-16 15:34:19 -05:00
Charles Kerr d72cb67cfb
chore: include directory name in libtransmission #includes (#5308) 2023-04-14 14:33:23 -05:00
Charles Kerr 63421489fe
refactor: tr_sys_dir_open() takes a std::string_view (#5380) 2023-04-14 09:31:46 -05:00
Mike Gelfand 81f8ceb0f9
Limit in-kernel file copying to 2 GiB blocks at a time (#5039)
This reportedly helps with copying to cifs target where
`copy_file_range()` would sometimes return `EINVAL` for no apparent
reason when copying large files. Extending the limit to `sendfile64()`
to avoid similar issue there, if it exists.

Overall, copying at most 2 GiB at a time will result in more syscalls
but shouldn't affect the performance gain in any noticeable way.
2023-02-25 03:15:17 +00:00
Julien 4b8cfa2e57
chore: update copyrights to 2023 (#4834) 2023-02-11 14:49:42 -06:00
Charles Kerr 93db8f088a
fix: cppcoreguidelines-pro-type-cstyle-cast (#4685)
* fix: libtransmission cppcoreguidelines-pro-type-cstyle-cast

* fix: libtransmission cppcoreguidelines-avoid-do-while

* refactor: inline static class fields

* fix: libtransmission cppcoreguidelines-avoid-reference-coroutine-parameters

* fix: announcer.cc cppcoreguidelines-narrowing-conversions
2023-01-28 15:26:23 -06:00
Charles Kerr c81d0b130c
refactor: add tr_error_set_from_errno() (#4662) 2023-01-25 12:20:10 -06:00
Charles Kerr b5c9e3d697
fix: clang-tidy warnings in libtransmission/transmission.h (#4628) 2023-01-21 13:49:43 -06:00
Dmitry Antipov 770da79cf3
daemon: check whether log file is regular and may be flushed (#4612) 2023-01-18 12:46:57 -06:00
Charles Kerr d9278bd167
refactor: misc-use-anonymous-namespace pt. 5 (#4552) 2023-01-07 16:55:00 -06:00
Charles Kerr cc4cbff049
refactor: misc-use-anonymous-namespace pt. 2 (#4538) 2023-01-04 22:16:22 -06:00
Charles Kerr d0639b5f0c
perf: tr_sys_path_basename() returns a std::string_view (#4176) 2022-11-15 08:29:00 -06:00
Charles Kerr cdf817f2e7
fix: FTBFS on Windows (#4036)
* refactor: getPiececLength() now returns size_t

* refactor: tr_torrentSetMetadataPiece() length arg is now size_t

* refactor: tr_peerIo::flushOutgoingProtocolMsgs() returns size_t, takes a tr_error** for reporting errors

* refactor: define tr_mode_t for convenience

* fix: suseconds_t portability fix
2022-10-28 19:12:37 -05:00
Charles Kerr 56e0a1bda8
chore: add cppcoreguidelines-pro-type-member-init to libtransmission/.clang-tidy (#3840) 2022-09-23 00:51:15 -05:00
Charles Kerr dd12fd010a
chore: iwyu headers (#3833) 2022-09-21 18:34:18 -05:00
Charles Kerr 9280bf3475
chore: re-enable qt clang tidy warnings (#3791) 2022-09-08 18:26:18 -05:00
Dmitry Antipov 2bcb8f8535
Do not fsync descriptor referred to a tty (#3785)
When transmission-daemon is running with '--foreground' option,
log messages are emitted to standard error, which may be referred
to a tty. Since an attempt to fsync() tty is always an error,
an extra isatty() precaution should be applied.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
2022-09-07 13:44:31 -05:00
Charles Kerr 806a6382d7
fixup new minor warnings (#3786)
* fixup! Add fallback for copy_file_range EXDEV error (#3756)

* fixup! refactor: use readability-identifier-naming in clang-tidy (#3784)
2022-09-07 12:41:01 -05:00
Charles Kerr 1782dc6d7a
refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
Xist12gh 32a4709b1a
Add fallback for copy_file_range EXDEV error (#3756)
* Invalid cross-device: copy_file_range changed in Kernel 5.18 (#3654)

* allow fallback to other copy routines based on errno

* tiered kernel copy routines are tried in runtime now when available
2022-09-07 00:25:52 -05:00
Charles Kerr ae74a13eb1
test: improve file-win32, file-posix test coverage (#3761) 2022-09-04 19:40:34 -05:00
Charles Kerr 4f3f0ccbeb
refactor: remove unused function tr_sys_file_seek() (#3727)
* refactor: remove TR_SYS_FILE_CREATE_NEW

* refactor: remove tr_sys_file_seek()
2022-08-28 14:10:00 -05:00
Charles Kerr db3467b553
refactor: remove tr_sys file_map_for_reading() (#3723) 2022-08-27 14:05:21 -05:00
Charles Kerr c7466b3ff4
fix: coverity warnings (#3632)
* fix: uninitialized field natpmp

* fix: unchecked downcast result

* fix: potential tr_error leak

* fix: potential tr_error leak

* fix: potential tr_error leak

* fix: potential nullptr dereference in test fixtures

* fix: handshake fields not initialized in constructor

* chore: cast unchecked return value to void

* chore: cast unchecked return value to void

* chore: cast unchecked return value to void

* chore: make single-arg constructors explicit

* fix: code smell make variable a pointer-to-const

* fix: code smell make variable a pointer-to-const

* chore: make single-arg constructors explicit

* chore: silence sonarcloud false warning on commented-out-code

* chore: fix code smell use std::array

* chore: make EvTimer::handleTimer() const

* chore: mark tr_bandwidth remove_child as noexcept
2022-08-13 12:11:07 -05:00
Charles Kerr 7c5862a5f5
refactor: remove tr_new, tr_free pt. 1 (#3626)
* refactor: tr_torrentGetMetadataPiece() returns an optional vector

* refactor: use tr_pathbuf in create_temp_path()

* refactor: use tr_pathbuf in win32 create_temp_path()

* refactor: use std::vector in isPeerInteresting()

* refactor: remove tr_new0 from tr_peerMgrPeerStats()

* refactor: remove tr_new0 from rechokeUploads()

* refactor: silence clang nullptr dereference warning

* refactor: make tr_natpmp a C++ class

* refactor: use std::string in tr_log_message
2022-08-11 19:59:58 -05:00
Charles Kerr 90f08f4fa1
refactor: fix recent sonarcloud warnings (#3593) 2022-08-05 20:37:21 -05:00
Charles Kerr 8b983b3d1c
refactor: tr_sys_path_resolve() returns a std::string (#3587)
* refactor: tr_sys_path_resolve returns std::string
2022-08-05 11:36:01 -05:00
Charles Kerr 3ed6b187bb
refactor: iwyu utils.h (#3583) 2022-08-04 08:44:18 -05:00
Charles Kerr 4f6909a27a
refactor: tr_sys_dir_get_current() returns a std::string (#3581) 2022-08-03 23:59:41 -05:00
Charles Kerr 5eb7f75010
refactor: tr_sys_path_get_info() now returns a tr_sys_path_info (#3566)
* refactor: tr_sys_path_get_info() now returns a tr_sys_path_info

* refactor: tr_sys_file_get_info() now returns a tr_sys_path_info
2022-08-02 12:41:04 -05:00
Charles Kerr ec79a2a888
fix: clang-tidy misc-const-correctness warnings (#3529) 2022-07-27 09:03:13 -05:00
Charles Kerr 690cf50e53
perf: tr_sys_path_dirname() returns a std::string_view (#2990)
* refactor: use nodejs impl of path.win32.dirname()

* refactor: use nodejs impl of path.posix.dirname()
2022-05-21 11:10:58 -05:00
Charles Kerr c8f5cff564
fixup! fixup! fix: ensure all bytes read / written to file (#2682) (#2780) (#3033)
fix spurious tr_error being set when reading up to EOF.

This regression generated invalid error messages when no error occurred.
2022-04-30 16:57:11 -05:00
Charles Kerr 5e769fbc55
refactor: make tr_recentHistory a template class (#3012)
This gives more flexibility on the size of the count bins, so we can save space on smaller counts
2022-04-28 10:52:26 -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 33cbe33229
refactor: remove varargs from TR_ASSERT_MSG() (#2861) 2022-04-01 18:00:51 -05: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