Commit Graph

65 Commits

Author SHA1 Message Date
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 79d244db82
refactor: rename tr_torrent.infoDictSize() (#2383) 2022-01-08 14:05:38 -06:00
Charles Kerr 6149870540
refactor: remove tr_file.priv (#2349) 2021-12-26 16:04:20 -06:00
Charles Kerr a515c1d94b
refactor: use tr_torrent_metainfo in tr ctor (#2345) 2021-12-26 10:25:07 -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 4ea2429217
refactor: tr_torrent housekeeping (#2319) 2021-12-16 02:49:04 -06:00
Charles Kerr 42b1362760
refactor: tidy libtransmission includes (#2316) 2021-12-15 15:25:42 -06:00
Charles Kerr f7b729a350
refactor: add tr_buildTorrentFilename() (#2196)
a simpler API for building .torrent and .resume filenames
2021-11-19 18:36:25 -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 d1f8c28fcd
refactor: make piece checksums private (#2130)
* refactor: remove tr_info.pieces
2021-11-12 10:42:51 -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 75ce9eae7b
perf: minor perf improvements (#2096)
* perf: use avoid unnecessary strlen when making log messages

* perf: avoid temporary string alloc/free in tr_metainfoAppendSanitizedPathComponent()
2021-11-03 20:36:32 -05:00
Charles Kerr 17ee032dd8
refactor: remove TR_BEGIN_DECLS, TR_END_DECLS (#1837)
* refactor: remove TR_BEGIN_DECLS, TR_END_DECLS
2021-09-25 11:07:22 -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
Mike Gelfand 99033b067d Sanitize suspicious path components instead of rejecting them
Apply the same rules on all the supported platforms to avoid issues
with network shares and alien file systems.

For future compatibility, explicitly mark adjusted paths as renamed.

Fixes: #294
2019-06-23 18:08:31 +03:00
Mike Gelfand 5b29fe1556 Ensure include guard is the first non-comment line 2017-11-14 23:21:28 +03:00
Mike Gelfand bb4741002f Go back to using hash as base name for resume and torrent files
The format introduced in TRAC-394 is nice but brings its own issues (e.g.
TRAC-4189, #122). I'm okay with a bit of grepping myself if it makes the
experience better for end users.

Using hashes results in filenames well under 255 bytes limit on some
filesystems. If even that will not be enough, I'd suggest reporting the
issue elsewhere.

Fixes: #122
2017-07-26 21:32:26 +03:00
Mike Gelfand dadffa2c0f Align type qualifiers to the right (code style)
This way all the qualifiers (`const`, `volatile`, `mutable`) are grouped
together, e.g. `T const* const x` vs. `const T* const x`. Also helps reading
types right-to-left, e.g. "constant pointer to constant T" vs. "constant
pointer to T which is constant".
2017-04-20 19:53:20 +03:00
Mike Gelfand d7930984ef Adjust uncrustify config, reformat all but Mac client
There're places where manual intervention is still required as uncrustify
is not ideal (unfortunately), but at least one may rely on it to do the
right thing most of the time (e.g. when sending in a patch).

The style itself is quite different from what we had before but making it
uniform across all the codebase is the key. I also hope that it'll make the
code more readable (YMMV) and less sensitive to further changes.
2017-04-20 10:01:22 +03:00
Mike Gelfand 2248d3670f Get rid of $Id$ SVN keywords in source files 2016-09-02 23:10:15 +03:00
Jordan Lee 1af60ad6ad use '#pragma once' instead of #ifndef..#define..#endif guards 2016-03-29 16:37:21 +00:00
Mike Gelfand 3523277e7f Ongoing refactoring (use size_t instead of int) 2015-12-25 11:34:35 +00:00
Jordan Lee 02cff80c2d Copyedit the license's revised text: (1) remove unnecessary repitition use of the word 'license' from the top of the header and source files (2) add the standard 'we hope it's useful, but no warranty' clause to COPYING (3) make explicit that linking OpenSSL is allowed (see https://people.gnome.org/~markmc/openssl-and-the-gpl.html for background) (4) sync the Qt and GTK+ clients' license popups with COPYING's revised text 2014-01-21 03:10:30 +00:00
Jordan Lee 4b9626bb83 Licensing changes:
1. add the option the code to be used under GPLv2 or GPLv3; previously only GPLv2 was allowed

2. add the "proxy option" as described in GPLv3 so we can add future licenses without having to bulk-edit everything again :)

3. remove the awkward "exception for MIT code in Mac client" clause; it was unnecessary and confusing.
2014-01-19 01:09:44 +00:00
Jordan Lee 4904b923fb (trunk) restore copyright year as suggested in email by rms 2014-01-18 20:56:57 +00:00
Jordan Lee e96ed247fe refactor libtransmission's tr_benc class as tr_variant. 2012-12-14 04:34:42 +00:00
Jordan Lee 410fa7e054 remove unused function tr_metainfoMigrate() 2012-12-09 01:27:01 +00:00
Jordan Lee 3d38723ad9 Follow more common whitespace style conventions in the C code (libtransmission, daemon, utils, cli, gtk). 2012-12-05 17:29:46 +00:00
Jordan Lee b4d36aeb54 (trunk) #4138 "use stdbool.h instead of tr_bool" -- done. 2011-03-22 15:19:54 +00:00
Jordan Lee 879a2afcbd Update the copyright year in the source code comments.
The Berne Convention says that the copyright year is moot, so instead of adding another year to each file as in previous years, I've removed the year altogether from the source code comments in libtransmission, gtk, qt, utils, daemon, and cli.

Juliusz's copyright notice in tr-dht and Johannes' copyright notice in tr-lpd have been left alone; it didn't seem appropriate to modify them.
2011-01-19 13:48:47 +00:00
Charles Kerr e5bb3205a1 (trunk) Join the 21st century and use only 1 space at the end sentences. This commit is nearly as important as the semi-annual ones that remove trailing spaces from the ends of lines of code... :) 2010-12-27 19:18:17 +00:00
Charles Kerr 13b073fcdc (libT) #3291 "tr_torrent.infoDictOffset should be lazily evaluated" 2010-06-16 03:05:23 +00:00
Charles Kerr 3682466488 (trunk libT) #3136 "slashes in magnet names" -- fixed in trunk for 2.00 2010-04-20 23:14:00 +00:00
Charles Kerr 36d97610bd (trunk) #2802, #2716, #2717 -- remember magnet links and their settings between sessions, and allow their trackers to be modified 2010-02-02 22:45:22 +00:00
Charles Kerr 5c26afdb52 happy new year! 2010-01-04 21:00:47 +00:00
Eric Petit 5fb945653f #2673 crash in tr_torrentGetMetadataPiece 2009-12-15 15:19:08 +00:00
Charles Kerr 907c67ba78 (trunk libT) remove unnecessary #includes 2009-12-07 03:57:55 +00:00
Charles Kerr f69e335291 (trunk) #2096: Magnet, BEP #9 support 2009-11-24 02:16:31 +00:00
Charles Kerr 1c3b53244d (trunk) clean up the return value of tr_torrentParse() 2009-08-05 01:59:16 +00:00
Charles Kerr d0ae679a2f (trunk) minor commit: sync the .h licenses with their counterpart .c licenses 2009-06-06 17:39:04 +00:00
Charles Kerr 788b397ecc (trunk libT) more semantic cleanup: tr_handle->tr_session, int->tr_bool, int->tr_port 2008-12-14 11:21:11 +00:00
Charles Kerr a1cd6d85dc (libT) add #ifdefs to ensure that client apps don't #include private libtransmission headers. 2008-11-24 20:17:36 +00:00
Charles Kerr 7ec84486ee (libT) more win32 portability fixes from Spry 2008-10-20 19:34:19 +00:00
Charles Kerr cc89872dd4 run libT, cli, daemon, gtk through the source-code formatter "uncrustify" as promised/threatened 2008-09-23 19:11:04 +00:00
Charles Kerr e4f6b9592d get tr_ctorSetMetainfoFromHash() working again. 2008-04-14 14:39:13 +00:00
Charles Kerr afde752dc0 'resume' cleanup 2008-04-14 11:52:50 +00:00
Charles Kerr b71a2985b3 #684: Use XDG basedir spec for configuration and cache files in $HOME 2008-04-05 20:12:11 +00:00
Charles Kerr 8cc587a66f more housekeeping: benc_val_t --> tr_benc 2008-02-26 21:58:58 +00:00