Commit Graph

392 Commits

Author SHA1 Message Date
Mike Gelfand c1b10abe0f Use UTF-8 for console I/O on Windows 2015-04-21 10:07:57 +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 8c511dc590 Use lseek64 instead of lseek, if available (large files on 32-bit systems) 2015-03-08 19:14:24 +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 4fe156a255 Fix tr_moveFile error reporting
Remove unused `renamed` argument.
Use tr_error instead of errno to report errors to support Win32 file
wrappers which do not map Windows error codes to POSIX ones.
Return bool instead of int (0/-1).

Uncomment tr_error_prefix and tr_error_propagate_prefixed functions.
2014-12-10 18:37:58 +00:00
Mike Gelfand 42de056a4b #4400, #5462: Move SHA1/HEX 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 SHA1/HEX conversion to crypto-utils.{c,h}.

Rename functions:
* tr_sha1_to_hex -> tr_binary_to_hex (add length argument),
* tr_hex_to_sha1 -> tr_hex_to_binary (add length argument).

Make tr_sha1_to_hex and tr_hex_to_sha1 wrappers around above functions.
2014-12-04 20:53:56 +00:00
Mike Gelfand 5c43b5c23c #4400, #5462: Move BASE64 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 BASE64 encoding and decoding to crypto-utils.{c,h}. OpenSSL-
related functionality is moved to crypto-utils-openssl.c.

Add new functions to be implemented by crypto backends:
* tr_base64_encode_impl - encode from binary to BASE64,
* tr_base64_decode_impl - decode from BASE64 to binary.

Change `tr_base64_encode` and `tr_base64_decode` functions to expect
non-negative input data length which is considered real and never adjusted.
To process null-terminated strings (which was achieved before by passing 0
or -1 as input data length), add new `tr_base64_encode_str` and
`tr_base64_decode_str` functions which do not accept input data length as
an argument but calculate it on their own.
2014-12-04 19:58:34 +00:00
Mike Gelfand 13cad2fb55 #5722: Rename remaining WIN32 uses to _WIN32 2014-11-30 20:08:20 +00:00
Jordan Lee 870041d92d (trunk) #4160: mike.dld patch: 4160-08-args.patch 2014-09-21 18:06:28 +00:00
Jordan Lee be290162c2 (trunk) #4160: mike.dld patch: 4160-07-env.patch 2014-09-21 18:05:14 +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 b33a7d4dc1 (trunk, libt) #4160 - the slow slog to catch trunk up to mike.dld's 4160 diff continues. This step applies 4160-03b-file.patch, which replaces native file operations with the tr_sys_file_*() portability wrappers added in r14321. 2014-07-28 04:13:38 +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 60a5c793d9 (trunk, libT) mike.dld's 4160-02a-path.patch: portability wrapper around file paths. 2014-07-03 21:58:39 +00:00
Mitchell Livingston 084273c106 Use built-in __APPLE__ macro instead of SYS_DARWIN and MACOSX 2014-07-03 19:20:12 +00:00
Jordan Lee 92daae473e mike.dld's portability improvements to libtransmission, pt 1 2014-06-23 02:38:53 +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
Mitchell Livingston 4ecbb29137 #5304 daemon fails to build on mac 2013-10-27 19:31:36 +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 af3481400f fix a couple of unlikely-to-be-triggered errors reported by clang static analyzer 2013-07-10 22:28:40 +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 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 445609f690 (trunk) prefer tr_remove() to unlink() or rmdir() 2013-02-04 21:53:19 +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 911d64df44 (libT) add rb07's win32 implementation of tr_is_same_file(). 2013-02-04 20:57:20 +00:00
Jordan Lee fdcba2a7fa only show ratios to one decimal place 2013-01-30 00:16:20 +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 ad3407567b (libT) copyediting: modify more files to the new indentation/whitespace formatting 2013-01-24 23:59:52 +00:00
Jordan Lee 0daad8b7f6 (libT) fix red herring issue that tr_mkdirp() was setting errno even if the call succeeded. Add tests to confirm the fix. 2013-01-23 21:28:35 +00:00
Jordan Lee 25b8b60245 (trunk, libT) #5199 'tr_sessionGetNextQueuedTorrent() can be faster' -- copy peer-mgr.c's partial-sorting peer candidate code to a reusable function in utils.c, tr_quickfindFirstK()" 2012-12-28 20:07:50 +00:00
Jordan Lee c1559f3cc4 (trunk, libT) first drop of the tr_quark patch. 2012-12-22 20:35:19 +00:00
Jordan Lee e96ed247fe refactor libtransmission's tr_benc class as tr_variant. 2012-12-14 04:34:42 +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
Jordan Lee e5304a8aaa make tr_mkdir() private. 2012-10-16 03:13:05 +00:00
Mitchell Livingston 723d681b63 Whoops! Revert new changes committed in r13469 2012-09-06 03:23:50 +00:00
Mitchell Livingston 9e7e64fe04 Revert r13468 for now. 2012-09-06 03:21:03 +00:00
Jordan Lee f55ab8dddb (trunk libT) move torrent.c's private function fileExists() to the utility function tr_fileExists() so that it can also be used by stats.c 2012-07-01 03:05:36 +00:00
Jordan Lee 512cc1af73 silence an unused-variable compiler warning introduced in the previous commit 2012-05-17 22:22:30 +00:00
Jordan Lee 6948852013 (trunk libT) #4894 -- don't use evbuffer_add_printf() and evbuffer_pullup() together. 2012-05-17 17:40:31 +00:00
Jordan Lee b2d65db45f (trunk) remove trailing spaces from code lines ;) 2012-02-03 16:44:07 +00:00
Jordan Lee 206b1a9a5f (trunk web) fix warnings in tr_urlIsValidTracker() and tr_urlIsValid() found by llvm's scan-build.
scan-build found similar warnings in these two functions relating to allowing NULL pointers to be passed as arguments to functions that don't allow NULL. So now those NULL checks are made explicit before the function calls.
2011-12-14 05:40:21 +00:00
Jordan Lee b3d382874a (trunk libT) #4625 "Transmission 2.42 fails to build on Solaris 10: Undefined symbol 'mkdtemp'" -- fixed. 2011-11-10 03:31:43 +00:00
Jordan Lee 9c6e686882 (trunk libT) #4556 "Transmission 2.40 fails to connect with UDP trackers on big endian systems" -- fixed. 2011-10-14 00:02:36 +00:00
Mitchell Livingston 0808bdd2fe We now require Mac OS X 10.6 or later. Make that change and all the nice little adjustments that go with it. 2011-10-06 00:30:40 +00:00
Jordan Lee efc306a8d3 (trunk libT) truncate the fractions when formatting KB/s speeds 2011-07-17 14:15:02 +00:00
Jordan Lee de34a0545b (trunk libT) minor #include cleanups 2011-07-13 03:23:37 +00:00