Commit Graph

71 Commits

Author SHA1 Message Date
Mike Gelfand db3d40d0ed Switch to clang-format for code formatting, include Mac client 2021-08-16 00:38:29 +03:00
Mike Gelfand 5b29fe1556 Ensure include guard is the first non-comment line 2017-11-14 23:21:28 +03:00
Mike Gelfand 4f9d9ad92b Code style change leftovers
For some reason, GTK client wasn't fully processed. All the rest of changes
are mostly in comments.
2017-04-21 10:40:57 +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
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
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 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 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 434a988165 (trunk libt) #4305 "New Torrent via RPC Error:No data found when subfolder does not exist" -- revert r12076 s.t. parent directories are created as necessary when saving local data to disk. 2011-07-25 17:48:14 +00:00
Jordan Lee 35fb00fd9e (trunk libt) #4315 "Transmission 2.31 crashes (segfaults) immediately after launch" -- remove the "max-open-files" code.
max-open-files might have been a nice configuration option once, but (1) we've never advertised it in the gui apps, and (2) the crazy cases are causing more trouble than this feature is worth. It's more complicated now after #4164 -- see #4294, #4311, and this ticket.
2011-06-24 22:39:20 +00:00
Jordan Lee 513a3fcc1d (trunk libT) tr_torrentGetFileMTime(): if the file being looked at is aleady open in fdlimit's file cache, use that cached handle instead of deriving our own. 2011-04-28 18:40: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 0cf05fdffd (trunk libT) add an "existing dir" argument to tr_fdFileCheckout().
existing_dir: An ancestor of filename which must already exist and won't be created by tr_fdFileCheckout(). In implementation this is the download directory and prevents directories from being created in error, such as a mount point for an external drive when the drive is unplugged.
2011-03-03 19:59:12 +00:00
Jordan Lee 22660ed751 (trunk libT) #3973 "JIT verification verifies fresh downloaded torrents" -- improvement to r11813.
r11813 fixed the timestamp issue by fsync()ing files before close()ing them in tr_close_file(). This causes a little overhead as even read-only files cause a sync as their atimes are modified. Instead, we should call fsync() further back in the call chain in tr_fdFileClose() so that we can know to only sync torrent files that were opened with write access.
2011-02-02 23:29:17 +00:00
Jordan Lee 4bf6f0ac40 (trunk libT) #3973 "JIT verification verifies fresh downloaded torrents" -- win32 portability fix for r11813.
fsync() doesn't exist on Windows. bencode had a private function, tr_fsync(), that is a portability wrapper around fsync() on *nix and _commit() on win32. Make this function package-visible, rather than private, so fdlimit.c can use it too.
2011-02-02 23: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 d16a424f76 (trunk libT) more fdlimit futzing 2010-12-28 08:38:55 +00:00
Charles Kerr a04f92729e (trunk libT) refactor libtransmission's file cache 2010-12-28 07:24:10 +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 f713451647 (trunk libT) #3531 "Pausing 500 torrents uses 650 MB of memory" -- on OS X, when saving a benc/json file, send a hint to the OS to not cache the file. 2010-12-17 15:36:31 +00:00
Charles Kerr 8a835610c6 (trunk libT) remove unused code 2010-06-28 13:42:45 +00:00
Charles Kerr 872291cd62 (trunk libT) make tr_pwrite()'s "buf" argument const 2010-05-22 00:09:36 +00:00
Charles Kerr 40a9133ced (trunk libT) remove dead code 2010-05-20 14:05:27 +00:00
Charles Kerr 8e85b1c6e5 (trunk libT) fdlimit.[ch] MIT -> GPL. There's not any MIT code left there. 2010-05-17 16:41:59 +00:00
Charles Kerr 6ce8085243 (trunk) housekeeping: (1) add standard svn properties for $Id$ substitution in some files (2) add #include guards in a couple of libtransmission headers (3) refresh build instructions in README 2010-01-14 14:20:49 +00:00
Charles Kerr 3759c98d76 (trunk libT) #2551 "better buffer cache management": apply jch's prefetch-base.patch 2009-11-08 23:43:38 +00:00
Charles Kerr c85ee09fef (trunk) trunk's just been too stable lately. #2119: reload settings.json on SIGHUP 2009-10-23 03:41:36 +00:00
Charles Kerr c59ae60488 libT doesn't need to create the Incomplete directory until it's needed 2009-10-21 19:33:37 +00:00
Charles Kerr 05c77cc975 (trunk) #1483: move completed torrents to a user-specified directory + #629: different file extension for incomplete files 2009-10-19 05:05:00 +00:00
Charles Kerr 1c5b344c85 (trunk libT) remove dead code noticed by geirha 2009-08-15 15:52:10 +00:00
Charles Kerr ef9896e223 (trunk libT) more efficient closing of a torrent's open files 2009-06-21 07:36:51 +00:00
Charles Kerr 452cb27f9e (trunk libT) re-start work on making libT doxygen friendly. still a long ways to go on this. 2009-05-29 19:17:12 +00:00
Charles Kerr 29b1d3e2cc (trunk) #920: add "move data" to libT so all clients can use it 2009-05-13 15:54:04 +00:00
Charles Kerr 698aa192aa (trunk libT) convert tr_open_file_for_scanning() and tr_close_file() to use file descriptors instead of file pointers so that we don't have to mix and match between them 2009-04-26 20:44:18 +00:00
Charles Kerr a84a1720a7 (trunk libT) experimental commit for wereHamster 2009-04-26 16:14:47 +00:00
Charles Kerr d99438bd1c (trunk libT) need feedback from Mac users on this change. On Linux, it gets rid of the inactive-memory-grows-during-torrent-verification behavior that's often reported as a bug. 2009-04-26 00:51:51 +00:00
Charles Kerr 87e4c99fbb (trunk libT) #1976: build problem with r8173: "erreur: ‘POSIX_FADV_SEQUENTIAL’ undeclared" 2009-04-07 20:25:32 +00:00
Charles Kerr c99f941d16 (trunk libT) make file preallocation optional via settings.json. choices are: full, sparse, and none 2009-01-16 16:38:16 +00:00
Charles Kerr 55aa6d834f (trunk libT) make the default number of open files 32 rather than 16, and make it configurable via settings.json. (Reported by Lucius Windschuh via denis_) 2009-01-08 19:20:24 +00:00
Charles Kerr a0390c6111 (trunk libT) remove unnecessary prototype 2009-01-04 04:37:47 +00:00
Charles Kerr 54be88dec3 (trunk libT) add ipv6 support by jhujhiti. I think this is the largest user-contributed patch we've ever used... thanks jhujhiti :) 2008-12-15 00:17:08 +00:00
Charles Kerr 0d5fed6442 (libT) re-apply jhujhiti's IPv6 patch. This merges in my tr_port cleanup, so any new bugs are mine :/ 2008-12-02 03:41:58 +00:00
Charles Kerr a14621c363 (libT) janitorial: use the tr_port type whenever we have a `port' as a function argument or as a field in a struct. 2008-12-01 20:51:01 +00:00
Charles Kerr 7fa9813955 (libT) #252: revert r7195 (jhujhiti's IPv6 test patch). It seems to be the culprit in a `thrashing' issue reported by Waldorf and m1b in irc -- the behavior appeared between r7183 and r7187 -- so this commit is to trigger off a nightly build w/o the patch to test with in irc. 2008-12-01 20:21:06 +00:00
Charles Kerr a2ad4f6543 (libT) patch from jhujhiti to add ipv6 support. 2008-11-30 00:47:18 +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