Commit Graph

44 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
Charles Kerr 46cb0b5e65
refactor: sonarcloud warnings about overly-complex looping logic (#1503)
* chore: simplify loop logic
2020-11-03 18:59:19 -06:00
Charles Kerr efaa66a920
fix: resolve some lgtm warnings (#1444)
* fix: warnings found by LGTM static analyzer
2020-09-11 16:07:45 -05:00
Tom Richards a82e728ad5
fix: memory leak in magnet parsing (#1222)
* Fix memory leak in magnet parsing

* Update libtransmission/magnet.c

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* Lint

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2020-05-11 19:57:06 -05:00
Mike Gelfand a3e4919385 Introduce `tr_str_is_empty` to relay intent better 2019-07-13 12:00:06 +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 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 fbd8d4c79f Fix a number of other style inconsistencies met along the way 2017-04-30 19:33:55 +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
Maciej Wolny 3a1730495d Use strncmp instead of memcmp to avoid out-of-bounds reads 2016-10-05 16:19:31 +02: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 42de056a4b #4400, #5462: Move SHA1/HEX 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/HEX conversion to crypto-utils.{c,h}.

Rename functions:
* tr_sha1_to_hex -> tr_binary_to_hex (add length argument),
* tr_hex_to_sha1 -> tr_hex_to_binary (add length argument).

Make tr_sha1_to_hex and tr_hex_to_sha1 wrappers around above functions.
2014-12-04 20:53:56 +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 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 3d38723ad9 Follow more common whitespace style conventions in the C code (libtransmission, daemon, utils, cli, gtk). 2012-12-05 17:29:46 +00:00
Mitchell Livingston 6bebaee639 #5134 Magnet links not adding all trackers with tr.0= 2012-11-14 02:22:55 +00:00
Jordan Lee cc51b1586c (trunk libT) #5075 'magnet.c:163 should use MAX_WEBSEEDS, not MAX_TRACKERS' ... fixed. Thanks to cfpp2p for catching this. 2012-10-05 16:10:12 +00:00
Jordan Lee 5332d234bb (trunk libT) #4504 "crash when adding malformed magnet link" -- fixed. 2011-09-25 21:51:50 +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 5725b7c922 (trunk) #3663 "clang warnings in 2.11" -- fixed. 2010-10-24 05:52:38 +00:00
Charles Kerr 80f69ee7d3 (trunk) fix svn properties on several files. Thanks ot Elbandi for suggesting this 2010-10-01 13:33:39 +00:00
Charles Kerr 5a0d9351d2 (trunk) #3341 "support alternate tracker syntax in magnet links" -- fixed 2010-06-24 18:25:21 +00:00
Charles Kerr 4401dcaa28 (trunk libT) #2965: "buffer overflow if too many tr= args in a magnet link" -- fixed in trunk for 1.92. thanks to pjz for the patch. 2010-02-24 04:23:36 +00:00
Charles Kerr 36d97610bd (trunk) #2802, #2716, #2717 -- remember magnet links and their settings between sessions, and allow their trackers to be modified 2010-02-02 22:45:22 +00:00
Charles Kerr 1c8426cfee (trunk libT) fix some #include statements 2010-01-20 23:58:09 +00:00
Charles Kerr 5c26afdb52 happy new year! 2010-01-04 21:00:47 +00:00
Charles Kerr 78ead8c3dd (trunk) update the copyright notices 2009-12-05 02:19:24 +00:00
Charles Kerr 5c3fd1b5cc (trunk libT) #2631 "Add webseed support to magnet links" 2009-11-29 17:49:58 +00:00
Charles Kerr 4322837189 (trunk) remove dead code 2009-11-23 21:57:10 +00:00
Charles Kerr 94a48c4c81 (trunk libT) a very minor commit. remove trailing spaces from lines and other stuff like that 2009-11-22 03:57:36 +00:00
Charles Kerr 9383a6abfd (trunk libT) #2096: add code magnet URL parser and unit tests 2009-11-20 04:38:19 +00:00