Commit Graph

349 Commits

Author SHA1 Message Date
Mike Gelfand cdf3cf62f9 Fix some issues revealed by coverity 2015-05-09 11:56:35 +00:00
Mike Gelfand df98031294 #5946: Save "prefetch-enabled" setting as boolean (spotted by cfpp2p) 2015-05-07 06:45:35 +00:00
Mike Gelfand 3b129a72d8 #5908: Check for `tr_loadFile` return value instead of `errno` in `tr_variantFromFile`
Seems like there could be a defect in uClibc making errno not
thread-local. Don't rely on errno value but check function return value
instead which is a better failure indicator.

Return errors from `tr_loadFile` and `tr_variantFromFile` via tr_error.
Fix `tr_sessionLoadSettings` to not fail on Windows if settings.json
does not exist.
2015-04-11 10:51:59 +00:00
Mike Gelfand 949e02b933 Define and use tr_socket_t and TR_BAD_SOCKET instead of int and -1.
Test socket validity by comparing to TR_BAD_SOCKET instead of various
(and sometimes wrong) other tests like `x >= 0`, `x != -1`, `x > 0`,
`x > -1`, `x` (valid), and `x < 0`, `x == -1` (invalid).
2015-03-18 07:34:26 +00:00
Mike Gelfand 440f482d01 Replace tabs with spaces; remove trailing spaces 2015-01-02 11:15:31 +00:00
Mike Gelfand 52a9d774e4 Fix compilation on Windows
This should not affect non-Win32 platforms in any way.
As for Win32 (both MinGW and MSVC), this should hopefully allow for
unpatched compilation. Correct functioning is not yet guaranteed though.
2014-12-13 15:22:39 +00:00
Mike Gelfand f6f7bf8227 #4400, #5462: Move random helpers to crypto-utils
On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing random numbers/data generation to crypto-utils.{c,h}. OpenSSL-
related functionality (generation of cryptographically strong random
data) is moved to crypto-utils-openssl.c.

Rename functions to follow currently accepted style:
* tr_cryptoRandBuf -> tr_rand_buffer
* tr_cryptoRandInt -> tr_rand_int
* tr_cryptoWeakRandInt -> tr_rand_int_weak

Fix rare case of invalid value being returned from tr_rand_int. Return
value for abs(INT_MIN) may be undefined and thus negative, and so
tr_rand_int will return negative value which is incorrect (out of
requested and expected range).
2014-12-04 11:27:38 +00:00
Jordan Lee d9d66e3e42 (trunk, libt) #4160 - the slow slog to catch trunk up to mike.dld's 4160 diff continues. This step applies 4160-04b-dir.patch, which replaces native file operations with the tr_sys_dir_*() portability wrappers added in the previous commit. 2014-09-21 17:55:39 +00:00
Jordan Lee 0323639e57 (trunk, libT) #4160 'foreign character support' -- merge mike.dld's 4160-02b-path.patch, which updates the codebase to use the new tr_sys_path_*() portability wrappers introduced in 4160-02a 2014-07-08 00:08:43 +00:00
Mitchell Livingston 0e01879974 Use built-in _WIN32 macro instead of WIN32 2014-07-04 00:00:07 +00:00
Jordan Lee 5a2268289e (trunk, libT) #5651 'int to bool patch' -- fixed, patch by rajmannugetr 2014-04-27 23:10:01 +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 d49b8b6650 (trunk, libT) #5467: 'transmission-daemon SEGFAULTs on startup without error message if ~/.config does not exist and ~ is not writeable' -- nice quick fix by mike.dld 2014-01-21 02:27:46 +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 d9a6539e19 fix pedantic compiler warnings 2013-09-09 01:32:09 +00:00
Jordan Lee 0e453bb873 (trunk, libT) improved/new MSVC portability wrappers dirname, basename, gettimeofday(). patch by mikedld, breakage by charles 2013-09-08 18:27:27 +00:00
Jordan Lee ea7d2482dd introduce TR_PRIuSIZE macro for portable printf()ing of size_t. mikedld 2013-09-08 17:32:09 +00:00
Jordan Lee 605e2e89ad use evutil_socket_t instead of int to define socket types. Patch my mikedLd :) 2013-09-08 17:03:11 +00:00
Jordan Lee f762c2ce6a treat bool args as booleans rather than ints; no need to compare them a la 'if (boolVal != 0)' 2013-08-24 18:08:38 +00:00
Jordan Lee 28fe36f1f8 #include limits.h where we use it, and don't where we don't 2013-08-24 17:53:45 +00:00
Jordan Lee 9182c34711 #5298 'Transmission not holding queue order' -- fixed with patch by gabrielrcp 2013-08-17 16:20:32 +00:00
Jordan Lee 29e53df9d9 silence a pair of 'unused variable' gcc warnings 2013-07-27 17:48:59 +00:00
Jordan Lee fe79ad39bc add tr_sessionGetTorrents(), a private utility to avoid code duplication in libtransmission 2013-07-20 15:37:13 +00:00
Jordan Lee de248c94fb in peer-msgs.c's tr_peerMsgsCalculateActive(), adjust some of those new tracer assertions to work better with magnet links. 2013-07-09 17:05:32 +00:00
Jordan Lee 74d0f305a6 move platform.c's quota code into its own file. Fixes FTBFS reported in bug #5389 and is also a nice piece of encapsulation. Patch by rb07 2013-07-08 17:07:31 +00:00
Jordan Lee 5452908346 whitespace/indentation 2013-05-23 05:43:12 +00:00
Jordan Lee 027e3f3066 (trunk, libT) #4682 'Add return id from duplicate torrent torrent-add rpc' -- added. 2013-05-22 20:35:38 +00:00
Jordan Lee fcdec9a8bc (libT) don't start the web thread until we have a task to feed to curl 2013-02-15 01:52:47 +00:00
Jordan Lee cd09204a6e (trunk) first draft of changing the FreeSpace API to behave as https://trac.transmissionbt.com/ticket/4076#comment:25 -- libT, rpc, qt, and gtk implementations. 2013-02-09 04:05:03 +00:00
Jordan Lee 407c0b53c7 (trunk) add portability wrappers tr_rename(), tr_remove() for the rename() and remove() funcs s.t. utf16 can be handled 2013-02-04 21:45:20 +00:00
Jordan Lee 1f2bccd17b (libT) recycle the peer id used for public torrents after N hours of use 2013-02-02 13:42:50 +00:00
Jordan Lee aa8ddcb218 (libT) remove pointless tr_session.peer_id variable 2013-02-02 05:31:43 +00:00
Jordan Lee f75027d5e9 make all the log functions/structs/enums use a single 'tr_log' namespace, such as tr_logGetQueue, tr_logAddInfo, tr_logIsLevelActive 2013-01-25 23:34:20 +00:00
Jordan Lee e2c1a360d4 (libT) replace errant snprintf() calls with tr_snprintf() calls 2013-01-23 04:28:37 +00:00
Jordan Lee 0da726e639 (libT) #4632 'custom blocklist generates 2x # of rules': add a fix, which causes r13825's test to pass 2013-01-21 21:14:14 +00:00
Jordan Lee 2d5fe73969 (libT) copyediting: rename the internal tr_blocklist class 'tr_blocklistFile' to distinguish the private per-file API from the public, global API in libtransmission.h 2013-01-21 17:48:36 +00:00
Jordan Lee 14dca05e21 (trunk, libT) #5199 'tr_sessionGetNextQueuedTorrent() can be faster' -- fix r13709 oops 2012-12-28 21:51:10 +00:00
Jordan Lee aa906ced75 (trunk, libT) #5199 'tr_sessionGetNextQueuedTorrent() can be faster' -- modify session.c's tr_sessionGetNextQueuedTorrents() and peer-mgr.c's getPeerCandidates() functions use the new tr_quickfindFirstK() utility" 2012-12-28 20:10:03 +00:00
Jordan Lee 9e86a38345 #3833 'freespace' -- fix memset error. 2012-12-28 05:28:37 +00:00
Jordan Lee 5f1f4934eb (trunk, libT) #3833 'freespace' argument for 'session-get' RPC method -- use TR_PATH_MAX instead of PATH_MAX for session.downloadDirFsType and session.downloadDirBlkDev 2012-12-27 20:22:32 +00:00
Jordan Lee 4cbe6a64e1 (trunk, libT) #3833 'freespace' argument for 'session-get' RPC method -- apply taem's 0003-Cache-download-dir-s-block-device-and-FS-type.patch​ to cache the download dir's block device and FS type 2012-12-27 19:45:01 +00:00
Jordan Lee c1559f3cc4 (trunk, libT) first drop of the tr_quark patch. 2012-12-22 20:35:19 +00:00
Jordan Lee aea6d7cd6f (trunk, libT) #5168 'make libtransmission's public funcs nonblocking when possible' -- remove tr_torrentRef() and tr_torrentUnref() as discussed in https://trac.transmissionbt.com/ticket/5168#comment:8 2012-12-14 20:04:37 +00:00
Jordan Lee e96ed247fe refactor libtransmission's tr_benc class as tr_variant. 2012-12-14 04:34:42 +00:00
Jordan Lee 079c78981c (trunk) #5168 'make libtransmission's public funcs nonblocking when possible' -- first attempt. 2012-12-12 20:22:57 +00:00
Jordan Lee 9ddd7e0166 preallocate a couple of dictionaries to the right size before using them. 2012-12-09 21:28:20 +00:00
Jordan Lee a2d2a10226 (trunk, libT) #5165: fix r13625 oops 2012-12-07 01:53:31 +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
Mitchell Livingston 8e5a62ed40 add a missing @ to a comment 2012-09-18 03:46:01 +00:00