Commit Graph

199 Commits

Author SHA1 Message Date
Mike Gelfand 14370e5353 Fix a number of other style inconsistencies met along the way (part 2) 2017-05-01 18:47:49 +03:00
Mike Gelfand e1d53855f4 Avoid declaring multiple variables on the same line 2017-05-01 18:46:41 +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 eda26f7590 Make sure `tr_sha1` calls pass lengths as int
This fixes inability to authenticate with password-protected session, and
a few more issues it seems.
2016-10-18 00:05:03 +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 3523277e7f Ongoing refactoring (use size_t instead of int) 2015-12-25 11:34:35 +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 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 f433f2ee17 (trunk, libT) #5517 when parsing a torrent's metainfo's path list, allow empty components because some .torrent files innocently have them. Update unit tests. 2014-06-09 02:53:04 +00:00
Jordan Lee 99eda37b5e in makemeta-tests, add tests to generate a .torrent file from a folder of randomly-generated files. 2014-06-08 22:21:27 +00:00
Jordan Lee 8f5c7809e7 (trunk, libT) #5517 'Don't create or add torrents with "../" at the beginning of the path or "/../" anywhere in the path' -- fixed. 2014-04-27 20:17:16 +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 fa23e1e60a (trunk, libT) #5517 'fix error adding torrents whose names with an ellipsis' -- fix by e5g6s. 2014-01-19 04:19:14 +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 445609f690 (trunk) prefer tr_remove() to unlink() or rmdir() 2013-02-04 21:53:19 +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 434bd6b287 (libT) #1220 'change top folder names' -- when the root file/folder is changed, update tr_info.name too. 2013-01-22 00:25:42 +00:00
Jordan Lee 3c9640bb8f make tr_info.webseedCount and tr_info.trackerCount unsigned. 2012-12-30 22:06:45 +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 46b3b79e63 in metainfo.c, don't include sys/stat.h anymore, it's unneeded after r13633 2012-12-09 22:05:31 +00:00
Jordan Lee 4f6dcc6d31 in tr_metainfoRemoveSaved(), don't look for .torrent files under our old naming scheme... we haven't used it since 2008 2012-12-09 01:32:25 +00:00
Jordan Lee 410fa7e054 remove unused function tr_metainfoMigrate() 2012-12-09 01:27:01 +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 031e313aa2 (trunk, libT) #5081 'Transmission discards webseed URLs that have trailing whitespace' -- fixed. Unit test passes and valgrind says 'All heap blocks were freed -- no leaks are possible' 2012-10-14 18:10:17 +00:00
Jordan Lee 718da0688f (trunk libT) fix webseed-in-magnet-link regression introduced in r13547 (2.71+). This issue was tracked down by by x190 in ticket #5081 2012-10-13 15:36:49 +00:00
Jordan Lee 1aa4286fbc (trunk, libT) #5069 'webseed magnet support is broken' reported & patch by cfpp2p 2012-10-05 16:44:36 +00:00
Jordan Lee 1e07439cd0 (trunk libT) #4908 "Handle UDP scrapes when they don't follow the /announce idiom" -- fixed. 2012-05-20 14:47:18 +00:00
Jordan Lee cfa4077e5e (trunk libT) #4437 "Multi file webseeds don't work" -- handle multifile torrents with web seed urls that incorrectly don't end with a slash. 2011-09-06 16:45:48 +00:00
Jordan Lee 45669fed08 (trunk libT) #4227 "invalid URLs aren't filtered out of .torrents' webseed lists"
If we can't parse a URL provided in the .torrent files' webseed list, that URL should be discarded.
2011-05-05 03:10:51 +00:00
Jordan Lee c54f469c39 (trunk libT) more malloc pruning. *yawn*
tr_metainfoGetBasename(): avoid an unnecessary malloc() + free()
getannounce(): avoid an unnecessary malloc() + free() per each tracker
2011-04-01 04:13:51 +00:00
Jordan Lee 2e05d830e5 (trunk libT) streamline parsing the metainfo's file list 2011-04-01 03:09:24 +00:00
Jordan Lee 1650a4730c (trunk libT) copyediting: yes, removing more unnecessary #includes 2011-03-25 06:20:12 +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 b4d36aeb54 (trunk) #4138 "use stdbool.h instead of tr_bool" -- done. 2011-03-22 15:19:54 +00:00
Jordan Lee b46d3a2713 (trunk libT) #117 "UDP tracker protocol support (BEP #15)" -- refactor announcer.c so that alternate tracker protocols can be supported.
This commit adds a set of package-visible structs and functions to allow delegating announces and scrapes to different protocol handlers. (Examples: struct tr_announce_request, struct tr_announce_response, struct tr_scrape_request, struct tr_scrape_response.) HTTP is the only protocol handler currently implemented; however, this provides a clean API for other protocol handlers, and having this in trunk will help shake out any bugs in this refactoring.

In addition, logging via the TR_DEBUG_FD environment variable is vastly improved in the announcer module now.
2011-03-11 04:19:01 +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 345b14adbc (trunk) #3836 "libevent2 support" -- bump libevent2 requirement to 2.0.10. This will break the Mac build for a minute intil BMW applies his Mac patch 2010-12-20 02:07:51 +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 a6c4cc2987 remove a harmless, but accidental, paste error 2010-09-22 14:20:42 +00:00
Mitchell Livingston 05fabc6255 #3535 remove unnecessary escape characters and use lowercase in escaped letters in info_hash 2010-08-31 11:49:09 +00:00
Charles Kerr 6df6fd929b (trunk libT) #3519 "webseeds don't work" -- patch from gostrc to add support for a single string in the url-list 2010-08-22 18:40:18 +00:00