Commit Graph

99 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 ff8d0dbf3b Switch from UNUSED macro to TR_UNUSED macro
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.
2020-08-18 14:19:55 +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 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 6101a69957 Avoid possible `_XOPEN_SOURCE` redefinition warning 2015-06-23 21:16:33 +00:00
Mike Gelfand e0dc1d6735 Fix some issues revealed by coverity 2015-05-09 14:10:55 +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
Mike Gelfand e30728367f #5771: Use true and false instead of 1 and 0 for bool variables (patch by ticamkq + additional fixes) 2014-11-30 19:38:47 +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 35638e210e add inline wrapper functions to tr_torrent to decouple the rest of the code from tr_completion 2013-08-18 13:06:39 +00:00
Jordan Lee ef9d4eee33 (libT) ensure that tr_torrentVerify()'s completion callback gets invoked even if it's removed from the verify queue before it gets a chance to run. 2013-02-01 00:21:30 +00:00
Jordan Lee 69f3e31230 (libT) change the API signature for tr_torrentVerify() s.t. client code can be notified when the verify is finished 2013-01-31 21:58:25 +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 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 b4d36aeb54 (trunk) #4138 "use stdbool.h instead of tr_bool" -- done. 2011-03-22 15:19:54 +00:00
Jordan Lee 374ed10f3b (trunk) it's bad form to #include so many system headers in libtransmission/utils.h... 2011-03-16 18:04:23 +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 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 6b7babde5c (trunk libT) remove some of the lazy-verify debug messages. 2010-12-21 23:09:26 +00:00
Charles Kerr 43ed57b278 (trunk libT) #2955 "Lazy Verification (aka Just-in-Time Verification)" -- implemented. 2010-12-09 20:43:23 +00:00
Charles Kerr 9335e02e6d (trunk libT) add some new bugs to the code so that it will crash when vraa tries to use it 2010-11-11 15:31:11 +00:00
Charles Kerr 6e29ad9459 (trunk libT) #3716 "take torrent priority into account when choosing which torrent to verify next" -- done. 2010-11-06 15:59:51 +00:00
Charles Kerr 851ed9f929 (trunk libT) #3622 "verification ignores return value of pread" -- commit fixVerify.patch 2010-10-19 13:56:58 +00:00
Charles Kerr 5c46cdb161 (trunk libT) remove dead variable pieceBytesRead from verify.c. Reported by Longinus00 2010-10-12 15:52:20 +00:00
Charles Kerr e7cf05a6ba (trunk libT) #3427 "use shortest-job-first scheduling for verifying local data" -- patch from wateenellende and sadface 2010-07-19 14:44:24 +00:00
Charles Kerr 254a1f15cb (trunk libT) down the rabbit hole: various minor type correctness changes unearthed by -Wconversion 2010-06-30 16:40:19 +00:00
Charles Kerr 8a835610c6 (trunk libT) remove unused code 2010-06-28 13:42:45 +00:00
Charles Kerr a1b85a633c (trunk libT) #3234 "Checking existing data can show 100%" -- fixed in trunk for 2.00 2010-05-26 16:40:47 +00:00
Charles Kerr 035dea80df (trunk libT) fix r10689 oops 2010-05-25 20:42:32 +00:00
Charles Kerr 25a5b2918a (trunk libT) #3231 "Check existing data is extremely slow" -- increase the read buffer size as suggested by eridius 2010-05-25 20:19:34 +00:00
Charles Kerr d0873d8369 (trunk libT) reduce the period to sleep per second during verification from 200 msec to 100 msec 2010-04-28 19:04:09 +00:00
Charles Kerr c615514944 (trunk libT) add a wrapper function tr_valloc() to try posix_memalign(), getpagesize(), valloc() etc 2010-02-23 06:06:45 +00:00
Mitchell Livingston 3ff11837d4 disable posix_memalign() on Mac - it requires 10.6 2010-02-22 02:36:17 +00:00
Mitchell Livingston b562dc13ec Mac has getpagesize() and posix_memalign() 2010-02-22 02:21:50 +00:00
Charles Kerr 204243c5bd (trunk libT) #2952: "When possible, use posix_memalign() instead of valloc()" -- fixed in trunk for 1.91 2010-02-22 01:01:59 +00:00
Charles Kerr c0cf694b85 (trunk libT) optimize out some unnecessary cycles when there are missing files in a torrent being verified 2010-02-13 05:46:31 +00:00
Charles Kerr adc7d6f8a4 (trunk libT) minor tweak to verify: use tr_pread() instead of lseek+read 2010-02-12 21:06:21 +00:00
Charles Kerr d3ae2cf696 (trunk libT) use valloc() and st.st_blksize when verifying local data 2010-02-12 19:59:30 +00:00
Charles Kerr 5c26afdb52 happy new year! 2010-01-04 21:00:47 +00:00