Commit Graph

41 Commits

Author SHA1 Message Date
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
Antoine Cœur bdac708762
docs: fix various typos and misspellings (#2955) 2022-04-21 09:28:38 -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
Charles Kerr 68bec3f8e3
refactor: remove tr_snprintf() (#2872) 2022-04-04 13:36:48 -05:00
Charles Kerr 1d7d17396f
refactor: remove tr_snprintf() pt 2 (#2871) 2022-04-03 13:23:00 -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
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 e64430941f
refactor: remove tr_strdup_printf() (#2854) 2022-03-31 19:13:37 -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
Ilkka Kallioniemi cff1d0a7d0 Add regression test for tr_strlcpy 2022-02-22 10:34:10 +02:00
Charles Kerr 253f4fe009
chore: remove /upload endpoint from rpc-server (#2550)
It's never been documented or supported and is unused by the web client.

In the unlikely case that a 3rd party app is using it, use 'torrent-add'
instead; it's documented + supported.
2022-01-31 14:54:21 -06:00
Ilkka 020a9e45ae
Add more decimals for low ratios (#2508) 2022-01-25 10:52:22 -06:00
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr db23ca4c6b
refactor: replace tr_info with tr_torrent_metainfo (#2397)
* refactor: replace tr_info with tr_torrent_metafo
2022-01-15 13:33:57 -06:00
Charles Kerr 49f2823d6f
refactor: use std::string in tr_info (#2384) 2022-01-08 17:41:05 -06:00
Charles Kerr a5c6168805
refactor: make tr_buildPath() private (#2374) 2022-01-02 11:51:59 -06:00
Charles Kerr 88f9704eed
refactor: remove varargs code in tr_sys_file (#2354) 2021-12-28 09:08:04 -06:00
Charles Kerr c656bee061
refactor: add tr_saveFile() (#2267)
* refactor: add tr_saveFile()

* refactor: add tr_ctorSaveContents()
2021-12-04 19:32:35 -06:00
Charles Kerr bbe49639d6
refactor: use cpputf for utf8 validation and conversion (#2251)
* refactor: use cpputf for utf8 validation and conversion
2021-11-30 15:13:56 -06:00
Charles Kerr 861474e0ce
refactor: tr session.tos (#2149)
* refactor: make tr_session.tos string_view-friendly
2021-11-13 23:23:19 -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 7693ef69bf
refactor: magnet metainfo (#2124)
* refactor: magnet-metainfo
2021-11-09 20:42:18 -06:00
Charles Kerr bdf1bb6d17
refactor: tr_strv*() util functions (#2123)
* feat: add tr_strv utils
2021-11-09 18:13:47 -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 feaf12a205
refactor: tr_urlIsValid*() now takes a std::string_view (#2078)
* refactor: tr_urlIsValid*() now take a string_view arg
2021-11-01 15:36:14 -05:00
Charles Kerr da51a17c30
refactor: add util tr_strvstrip() to strip string_views (#2077) 2021-11-01 13:50:53 -05:00
Charles Kerr 484e9ee64e
refactor: add a tr_urlParse() with no heap allocs (#2070) 2021-10-31 13:48:32 -05:00
Charles Kerr 236a0965fa
refactor: tr_variant*Str() functions now take a std::string_view (#1990)
* refactor tr_variant*Str functions now take a std::string_view

* refactor: tr_torrentPrimaryMimeType returns a string-view
2021-10-19 21:30:50 -05:00
Charles Kerr 7b423b7e0d
refactor: tr_utf8clean now takes a std::string_view (#1967) 2021-10-15 20:02:40 -05:00
Charles Kerr 3e7b8eb7bb
refactor: tr_parseNumberRange() takes a std::string_view (#1962)
* tr_parseNumberRange() now takes a std::string_view
2021-10-15 17:15:33 -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
Charles Kerr baafb68bfd
refactor: use std::unordered_set for tr_torrent.labels (#1856) 2021-09-29 14:52:19 -05:00
Charles Kerr 7f2578008d
refactor: tr_parseNumberRange returns std::vector. (#1838)
* refactor: tr_parseNumberRange returns std::vector.
2021-09-25 14:37:28 -05:00
Charles Kerr fc0ba38bc9
refactor: tr_quickfindFirstK --> std::partial_sort (#1794)
* refactor: tr_quickfindFirstK --> std::partial_sort

Remove `tr_quickfindFirstK()` and use `std::partial_sort()` instead.

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2021-09-15 09:32:07 -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 f59118d1fe
feat: add torrent-get 'primary-mime-type' to RPC. (#1464)
* feat: add torrent-get 'primary-mime-type' to RPC.

This is a cheap way for RPC clients to know what type of content is in a
torrent. This info can be used to display the torrent, e.g. by using an
icon that corresponds to the mime type.

* use size_t for content byte count

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* explicit boolean expressions

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* use uint64_t for content byte counts

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* avoid unnecessary logic branches

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* explicit cast

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* refactor: add an autogenerated mime-type.h header

* chore: maybe fix the win32 FTBFS

* chore: add mime-types.[ch] to xcode

* Squashed commit of the following:

commit 4c7153fa48
Author: Mike Gelfand <mikedld@users.noreply.github.com>
Date:   Tue Oct 13 03:15:19 2020 +0300

    Remove autotools-based build system (#1465)

    * Support .git files (e.g. for worktrees, submodules)
    * Fix symlinks in source tarball, switch to TXZ, adjust non-release name
    * Remove autotools stuff

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2020-10-13 10:33:56 -05:00
Charles Kerr ce51f1adbf
refactor: work around msvc constxpr std::array bug (#1429)
The tests FTBFS on the latest version of MSVC because it has a regression
that crashes the compiler when it sees a constexpr std::array. This commit
can be reverted when MSVC releases a fix.

https://developercommunity.visualstudio.com/content/problem/1139953/167-regression-auto-constexpr-with-deduced-array-i.html
2020-09-07 19:33:36 -05: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