Commit Graph

57 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 073ae6c206
chore: fix deprecation warnings of GTK_STOCK_ use. (#1370)
* chore: fix deprecation warnings of GTK_STOCK_ use.

This is just a tiny step towards getting all of the GTK code up-to-date,
but GTK_STOCK warnings are the lowest-hanging fruit of the warnings, so
let's fix them.
2020-07-27 12:49:45 -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
Charles Kerr abac811dd2
fix: gcc warnings in libtransmission/ and utils/ (#843)
* fix: __attribute__(__printf__) warnings

* fix: implicit fallthrough warning

* fixup! fix: implicit fallthrough warning

* fix: disable warnings for 3rd party code

Since we want to leave upstream code as-is

* fixup! fix: disable warnings for 3rd party code

* fixup! fix: disable warnings for 3rd party code

* silence spurious alignment warning

Xrefs
Discussion: https://stackoverflow.com/a/35554349
Macro inspiration: 90ac46f710/f/src/util/util_safealign.h (_35)

* fixup! fix: disable warnings for 3rd party code

* fixup! fix: implicit fallthrough warning

* make uncrustify happy

* remove uncrustify-test.sh

that's probably off-topic for this PR

* fixup! fix: __attribute__(__printf__) warnings

* Update libtransmission/CMakeLists.txt

Co-Authored-By: ckerr <ckerr@github.com>

* fixup! silence spurious alignment warning

* use -w for DISABLE_WARNINGS in Clang

* refactor: fix libtransmission deprecation warnings

* fix: pthread_create's start_routine's return value

This was defined as `void` on non-Windows but should have been `void*`

* chore: uncrustify

* fix: add DISABLE_WARNINGS option for SunPro Studio

* fix "unused in lambda capture" warnings by clang++

* fix 'increases required alignment' warning

Caused from storing int16_t's in a char array.

* fix net.c 'increases required alignment' warning

The code passes in a `struct sockaddr_storage*` which is a padded struct
large enough for the necessary alignment. Unfortunately it was recast as
a `struct sockaddr*` which has less padding and a smaller alignment. The
warning occrred because of these differing alignments.

* make building quieter so warnings are more visible

* fixup! fix 'increases required alignment' warning

* Fix -Wcast-function-type warnings in GTK+ app code

https://gitlab.gnome.org/GNOME/gnome-terminal/issues/96 talks about both
the issue and its solution.

GCC 8's -Wcast-function-type, enabled by -Wextra, is problematic in glib
applications because it's idiomatic there to recast function signatures,
e.g. `g_slist_free(list, (GFunc)g_free, NULL);`.

Disabling the warning with pragmas causes "unrecognized pragma" warnings
on clang and older versions of gcc, and disabling the warning could miss
actual bugs. GCC defines `void (*)(void)` as a special case that matches
anything so we can silence warnings by double-casting through GCallback.

In the previous example, the warning is silenced by changing the code to
read `g_slist_free(list, (GFunc)(GCallback)g_free, NULL);`).

* fixup! fix "unused in lambda capture" warnings by clang++

* fixup! fix "unused in lambda capture" warnings by clang++

* fix two more libtransmission compiler warnings

* fix: in watchdir, use TR_ENABLE_ASSERTS not NDEBUG
2019-11-06 11:27:03 -06:00
Mike Gelfand d3b8982195 Uppercase the literal suffixes
* MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case
* MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a
  literal suffix
* CERT DCL16-C. - Use "L," not "l," to indicate a long value
* CERT, DCL50-J. - Use visually distinct identifiers
2019-03-17 07:07:48 +03:00
Mike Gelfand 1e3d20422a Reduce for loop variables scope 2017-05-14 01:38:31 +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 13a98a02b8 Use `TR_BAD_SIZE` instead of -1 in `tr_quark_new()` calls
Extend quark test to improve branch coverage.
2016-01-07 19:20:14 +00:00
Mike Gelfand 88983c1ac1 Use tr_sys_path_remove instead of remove 2015-10-23 04:09:40 +00:00
Mike Gelfand 2e6d5c8bc9 Add more booleans to the picture 2015-05-31 22:13:31 +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
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 7cbb20279b use consistent code indentation/whitespace in open dialog, file list, and set location dialog 2013-07-20 16:19:15 +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 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 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 357b160cde remove trailing spaces 2012-09-07 04:25:04 +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 fd5014aef5 (trunk gtk) fix ticket #4827 'clicking cancel in Open URL dialog does nothing' 2012-04-07 00:41:21 +00:00
Jordan Lee 300f070104 Silence a minor compiler warning.
We used to pass no button text + response_id pairs when creating the dialog because only gtk_dialog_add_button() would return back the actual button widget s.t. we could use a grab on it. However as of GTK+ 2.20 we can use gtk_dialog_get_widget_for_response() to get the button, so we can create dialogs in the more common way (which also fixes the gcc warning)
2012-01-13 22:10:26 +00:00
Jordan Lee b5de483362 (trunk gtk) the row and col arguments passed to gtk_table_attach() should be guint. we were using "int" in several places. 2011-08-13 21:08:53 +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
Jordan Lee 0e48418f26 (trunk gtk) since we're bumping glib's requirement to 2.26 (27 Sept 2010), it's a good time to bump the gtk+ requirement to 2.22 (32 Sept 2010). 2011-08-07 18:41:13 +00:00
Jordan Lee 7069534abf (trunk, gtk) #4218 "open url should set focus on the open button by default" -- fix r12409 oops 2011-05-01 05:04:09 +00:00
Jordan Lee a9b379777f (trunk gtk) #4218 "open url should set focus on the open button by default" -- done. 2011-05-01 04:14: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 c7006ed8b3 (trunk gtk) remove the TrTorrent GObject subclass. 2011-03-03 01:59:25 +00:00
Jordan Lee 3b28138c71 (trunk) #3926: use "Open Torrent" instead of "Add Torrent" in GTK+ and Qt clients -- change the filename from add-dialog.[ch] to open-dialog.[ch]. whoooo 2011-01-20 19:57:42 +00:00
Charles Kerr 2158ef37cd (gtk) "open torrent" --> "add torrent" 2008-04-03 02:11:15 +00:00
Charles Kerr ca9a75d4aa (gtk) fix minor terminology inconsistencies between the "new torrent" and "details" dialogs 2008-03-19 20:34:35 +00:00
Charles Kerr 7bb54cece8 (gtk) small string folding & i18n tweaks. 2008-03-19 17:14:47 +00:00
Charles Kerr b6aa753f06 (gtk) add a "display options dialog" checkbox in the "open torrent" dialog. 2008-03-19 14:54:32 +00:00
Charles Kerr dd7111d3a0 fix "select all" wart for users w/gtk < 2.10 2008-03-19 01:49:07 +00:00
Charles Kerr d6a55c133b (gtk) have the "open" dialog remember which folder it was in the last time it was used. 2008-03-18 20:41:27 +00:00
Charles Kerr 21124a8de8 strings work: (1) folding similar strings together for easier tranlation (2) gtk: use consistent shortcuts/phrases/terminology between the preferences and "open torrent" dialogs (3) promote the port forwarding messages from Debug to Info as per BMW's request 2008-03-18 19:14:21 +00:00
Charles Kerr 1898904620 (gtk) fix open dialog error reported by Lacrocivious 2008-03-18 16:18:22 +00:00
Charles Kerr 0437c5f33e (gtk) try to iron out the remaining "add torrent" issues reported by wereHamster and Lacrocivous 2008-03-18 01:22:11 +00:00
Charles Kerr e4562bcd7b (gtk) #772, #753: added `watch dir' for automatically adding torrents. delete files to trashcan, rather than unlinking them. These features require 2.15.5 or higher. 2008-03-09 15:27:08 +00:00
Charles Kerr 6ef6ac0928 the last i18n-centric commit for awhile, I hope. 2008-03-08 04:53:11 +00:00
Charles Kerr 7200b27a18 lots more i18n string work -- making strings more consistent, folding redundant strings together, etc. 2008-03-07 20:48:36 +00:00
Charles Kerr 777c0de53a more i18n strings work 2008-03-06 21:59:00 +00:00