Commit Graph

206 Commits

Author SHA1 Message Date
Charles Kerr 41f225df7b
Remove posix memalign (#1520)
* 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.
2020-11-15 15:53:42 -06:00
Mike Gelfand 82df3a87f4 Update to Uncrustify 0.68.1
Tweak a few rules in the process. Now all code in cli, daemon, gtk,
libtransmission, qt, and utils is properly formatted with no manual
intervention.
2019-02-15 09:21:48 +03:00
Mike Gelfand 580c5e4166 Rename `tr_sys_file_prefetch` to `tr_sys_file_advise`
New function now supports two flags: will need and don't need.
2017-07-08 16:09:37 +03:00
Mike Gelfand deea6fc6a2 Bring assertions closer to the beginning of blocks 2017-06-13 07:44:09 +03:00
Mike Gelfand 98695fe3c1 Introduce our own assertion macros with finer control 2017-06-08 10:24:12 +03:00
Mike Gelfand 295d3359b2 Little bastards keep popping up here and there :( 2017-05-23 22:17:17 +03:00
Mike Gelfand a762c770f2 Make conditional expressions explicitly boolean 2017-04-30 19:26:01 +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 c955c04d8f Explicitly compare result of str(n)cmp/memcmp to signify that it's not boolean 2016-03-13 22:11:01 +00:00
Mike Gelfand 3f9575fcc8 Minor type adjustments (incomplete, it takes way too much time) 2015-03-15 11:43:32 +00:00
Mike Gelfand 4cfe7e7ddb #4400, #5462: Move SHA1 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 calculation to crypto-utils.{c,h}. OpenSSL-related
functionality (SHA1 context management) is moved to crypto-utils-openssl.c.

Add new tr_sha1_ctx_t type and functions to be implemented by crypto
backends:
* tr_sha1_init - allocate SHA1 context and and initialize it,
* tr_sha1_update - hash some [more] data,
* tr_sha1_final - finish hash calculation and free the context.

Add new files to CMakeLists.txt (leftover from previous commit) to fix
CMake-based configuration.
2014-12-04 12:13:59 +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 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 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 dcf814a481 (trunk libT) #4283 "Remove 'Prefetch failed' error message" -- done. 2011-05-27 23:26:05 +00:00
Jordan Lee 0245703634 (trunk libT) tr_torrentGetFileMTime() used to require two stat() calls.. now it only requires one. 2011-04-02 07:36:34 +00:00
Jordan Lee 1304aa0079 (trunk libT) still fiddling around with #includes -- this time removing unncecessary libT includes from libT .c files 2011-03-25 01:41:57 +00:00
Jordan Lee 324f0f470c (trunk libT) copyediting: '#include "crypto.h"' cleanup 2011-03-25 01:21:31 +00:00
Jordan Lee 375694eda9 (trunk) copyediting: remove some unneeded #includes, and annotate some needed ones 2011-03-24 21:49:42 +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 29af00ef56 (trunk libT) make readOrWriteBytes() more readable 2011-03-16 04:44:38 +00:00
Jordan Lee 4844555f26 (trunk libT) remove the "a file disappeared!" check from readOrWriteFile().
In both the reading and writing case, this is handled with human-readable errors further up the call chain.
2011-03-16 03:19:56 +00:00
Jordan Lee 7f1a419dd1 (trunk libT) remove unused code from inout.c 2011-03-16 03:17:26 +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 4736d863bf (trunk libT) minor code cleanup to inout.c's readOrWriteBytes().
Use ijuxda's suggestion of making the fstat(fd) call dependent on (fd>=0) rather than (!err).
2011-02-02 06:06:09 +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
Jordan Lee 5c96f9ebd8 (trunk libT) fix a minor error in the log message for prefetch errors. thanks to Chinstrap for spotting this. 2011-01-15 05:34:47 +00:00
Charles Kerr c011fe527b (trunk libT) #3852 "Removing data from an active torrent doesn't stop activity" -- possible fix. 2010-12-27 21:34:12 +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 47fac6bc97 (trunk libT) #3631 "crash in tr_ioFindFileLocation" -- possible fix 2010-10-14 19:43:18 +00:00
Charles Kerr b51b6b14ae (trunk libT) #3631 "crash in tr_ioFindFileLocation" -- more tracer messages for the testers @ https://forum.transmissionbt.com/viewtopic.php?p=49625#p49625 2010-10-14 17:12:12 +00:00
Charles Kerr dbed40ff5a (trunk libT) #3631 "crash in tr_ioFindFileLocation" -- add tracer messages to try & smoke out the error 2010-10-14 04:21:14 +00:00
Daniel Lee 04a9add256 (libt) #3588:Torrents with non power 2 pieceSizes fail hashchecks 2010-09-30 17:59:30 +00:00
Charles Kerr 95232dfe58 (trunk libT) fix bug between the new inout checksum code and the new cache code 2010-07-08 23:04:12 +00:00
Charles Kerr 93bb7d6b3c (trunk libT) #3399 "tr_ioTestPiece() can be faster" -- fixed 2010-07-07 16:31:07 +00:00
Charles Kerr 8a835610c6 (trunk libT) remove unused code 2010-06-28 13:42:45 +00:00
Charles Kerr 8d413e98fc (trunk libT) silence a cache log message 2010-06-20 13:19:24 +00:00
Charles Kerr e70bebf930 (trunk) #1521 "memory cache to reduce disk IO" -- commit block-cache-rc1.diff to trunk for the nightlies. 2010-06-19 14:25:11 +00:00
Charles Kerr 7da3b81cda (trunk libT) #2551 "when uploading to peers, prefetch local data from disk" -- commit jch patch #2, which prefetches before checksumming an individual piece 2010-04-30 00:04:15 +00:00
Charles Kerr fad8f285a8 (trunk libT) use jch's suggestion of having a per-session page-aligned memory buffer for general reuse. (http://trac.transmissionbt.com/ticket/2551#comment:5) 2010-02-23 07:20:57 +00:00
Charles Kerr f1221f958f (trunk libT) dead code removal -- the buffer & buflen arguments to tr_ioTestPiece() were unused 2010-02-23 06:05:18 +00:00
Charles Kerr 9c0900eb20 (trunk libT) possible fix for gn0s1s' "file not found" error message 2010-01-26 21:41:40 +00:00
Charles Kerr 5c26afdb52 happy new year! 2010-01-04 21:00:47 +00:00