Commit Graph

14 Commits

Author SHA1 Message Date
Charles Kerr b0ee4007ff
refactor: include cleanups (#2392)
* refactor: include <memory> when using shared_ptr or unique_ptr

* refactor: include <cstdio> iff we use it

* refactor: include <cstring> iff we use it

* refactor: include <cstdlib> iff we use it

* refactor: include <string_view> or <string> iff we use it

* refactor: include <array> iff we use it

* refactor: include <ctime> iff we use it

* refactor: include <cctype> iff we use it

* refactor: misc #include cleanups in libtransmission
2022-01-12 20:13:58 -06:00
Charles Kerr 02aa2f46d4
refactor: don't use varargs in tr_error (#2352) 2021-12-27 20:32:22 -06:00
Charles Kerr e7a229e6c3
refactor: tr_sys_path_dirname(), tr_sys_path_basename() now take std::string_view parameters (#2177)
* refactor tr_sys_path_dirname(), tr_sys_path_basename() now take std::string_views
2021-11-15 18:50:14 -06:00
Charles Kerr 86f4e37571
refactor: tr_sys_path_is_relative() takes a string_view (#2142)
* refactor: tr_sys_path_is_relative() takes a string_view
2021-11-13 10:08:50 -06:00
Charles Kerr f270d6081c
refactor: cppcoreguidelines-init-variables pt. 15 (#2055)
* refactor: uninit vars in subprocess-posix

* refactor: uninit vars in handshake

* refactor: uninit vars in file-posix

* refactor: uninit vars in platform-quota
2021-10-29 17:43:25 -05:00
Charles Kerr c472cbd88d
refactor: only use [[maybe_unused]] if arg might be used (#2033)
* refactor: [[maybe_unused]] iff arg _might_ be used

If the arg is never used, comment out its name.
If the arg is _sometimes_ used e.g. with ifdefs, use [[maybe_unused]].
2021-10-24 11:41:54 -05:00
Charles Kerr c6501c655c
refactor: add performance-* to libt .clang-tidy (#1981) 2021-10-17 16:09:58 -05:00
Charles Kerr f0171668c6
refactor: use C++ static_assert; remove TR_STATIC_ASERT (#1959) 2021-10-14 15:40:35 -05:00
Charles Kerr 1fb5a79813
refactor: use maybe unused attribute (#1918)
* refactor: replace TR_UNUSED with [[maybe_unused]]
2021-10-10 11:52:26 -05:00
Charles Kerr 035ca23226
fix: sonarcloud false error from O_SEQUENTIAL use. (#1882)
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AXvcFXmBqMngl89XhIRU&open=AXvcFXmBqMngl89XhIRU
2021-10-06 08:09:16 -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
Charles Kerr e19353bf60
fix: dead-store asssignment warning in file-posix. (#1809)
* fix: dead-store asssignment warning in file-posix.

This also extracts the different per-platform preallocation methods into
their own standalone functions for readability and clarity.
2021-09-15 11:55:46 -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/file-posix.c (Browse further)