Commit Graph

25 Commits

Author SHA1 Message Date
Yat Ho a2b547fb50
chore: iwyu (#6201) 2023-11-03 12:03:26 -05:00
Yat Ho 0259edbaf3
fix: json string serializer improperly escaping characters (#6005)
* feat: escape json string according to RFC8259

* fix: do not append newline when json serde is in compact mode

* fix: json tests

1. Use the same locale settings as the apps
2. Added additional test case for a string that are known to be prone to locale issues
3. Removed test for escaping non-BMP characters to UTF-16 escape sequences

* chore: add more test cases to `JSONTest.testUtf8`

* chore: order cases in the same order as RFC8259
2023-10-16 19:36:37 -05:00
Charles Kerr 59c638c63d
refactor: replace tr_variant::is_*() with tr_variant::holds_alternative() (#5930) 2023-08-21 16:16:54 -05:00
Charles Kerr 5837603b6f
refactor: make tr_variant follow RAII (#5923) 2023-08-20 23:15:23 -05:00
Charles Kerr a4d205612a
refactor: add tr_variant_serde (#5903) 2023-08-17 11:02:45 -05:00
tearfur 5ec4ca550e
chore: iwyu (#5746) 2023-07-08 10:24:03 -05:00
tearfur 41cfdce6fd
refactor: replace some C idioms with C++ ones (#5656)
* tidy up legecy practices

* remove undefined std::ignore usage

* avoid extra function stack level in daemon.cc
2023-06-22 17:58:16 -05:00
Mike Gelfand e8fcb025a0
fix: use user-preferred locale (#5444)
* Use user-preferred locale

Previous fix adding `L` format specifier was correct but only fixed half
of the problem, as C++ locale is set up to be "C" by default. GTK client
used to call `setlocale(LC_ALL, "")` to set up user-preferred locale
which only affected C functions and `std::locale` (used by libfmt) was
unaware of those changes.

Apply the fix to all the binaries since they're all doing some sort of
output to the user and calling libtransmission helpers, as well as using
libfmt directly.

* Improve libtransmission's json-test

Set the locale C++ way to avoid any sort of inconsistencies, and also
restore it to the old one once finished testing.

* Improve transmission-show test runner script

Quote outputs to avoid CMake error about `message()` being called with
no arguments. Capture stderr to the same output file. Fallback to `git
diff` if `diff` wasn't found. A few other minor changes.
2023-04-27 09:10:33 -05:00
Daniel Kamil Kozar 848212eea1
fix: escaped representation of non-BMP characters when generating JSON (#5096) 2023-03-02 00:55:16 -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 8df26dd2fc
refactor: re-enable some clang tidy warnings in tests (#4170) 2022-11-14 14:16:29 -06:00
Charles Kerr bfec98c323
refactor: avoid tr_new() in transmission-remote (#3665) 2022-08-17 20:25:42 -05:00
Charles Kerr 29f57bc296
chore: iwyu headers (#3661) 2022-08-17 11:08:36 -05:00
Charles Kerr 83ffa6bf1b
chore: fix spdx abbreviations (#3602) 2022-08-08 13:05:39 -05:00
Charles Kerr 3ed6b187bb
refactor: iwyu utils.h (#3583) 2022-08-04 08:44:18 -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 df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -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 a79a868257
refactor: make tr_variantFromBuf() public (#2187)
* refactor: add tr_variantFromBuf() and support inplace json/benc parsing
2021-11-17 23:37:35 -06:00
Charles Kerr 250a2e3cc5
refactor: remove unused pieces of str to variant (#2166)
* feat: add tr_variantInitStrView()

* refactor: remove unused function tr_variantFromJsonFull

* refactor: tr_variantFromJson() now takes a string_view

* refactor: tr_variantFromBenc() now takes a string_view

* refactor: remove unused source arg from tr_variantFromBencFull()

* refactor: make tr_variantFromBuf() private
2021-11-15 01:21:57 -06:00
Charles Kerr 4091f273fa
refactor: prefer tr_variantDictFindStrView() in tests (#2132)
* refactor: prefer string_view in tests
2021-11-12 12:04:55 -06: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 567f1e48c8
tr_quark_new() now takes a std::string_view (#1961) 2021-10-15 08:28:47 -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 677dc73eac
refactor: use GTest for running tests (#1383)
* refactor: use google-test on libtransmission tests
2020-08-11 13:11:55 -05:00