* Add support for creating torrents with a source flag
* Add the source flag functionality for Mac OSX
* Source flag should be a part of the info dictionary
* Address review comments
* Rename "sourceFlag" to "source" since "Flag" is usually reserved for booleans.
* Free the "source" pointer in tr_metainfoFree.
* Add information about transmission-create argument to its manpage.
* Replace all occurences of "sourceFlag" with "source" and use "Source tag" in UI
* Settle on just "Source" in UI
* The last usage of "flag" hopefully bites the dust! ;-)
* Add a missing free for the source in tr_metainfoFree
* Add a "source" field to the torrent-get RPC method
* uncrustify
* Test for torrents having different infohashes due to different source flags.
This is the whole point of this feature, so it makes sense to test it.
* case is important
* try to incorporate the macosx xml changes
* refactor: fix uninit var warnings in magnet.cc
* refactor: fix uninit var warnings in completion.cc
* refactor: fix uninit var warnings in session.cc
* Modernize bitfield.cc: Storage changed to vector of bytes, return vector from getRaw, new Span readonly memory view
Modernize bitfield.cc: Code style/review notes
Modernize bitfield.cc: Code format
* Modernize bitfield.cc: Swap end and begin in bit counting code assertion
* Modernize bitfield.cc: Rewrite states and simplify code
* Modernize bitfield.cc: Fixing the code and tests
* Modernize bitfield.cc: Fixing tests
* Modernize bitfield.cc: Formatting; +std::size, +const
wolfSSL's fastmath support requires options.h to be included before
anything else. Otherwise bad codepaths get taken and a crash occurs
during DH initialization.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
* refactor: add an enumeration of the script types
This simplifies the API by having a single set of functions that can be
used for getting/setting all the script types.
* Fix 409/404 error when request URI is exactly equal with server URL
* Fix 409/404 error when user requests "/web" path without trailing slash
* Fix errors when "rpc_url" setting has no trailing slash
* Code style fixes
* rpc-server.c: code refactoring and minor fixes
* Minor code style fix
* rpc-server.c: handle_request refactoring
Co-Authored-By: uprt <15909793+uprt@users.noreply.github.com>
* rpc-server.c: minor refactoring
Co-Authored-By: uprt <15909793+uprt@users.noreply.github.com>
* Fix clang-format warning
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: allow vararg calls in qt/.clang-tidy
An awkward PR since this isn't intended for the qt/ codebase at all, but
rather for use with libtransmission instead. But libtransmission is *so*
noncompilant at this point that this config can't be promoted higher up
the tree yet. Instead, it needs to be callable on-request by devs.
* refactor: make clang-tidy happy with bandwidth.h, .cc
* refactor: use getFooSpeedBytesPerSecond()
* refactor: make tr_peerIo a class
No behavioral changes.
Use `new` and `delete` and change `struct` references to `class`.
* refactor: make some tr_peerIo fields const
* refactor: reorganize tr_peerIo fields to remove padding holes
* refactor: remove redundant field tr_peerIo.isIncoming
* refactor: make tr_peerIo.inbuf, .outbuf fields const*
* Modernize bitfield.cc: Grouped member functions into the struct; C++ construction
* Modernize bitfield.cc: Naming style similar to qt/ C++ source
* Modernize bitfield.cc: Bitfield test updated to new API
* Modernize bitfield.cc: Renames for private functions
* Modernize bitfield.cc: Formatting
* Modernize bitfield.cc: Remove struct in 'struct Bitfield' and update commented code too
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* Modernize bitfield.cc: Rename tr_bandwidth to Bandwidth; Move dependent structs and consts into it
* Modernize bitfield.cc: Rename internal fields to lower_snake_case_ with suffix underscore
* Modernize bitfield.cc: Remove struct in 'struct Bandwidth' type usages
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* Modernize bandwidth.cc: Move functions inside struct
* Modernize bandwidth.cc: Review notes - remove extraneous checks, move small functions into .H file, etc
* Modernize bandwidth.cc: Construction and destruction is now via C++ new/delete
* Modernize bandwidth.cc: Rename used() to notifyBandwidthConsumed()
* Modernize bandwidth.cc: Children is now unordered_set
* Modernize bandwidth.cc: Allocation functions for peer bandwidth are now using std::vector instead of ptrArrays
* Modernize bandwidth.cc: Code formatting
* Modernize bandwidth.cc: Private fields after public; Minor review notes
* Modernize bandwidth.cc: Ungroup enums into constants; Docs minor update
* Modernize bitfield.cc: Docs comments changes; Using constexpr instead of const
Co-authored-by: Charles Kerr <charles@charleskerr.com>
These public methods weren't used anywhere except in tr_session, so make
them private.
tr_sessionGetAltSpeed_Bps()
tr_sessionGetPieceSpeed_Bps()
tr_sessionGetRawSpeed_Bps()
tr_sessionSetAltSpeed_Bps()
tr_sessionSetSpeedLimit_Bps()
this field now points to tr_torrent.errorString instead of copying into
a standalone char array.
old: sizeof(tr_torrent) 2640
new: sizeof(tr_torrent) 2136
* fixup! refactor: use std::set in tr_webseed (#1847)
fix: use placement new to instantiate tr_webseeds.tasks
* fixup! refactor: use std::string in tr_scrape_response (#1866)
fix: avoid assigning a nullptr to std::string
* fixup! refactor: use std::string in tr_scrape_response (#1866)
fix: avoid assigning a nullptr to std::string
* C++ modernize: Replace MIN/MAX with type safe std::min/std::max
* Template std::min/max invocations now explicitly use largest integer type
* torrent.cc did not have <algorithm> included
* MIN/MAX Changes for subprocess-win32.cc
* Using type{} style cast instead of template parameter in std::min/max
* 32-bit type cast errors with uint64_t versus size_t
* 32-bit type cast errors inout.cc and file.cc
* Missing include in windows code; Type cast error fixed
* Missing macro in win32 daemon; Replaced MIN in commented code with std::min
* Update libtransmission/tr-getopt.cc
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
* Update libtransmission/file-posix.cc
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
* Update tests/libtransmission/copy-test.cc
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
* Update libtransmission/peer-mgr.cc
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
* Strlen returns size_t, remove cast
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
Simple change to silence warnings, changes the offending enums to be
constexprs. There is still more cleanup work to update other enums;
this just addresses the ones causing compiler warnings
* fix: dead-store asssignment warning in file-posix.
This also extracts the different per-platform preallocation methods into
their own standalone functions for readability and clarity.
* refactor: tr_quickfindFirstK --> std::partial_sort
Remove `tr_quickfindFirstK()` and use `std::partial_sort()` instead.
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
We know what strings are passed into tr_strip_positional_args(). Instead
of using dynamic allocation, use a fixed-size array that's big enough to
fit the strings that we have.
Port libtransmission to C++. This PR doesn't refactor everything to c++.
Its code changes are only what was necessary to compile and link as c++.
See libtransmission/README.md for details on how to submit modernization
patches!
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
* Switch to a standalone ARC4 implementation
This frees us from expecting it being provided by one of the crypto
libraries we support, all of which deprecated and/or removed it at this
point.
Fixes: #1103Fixes: #1777
* Suppress lgtm warnings about RC4 being weak (we don't care)
The previous code had some redundant calculations, e.g. calling
tr_torrentGetActivity() a couple of times per torrent, once in
tr_sessionCountQueueFreeSlots() and once in tr_torrentIsStalled().
Only one call is necessary.
tr_sessionCountQueueFreeSlots() used to keep iterating through all
torrents even if the number of free slots had already been decremented
to zero, even though further iteration does not change the zero return
value :) This PR checks the return value while looping to prevent this.
* perf: if logs are disabled, don't build log names
handshake.c and peer-io.c call tr_peerIoGetAddrStr() to build a name for
passing to tr_logAddDeepNamed(). Since tr_peerIoGetAddrStr() isn't free,
make sure deep logging is enabled before building the name.
* perf: prioritize announces based on scrape stats
This change is to improve responsiveness when starting a large batch of
torrents, e.g. when starting up a seedbox, but is also generally useful.
First, try to scrape as many torrents as as quickly as possible, giving
preference to that even over announces. Thanks to multiscrape we can run
through scrapes an order of magnitude faster than announces. Then scrape
responses tell us which swarms have leechers and we can prioritize those
torrents' announces.
Second, increase how many scrapes and announces we start at a time. This
limit probably hasn't been needed since 2da97b25 and by scraping faster,
the sooner we'll know which torrents to announce first.
* chore: remove printf() tracer
* perf: use scrape to know when a swarm is all-seeds
For private torrents, the tracker is the sole source of peers. So when a
private torrent's tracker responds that there are 0 leechers, we can use
that information to mark the entire swarm as seeders and to not initiate
connections to those peers if we are seeding. This can help seedboxes to
more efficiently pick which swarms to prioritize.
This strategy is not used on public torrents, since new seeder-to-seeder
connections can be useful there for pex.
This PR changes tr_peerMgrAddPex() to (1) remove tr_atom.seedProbability
field (which was not as robust as intended) and (2) add batches of peers
instead of a single peer.
* fix: only use all-seeds check for private torrents
tr_peerMgrStartTorrent() is called once per torrent on startup, so this
can be expensive if the user has a lot of torrents.
Instead, enqueue a pending rechoke that will happen on idle. This way,
all the added torrents can be handled by a single rechoke call.
* perf: lookup tables for faster torrent searching.
tr_torrentFindFromId(), tr_torrentFindFromHashString(), and
tr_torrentFindFromHash() are now O(log N) instead of O(N) where
N is the number of torrents.
* build: fix clang-tidy warning
error: integer to pointer cast pessimizes optimization opportunities
[performance-no-int-to-ptr,-warnings-as-errors] from TR_BAD_SYS_FILE
which expands to INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)
* Add in-kernel copying support for Linux (sendfile64(2), copy_file_range(2)), FreeBSD 13 (copy_file_range(2)), MacOS (copyfile(2)), and Windows (CopyFileExA).
* Fix macro name USE_COPY_FILE_RANGE.
* Minor bugfixes for userspace fallback.
* Fix linux sendfile64 bugs.
* Remove some overzealous asserts.
* Allow transmission-test-copy to take an optional argument for an external reference file.
* Fix return value error of tr_sys_path_copy.
* Use COPYFILE_ALL for Macs without COPYFILE_CLONE.
* Add in-kernel file copying for several platforms.
Numerous operating systems now have support for copying files directly in the
kernel, which is generally more efficient than copying in a userspace read(2)/
write(2) loop. (This becomes particularly relevant for 4th gen PCI-E storage,
which approaches the latency of DRAM.) For Linux I use sendfile64(2), and, for
later kernels, copy_file_range(2). FreeBSD 13 will also support
copy_file_range(2). MacOS has copyfile(2), and Windows has CopyFileExA.
Operating systems lacking such a syscall continue to use the existing
read(2)/write(2) loop.
* Appease uncrustify.
* Appease uncrustify.
* copy-test: generate random content at run time.
* copy-test: Stylistic changes and more check()s.
* copy-test: files_are_identical should follow test idioms
* tr_sys_path_copy: numerous tweaks as requested by review.
* s/old file/source file; s/new file/destination file.
* tr_sys_path_copy: handle win32 wide characters in paths.
* Uncrustify.
* test-copy: Use non-string create_file_with_contents.
* tr_sys_path_copy: numerous fixes.
Per review: generate test file content at runtime; tidy use of check();
fix style; re-measure file sizes in the copy; define a macro when the
system does not provide it; use Unicode APIs on Windows; and fix
documentation.
* Updated as per comments.
* Rebase kernel-copy changes onto 3.0 with gtest.
* Undo irrelevant comment change.
* Fix syntax error.
* Use tr_malloc() instead of tr_valloc().
* Use EXPECT instead of TR_ASSERT in gtest.
* Add error handling.
* Acceptable coding style has changed again.
Now it's camelCase. Also use nullptr instead of NULL, etc.
* Fix east/west const.
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
This is based off of PR#1526 by azy5030 to add in: Torrent Web, BiglyBT, and FrostWire. I made the additional change requested by livings124.
In addition this also adds support for: HTTP Seed, aria2 (#532), and BitLord.
* refactor: remove unnecessary func tr_valloc()
We're only using it in a handful of places, and none of them need the
kind of alignment that posix_memalign() provide. So we can drop a few
dozen lines by removing the portability wrapper.
* refactor: const correctness
* refactor: fix some implicit conversions
* refactor: make local pointers const if their objects are not modified
* refactor: do not cast away const in torrent-cell-renderer
* refactor: remove call to deprecated gtk_icon_size_lookup_for_settings
* refactor: member functions that do not mutate their objects should be declared const
* chore: do not end comments with a semicolon
* refactor: const correctness
* refactor: use getpwuid_r instead of getpwuid
* chore: simplify dict walking loop logic
* refactor: remove dead store assignment in announcer
* refactor: use std::make_shared
* chore: add '@license' tag to web sources' comments
Webpack's tersify plugin looks for that JSDoc tag in order to decide
which comments to extract into the generated license file.
* chore: address sonarcloud.io warnings
* chore: address sonarcloud.io code smells
* fixup! chore: address sonarcloud.io warnings
Give the web client a major overhaul.
User-visible highlights include:
* Mobile is now fully supported.
* Added fullscreen support on mobile.
* Better support for dark mode.
* Added mime icons to the torrent list.
* Improved theme consistency across the app.
Maintainer highlights include:
* Updated code to use ES6 APIs.
* No longer uses jQuery UI.
* No longer uses jQuery.
* Use Webpack to bundle the Javascript, CSS, and assets together -- the entire bundle size is now 68K gzipped.
* Added eslint / prettier / stylelint tooling.
* Uses torrent-get's 'table' mode for more efficient RPC calls.
* 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>
* Support .git files (e.g. for worktrees, submodules)
* Fix symlinks in source tarball, switch to TXZ, adjust non-release name
* Remove autotools stuff
Since there is no way to mark parameters as [potentially] unused in
standard C and when using MSVC compiler, use the widely accepted
cast-to-void approach instead.
* Switch to new libcurl's polling interface
* Drop unused includes
* Use NOFILE limit value defined by operating system
* Avoid tight loops, ensure blocking for a small timeout
When there are no file descriptors to wait for, select() would work the
same as sleep(). But curl_multi_wait() returns immediately in this case,
so we need to add explicit wait to avoid tight loops.
Documentation: https://curl.haxx.se/libcurl/c/curl_multi_timeout.html
Discussion: https://curl.haxx.se/mail/lib-2018-03/0074.html
* Bump libcurl minimum version to 7.28.0
* refactor: make variant_headers reusable to qt app.
Torrent.cc's `change()` template methods are generically useful to deal
with tr_variant wrangling, but previously were only used in Torrent.cc.
This PR moves them into a new API `VariantHelpers.h` for use by Prefs,
Session, TorrentModel, etc.
* crypto-utils: do tr_rand_int without abs
There is really not much point in trying to abs a random int when you can just interpret it as unsigned in the first place.
* fixup! trailing space
how did this get in here?
* fixup! unsigned int
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Previously it was calculated from `log10(1.0 / DBL_EPISILON) - 1`;
however, there's no need to calculate it out when there's an ANSI
standard that already spells it out consisely.
In libtransmission/variant.c, function tr_variantWalk, when the variant
stack is reallocated, a pointer to the previously allocated memory
region is kept. This address is later accessed (heap use-after-free)
while walking back down the stack, causing the application to crash.
The application can be any application which uses libtransmission, such
as transmission-daemon, transmission-gtk, transmission-show, etc.
Reported-by: Tom Richards <tom@tomrichards.net>
* feat: add tr_stat.infoDate to note tr_info changes
The last time during this session that any tr_info field changed
(e.g. trackers/filenames edited or magnet torrent got metadata).
RPC clients can monitor this to know when to reload fields which
don't usually change.
* faster updating of trackers combobox.
* generate trackerDisplayNames just once per torrent
* refactor: cache torrent delegate's warning emblem
* refactor: change mainwin refresh debounce to 200ms
* refactor: do not store trackers, hosts in QVariant
* refactor: don't use `virtual` when it's not needed
* refactor: faster counting torrents-matching-filter
* refactor: faster tracker handling in filterbar
* refactor: improve json parser's prealloc heuristic
* refactor: make Torrent::hasError() faster
* refactor: remove redundant speed stats collection
* refactor: remove unnecessary tor->isQueued() calls
* refactor: use unordered containers where possible
* scale favicons only once, when adding to the cache
* feat: add optional "format" arg to torrent-get RPC
If the "format" request was "objects" (default), "torrents" will be an
array of objects, each of which contains the key/value pairs matching
the request's "fields" arg. This is unchanged from previous versions.
If the format was "table", then "torrents" will be an array of arrays.
The first row holds the keys and each remaining row holds a torrent's
values for those keys. This format is more efficient in terms of JSON
generation and JSON parsing.
* fix: __attribute__(__printf__) warnings
* fix: implicit fallthrough warning
* fixup! fix: implicit fallthrough warning
* fix: disable warnings for 3rd party code
Since we want to leave upstream code as-is
* fixup! fix: disable warnings for 3rd party code
* fixup! fix: disable warnings for 3rd party code
* silence spurious alignment warning
Xrefs
Discussion: https://stackoverflow.com/a/35554349
Macro inspiration: 90ac46f710/f/src/util/util_safealign.h (_35)
* fixup! fix: disable warnings for 3rd party code
* fixup! fix: implicit fallthrough warning
* make uncrustify happy
* remove uncrustify-test.sh
that's probably off-topic for this PR
* fixup! fix: __attribute__(__printf__) warnings
* Update libtransmission/CMakeLists.txt
Co-Authored-By: ckerr <ckerr@github.com>
* fixup! silence spurious alignment warning
* use -w for DISABLE_WARNINGS in Clang
* refactor: fix libtransmission deprecation warnings
* fix: pthread_create's start_routine's return value
This was defined as `void` on non-Windows but should have been `void*`
* chore: uncrustify
* fix: add DISABLE_WARNINGS option for SunPro Studio
* fix "unused in lambda capture" warnings by clang++
* fix 'increases required alignment' warning
Caused from storing int16_t's in a char array.
* fix net.c 'increases required alignment' warning
The code passes in a `struct sockaddr_storage*` which is a padded struct
large enough for the necessary alignment. Unfortunately it was recast as
a `struct sockaddr*` which has less padding and a smaller alignment. The
warning occrred because of these differing alignments.
* make building quieter so warnings are more visible
* fixup! fix 'increases required alignment' warning
* Fix -Wcast-function-type warnings in GTK+ app code
https://gitlab.gnome.org/GNOME/gnome-terminal/issues/96 talks about both
the issue and its solution.
GCC 8's -Wcast-function-type, enabled by -Wextra, is problematic in glib
applications because it's idiomatic there to recast function signatures,
e.g. `g_slist_free(list, (GFunc)g_free, NULL);`.
Disabling the warning with pragmas causes "unrecognized pragma" warnings
on clang and older versions of gcc, and disabling the warning could miss
actual bugs. GCC defines `void (*)(void)` as a special case that matches
anything so we can silence warnings by double-casting through GCallback.
In the previous example, the warning is silenced by changing the code to
read `g_slist_free(list, (GFunc)(GCallback)g_free, NULL);`).
* fixup! fix "unused in lambda capture" warnings by clang++
* fixup! fix "unused in lambda capture" warnings by clang++
* fix two more libtransmission compiler warnings
* fix: in watchdir, use TR_ENABLE_ASSERTS not NDEBUG
In some filesystems, including ones mounted on a network drive, using a small buffer size
significantly hurts copy performance. Upping the buffer to 1024kb to increase copy performance.
* Unify/Modernize TOS to DSCP standards
The set of pre-named TOS values are now renamed to the latest DSCP
standards, with traffic classes and everything exciting. To keep
everything in the same place, a segment has been added to net.h to keep
the currently named values.
A result of these changes is that "lowcost" is probably no longer
harmless, as it now encourages the router to preferentially drop the
packages when bandwidth requires so. "lowdelay" is assigned to a pretty
high AF class for SIP and stuff. I am not sure at all about the
"throughput" assignment. I mean, the whole point of DSCP-fication is
translating from the old ToS bits to a more precedence-based notation,
and precedence is supposed to lie beside the old 4 ToS bits...
A funny interaction between the AFxy and the old ToS fields lies in
the old "reliability" (0x08) field. All odd numbers of y (1, 3 : low,
high) switches it on. If you spend 5 more minutes on it you can probably
come up with "pun" values that hold similar meanings in DSCP and
Prec/ToS.
By removing the IPv6 override, I should have kind of satisfied the #692
request.
Fixes: #692
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
RFC 2616 defines headers as case-insensitive, so if rpc is behind a
reverse proxy that lowers the case of headers, transmission will not
parse them correctly.
A new wrapper function, `tr_strcasestr` is added to
libtransmission/utils.c to allow for comparisons of headers case
insensitively, and checks in cmake and autogen are included.
* MISRA C++:2008, 8-0-1 - An init-declarator-list or a member-declarator-list
shall consist of a single init-declarator or member-declarator respectively
* CERT, DCL52-J. - Do not declare more than one variable per declaration
* CERT, DCL04-C. - Do not declare more than one variable per declaration
* MISRA C:2004, 12.4 - The right-hand operand of a logical && or || operator
shall not contain side effects.
* MISRA C++:2008, 5-14-1 - The right hand operand of a logical && or ||
operator shall not contain side effects.
* MISRA C:2012, 13.5 - The right hand operand of a logical && or || operator
shall not contain persistent side effects
* CERT, EXP02-C. - Be aware of the short-circuit behavior of the logical AND
and OR operators
Assignments explicitly enclosed in parentheses are ignored.
* MISRA C:2004, 13.1 - Assignment operators shall not be used in expressions
that yield a Boolean value
* MISRA C++:2008, 6-2-1 - Assignment operators shall not be used in
sub-expressions
* MISRA C:2012, 13.4 - The result of an assignment operator should not be used
* MITRE, CWE-481 - Assigning instead of Comparing
* CERT, EXP45-C. - Do not perform assignments in selection statements
* CERT, EXP51-J. - Do not perform assignments in conditional expressions
* MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case
* MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a
literal suffix
* CERT DCL16-C. - Use "L," not "l," to indicate a long value
* CERT, DCL50-J. - Use visually distinct identifiers
I'm seeing 7 potentially false reported issues re. use of uninitialized buffer
data here. It seems that `read` function should be properly supported by
Coverity, but maybe it can't figure out the postconditions of it properly...
Walking in the dark here.
Remove static assert altogether: it should have worked everywhere anyway,
otherwise there is no point.
Add a few casts here and there to ensure proper type for directory handle.
* Silence coverity CHECKED_RETURN on added.f load
The existing code behaved alright since added.f is optional.
However, by testing for success we can both silence the warning
and prevent a useless initialization of NULL/0 to added_f and
added_f_length.
* Silence coverity CHECKED_RETURN on added6.f load
ipv6 variant of previous commit.
* Silence coverity CHECKED_RETURN writing benc strs
saveStringFunc() gets the target string by calling tr_variantGetStr().
It previously didn't check to see if this function succeeded because
saveStringFunc() isn't reached without the type already being known.
However, checking the return value costs nothing and makes Coverity happy.
* Silence coverity CHECKED_RETURN on ut metadata
Like earlier few Coverity commits in this PR, we're handling optional
values by declaring stack locals set to the default (e.g. -1) and then
trying to read the variant.
Unlike the earlier commits, there is a two-part step to thise read:
checking for the metadata, then checking for the individual fields.
The earlier fixes' aproach -- e.g. initializing to -1 only if the reads
failed -- would involve new nested conditionals. I find the new complexity
to outweigh the benefit of removing the dead store, so in this case I'm
casting the return value to `(void)` to tell Coverity to shush.
* Silence coverity CHECKED_RETURN on scrape
Check the return value of tr_variantGetInt() when showing
seeder and leecher counts in transmission-show.
* Silence CHECKED_RETURN on rpc recently-active
When building a list of removed torrent IDs from variants, confirm that
we can read the IDs from the variants before adding them to the list.
I don't _think_ this would have failed before, but Coverity's right that
it's reasonable to add a safeguard here.
* fix: better fix to serializing benc strings
The approach in 33e2ece7e5 was
a little problematic: GetString() shouldn't fail here; but if
it somehow did, we still want to encode a zero-length benc string here.
* chore: make uncrustify happy
* applied changes from https://github.com/Elbandi/transmission/tree/elbandi/labels to official transmission repo
* Fix compilation errors
* Address review comments
Changed `tr_ptrArray* labels` to `tr_ptrArray labels`;
Removed tr_ptrArrayNew() tr_ptrArrayDup() tr_ptrArrayFree()
Use tr_strsep() to split string by delimiters
Update transmission-remote.1
Update rpc-spec.txt
* Fix warning, address comments
* Rebase, fix formatting and address comments
Use uncrustify to format changed files
Fix "const <type>" -> "<type> const"
Fix small comments
* Lock torrent for setLabels, check for duplicates
* Check for empty labels in daemon
* Stop on first error
* feat: make multiscrape limits adaptive
Previously hardcoded by TR_MULTISCRAPE_MAX. This change makes
that the initial value, then incrementally lowers the value
when multiscrapes get "req too long" style errors.
* fix: don't log personal announce url
* chore: treat HTTP 400 as scrape-too-long
* chore: copyediting
* chore: copyediting
* move 'const' to the right of the type
* make conditional tests explicitly boolean
* make 'key' const
* don't lookup a value we already have
* make an array for known too-big scrape error messages
* improved multiscrape throttle logging
* fix: multiscraping of low numbers of torrents
Handle the case of getting a 'multiscrape too big' error message
back even if the user fewer than TR_MULTISCRAPE_MAX torrents.
* uncrustify
* fix oops
* refactor: remove TR_MULTISCRAPE_MIN
Is there any reason to have a minimum batch size?
* make test explicit boolean
Co-Authored-By: ckerr <ckerr@github.com>
* improve declaration of too_long_errors
Co-Authored-By: ckerr <ckerr@github.com>
* make test explicitly boolean
Co-Authored-By: ckerr <ckerr@github.com>
* make test explicitly boolean
Co-Authored-By: ckerr <ckerr@github.com>
* improve looping decl of too_long_errors
This is useful if the client script is going to access
the .resume file. Ensuring an up-to-date .resume file
means that user scripts will be able to access it.
This commit adds a new blocklist line format, namely individual IPv4
CIDR ranges separated by newlines. Text put after each entry is ignored
by sscanf, so feel free to put any kind of comments there.
Fix#230.
Set the first version component to be the same as the last Subversion-based
release build version and add two more components (major and minor version
numbers). To allow for nightly build updates this should probably include
another component (e.g. build timestamp), but we're not there yet.
This seems to be the idiomatic way to fix libressl compatibility issues,
judging by what most other open source projects seem to be doing.
I've confirmed that transmission builds with libressl for me after this
patch is applied.
While zlib is mandatory for transmission, it is not mandatory for curl.
A libcurl that has been compiled with no support for zlib will return no data if compressed responses are set to on.
In the basic case this prevents the port checking functionality from working properly. It also prevents web seeding from working as well.
While resolved paths always contain the `\\?\` prefix, it's not always
correct to strip only those 4 chars. In case of UNC paths, the prefix
is actually a bit longer (`\\?\UNC\`) and needs to be replaced with `\\`
instead.
Failing to do so results in invalid paths, e.g. `\\Host\Share\File` becomes
`UNC\Host\Share\File` which totally wrong.
While resolved paths always contain the `\\?\` prefix, it's not always
correct to strip only those 4 chars. In case of UNC paths, the prefix
is actually a bit longer (`\\?\UNC\`) and needs to be replaced with `\\`
instead.
Failing to do so results in invalid paths, e.g. `\\Host\Share\File` becomes
`UNC\Host\Share\File` which totally wrong.
Store full revision hash in REVISION file. Write fixes 10 chars of revision
hash to version.h. Use `#pragma once` in version.h. Support getting revision
from TeamCity environment variable (similar to Jenkins).
Walk up one level at a time until the directory creation succeeds, then go
back down one level at a time. This reduces the number of operations in the
most common case (when directory already exists).