Charles Kerr
e191407dee
refactor: modernize-avoid-c-arrays pt. 1 ( #3702 )
2022-08-24 20:19:21 -05:00
Charles Kerr
c532728c42
refactor: remove TR_N_ELEMENTS macro ( #3674 )
...
* refactor: use std::array for keys in transmission-remote
* refactor: use std::array for wide_module_path in platform.cc
* refactor: use std::array for value in tr_env_get_int()
* refactor: use std::array for SysStoreNames in web.cc
* chore: remove unused macro TR_N_ELEMENTS
2022-08-18 21:31:53 -05:00
Charles Kerr
29f57bc296
chore: iwyu headers ( #3661 )
2022-08-17 11:08:36 -05:00
Charles Kerr
e49747ab51
feat: add tr_strvToBuf() ( #3657 )
...
* feat: add tr_getDefaultConfigDirToBuf()
* feat: add tr_getDefaultDownloadDirToBuf()
* feat: add tr_strvToBuf()
* feat: add tr_torrentFindFileToBuf()
* feat: add tr_torrentGetMagnetLinkToBuf()
* refactor: remove unused makeString() from tests
* feat: add tr_torrentFilenameToBuf()
* feat: add tr_torrentGetTrackerListToBuf()
* chore: remove obsolete comment references to tr_free
* chore: remove unused tr_strdup()
* chore: remove unused forward declarations
2022-08-16 19:28:57 -05:00
Charles Kerr
ef34c7c4dc
refactor: use std::wstring on win32 ( #3578 )
2022-08-03 18:07:38 -05:00
Charles Kerr
0e7ef51d5c
refactor: tr_env_get_string() now returns a std::string ( #3527 )
2022-07-26 23:26:37 -05:00
Charles Kerr
4f7051fe7f
refactor: make tr_session's directory fields private ( #3516 )
2022-07-23 02:13:18 -05:00
Charles Kerr
445aad56a0
test: add platform tests ( #3514 )
...
* test: add tr_getDefaultDownloadDir() tests
this also indirectly tests xdg and homedir
* test: add PlatformTest.defaultConfigDirEnv
* test: add PlatformTest.defaultConfigDirXdgConfig
test: add PlatformTest.defaultConfigDirXdgConfigHome
* test: add PlatformTest.webClientDirEnvClutch
test: add PlatformTest.webClientDirEnvTr
test: add PlatformTest.webClientDirXdgDataHome
* fixup! test: add PlatformTest.webClientDirEnvClutch
fix: win32 breakage
2022-07-22 20:10:02 -05:00
Charles Kerr
9bf2918ad0
refactor: remove tr_strvPath() ( #3509 )
2022-07-22 13:07:23 -05:00
Charles Kerr
0da1cbb6ec
fix: 3508 location invalidation ( #3511 )
...
* Revert "refactor: remove tr_sessionGetConfigDir() (#3506 )"
This reverts commit c50da43ae0
.
* Revert "fix: do not leak in tr_getWebClientDir() (#3502 )"
This reverts commit 5a75e37033
.
2022-07-22 00:52:48 -05:00
Charles Kerr
c50da43ae0
refactor: remove tr_sessionGetConfigDir() ( #3506 )
...
* refactor: remove tr_sessionGetConfigDir() from GTK client
* refactor: remove tr_sessionGetConfigDir() from daemon
* refactor: remove tr_sessionGetConfigDir()
* refactor: remove tr_getTorrentDir()
* fixup! refactor: remove tr_sessionGetConfigDir()
2022-07-21 20:12:45 -05:00
Charles Kerr
5a75e37033
fix: do not leak in tr_getWebClientDir() ( #3502 )
2022-07-21 17:02:13 -05:00
Charles Kerr
bb3871b8b9
fix: silence "couldn't read file" warnings ( #3501 )
...
* fix: silence could not read user-dirs.dirs warning
* fix: silence could not read bandwidth-groups warning
2022-07-21 13:22:38 -05:00
Charles Kerr
c0bb2d40f1
refactor: add pathbuf and std::string-friendly helpers to tr_sys file and path funcs ( #3118 )
...
* refactor: add sv-friendly tr_sys_dir_create() variant
* refactor: add sv-friendly tr_sys_path_get_info() variant
* refactor: add sv-friendly tr_sys_path_exists() variant
* refactor: add sv-friendly tr_sys_path_remove() variant
* refactor: add sv-friendly tr_sys_path_rename() variant
* fixup! refactor: add sv-friendly tr_sys_path_rename() variant
2022-05-21 20:17:00 -05:00
Charles Kerr
31c65eec1f
refactor: remove tr_strvJoin() ( #2896 )
2022-04-07 17:26:59 -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
Charles Kerr
71ad42b1ef
refactor: make err arg optional in tr_sys_* funcs ( #2827 )
2022-03-27 12:37:29 -05:00
Charles Kerr
977b2a1bab
refactor: tr_loadFile() tr_saveFile() take a std::string_view filename arg ( #2822 )
...
* refactor: tr_saveFile takes a string_view
* refactor: tr_saveFile, tr_loadFile take string_view filename
2022-03-25 19:31:27 -05:00
Charles Kerr
03ee0028d4
refactor: tr_sys_path_dirname returns a std::string ( #2792 )
2022-03-21 15:22:50 -05:00
Charles Kerr
a942c67199
refactor: use fmt ( #2758 )
...
* deps: use fmt (8.1.1 tag) to build log strings
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-13 23:43:35 -05:00
Charles Kerr
d2f8e1d4e0
refactor: set logging levels ( #2755 )
2022-03-11 15:09:22 -06:00
Charles Kerr
ba14ffa74c
refactor: sonarcloud "use if init" statements ( #2587 )
2022-02-07 23:44:31 -06:00
Charles Kerr
ebb2ab6aee
chore: update license spdx abbreviations ( #2582 )
...
Use SPDX license list 3.0 terminology: replace deprecated identifiers
GPL-2.0" and "GPL-3.0" with "GPL-3.0-only" and "GPL-3.0-only".
2022-02-07 10:25:02 -06:00
Charles Kerr
ecef0feb0c
refactor: clang-tidy in libtransmission ( #2578 )
...
* chore: enable cppcoreguidelines-slicing warning
* chore: enable readability-named-parameter warning
* chore: enable bugprone-reserved-identifier check
* chore: enable bugprone-not-null-terminated-result check
* chore: enable bugprone-sizeof-expression check
* chore: enable bugprone-incorrect-roundings check
* chore: enable misc-misplaced-const check
* chore: enable bugprone-suspicious-include check
* chore: enable bugprone-signed-char-misuse check
* chore: enable modernize-raw-string-literal check
* chore: enable readability-static-accessed-through-instance check
* chore: enable readability-implicit-bool-conversion check
* fixup! Merge branch 'main' into refactor/clang-tidy
2022-02-06 22:28:36 -06:00
Charles Kerr
5db993d348
chore: iwyu ( #2553 )
2022-01-31 17:05:35 -06:00
Charles Kerr
87dfabb9d2
refactor: replace tr_thread with std::thread ( #2548 )
2022-01-31 13:34:04 -06:00
Charles Kerr
374c24dde1
refactor: trevent use std:: tools intead of pipes ( #2520 )
2022-01-28 17:56:46 -06:00
Charles Kerr
e83a57efa3
refactor: re-enable some clang-tidy rules ( #2498 )
2022-01-24 13:07:55 -06:00
Charles Kerr
df1cca9b57
chore: update copyright years, make notices consistent ( #2463 )
2022-01-20 12:27:56 -06:00
Charles Kerr
3036a76beb
fix: sonarcloud code smells ( #2421 )
2022-01-17 12:39:50 -06:00
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
a5c6168805
refactor: make tr_buildPath() private ( #2374 )
2022-01-02 11:51:59 -06:00
Charles Kerr
deee2b043e
refactor: take string_view in tr_loadFile(), tr_saveFile() ( #2335 )
2021-12-24 13:37:34 -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
e65e0b3caa
refactor: prefer tr_strv*() even more ( #2318 )
2021-12-15 23:16:40 -06:00
Charles Kerr
da855a7257
refactor: use std mutex/lock intead of bespoke ( #2194 )
...
* refactor: use std mutex/lock intead of bespoke
2021-11-20 15:20:45 -06:00
Charles Kerr
f14e741052
fix: some sonarcloud warnings ( #2189 )
...
* fix: pass-large-object-by-reference-to-const warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0Gz8ze7dx8i2lkKEvq\&open\=AX0Gz8ze7dx8i2lkKEvq
* fix: use-std-array-instead-of-C-array warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qcgUnpKTxYiu5B-\&open\=AX0L8qcgUnpKTxYiu5B-
* fix: extract-assignment-from-expression
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qcgUnpKTxYiu5CH\&open\=AX0L8qcgUnpKTxYiu5CH
* fix: move-include-directives-to-top
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qlYUnpKTxYiu5CQ\&open\=AX0L8qlYUnpKTxYiu5CQ
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qcgUnpKTxYiu5CK\&open\=AX0L8qcgUnpKTxYiu5CK
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0WPlmBwxvzFbF6whWh\&open\=AX0WPlmBwxvzFbF6whWh
* fix: ensure-move-constructor-is-noexcept
https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0WPlWzwxvzFbF6whWU\&open\=AX0WPlWzwxvzFbF6whWU
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0bZP20jI_aUyxGBxCD\&open\=AX0bZP20jI_aUyxGBxCD
* fix: replace-redundant-type-with-auto
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0bZP0rjI_aUyxGBxCB\&open\=AX0bZP0rjI_aUyxGBxCB
* fix: make-parameter-const
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0gkQqqPDVGqE4PY-io\&open\=AX0gkQqqPDVGqE4PY-io
* fix: use-init-statement
https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rARJbfJ-O-YIDS9xM\&open\=AX0rARJbfJ-O-YIDS9xM
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0WPlmBwxvzFbF6whWh\&open\=AX0WPlmBwxvzFbF6whWh
* fix: explicitly-delete-copy-ctor
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0gkQr6PDVGqE4PY-i4\&open\=AX0gkQr6PDVGqE4PY-i4
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0bZP9wjI_aUyxGBxCF\&open\=AX0bZP9wjI_aUyxGBxCF
2021-11-17 18:17:09 -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
6571be2b95
feat: add tr_strvPath() ( #2134 )
...
* feat: add tr_strvJoin
* feat: add tr_strvPath
2021-11-12 18:10:04 -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
1fb5a79813
refactor: use maybe unused attribute ( #1918 )
...
* refactor: replace TR_UNUSED with [[maybe_unused]]
2021-10-10 11:52:26 -05:00
Charles Kerr
cc204e0b2c
refactor: prefer "using" over "typedef" ( #1883 )
...
* refactor: prefer "using" over "typedef"
2021-10-06 09:26:07 -05:00
Charles Kerr
96d3559a18
refactor: replace tr_list with std::list in tr_getWebClientDir() ( #1843 )
2021-09-27 08:45:21 -05:00
Charles Kerr
b92c609ed9
refactor: use std container for session torrents ( #1832 )
...
* refactor: use std container for session's torrents
2021-09-24 18:31:02 -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