Commit Graph

32 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 2866638e1b
refactor: add tr_torrent_files::move() and remove() (#2919) 2022-04-15 18:39:04 -05:00
Antoine Cœur 4590d172de
meta info piece_size should be maximum UINT32_MAX (#2914) 2022-04-15 00:38:59 -05:00
Charles Kerr 9f9f60f1e3
refactor: tr_block_info (#2908) 2022-04-13 20:22:59 -05:00
Charles Kerr 4a65956cc9
refactor: extract some file management into tr_files class (#2906) 2022-04-12 10:00:02 -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
Charles Kerr 2996e223dd
refactor: strbuf for metainfo files (#2833)
* refactor: tr_ctorSaveContents takes a string_view filename

* refactor: remove tr_ctorSaveMagnetContents

* refactor: announce_list::save takes a std::string_view

* refactor: magnet() takes an OutputIt arg

Generate the magnet link URL into an output iterator

* refactor: remove deprecated calls to tr_http_escape

* refactor: tr_torrent.torrentFile takes an OutputIterator

* refactor: tr_torrent.torrentFile returns a tr_pathbuf

* refactor: tr_torrent_metainfo.makeFilename returns a tr_pathbuf

* refactor: use tr_urlbuf in announcer-http
2022-03-28 17:13:32 -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 fa8aaf7631
refactor: remove remaining vararg log messages (#2776) 2022-03-17 17:39:06 -05:00
Charles Kerr 0be920156b
refactor: fmt part 3 (#2773) 2022-03-15 19:51:36 -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 cfb92c47f0
feat: warn when creating torrents with nonportable filenames (#2695)
* feat: check new torrents for nonportable filenames

* fix: parse torrents even if they have nonportable filenames in the info dict's 'file' string
2022-02-23 17:38:07 -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 52f6e80a61
test: add tr_torrent_metainfo.infoDictSize() tests (#2535) 2022-01-29 15:37:42 -06:00
Charles Kerr e51527203e
refactor: re-enable clang-tidy warnings (#2485) 2022-01-23 16:47:41 -06:00
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr aa2183c9c5
fix: torrents readded due to unremoved cfg files (#2433)
Fixes #2430.

When removing a torrent, try to remove config filenames under both old
and new filename formats. This prevents torrents from being incorrectly
re-added when old-format files aren't removed.
2022-01-17 20:36:41 -06:00
Charles Kerr f415de0626
explicitly use unsigned chars (#2423)
Fixes #2106
2022-01-17 15:13:22 -06:00
Charles Kerr 19ede2b8cd
fixup! refactor: replace tr_info with tr_torrent_metainfo (#2397) (#2415) 2022-01-17 11:44:53 -06:00
Charles Kerr 6b440af32f
fix: potential out-of-range error in io's readOrWritePiece() (#2413) 2022-01-16 12:02:47 -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 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 7068eb66c1
refactor: migrate makeFilename() to tr_magnet_metainfo (#2385) 2022-01-08 21:03:21 -06:00
Charles Kerr 02aa2f46d4
refactor: don't use varargs in tr_error (#2352) 2021-12-27 20:32:22 -06:00
Charles Kerr fa35b8ad39
refactor: use std::string in tr_variantToStr() (#2351)
* refactor: use std::string in tr_variantToStr()
2021-12-27 16:47:25 -06:00
Charles Kerr 0b095dc258
fix: sonarcloud warnings (#2350)
* fix: use-init-statement sonarcloud warning

* fix: use-init-statement sonarcloud warning

* fix: conversion-loses-precision sonarcloud warning

* fix: use std::string_view::npos sonarcoud warning

* fix: refactor code to not nest more than 3x sonarcloud warning

* fix: conversion-loses-precision sonarcloud warning

* fix: use init-statement sonarcloud warning

* fix: global variables should be const sonarcloud warning

* fix: conversion-loses-precision sonarcloud warning

* refactor: reduce complexity in doScrape()
2021-12-26 18:32:36 -06:00
Charles Kerr 7c87cb36eb
refactor: tr_torrent_metainfo (#2340)
* refactor: add tr_torrent_metainfo class

Can be used for parsing bencoded .torrent data without instantiating
a tr_torrent. This will be used in all the places where client code
needs to test a .torrent file for validity / to add a preview window
before adding the torrent.
2021-12-25 15:21:13 -06:00