Commit Graph

51 Commits

Author SHA1 Message Date
Charles Kerr 677dc73eac
refactor: use GTest for running tests (#1383)
* refactor: use google-test on libtransmission tests
2020-08-11 13:11:55 -05:00
Mike Gelfand a3e4919385 Introduce `tr_str_is_empty` to relay intent better 2019-07-13 12:00:06 +03:00
Mike Gelfand 501be27972 Reduce code duplication in logging macros 2017-05-22 23:20:28 +03:00
Mike Gelfand 1e3d20422a Reduce for loop variables scope 2017-05-14 01:38:31 +03:00
Mike Gelfand e1d53855f4 Avoid declaring multiple variables on the same line 2017-05-01 18:46:41 +03:00
Mike Gelfand 6a74bd438c Announce INT64_MAX as size left if the value is unknown
This helps with trakers like Amazon S3 where signed type is used but
negative values aren't accepted.

Fixes: #250
2017-05-01 12:33:55 +03:00
Mike Gelfand ac4fa04277 Announce -1 as size left if the value is unknown
Fixes: #250
2017-04-30 21:18:02 +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 eb8fc35ac6 Remove useless checks and definitions (C99)
Now that MSVC support for C99 is quite good, remove previously needed but
now unused checks and definitions, like PRI* format macros (including
PRIdMAX and TR_PRIuSIZE, replaced with %jd and %zu) and inline macro.
Also, remove ssize_t typedef and replace few occurences with ev_ssize_t.
Also, remove check for stdbool.h availability (guaranteed by C99) and
include it unconditionally (except when in C++ mode).
2015-12-29 19:37:31 +00:00
Mike Gelfand 3523277e7f Ongoing refactoring (use size_t instead of int) 2015-12-25 11:34:35 +00:00
Mike Gelfand ceb19b9711 Optionally return result length from `evbuffer_free_to_str()` 2015-12-13 10:23:22 +00:00
Mike Gelfand 7879100c01 Cut internal macro names to have equal number of underscores on each side 2015-05-04 19:58:34 +00:00
Jordan Lee be290162c2 (trunk) #4160: mike.dld patch: 4160-07-env.patch 2014-09-21 18:05:14 +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 ea7d2482dd introduce TR_PRIuSIZE macro for portable printf()ing of size_t. mikedld 2013-09-08 17:32:09 +00:00
Jordan Lee 4c8bda8805 function pointer type correctness. mikedld 2013-09-08 17:08:18 +00:00
Jordan Lee 96786b7fa1 (trunk) update web.h's API s.t. there's an explicit function to use when downloading webseed content. 2013-04-13 20:25:28 +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 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 e9e76fa970 (trunk libT) #4888: when scraping magnet links, don't send a left=0 argument to the tracker. 2012-05-20 14:14:59 +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 ed56cd1193 (trunk libT) #4526 "do not skip scrape unless all three scrape fields came with announce" -- add field initializers. 2011-10-14 00:27:14 +00:00
Jordan Lee 4522a3c055 (trunk libT) #4507 "scrape min_request_interval no longer working" -- fixed. 2011-09-25 21:48:34 +00:00
Jordan Lee 246d6a72a3 (trunk libT) #4502 "allow verbose scrape" -- patch by reardon. 2011-09-24 05:54:47 +00:00
Jordan Lee 0bffa36377 (trunk libT) improve the debugging message that logs an http announce response 2011-07-30 22:40:15 +00:00
Jordan Lee c9b54799e3 (trunk libT) tweak the ABI of tr_bencToBuf() to match the way it's being used 2011-04-27 21:22:08 +00:00
Jordan Lee aa41779aaa (trunk libT) heap pruning: using the same mechanism as in r12388, avoid an unnecessary malloc+memcpy+free when TR_CURL_VERBOSE is logging HTTP messages 2011-04-27 20:50:43 +00:00
Jordan Lee 5681ea73e2 (trunk libT) heap pruning: avoid unnecessary malloc+memcpy+frees in announcer.
1. when creating announce URLs in announcer-http.c
2. when creating scrape URLs in announcer-http.c
3. when deep-logging what announces are in a torrent's queue in announcer.c
2011-04-27 20:41:47 +00:00
Jordan Lee b54ebeafd7 (trunk libT) remove the tr_session argument from the announce/scrape response callbacks 2011-03-26 12:06:04 +00:00
Jordan Lee 1b825079be (trunk libT) API cleanup of the tr_address functions to make them more consistent.
This is loosely related to #2910, but only in the sense of laying the groundwork for #2910's fix...
2011-03-25 05:34:26 +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 fee784f1d8 (trunk) #4081 "Add 'cookieString' argument 'torrent-add' method in RPC" -- done. 2011-03-15 04:22:47 +00:00
Jordan Lee e3fab720d1 (trunk) make sure all files with $Id$ has svn:properties set 2011-03-13 14:38:49 +00:00
Jordan Lee dc8e97eb43 (trunk libT) tweak #includes in announcer-http.c 2011-03-13 14:33:28 +00:00
Jordan Lee 4a4842fea5 (trunk libT) use libevent2's portability wrappers for inet_ntop() and inet_pton().
We currently implement our own versions of these on mingw because that platform doesn't have them... but why reinvent the wheel; libevent has already done the same thing. Let's use libevent2's implementation.
has already done it for us.
2011-03-13 08:15:40 +00:00
Jordan Lee 3cfef5eded (trunk libT) #117 "UDP tracker protocol support" -- working implementation; needs testing and valgrinding and review. 2011-03-13 00:18:11 +00:00
Jordan Lee 77a0a0b619 remove unused field 2011-03-11 17:26:41 +00:00
Jordan Lee 99ab56a82f (trunk libT) copyediting: removing trailing spaces from lines 2011-03-11 15:44:24 +00:00