Commit Graph

46 Commits

Author SHA1 Message Date
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
Charles Kerr fbfbfac3ae
fix: minor coverity warnings (#5916)
* fix: unchecked return value from tr_variantDictFindInt()

coverity 1541113

* fix: unchecked return value from tr_variantDictFindBool()

coverity 1541112

* fix: copy-instead-of-move in tr_strlower()

coverity 1541092

* fix: use auto& instead of auto in test

coverity 1541084

* fix: logically dead code

coverity 1541065

* fix: copy-instead-of-move in tr_announcer_impl::addTorrent()

coverity 1541062

* fix: unchecked return value of tr_variantDictFindInt()

coverity 1541061

* fix: copy-instead-of-move in FilterBar::Impl::tracker_filter_model_update()

coverity 1541058

* fix: copy-instead-of-move in gtr_window_on_close()

* fix: silence invalid resource leak warning

coverity 1520595

* fix: unchecked return value from setsockopt()

coverity 1518345

* fix: dereference after null check (FORWARD_NULL)

coverity 1517816
2023-08-21 21:59:47 -05:00
tearfur 5ec4ca550e
chore: iwyu (#5746) 2023-07-08 10:24:03 -05:00
Thomas Weißschuh 4dc836f330
tests: expose libtransmission gtests to ctest (#4731) 2023-02-11 11:27:36 -06:00
Charles Kerr 0e5f7f86d7
fix: coverity warnings (#4687)
* fix: minor tr_error leak warning in tests

* fix: socket leak in tr_globalIPv6()
2023-01-29 16:49:59 -06:00
Charles Kerr 862abe909c
fix: bugprone-unchecked-optional-access warnings in tests (#4672) 2023-01-26 10:50:42 -06:00
Mike Gelfand 57e6b06921
Modernize CMake code (ongoing refactoring) (#4515)
* Use imported CMake target for CURL

* Use imported CMake target for fmtlib

* Use imported CMake target for WideInteger

* Use imported CMake target for FastFloat

* Use imported CMake target for UtfCpp

* Use imported CMake target for Threads

* Use imported CMake target for Iconv

* Use imported CMake target for crypto backend

* Use imported CMake target for GTK

* Use imported CMake target for Qt

* Use imported CMake target for deflate

* Use imported CMake target for libevent

* Use imported CMake target for natpmp

* Use imported CMake target for miniupnpc

* Use imported CMake target for dht

* Use imported CMake target for psl

* Use imported CMake target for libutp

* Use imported CMake target for libb64

* Use include directories from libtransmission target
2023-01-02 16:23:51 +00:00
Charles Kerr 554ba06ae2
fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -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 8df26dd2fc
refactor: re-enable some clang tidy warnings in tests (#4170) 2022-11-14 14:16:29 -06:00
Charles Kerr 80d9d5a63b
refactor: add tr_peerIo::peek() (#3798) 2022-09-09 13:12:47 -05:00
Charles Kerr 9fb590d3f5
fix: recent coverity warnings (#3788)
* fix: suppress intentional USE_AFTER_FREE in tests

* fix: unnecessary field check

* fix: in ~tr_verify_worker(), release mutex lock before waiting
2022-09-07 19:24:56 -05:00
Charles Kerr 82212ff1d8
refactor: move the verify worker thread into a wrapper class (#3775) 2022-09-05 23:43:59 -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 83ffa6bf1b
chore: fix spdx abbreviations (#3602) 2022-08-08 13:05:39 -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 ef34c7c4dc
refactor: use std::wstring on win32 (#3578) 2022-08-03 18:07:38 -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
Mike Gelfand 4a18c503c7
Don't call `front()` on an empty string (#3520) 2022-07-25 00:01:42 +01:00
Charles Kerr 4f7051fe7f
refactor: make tr_session's directory fields private (#3516) 2022-07-23 02:13:18 -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 fe288b45e5
perf: do not use tr_variant when parsing .torrent files 2022-05-23 23:05:16 -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 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 32facb50d7
refactor: prefer tr_pathbuf over tr_strvPath() (#2966) 2022-04-22 11:35:56 -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 71ad42b1ef
refactor: make err arg optional in tr_sys_* funcs (#2827) 2022-03-27 12:37:29 -05:00
Charles Kerr bd895b5052
test: fix file-info test edge case (#2811) 2022-03-24 19:03:15 -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 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 88f9704eed
refactor: remove varargs code in tr_sys_file (#2354) 2021-12-28 09:08:04 -06:00
Charles Kerr 2277fde4e0
refactor: prefer tr_strv*() funcs (#2317) 2021-12-15 20:09:46 -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 1fb5a79813
refactor: use maybe unused attribute (#1918)
* refactor: replace TR_UNUSED with [[maybe_unused]]
2021-10-10 11:52:26 -05:00
Charles Kerr 916d418824
fix: some Coverity regressions reported on 2021-09-16 (#1870)
* fix: coverity regressions reported on 2021-10-01

leaks introduced by 3fd5c81a

* fix: resource leak in test utility filesAreIdentical()

* fix: use-after-free warning in test code for tr_urlParse()

* fix: false warning for unterminated c string

* fix: false unchecked return value in test code

cid 1491881

* fix: unterminated c string in test code

cid 1491890

* refactor: slightly better assertions in file-test
2021-10-01 15:28:01 -05:00
Mike Gelfand db3d40d0ed Switch to clang-format for code formatting, include Mac client 2021-08-16 00:38:29 +03:00
Charles Kerr 9f7c865454
refactor: don't store torrent hashes in QStrings (#1428)
* refactor: keep torrent hash in std::array<char,20>

This replaces the hashString QString allocation with a compile-time
array that's included in sizeof the Torrent struct that owns it.
2020-09-07 16:19:10 -05:00
Berbe 8445e090a7
Fix: Test structure shadowing Google Test suite one (#1417)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2020-09-07 13:52:05 -05:00
Mike Gelfand 75458d6be3 Make use of TR_UNUSED macro where cast-to-void was used before 2020-08-18 14:34:49 +03:00
Charles Kerr 677dc73eac
refactor: use GTest for running tests (#1383)
* refactor: use google-test on libtransmission tests
2020-08-11 13:11:55 -05:00