Commit Graph

249 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 9d313a8816
sonarcloud warnings 9 (#1511)
* refactor: const correctness 

* refactor: fix some implicit conversions

* refactor: make local pointers const if their objects are not modified

* refactor: do not cast away const in torrent-cell-renderer

* refactor: remove call to deprecated gtk_icon_size_lookup_for_settings

* refactor: member functions that do not mutate their objects should be declared const

* chore: do not end comments with a semicolon
2020-11-08 21:31:02 -06:00
Charles Kerr 7f147c65fb
refactor: fix more sonarcloud warnings (#1508)
* refactor: const correctness

* refactor: use getpwuid_r instead of getpwuid

* chore: simplify dict walking loop logic

* refactor: remove dead store assignment in announcer

* refactor: use std::make_shared
2020-11-05 16:46:21 -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
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
Charles Kerr fa6df52d58
chore: remove unused methods (#1207)
* chore: remove unused methods in qt client

* chore: remove unused libtransmission methods

* chore: remove unused gtk methods

* chore: remove more unused libtransmission methods

* chore: remove more unused code found by @reardonia
2020-05-11 17:20:46 -05:00
Charles Kerr b0e33117c5
Fix some gtk warnings (#1038)
* fix gtk deprecation warning: gtk_misc_set_alignment

* fix gtk deprecation warning: gtk_alignment_new

* fix gtk deprecation warning: gtk_tree_view_set_rules_hint

* fix gtk deprecation warning: gtk_image_new_from_stock

* fixup! fix gtk deprecation warning: gtk_alignment_new

* fix gtk deprecation warning: gtk_dialog_set_alternative_button_order

* fix gtk deprecation warning: gtk_show_uri

* fix gtk deprecation warning: gtk_widget_set_margin_left

* fix gtk deprecation warning: gtk_button_set_alignment

* fix gtk deprecation warning: g_type_class_add_private

* fix gtk deprecation warning: gtk_menu_popup

* fix gtk deprecation warning: gtk_misc_set_padding

* chore: uncrustify

* fix: silence G_TYPE_INSTANCE_GET_PRIVATE warning

Deprecaed starting in glib 2.58

* chore: uncrustify
2019-11-06 13:09:27 -06:00
Mike Gelfand c567588587 Remove useless parentheses 2019-03-17 09:18:27 +03:00
Mike Gelfand 17307e7484 Extract assignments from expression
Assignments explicitly enclosed in parentheses are ignored.

* MISRA C:2004, 13.1 - Assignment operators shall not be used in expressions
  that yield a Boolean value
* MISRA C++:2008, 6-2-1 - Assignment operators shall not be used in
  sub-expressions
* MISRA C:2012, 13.4 - The result of an assignment operator should not be used
* MITRE, CWE-481 - Assigning instead of Comparing
* CERT, EXP45-C. - Do not perform assignments in selection statements
* CERT, EXP51-J. - Do not perform assignments in conditional expressions
2019-03-17 08:00:15 +03: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 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
Markus Amalthea Magnuson 727b9671f7 Update all website links to canonical HTTPS version. 2016-10-31 10:00:11 +01: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 88983c1ac1 Use tr_sys_path_remove instead of remove 2015-10-23 04:09:40 +00:00
Mike Gelfand cdf3cf62f9 Fix some issues revealed by coverity 2015-05-09 11:56:35 +00:00
Mike Gelfand 2321bc3fad Fix some issues revealed by coverity 2015-05-09 08:37:55 +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 28fe36f1f8 #include limits.h where we use it, and don't where we don't 2013-08-24 17:53:45 +00:00
Jordan Lee 16ab373503 (trunk gtk) #5320 'can't opena folder with '#' in its name': in gtr_open_file(), use g_file_new_for_path(). 2013-07-24 17:11:21 +00:00
Jordan Lee cc1b1cd430 since Transmission supports older versions of glib, add a portability wrapper for G_DEFINE_QUARK 2013-07-24 00:13:31 +00:00
Jordan Lee 6a47b4a5d3 don't use a '-' character in the QN argument to G_DEFINE_QUARK. https://forum.transmissionbt.com/viewtopic.php?p=65548#p65548 2013-07-22 23:00:10 +00:00
Jordan Lee d244545979 use G_DEFINE_QUARK instead of rolling our own quark getters 2013-07-09 22:44:24 +00:00
Jordan Lee 027e3f3066 (trunk, libT) #4682 'Add return id from duplicate torrent torrent-add rpc' -- added. 2013-05-22 20:35:38 +00:00
Jordan Lee d1571bda02 (gtk) use replace strcmp() with g_strcmp0() everywhere 2013-02-14 15:17:42 +00:00
Jordan Lee cd09204a6e (trunk) first draft of changing the FreeSpace API to behave as https://trac.transmissionbt.com/ticket/4076#comment:25 -- libT, rpc, qt, and gtk implementations. 2013-02-09 04:05:03 +00:00
Jordan Lee 445609f690 (trunk) prefer tr_remove() to unlink() or rmdir() 2013-02-04 21:53:19 +00:00
Jordan Lee 20fe66bccf more experimentation with the shortTransferString 2013-01-30 00:22:52 +00:00
Jordan Lee 10b96f0f12 (gtk) copyediting: update several files to be closer to the gtk+ indentation style. 2013-01-04 19:45:39 +00:00
Jordan Lee c1559f3cc4 (trunk, libT) first drop of the tr_quark patch. 2012-12-22 20:35:19 +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 6755e4e24f (trunk, gtk) #5089 'Open-by-URL doesn't automatically paste URLs/magnet links from the clipboard if they contain leading whitespace' -- fixed. 2012-10-13 16:47:26 +00:00
Jordan Lee b8ef3a9acd (trunk, gtk) #5088 'gtr_is_supported_url(), gtr_is_magnet_link() aren't NULL-safe' -- fixed. 2012-10-13 16:45:20 +00:00
Jordan Lee 33c4d25f19 fix a handful of console warnings that were generated by trying to trash a NULL .torrent file b/c the torrent had been added from a URL 2012-09-23 15:38:07 +00:00
Jordan Lee cdd71c6427 (trunk gtk) #4970 remove deprecated GTK+ API calls, raise GTK+ dependency to 3.2 2012-07-14 19:26:55 +00:00
Jordan Lee fbc7f3dc3c (trunk) use base-10 units for network bandwidth (ie, speed) and disk sizes.
It looks like the Mac client is already doing this and it's clearly the trend in other apps as well. Even apt-get is using kB/s, ferchrissake... :)

Flame away.
2012-02-03 21:21:52 +00:00
Jordan Lee 7e83c406d4 (trunk gtk) fix a minor memory leak in gtr_open_file(). reported by clang static analyzer. 2012-01-24 18:09:12 +00:00
Jordan Lee 76cf0520ba (trunk gtk) #4553 "Set about dialog to modal when compiled with GTK+-3" -- fix About dialog issue when hiding and then re-showing Transmission. 2011-10-13 00:36:19 +00:00
Jordan Lee f9388714b7 (trunk gtk) add portability wrappers for gtk_hbox_new() and gtk_vbox_new(), which are deprecated now in GTK+ 3.2 2011-10-11 04:11:08 +00:00
Jordan Lee a7a9c2b12e (trunk gtk) #4399 "Add option to disable 'trash can' feature" -- done. 2011-08-13 22:58:49 +00:00
Jordan Lee 38a1df9344 (trunk gtk) remove some unnecessary #includes 2011-08-13 14:19:40 +00:00
Jordan Lee 4d4eeae682 (trunk gtk) first cut at using GApplication. This lets glib replace hundreds of lines of homegrown code. Whee! 2011-08-09 02:30:31 +00:00