Code style change leftovers

For some reason, GTK client wasn't fully processed. All the rest of changes
are mostly in comments.
This commit is contained in:
Mike Gelfand 2017-04-21 10:40:57 +03:00
parent dadffa2c0f
commit 4f9d9ad92b
111 changed files with 783 additions and 779 deletions

View File

@ -24,14 +24,14 @@ if(ICONV_FOUND AND NOT DEFINED ICONV_SECOND_ARGUMENT_IS_CONST)
check_c_source_compiles("
#include <iconv.h>
int main ()
int main()
{
iconv_t conv = 0;
const char * in = 0;
size_t ilen = 0;
char * out = 0;
size_t olen = 0;
iconv (conv, &in, &ilen, &out, &olen);
iconv(conv, &in, &ilen, &out, &olen);
return 0;
}"
ICONV_SECOND_ARGUMENT_IS_CONST

View File

@ -10,9 +10,9 @@
#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <stdlib.h> /* abort (), daemon (), exit () */
#include <fcntl.h> /* open () */
#include <unistd.h> /* fork (), setsid (), chdir (), dup2 (), close (), pipe () */
#include <stdlib.h> /* abort(), daemon(), exit() */
#include <fcntl.h> /* open() */
#include <unistd.h> /* fork(), setsid(), chdir(), dup2(), close(), pipe() */
#include <libtransmission/transmission.h>
#include <libtransmission/error.h>
@ -162,7 +162,7 @@ bool dtr_daemon(dtr_callbacks const* cb, void* cb_arg, bool foreground, int* exi
#else
/* this is loosely based off of glibc's daemon () implementation
/* this is loosely based off of glibc's daemon() implementation
* http://sourceware.org/git/?p=glibc.git;a=blob_plain;f=misc/daemon.c */
switch (fork())

View File

@ -6,7 +6,7 @@
*
*/
#include <process.h> /* _beginthreadex () */
#include <process.h> /* _beginthreadex() */
#include <windows.h>

View File

@ -59,14 +59,14 @@ static void sd_notifyf(int status UNUSED, char const* fmt UNUSED, ...)
#define MEM_T_STR "TiB"
#define DISK_K 1000
#define DISK_B_STR "B"
#define DISK_B_STR "B"
#define DISK_K_STR "kB"
#define DISK_M_STR "MB"
#define DISK_G_STR "GB"
#define DISK_T_STR "TB"
#define SPEED_K 1000
#define SPEED_B_STR "B/s"
#define SPEED_B_STR "B/s"
#define SPEED_K_STR "kB/s"
#define SPEED_M_STR "MB/s"
#define SPEED_G_STR "GB/s"

View File

@ -2892,7 +2892,7 @@ static int processArgs(char const* rpcurl, int argc, char const* const* argv)
return status;
}
/* [host:port] or [host] or [port] or [http (s?)://host:port/transmission/] */
/* [host:port] or [host] or [port] or [http(s?)://host:port/transmission/] */
static void getHostAndPortAndRpcUrl(int* argc, char** argv, char** host, int* port, char** rpcurl)
{
if (*argv[1] != '-')

View File

@ -76,16 +76,16 @@ static GtkToggleActionEntry pref_toggle_entries[] =
static GtkActionEntry entries[] =
{
{ "file-menu", NULL, N_("_File"), NULL, NULL, NULL },
{ "torrent-menu", NULL, N_("_Torrent"), NULL, NULL, NULL },
{ "view-menu", NULL, N_("_View"), NULL, NULL, NULL },
{ "file-menu", NULL, N_("_File"), NULL, NULL, NULL },
{ "torrent-menu", NULL, N_("_Torrent"), NULL, NULL, NULL },
{ "view-menu", NULL, N_("_View"), NULL, NULL, NULL },
{ "sort-menu", NULL, N_("_Sort Torrents By"), NULL, NULL, NULL },
{ "queue-menu", NULL, N_("_Queue"), NULL, NULL, NULL },
{ "edit-menu", NULL, N_("_Edit"), NULL, NULL, NULL },
{ "help-menu", NULL, N_("_Help"), NULL, NULL, NULL },
{ "copy-magnet-link-to-clipboard", GTK_STOCK_COPY, N_("Copy _Magnet Link to Clipboard"), "", NULL, G_CALLBACK(action_cb) },
{ "open-torrent-from-url", GTK_STOCK_OPEN, N_("Open _URL…"), "<control>U", N_("Open URL…"), G_CALLBACK(action_cb) },
{ "open-torrent-toolbar", GTK_STOCK_OPEN, NULL, NULL, N_("Open a torrent"), G_CALLBACK(action_cb) },
{ "copy-magnet-link-to-clipboard", GTK_STOCK_COPY, N_("Copy _Magnet Link to Clipboard"), "", NULL, G_CALLBACK(action_cb) },
{ "open-torrent-from-url", GTK_STOCK_OPEN, N_("Open _URL…"), "<control>U", N_("Open URL…"), G_CALLBACK(action_cb) },
{ "open-torrent-toolbar", GTK_STOCK_OPEN, NULL, NULL, N_("Open a torrent"), G_CALLBACK(action_cb) },
{ "open-torrent-menu", GTK_STOCK_OPEN, NULL, NULL, N_("Open a torrent"), G_CALLBACK(action_cb) },
{ "torrent-start", GTK_STOCK_MEDIA_PLAY, N_("_Start"), "<control>S", N_("Start torrent"), G_CALLBACK(action_cb) },
{ "torrent-start-now", GTK_STOCK_MEDIA_PLAY, N_("Start _Now"), "<shift><control>S", N_("Start torrent now"), G_CALLBACK(action_cb) },
@ -104,7 +104,7 @@ static GtkActionEntry entries[] =
{ "deselect-all", NULL, N_("Dese_lect All"), "<shift><control>A", NULL, G_CALLBACK(action_cb) },
{ "edit-preferences", GTK_STOCK_PREFERENCES, NULL, NULL, NULL, G_CALLBACK(action_cb) },
{ "show-torrent-properties", GTK_STOCK_PROPERTIES, NULL, "<alt>Return", N_("Torrent properties"), G_CALLBACK(action_cb) },
{ "open-torrent-folder", GTK_STOCK_OPEN, N_("Open Fold_er"), "<control>E", NULL, G_CALLBACK(action_cb) },
{ "open-torrent-folder", GTK_STOCK_OPEN, N_("Open Fold_er"), "<control>E", NULL, G_CALLBACK(action_cb) },
{ "show-about-dialog", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(action_cb) },
{ "help", GTK_STOCK_HELP, N_("_Contents"), "F1", NULL, G_CALLBACK(action_cb) },
{ "torrent-reannounce", GTK_STOCK_NETWORK, N_("Ask Tracker for _More Peers"), NULL, NULL, G_CALLBACK(action_cb) },
@ -246,11 +246,11 @@ static void ensure_action_map_loaded(GtkUIManager* uim)
for (l = gtk_ui_manager_get_action_groups(uim); l != NULL; l = l->next)
{
GtkActionGroup* action_group = GTK_ACTION_GROUP(l->data);
GList* ait, *actions = gtk_action_group_list_actions(action_group);
GList* ait, * actions = gtk_action_group_list_actions(action_group);
for (ait = actions; ait != NULL; ait = ait->next)
{
GtkAction* action = GTK_ACTION(ait->data);
GtkAction* action = GTK_ACTION(ait->data);
char const* name = gtk_action_get_name(action);
g_hash_table_insert(key_to_action, g_strdup(name), action);
}
@ -262,7 +262,7 @@ static void ensure_action_map_loaded(GtkUIManager* uim)
static GtkAction* get_action(char const* name)
{
ensure_action_map_loaded(myUIManager);
return (GtkAction*) g_hash_table_lookup(key_to_action, name);
return (GtkAction*)g_hash_table_lookup(key_to_action, name);
}
void gtr_action_activate(char const* name)
@ -300,4 +300,3 @@ GtkWidget* gtr_action_get_widget(char const* path)
{
return gtk_ui_manager_get_widget(myUIManager, path);
}

View File

@ -19,8 +19,8 @@ void gtr_actions_init(GtkUIManager* ui_manager, gpointer callback_user_data);
void gtr_actions_set_core(TrCore* core);
void gtr_actions_handler(char const* action_name, gpointer user_data);
void gtr_action_activate(char const* action_name);
void gtr_action_set_sensitive(char const* action_name, gboolean is_sensitive);
void gtr_action_set_toggled(char const* action_name, gboolean is_toggled);
void gtr_action_set_important(char const* action_name, gboolean is_important);
void gtr_action_activate(char const* action_name);
void gtr_action_set_sensitive(char const* action_name, gboolean is_sensitive);
void gtr_action_set_toggled(char const* action_name, gboolean is_toggled);
void gtr_action_set_important(char const* action_name, gboolean is_important);
GtkWidget* gtr_action_get_widget(char const* path);

View File

@ -22,7 +22,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h> /* strtol () */
#include <stdlib.h> /* strtol() */
#include <string.h>
#include <unistd.h>

View File

@ -8,8 +8,8 @@
#include <limits.h> /* INT_MAX */
#include <stddef.h>
#include <stdio.h> /* sscanf () */
#include <stdlib.h> /* abort () */
#include <stdio.h> /* sscanf() */
#include <stdlib.h> /* abort() */
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@ -19,7 +19,7 @@
#include "actions.h"
#include "conf.h"
#include "details.h"
#include "favicon.h" /* gtr_get_favicon () */
#include "favicon.h" /* gtr_get_favicon() */
#include "file-list.h"
#include "hig.h"
#include "tr-prefs.h"
@ -383,7 +383,7 @@ static void refreshOptions(struct DetailsImpl* di, tr_torrent** torrents, int n)
static void torrent_set_bool(struct DetailsImpl* di, tr_quark const key, gboolean value)
{
GSList* l;
tr_variant top, *args, *ids;
tr_variant top, * args, * ids;
tr_variantInitDict(&top, 2);
tr_variantDictAddStr(&top, TR_KEY_method, "torrent-set");
@ -403,7 +403,7 @@ static void torrent_set_bool(struct DetailsImpl* di, tr_quark const key, gboolea
static void torrent_set_int(struct DetailsImpl* di, tr_quark const key, int value)
{
GSList* l;
tr_variant top, *args, *ids;
tr_variant top, * args, * ids;
tr_variantInitDict(&top, 2);
tr_variantDictAddStr(&top, TR_KEY_method, "torrent-set");
@ -423,7 +423,7 @@ static void torrent_set_int(struct DetailsImpl* di, tr_quark const key, int valu
static void torrent_set_real(struct DetailsImpl* di, tr_quark const key, double value)
{
GSList* l;
tr_variant top, *args, *ids;
tr_variant top, * args, * ids;
tr_variantInitDict(&top, 2);
tr_variantDictAddStr(&top, TR_KEY_method, "torrent-set");
@ -505,10 +505,10 @@ static void onComboEnumChanged(GtkComboBox* combo_box, struct DetailsImpl* di)
static GtkWidget* ratio_combo_new(void)
{
GtkWidget* w = gtr_combo_box_new_enum(
_("Use global settings"), TR_RATIOLIMIT_GLOBAL,
_("Seed regardless of ratio"), TR_RATIOLIMIT_UNLIMITED,
_("Stop seeding at ratio:"), TR_RATIOLIMIT_SINGLE,
NULL);
_("Use global settings"), TR_RATIOLIMIT_GLOBAL,
_("Seed regardless of ratio"), TR_RATIOLIMIT_UNLIMITED,
_("Stop seeding at ratio:"), TR_RATIOLIMIT_SINGLE,
NULL);
g_object_set_qdata(G_OBJECT(w), ARG_KEY, GINT_TO_POINTER(TR_KEY_seedRatioMode));
return w;
}
@ -516,10 +516,10 @@ static GtkWidget* ratio_combo_new(void)
static GtkWidget* idle_combo_new(void)
{
GtkWidget* w = gtr_combo_box_new_enum(
_("Use global settings"), TR_IDLELIMIT_GLOBAL,
_("Seed regardless of activity"), TR_IDLELIMIT_UNLIMITED,
_("Stop seeding if idle for N minutes:"), TR_IDLELIMIT_SINGLE,
NULL);
_("Use global settings"), TR_IDLELIMIT_GLOBAL,
_("Seed regardless of activity"), TR_IDLELIMIT_UNLIMITED,
_("Stop seeding if idle for N minutes:"), TR_IDLELIMIT_SINGLE,
NULL);
g_object_set_qdata(G_OBJECT(w), ARG_KEY, GINT_TO_POINTER(TR_KEY_seedIdleMode));
return w;
}
@ -529,7 +529,7 @@ static GtkWidget* options_page_new(struct DetailsImpl* d)
guint row;
gulong tag;
char buf[128];
GtkWidget* t, *w, *tb, *h;
GtkWidget* t, * w, * tb, * h;
row = 0;
t = hig_workarea_create();
@ -727,7 +727,6 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
gtr_label_set_text(GTK_LABEL(di->privacy_lb), str);
/* origin_lb */
if (n <= 0)
{
@ -781,7 +780,6 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
gtr_label_set_text(GTK_LABEL(di->origin_lb), str);
/* comment_buffer */
if (n <= 0)
{
@ -869,7 +867,6 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
stateString = str;
gtr_label_set_text(GTK_LABEL(di->state_lb), str);
/* date started */
if (n <= 0)
{
@ -903,7 +900,6 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
gtr_label_set_text(GTK_LABEL(di->date_started_lb), str);
/* eta */
if (n <= 0)
{
@ -937,7 +933,6 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
gtr_label_set_text(GTK_LABEL(di->eta_lb), str);
/* size_lb */
{
char sizebuf[128];
@ -970,8 +965,8 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
{
char piecebuf[128];
tr_formatter_mem_B(piecebuf, pieceSize, sizeof(piecebuf));
g_snprintf(buf, sizeof(buf), ngettext("%1$s (%2$'d piece @ %3$s)", "%1$s (%2$'d pieces @ %3$s)", pieces), sizebuf, pieces,
piecebuf);
g_snprintf(buf, sizeof(buf), ngettext("%1$s (%2$'d piece @ %3$s)", "%1$s (%2$'d pieces @ %3$s)",
pieces), sizebuf, pieces, piecebuf);
str = buf;
}
else
@ -983,7 +978,6 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
gtr_label_set_text(GTK_LABEL(di->size_lb), str);
}
/* have_lb */
if (n <= 0)
{
@ -1014,7 +1008,7 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
tr_strlpercent(avail, d, sizeof(avail));
tr_strlpercent(buf2, ratio, sizeof(buf2));
tr_strlsize(total, haveUnchecked + haveValid, sizeof(total));
tr_strlsize(unver, haveUnchecked, sizeof(unver));
tr_strlsize(unver, haveUnchecked, sizeof(unver));
if (!haveUnchecked && !leftUntilDone)
{
@ -1026,7 +1020,8 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
}
else
{
g_snprintf(buf, sizeof(buf), _("%1$s (%2$s%% of %3$s%% Available); %4$s Unverified"), total, buf2, avail, unver);
g_snprintf(buf, sizeof(buf), _("%1$s (%2$s%% of %3$s%% Available); %4$s Unverified"), total, buf2, avail,
unver);
}
str = buf;
@ -1068,7 +1063,6 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
gtr_label_set_text(GTK_LABEL(di->dl_lb), str);
/* ul_lb */
if (n <= 0)
{
@ -1145,7 +1139,6 @@ static void refreshInfo(struct DetailsImpl* di, tr_torrent** torrents, int n)
gtr_label_set_text(GTK_LABEL(di->error_lb), str);
/* activity date */
if (n <= 0)
{
@ -1196,7 +1189,7 @@ static GtkWidget* info_page_new(struct DetailsImpl* di)
{
guint row = 0;
GtkTextBuffer* b;
GtkWidget* l, *w, *fr, *sw;
GtkWidget* l, * w, * fr, * sw;
GtkWidget* t = hig_workarea_create();
hig_workarea_add_section_title(t, &row, _("Activity"));
@ -1324,11 +1317,11 @@ static char const* getWebseedColumnNames(int column)
static GtkListStore* webseed_model_new(void)
{
return gtk_list_store_new(N_WEBSEED_COLS,
G_TYPE_STRING, /* key */
G_TYPE_BOOLEAN, /* was-updated */
G_TYPE_STRING, /* url */
G_TYPE_DOUBLE, /* download rate double */
G_TYPE_STRING); /* download rate string */
G_TYPE_STRING, /* key */
G_TYPE_BOOLEAN, /* was-updated */
G_TYPE_STRING, /* url */
G_TYPE_DOUBLE, /* download rate double */
G_TYPE_STRING); /* download rate string */
}
enum
@ -1417,31 +1410,31 @@ static char const* getPeerColumnName(int column)
static GtkListStore* peer_store_new(void)
{
return gtk_list_store_new(N_PEER_COLS,
G_TYPE_STRING, /* key */
G_TYPE_BOOLEAN, /* was-updated */
G_TYPE_STRING, /* address */
G_TYPE_STRING, /* collated address */
G_TYPE_DOUBLE, /* download speed int */
G_TYPE_STRING, /* download speed string */
G_TYPE_DOUBLE, /* upload speed int */
G_TYPE_STRING, /* upload speed string */
G_TYPE_STRING, /* client */
G_TYPE_INT, /* progress [0..100] */
G_TYPE_INT, /* upload request count int */
G_TYPE_STRING, /* upload request count string */
G_TYPE_INT, /* download request count int */
G_TYPE_STRING, /* download request count string */
G_TYPE_INT, /* # blocks downloaded int */
G_TYPE_STRING, /* # blocks downloaded string */
G_TYPE_INT, /* # blocks uploaded int */
G_TYPE_STRING, /* # blocks uploaded string */
G_TYPE_INT, /* # blocks cancelled by client int */
G_TYPE_STRING, /* # blocks cancelled by client string */
G_TYPE_INT, /* # blocks cancelled by peer int */
G_TYPE_STRING, /* # blocks cancelled by peer string */
G_TYPE_STRING, /* encryption stock id */
G_TYPE_STRING, /* flagString */
G_TYPE_STRING); /* torrent name */
G_TYPE_STRING, /* key */
G_TYPE_BOOLEAN, /* was-updated */
G_TYPE_STRING, /* address */
G_TYPE_STRING, /* collated address */
G_TYPE_DOUBLE, /* download speed int */
G_TYPE_STRING, /* download speed string */
G_TYPE_DOUBLE, /* upload speed int */
G_TYPE_STRING, /* upload speed string */
G_TYPE_STRING, /* client */
G_TYPE_INT, /* progress [0..100] */
G_TYPE_INT, /* upload request count int */
G_TYPE_STRING, /* upload request count string */
G_TYPE_INT, /* download request count int */
G_TYPE_STRING, /* download request count string */
G_TYPE_INT, /* # blocks downloaded int */
G_TYPE_STRING, /* # blocks downloaded string */
G_TYPE_INT, /* # blocks uploaded int */
G_TYPE_STRING, /* # blocks uploaded string */
G_TYPE_INT, /* # blocks cancelled by client int */
G_TYPE_STRING, /* # blocks cancelled by client string */
G_TYPE_INT, /* # blocks cancelled by peer int */
G_TYPE_STRING, /* # blocks cancelled by peer string */
G_TYPE_STRING, /* encryption stock id */
G_TYPE_STRING, /* flagString */
G_TYPE_STRING); /* torrent name */
}
static void initPeerRow(GtkListStore* store, GtkTreeIter* iter, char const* key, char const* torrentName,
@ -1508,22 +1501,22 @@ static void refreshPeerRow(GtkListStore* store, GtkTreeIter* iter, tr_peer_stat
if (peer->blocksToPeer > 0)
{
g_snprintf(blocks_to_peer, sizeof(blocks_to_peer), "%"PRIu32, peer->blocksToPeer);
g_snprintf(blocks_to_peer, sizeof(blocks_to_peer), "%" PRIu32, peer->blocksToPeer);
}
if (peer->blocksToClient > 0)
{
g_snprintf(blocks_to_client, sizeof(blocks_to_client), "%"PRIu32, peer->blocksToClient);
g_snprintf(blocks_to_client, sizeof(blocks_to_client), "%" PRIu32, peer->blocksToClient);
}
if (peer->cancelsToPeer > 0)
{
g_snprintf(cancelled_by_client, sizeof(cancelled_by_client), "%"PRIu32, peer->cancelsToPeer);
g_snprintf(cancelled_by_client, sizeof(cancelled_by_client), "%" PRIu32, peer->cancelsToPeer);
}
if (peer->cancelsToClient > 0)
{
g_snprintf(cancelled_by_peer, sizeof(cancelled_by_peer), "%"PRIu32, peer->cancelsToClient);
g_snprintf(cancelled_by_peer, sizeof(cancelled_by_peer), "%" PRIu32, peer->cancelsToClient);
}
gtk_list_store_set(store, iter,
@ -2078,11 +2071,11 @@ static GtkWidget* peer_page_new(struct DetailsImpl* di)
gboolean b;
char const* str;
GtkListStore* store;
GtkWidget* v, *w, *ret, *sw, *vbox;
GtkWidget* v, * w, * ret, * sw, * vbox;
GtkWidget* webtree = NULL;
GtkTreeModel* m;
GtkTreeViewColumn* c;
GtkCellRenderer* r;
GtkCellRenderer* r;
/* webseeds */
@ -2116,7 +2109,7 @@ static GtkWidget* peer_page_new(struct DetailsImpl* di)
/* peers */
store = di->peer_store = peer_store_new();
store = di->peer_store = peer_store_new();
m = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(store));
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(m), PEER_COL_PROGRESS, GTK_SORT_DESCENDING);
v = GTK_WIDGET(g_object_new(GTK_TYPE_TREE_VIEW, "model", m, "rules-hint", TRUE, "has-tooltip", TRUE, NULL));
@ -2150,11 +2143,11 @@ static GtkWidget* peer_page_new(struct DetailsImpl* di)
/* ip-to-GtkTreeRowReference */
di->peer_hash = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify)g_free,
(GDestroyNotify)gtk_tree_row_reference_free);
(GDestroyNotify)gtk_tree_row_reference_free);
/* url-to-GtkTreeRowReference */
di->webseed_hash = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify)g_free,
(GDestroyNotify)gtk_tree_row_reference_free);
(GDestroyNotify)gtk_tree_row_reference_free);
ret = vbox;
return ret;
}
@ -2215,18 +2208,18 @@ static void buildTrackerSummary(GString* gstr, char const* key, tr_tracker_stat
if (st->lastAnnounceSucceeded)
{
g_string_append_printf(gstr, _("Got a list of %1$s%2$'d peers%3$s %4$s ago"), success_markup_begin, st->lastAnnouncePeerCount,
success_markup_end, timebuf);
g_string_append_printf(gstr, _("Got a list of %1$s%2$'d peers%3$s %4$s ago"),
success_markup_begin, st->lastAnnouncePeerCount, success_markup_end, timebuf);
}
else if (st->lastAnnounceTimedOut)
{
g_string_append_printf(gstr, _("Peer list request %1$stimed out%2$s %3$s ago; will retry"), timeout_markup_begin,
timeout_markup_end, timebuf);
g_string_append_printf(gstr, _("Peer list request %1$stimed out%2$s %3$s ago; will retry"),
timeout_markup_begin, timeout_markup_end, timebuf);
}
else
{
g_string_append_printf(gstr, _("Got an error %1$s\"%2$s\"%3$s %4$s ago"), err_markup_begin, st->lastAnnounceResult,
err_markup_end, timebuf);
g_string_append_printf(gstr, _("Got an error %1$s\"%2$s\"%3$s %4$s ago"), err_markup_begin,
st->lastAnnounceResult, err_markup_end, timebuf);
}
}
@ -2264,13 +2257,13 @@ static void buildTrackerSummary(GString* gstr, char const* key, tr_tracker_stat
if (st->lastScrapeSucceeded)
{
g_string_append_printf(gstr, _("Tracker had %s%'d seeders and %'d leechers%s %s ago"), success_markup_begin, st->seederCount,
st->leecherCount, success_markup_end, timebuf);
g_string_append_printf(gstr, _("Tracker had %s%'d seeders and %'d leechers%s %s ago"), success_markup_begin,
st->seederCount, st->leecherCount, success_markup_end, timebuf);
}
else
{
g_string_append_printf(gstr, _("Got a scrape error \"%s%s%s\" %s ago"), err_markup_begin, st->lastScrapeResult, err_markup_end,
timebuf);
g_string_append_printf(gstr, _("Got a scrape error \"%s%s%s\" %s ago"), err_markup_begin,
st->lastScrapeResult, err_markup_end, timebuf);
}
}
@ -2392,7 +2385,7 @@ static void refreshTracker(struct DetailsImpl* di, tr_torrent** torrents, int n)
tr_tracker_stat** stats;
GtkTreeIter iter;
GtkTreeModel* model;
GString* gstr = di->gstr; /* buffer for temporary strings */
GString* gstr = di->gstr; /* buffer for temporary strings */
GHashTable* hash = di->tracker_hash;
GtkListStore* store = di->tracker_store;
tr_session* session = gtr_core_session(di->core);
@ -2602,11 +2595,10 @@ static void on_edit_trackers_response(GtkDialog* dialog, int response, gpointer
{
GtkWidget* w;
char const* text = _("List contains invalid URLs");
w = gtk_message_dialog_new(GTK_WINDOW(dialog),
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, "%s", text);
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(w), "%s", _("Please correct the errors and try again."));
w = gtk_message_dialog_new(GTK_WINDOW(dialog), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s",
text);
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(w), "%s",
_("Please correct the errors and try again."));
gtk_dialog_run(GTK_DIALOG(w));
gtk_widget_destroy(w);
do_destroy = FALSE;
@ -2658,15 +2650,15 @@ static void on_edit_trackers(GtkButton* button, gpointer data)
if (tor != NULL)
{
guint row;
GtkWidget* w, *d, *fr, *t, *l, *sw;
GtkWidget* w, * d, * fr, * t, * l, * sw;
GtkWindow* win = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(button)));
GString* gstr = di->gstr; /* buffer for temporary strings */
GString* gstr = di->gstr; /* buffer for temporary strings */
int const torrent_id = tr_torrentId(tor);
g_string_truncate(gstr, 0);
g_string_append_printf(gstr, _("%s - Edit Trackers"), tr_torrentName(tor));
d = gtk_dialog_new_with_buttons(gstr->str, win, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
g_signal_connect(d, "response", G_CALLBACK(on_edit_trackers_response), data);
row = 0;
@ -2675,7 +2667,7 @@ static void on_edit_trackers(GtkButton* button, gpointer data)
l = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(l), _("To add a backup URL, add it on the line after the primary URL.\n"
"To add another primary URL, add it after a blank line."));
"To add another primary URL, add it after a blank line."));
gtk_label_set_justify(GTK_LABEL(l), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment(GTK_MISC(l), 0.0, 0.5);
hig_workarea_add_wide_control(t, &row, l);
@ -2769,12 +2761,12 @@ static void on_tracker_list_add_button_clicked(GtkButton* button UNUSED, gpointe
GtkWidget* e;
GtkWidget* t;
GtkWidget* w;
GString* gstr = di->gstr; /* buffer for temporary strings */
GString* gstr = di->gstr; /* buffer for temporary strings */
g_string_truncate(gstr, 0);
g_string_append_printf(gstr, _("%s - Add Tracker"), tr_torrentName(tor));
w = gtk_dialog_new_with_buttons(gstr->str, GTK_WINDOW(di->dialog), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL);
GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL);
gtk_dialog_set_alternative_button_order(GTK_DIALOG(w), GTK_RESPONSE_ACCEPT, GTK_RESPONSE_CANCEL, -1);
g_signal_connect(w, "response", G_CALLBACK(on_add_tracker_response), gdi);
@ -2831,23 +2823,23 @@ static GtkWidget* tracker_page_new(struct DetailsImpl* di)
GtkCellRenderer* r;
GtkTreeViewColumn* c;
GtkTreeSelection* sel;
GtkWidget* vbox, *sw, *w, *v, *hbox;
GtkWidget* vbox, * sw, * w, * v, * hbox;
int const pad = (GUI_PAD + GUI_PAD_BIG) / 2;
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, GUI_PAD);
gtk_container_set_border_width(GTK_CONTAINER(vbox), GUI_PAD_BIG);
di->tracker_store = gtk_list_store_new(TRACKER_N_COLS,
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_BOOLEAN,
G_TYPE_INT,
GDK_TYPE_PIXBUF,
G_TYPE_BOOLEAN,
G_TYPE_STRING);
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_BOOLEAN,
G_TYPE_INT,
GDK_TYPE_PIXBUF,
G_TYPE_BOOLEAN,
G_TYPE_STRING);
di->tracker_hash = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify)g_free,
(GDestroyNotify)gtk_tree_row_reference_free);
(GDestroyNotify)gtk_tree_row_reference_free);
di->trackers_filtered = gtk_tree_model_filter_new(GTK_TREE_MODEL(di->tracker_store), NULL);
gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(di->trackers_filtered),
@ -2970,7 +2962,7 @@ static void details_free(gpointer gdata)
GtkWidget* gtr_torrent_details_dialog_new(GtkWindow* parent, TrCore* core)
{
GtkWidget* d, *n, *v, *w, *l;
GtkWidget* d, * n, * v, * w, * l;
struct DetailsImpl* di = g_new0(struct DetailsImpl, 1);
/* one-time setup */
@ -3002,7 +2994,7 @@ GtkWidget* gtr_torrent_details_dialog_new(GtkWindow* parent, TrCore* core)
w = peer_page_new(di);
l = gtk_label_new(_("Peers"));
gtk_notebook_append_page(GTK_NOTEBOOK(n), w, l);
gtk_notebook_append_page(GTK_NOTEBOOK(n), w, l);
w = tracker_page_new(di);
l = gtk_label_new(_("Trackers"));

View File

@ -103,33 +103,34 @@ void gtr_confirm_remove(GtkWindow* parent, TrCore* core, GSList* torrent_ids, gb
}
else
{
g_string_printf(primary_text, ngettext("Delete this torrent's downloaded files?", "Delete these %d torrents' downloaded files?",
count), count);
g_string_printf(primary_text, ngettext("Delete this torrent's downloaded files?",
"Delete these %d torrents' downloaded files?", count), count);
}
secondary_text = g_string_new(NULL);
if (!incomplete && !connected)
{
g_string_assign(secondary_text, ngettext("Once removed, continuing the transfer will require the torrent file or magnet link.",
"Once removed, continuing the transfers will require the torrent files or magnet links.", count));
g_string_assign(secondary_text,
ngettext("Once removed, continuing the transfer will require the torrent file or magnet link.",
"Once removed, continuing the transfers will require the torrent files or magnet links.", count));
}
else if (count == incomplete)
{
g_string_assign(secondary_text, ngettext("This torrent has not finished downloading.",
"These torrents have not finished downloading.", count));
"These torrents have not finished downloading.", count));
}
else if (count == connected)
{
g_string_assign(secondary_text, ngettext("This torrent is connected to peers.", "These torrents are connected to peers.",
count));
g_string_assign(secondary_text, ngettext("This torrent is connected to peers.",
"These torrents are connected to peers.", count));
}
else
{
if (connected)
{
g_string_append(secondary_text, ngettext("One of these torrents is connected to peers.",
"Some of these torrents are connected to peers.", connected));
"Some of these torrents are connected to peers.", connected));
}
if (connected && incomplete)
@ -140,12 +141,12 @@ void gtr_confirm_remove(GtkWindow* parent, TrCore* core, GSList* torrent_ids, gb
if (incomplete)
{
g_string_assign(secondary_text, ngettext("One of these torrents has not finished downloading.",
"Some of these torrents have not finished downloading.", incomplete));
"Some of these torrents have not finished downloading.", incomplete));
}
}
d = gtk_message_dialog_new_with_markup(parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
"<big><b>%s</b></big>", primary_text->str);
"<big><b>%s</b></big>", primary_text->str);
if (secondary_text->len)
{

View File

@ -6,14 +6,14 @@
*
*/
#include <glib/gstdio.h> /* g_remove () */
#include <glib/gstdio.h> /* g_remove() */
#include <gtk/gtk.h>
#include <libtransmission/transmission.h>
#include <libtransmission/web.h> /* tr_webRun () */
#include <libtransmission/web.h> /* tr_webRun() */
#include "favicon.h"
#include "util.h" /* gtr_get_host_from_url () */
#include "util.h" /* gtr_get_host_from_url() */
#define IMAGE_TYPES 4
static char const* image_types[IMAGE_TYPES] = { "ico", "png", "gif", "jpg" };

View File

@ -22,9 +22,9 @@
#include "tr-prefs.h"
#include "util.h"
#define TR_DOWNLOAD_KEY "tr-download-key"
#define TR_DOWNLOAD_KEY "tr-download-key"
#define TR_COLUMN_ID_KEY "tr-model-column-id-key"
#define TR_PRIORITY_KEY "tr-priority-key"
#define TR_PRIORITY_KEY "tr-priority-key"
enum
{
@ -131,12 +131,13 @@ static gboolean refreshFilesForeach(GtkTreeModel* model, GtkTreePath* path UNUSE
* sorting until we finish walking the tree. */
if (!refresh_data->resort_needed)
{
if ((refresh_data->resort_needed = ((refresh_data->sort_column_id == FC_PRIORITY) && (priority != old_priority)) ||
((refresh_data->sort_column_id == FC_ENABLED) && (enabled != old_enabled))))
if ((refresh_data->resort_needed =
((refresh_data->sort_column_id == FC_PRIORITY) && (priority != old_priority)) ||
((refresh_data->sort_column_id == FC_ENABLED) && (enabled != old_enabled))))
{
refresh_data->resort_needed = TRUE;
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(data->model), GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE( data->model),
GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, GTK_SORT_ASCENDING);
}
}
@ -157,7 +158,7 @@ static gboolean refreshFilesForeach(GtkTreeModel* model, GtkTreePath* path UNUSE
int enabled = NOT_SET;
int priority = NOT_SET;
/* since gtk_tree_model_foreach () is depth-first, we can
/* since gtk_tree_model_foreach() is depth-first, we can
* get the `sub' info by walking the immediate children */
if (gtk_tree_model_iter_children(model, &child, iter))
@ -204,7 +205,8 @@ static gboolean refreshFilesForeach(GtkTreeModel* model, GtkTreePath* path UNUSE
prog = sub_size ? (int)((100.0 * have) / sub_size) : 1;
if ((size != sub_size) || (have != old_have) || (priority != old_priority) || (enabled != old_enabled) || (prog != old_prog))
if ((size != sub_size) || (have != old_have) || (priority != old_priority) || (enabled != old_enabled) ||
(prog != old_prog))
{
char size_str[64];
tr_strlsize(size_str, sub_size, sizeof size_str);
@ -443,8 +445,8 @@ static void buildTree(GNode* node, gpointer gdata)
char const* mime_type = isLeaf ? gtr_get_mime_type_from_filename(child_data->name) : DIRECTORY_MIME_TYPE;
GdkPixbuf* icon = gtr_get_mime_type_icon(mime_type, GTK_ICON_SIZE_MENU, build->w);
tr_info const* inf = tr_torrentInfo(build->tor);
int const priority = isLeaf ? inf->files[ child_data->index ].priority : 0;
gboolean const enabled = isLeaf ? !inf->files[ child_data->index ].dnd : TRUE;
int const priority = isLeaf ? inf->files[child_data->index].priority : 0;
gboolean const enabled = isLeaf ? !inf->files[child_data->index].dnd : TRUE;
char* name_esc = g_markup_escape_text(child_data->name, -1);
tr_strlsize(size_str, child_data->length, sizeof size_str);
@ -504,16 +506,16 @@ void gtr_file_list_set_torrent(GtkWidget* w, int torrentId)
/* instantiate the model */
store = gtk_tree_store_new(N_FILE_COLS,
GDK_TYPE_PIXBUF, /* icon */
G_TYPE_STRING, /* label */
G_TYPE_STRING, /* label esc */
G_TYPE_INT, /* prog [0..100] */
G_TYPE_UINT, /* index */
G_TYPE_UINT64, /* size */
G_TYPE_STRING, /* size str */
G_TYPE_UINT64, /* have */
G_TYPE_INT, /* priority */
G_TYPE_INT); /* dl enabled */
GDK_TYPE_PIXBUF, /* icon */
G_TYPE_STRING, /* label */
G_TYPE_STRING, /* label esc */
G_TYPE_INT, /* prog [0..100] */
G_TYPE_UINT, /* index */
G_TYPE_UINT64, /* size */
G_TYPE_STRING, /* size str */
G_TYPE_UINT64, /* have */
G_TYPE_INT, /* priority */
G_TYPE_INT); /* dl enabled */
data->store = store;
data->model = GTK_TREE_MODEL(store);
@ -631,7 +633,7 @@ static void renderPriority(GtkTreeViewColumn* column UNUSED, GtkCellRenderer* re
g_object_set(renderer, "text", text, NULL);
}
/* build a filename from tr_torrentGetCurrentDir () + the model's FC_LABELs */
/* build a filename from tr_torrentGetCurrentDir() + the model's FC_LABELs */
static char* buildFilename(tr_torrent* tor, GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter)
{
char* ret;
@ -735,7 +737,7 @@ static gboolean onViewPathToggled(GtkTreeView* view, GtkTreeViewColumn* col, Gtk
break;
}
tr_torrentSetFilePriorities(tor, (tr_file_index_t*) indices->data, (tr_file_index_t) indices->len, priority);
tr_torrentSetFilePriorities(tor, (tr_file_index_t*)indices->data, (tr_file_index_t)indices->len, priority);
}
else
{
@ -743,7 +745,7 @@ static gboolean onViewPathToggled(GtkTreeView* view, GtkTreeViewColumn* col, Gtk
gtk_tree_model_get(model, &iter, FC_ENABLED, &enabled, -1);
enabled = !enabled;
tr_torrentSetFileDLs(tor, (tr_file_index_t*) indices->data, (tr_file_index_t) indices->len, enabled);
tr_torrentSetFileDLs(tor, (tr_file_index_t*)indices->data, (tr_file_index_t)indices->len, enabled);
}
refresh(data);
@ -832,7 +834,8 @@ static int on_rename_done_idle(struct rename_data* data)
else
{
GtkWidget* w = gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_toplevel(data->file_data->top)), GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Unable to rename file as \"%s\": %s"), data->newname, tr_strerror(data->error));
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Unable to rename file as \"%s\": %s"), data->newname,
tr_strerror(data->error));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(w), "%s", _("Please correct the errors and try again."));
gtk_dialog_run(GTK_DIALOG(w));
gtk_widget_destroy(w);
@ -903,7 +906,6 @@ static void cell_edited_callback(GtkCellRendererText* cell G_GNUC_UNUSED, gchar*
g_string_free(oldpath, TRUE);
}
GtkWidget* gtr_file_list_new(TrCore* core, int torrentId)
{
int size;
@ -932,7 +934,6 @@ GtkWidget* gtr_file_list_new(TrCore* core, int torrentId)
g_signal_connect(view, "row_activated", G_CALLBACK(onRowActivated), data);
g_signal_connect(view, "button-release-event", G_CALLBACK(on_tree_view_button_released), NULL);
pango_context = gtk_widget_create_pango_context(view);
pango_font_description = pango_font_description_copy(pango_context_get_font_description(pango_context));
size = pango_font_description_get_size(pango_font_description);

View File

@ -6,7 +6,7 @@
*
*/
#include <stdlib.h> /* qsort () */
#include <stdlib.h> /* qsort() */
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@ -14,11 +14,11 @@
#include <libtransmission/transmission.h>
#include <libtransmission/utils.h>
#include "favicon.h" /* gtr_get_favicon () */
#include "favicon.h" /* gtr_get_favicon() */
#include "filter.h"
#include "hig.h" /* GUI_PAD */
#include "tr-core.h" /* MC_TORRENT */
#include "util.h" /* gtr_get_host_from_url () */
#include "util.h" /* gtr_get_host_from_url() */
static GQuark DIRTY_KEY = 0;
static GQuark SESSION_KEY = 0;
@ -50,7 +50,7 @@ enum
static int pstrcmp(void const* a, void const* b)
{
return g_strcmp0(* (char const* const*)a, * (char const* const*)b);
return g_strcmp0(*(char const* const*)a, *(char const* const*)b);
}
/* human-readable name; ie, Legaltorrents */
@ -202,7 +202,7 @@ static gboolean tracker_filter_model_update(gpointer gstore)
store_pos = first_tracker_pos;
for (i = 0, n = hosts->len ; ;)
for (i = 0, n = hosts->len;;)
{
gboolean const new_hosts_done = i >= n;
gboolean const old_hosts_done = !gtk_tree_model_iter_nth_child(model, &iter, NULL, store_pos);
@ -228,7 +228,7 @@ static gboolean tracker_filter_model_update(gpointer gstore)
{
int cmp;
char* host;
gtk_tree_model_get(model, &iter, TRACKER_FILTER_COL_HOST, &host, -1);
gtk_tree_model_get(model, &iter, TRACKER_FILTER_COL_HOST, &host, -1);
cmp = g_strcmp0(host, hosts->pdata[i]);
if (cmp < 0)
@ -257,7 +257,7 @@ static gboolean tracker_filter_model_update(gpointer gstore)
tr_session* session = g_object_get_qdata(G_OBJECT(store), SESSION_KEY);
char const* host = hosts->pdata[i];
char* name = get_name_from_host(host);
int const count = * (int*)g_hash_table_lookup(hosts_hash, host);
int const count = *(int*)g_hash_table_lookup(hosts_hash, host);
gtk_tree_store_insert_with_values(store, &add, NULL, store_pos,
TRACKER_FILTER_COL_HOST, host,
TRACKER_FILTER_COL_NAME, name,
@ -275,7 +275,7 @@ static gboolean tracker_filter_model_update(gpointer gstore)
else /* update row */
{
char const* host = hosts->pdata[i];
int const count = * (int*)g_hash_table_lookup(hosts_hash, host);
int const count = *(int*)g_hash_table_lookup(hosts_hash, host);
tracker_model_update_count(store, &iter, count);
++store_pos;
++i;
@ -292,11 +292,11 @@ static gboolean tracker_filter_model_update(gpointer gstore)
static GtkTreeModel* tracker_filter_model_new(GtkTreeModel* tmodel)
{
GtkTreeStore* store = gtk_tree_store_new(TRACKER_FILTER_N_COLS,
G_TYPE_STRING,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_STRING,
GDK_TYPE_PIXBUF);
G_TYPE_STRING,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_STRING,
GDK_TYPE_PIXBUF);
gtk_tree_store_insert_with_values(store, NULL, NULL, -1,
TRACKER_FILTER_COL_NAME, _("All"),
@ -501,7 +501,7 @@ static gboolean test_torrent_activity(tr_torrent* tor, int type)
case ACTIVITY_FILTER_ACTIVE:
return (st->peersSendingToUs > 0) || (st->peersGettingFromUs > 0) || (st->webseedsSendingToUs > 0) ||
(st->activity == TR_STATUS_CHECK);
(st->activity == TR_STATUS_CHECK);
case ACTIVITY_FILTER_PAUSED:
return st->activity == TR_STATUS_STOPPED;
@ -601,10 +601,10 @@ static GtkTreeModel* activity_filter_model_new(GtkTreeModel* tmodel)
};
GtkListStore* store = gtk_list_store_new(ACTIVITY_FILTER_N_COLS,
G_TYPE_STRING,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_STRING);
G_TYPE_STRING,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_STRING);
for (i = 0, n = G_N_ELEMENTS(types); i < n; ++i)
{
@ -789,7 +789,7 @@ static gboolean is_row_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer
text = (char const*)g_object_get_qdata(o, TEXT_KEY);
return (tor != NULL) && test_tracker(tor, data->active_tracker_type, data->active_tracker_host) &&
test_torrent_activity(tor, data->active_activity_type) && testText(tor, text);
test_torrent_activity(tor, data->active_activity_type) && testText(tor, text);
}
static void selection_changed_cb(GtkComboBox* combo, gpointer vdata)

View File

@ -68,7 +68,7 @@ static IconCache* icon_cache_new(GtkWidget* for_widget, int icon_size)
icon_cache->cache = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_object_unref);
g_hash_table_insert(icon_cache->cache, (void*)VOID_PIXBUF_KEY, create_void_pixbuf(icon_cache->icon_size,
icon_cache->icon_size));
icon_cache->icon_size));
return icon_cache;
}
@ -80,7 +80,7 @@ static char const* _icon_cache_get_icon_key(GIcon* icon)
if (G_IS_THEMED_ICON(icon))
{
char** icon_names;
char* name;
char* name;
g_object_get(icon, "names", &icon_names, NULL);
name = g_strjoinv(",", icon_names);
@ -93,7 +93,7 @@ static char const* _icon_cache_get_icon_key(GIcon* icon)
else if (G_IS_FILE_ICON(icon))
{
GFile* file;
char* filename;
char* filename;
file = g_file_icon_get_file(G_FILE_ICON(icon));
filename = g_file_get_path(file);
@ -135,7 +135,7 @@ static GdkPixbuf* get_themed_icon_pixbuf(GThemedIcon* icon, int size, GtkIconThe
g_clear_error(&error);
}
#if GTK_CHECK_VERSION(3,8,0)
#if GTK_CHECK_VERSION(3, 8, 0)
g_object_unref(icon_info);
#else
gtk_icon_info_free(icon_info);
@ -208,7 +208,7 @@ static GdkPixbuf* icon_cache_get_mime_type_icon(IconCache* icon_cache, char cons
if (pixbuf != NULL)
{
g_hash_table_insert(icon_cache->cache, (gpointer) key, g_object_ref(pixbuf));
g_hash_table_insert(icon_cache->cache, (gpointer)key, g_object_ref(pixbuf));
}
g_object_unref(G_OBJECT(icon));

View File

@ -24,7 +24,7 @@
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h> /* exit () */
#include <stdlib.h> /* exit() */
#include <time.h>
#include <glib/gi18n.h>
@ -623,7 +623,7 @@ int main(int argc, char** argv)
/* default settings */
memset(&cbdata, 0, sizeof(struct cbdata));
cbdata.config_dir = (char*) tr_getDefaultConfigDir(MY_CONFIG_NAME);
cbdata.config_dir = (char*)tr_getDefaultConfigDir(MY_CONFIG_NAME);
/* init i18n */
setlocale(LC_ALL, "");
@ -676,7 +676,8 @@ int main(int argc, char** argv)
/* init the application for the specified config dir */
stat(cbdata.config_dir, &sb);
application_id = g_strdup_printf("com.transmissionbt.transmission_%lu_%lu", (unsigned long)sb.st_dev, (unsigned long)sb.st_ino);
application_id = g_strdup_printf("com.transmissionbt.transmission_%lu_%lu", (unsigned long)sb.st_dev,
(unsigned long)sb.st_ino);
app = gtk_application_new(application_id, G_APPLICATION_HANDLES_OPEN);
g_signal_connect(app, "open", G_CALLBACK(on_open), &cbdata);
g_signal_connect(app, "startup", G_CALLBACK(on_startup), &cbdata);
@ -742,8 +743,9 @@ static void app_setup(GtkWindow* wind, struct cbdata* cbdata)
if (!gtr_pref_flag_get(TR_KEY_user_has_given_informed_consent))
{
GtkWidget* w = gtk_message_dialog_new(GTK_WINDOW(wind), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_OTHER, GTK_BUTTONS_NONE,
"%s", _("Transmission is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility."));
GtkWidget* w = gtk_message_dialog_new(GTK_WINDOW(wind), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_OTHER,
GTK_BUTTONS_NONE, "%s", _("Transmission is a file sharing program. When you run a torrent, its data will be "
"made available to others by means of upload. Any content you share is your sole responsibility."));
gtk_dialog_add_button(GTK_DIALOG(w), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
gtk_dialog_add_button(GTK_DIALOG(w), _("I _Agree"), GTK_RESPONSE_ACCEPT);
gtk_dialog_set_default_response(GTK_DIALOG(w), GTK_RESPONSE_ACCEPT);
@ -938,7 +940,7 @@ static void exit_now_cb(GtkWidget* w UNUSED, gpointer data UNUSED)
static void on_app_exit(gpointer vdata)
{
GtkWidget* r, *p, *b, *w, *c;
GtkWidget* r, * p, * b, * w, * c;
struct cbdata* cbdata = vdata;
struct session_close_struct* session_close_data;
@ -1038,13 +1040,13 @@ static void flush_torrent_errors(struct cbdata* cbdata)
if (cbdata->error_list)
{
show_torrent_errors(cbdata->wind, ngettext("Couldn't add corrupt torrent", "Couldn't add corrupt torrents",
g_slist_length(cbdata->error_list)), &cbdata->error_list);
g_slist_length(cbdata->error_list)), &cbdata->error_list);
}
if (cbdata->duplicates_list)
{
show_torrent_errors(cbdata->wind, ngettext("Couldn't add duplicate torrent", "Couldn't add duplicate torrents",
g_slist_length(cbdata->duplicates_list)), &cbdata->duplicates_list);
g_slist_length(cbdata->duplicates_list)), &cbdata->duplicates_list);
}
}
@ -1087,7 +1089,7 @@ static void on_add_torrent(TrCore* core, tr_ctor* ctor, gpointer gdata)
struct cbdata* cbdata = gdata;
GtkWidget* w = gtr_torrent_options_dialog_new(cbdata->wind, core, ctor);
g_signal_connect(w, "focus-in-event", G_CALLBACK(on_main_window_focus_in), cbdata);
g_signal_connect(w, "focus-in-event", G_CALLBACK(on_main_window_focus_in), cbdata);
if (cbdata->wind)
{
@ -1389,7 +1391,7 @@ static void append_id_to_benc_list(GtkTreeModel* m, GtkTreePath* path UNUSED, Gt
static gboolean call_rpc_for_selected_torrents(struct cbdata* data, char const* method)
{
tr_variant top, *args, *ids;
tr_variant top, * args, * ids;
gboolean invoked = FALSE;
GtkTreeSelection* s = data->sel;
tr_session* session = gtr_core_session(data->core);

View File

@ -11,7 +11,7 @@
#include <libtransmission/transmission.h>
#include <libtransmission/makemeta.h>
#include <libtransmission/utils.h> /* tr_formatter_mem_B () */
#include <libtransmission/utils.h> /* tr_formatter_mem_B() */
#include "hig.h"
#include "makemeta-ui.h"
@ -174,10 +174,10 @@ static void onProgressDialogResponse(GtkDialog* d, int response, gpointer data)
static void makeProgressDialog(GtkWidget* parent, MakeMetaUI* ui)
{
GtkWidget* d, *l, *w, *v, *fr;
GtkWidget* d, * l, * w, * v, * fr;
d = gtk_dialog_new_with_buttons(_("New Torrent"), GTK_WINDOW(parent), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL);
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL);
ui->progress_dialog = d;
g_signal_connect(d, "response", G_CALLBACK(onProgressDialogResponse), ui);
@ -306,12 +306,13 @@ static void updatePiecesLabel(MakeMetaUI* ui)
{
char buf[128];
tr_strlsize(buf, builder->totalSize, sizeof(buf));
g_string_append_printf(gstr, ngettext("%1$s; %2$'d File", "%1$s; %2$'d Files", builder->fileCount), buf, builder->fileCount);
g_string_append_printf(gstr, ngettext("%1$s; %2$'d File", "%1$s; %2$'d Files", builder->fileCount), buf,
builder->fileCount);
g_string_append(gstr, "; ");
tr_formatter_mem_B(buf, builder->pieceSize, sizeof(buf));
g_string_append_printf(gstr, ngettext("%1$'d Piece @ %2$s", "%1$'d Pieces @ %2$s", builder->pieceCount), builder->pieceCount,
buf);
g_string_append_printf(gstr, ngettext("%1$'d Piece @ %2$s", "%1$'d Pieces @ %2$s", builder->pieceCount),
builder->pieceCount, buf);
}
g_string_append(gstr, "</i>");
@ -388,7 +389,7 @@ static void on_drag_data_received(GtkWidget* widget UNUSED, GdkDragContext* drag
if (uris && uris[0])
{
char const* uri = uris[ 0 ];
char const* uri = uris[0];
gchar* filename = g_filename_from_uri(uri, NULL, NULL);
if (g_file_test(filename, G_FILE_TEST_IS_DIR))
@ -413,18 +414,18 @@ static void on_drag_data_received(GtkWidget* widget UNUSED, GdkDragContext* drag
gtk_drag_finish(drag_context, success, FALSE, time_);
}
GtkWidget* gtr_torrent_creation_dialog_new(GtkWindow* parent, TrCore* core)
GtkWidget* gtr_torrent_creation_dialog_new(GtkWindow* parent, TrCore* core)
{
char const* str;
GtkWidget* d, *t, *w, *l, *fr, *sw, *v;
GtkWidget* d, * t, * w, * l, * fr, * sw, * v;
GSList* slist;
guint row = 0;
MakeMetaUI* ui = g_new0(MakeMetaUI, 1);
ui->core = core;
d = gtk_dialog_new_with_buttons(_("New Torrent"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
GTK_STOCK_NEW, GTK_RESPONSE_ACCEPT, NULL);
d = gtk_dialog_new_with_buttons(_("New Torrent"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE, GTK_STOCK_NEW, GTK_RESPONSE_ACCEPT, NULL);
ui->dialog = d;
g_signal_connect(d, "response", G_CALLBACK(onResponse), ui);
g_object_set_data_full(G_OBJECT(d), "ui", ui, freeMetaUI);
@ -483,7 +484,7 @@ GtkWidget* gtr_torrent_creation_dialog_new(GtkWindow* parent, TrCore* core)
gtk_box_pack_start(GTK_BOX(v), fr, TRUE, TRUE, 0);
l = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(l), _("To add a backup URL, add it on the line after the primary URL.\n"
"To add another primary URL, add it after a blank line."));
"To add another primary URL, add it after a blank line."));
gtk_label_set_justify(GTK_LABEL(l), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment(GTK_MISC(l), 0.0, 0.5);
gtk_box_pack_start(GTK_BOX(v), l, FALSE, FALSE, 0);

View File

@ -123,7 +123,7 @@ static void level_combo_changed_cb(GtkComboBox* combo_box, gpointer gdata)
/* similar to asctime, but is utf8-clean */
static char* gtr_localtime(time_t time)
{
char buf[256], *eoln;
char buf[256], * eoln;
struct tm const tm = *localtime(&time);
g_strlcpy(buf, asctime(&tm), sizeof(buf));
@ -142,7 +142,8 @@ static void doSave(GtkWindow* parent, struct MsgData* data, char const* filename
if (!fp)
{
GtkWidget* w = gtk_message_dialog_new(parent, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Couldn't save \"%s\""), filename);
GtkWidget* w = gtk_message_dialog_new(parent, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _(
"Couldn't save \"%s\""), filename);
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(w), "%s", g_strerror(errno));
g_signal_connect_swapped(w, "response", G_CALLBACK(gtk_widget_destroy), w);
gtk_widget_show(w);
@ -178,7 +179,8 @@ static void doSave(GtkWindow* parent, struct MsgData* data, char const* filename
break;
}
fprintf(fp, "%s\t%s\t%s\t%s\n", date, levelStr, (node->name ? node->name : ""), (node->message ? node->message : ""));
fprintf(fp, "%s\t%s\t%s\t%s\n", date, levelStr, (node->name ? node->name : ""),
(node->message ? node->message : ""));
g_free(date);
}
while (gtk_tree_model_iter_next(model, &iter));
@ -204,7 +206,7 @@ static void onSaveRequest(GtkWidget* w, gpointer data)
{
GtkWindow* window = GTK_WINDOW(gtk_widget_get_toplevel(w));
GtkWidget* d = gtk_file_chooser_dialog_new(_("Save Log"), window, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
gtk_dialog_set_alternative_button_order(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT, GTK_RESPONSE_CANCEL, -1);
g_signal_connect(d, "response", G_CALLBACK(onSaveDialogResponse), data);
@ -272,7 +274,7 @@ static void renderTime(GtkTreeViewColumn* column UNUSED, GtkCellRenderer* render
static void appendColumn(GtkTreeView* view, int col)
{
GtkCellRenderer* r;
GtkCellRenderer* r;
GtkTreeViewColumn* c;
char const* title = NULL;
@ -425,10 +427,10 @@ static gboolean onRefresh(gpointer gdata)
static GtkWidget* debug_level_combo_new(void)
{
GtkWidget* w = gtr_combo_box_new_enum(
_("Error"), TR_LOG_ERROR,
_("Information"), TR_LOG_INFO,
_("Debug"), TR_LOG_DEBUG,
NULL);
_("Error"), TR_LOG_ERROR,
_("Information"), TR_LOG_INFO,
_("Debug"), TR_LOG_DEBUG,
NULL);
gtr_combo_box_set_active_enum(GTK_COMBO_BOX(w), gtr_pref_int_get(TR_KEY_message_level));
return w;
}
@ -505,13 +507,13 @@ GtkWidget* gtr_message_log_window_new(GtkWindow* parent, TrCore* core)
**/
data->store = gtk_list_store_new(N_COLUMNS,
G_TYPE_UINT, /* sequence */
G_TYPE_POINTER, /* category */
G_TYPE_POINTER, /* message */
G_TYPE_POINTER); /* struct tr_log_message */
G_TYPE_UINT, /* sequence */
G_TYPE_POINTER, /* category */
G_TYPE_POINTER, /* message */
G_TYPE_POINTER); /* struct tr_log_message */
addMessages(data->store, myHead);
onRefresh(data); /* much faster to populate *before* it has listeners */
onRefresh(data); /* much faster to populate *before* it has listeners */
data->filter = gtk_tree_model_filter_new(GTK_TREE_MODEL(data->store), NULL);
data->sort = gtk_tree_model_sort_new_with_model(data->filter);
@ -520,7 +522,6 @@ GtkWidget* gtr_message_log_window_new(GtkWindow* parent, TrCore* core)
data->maxLevel = gtr_pref_int_get(TR_KEY_message_level);
gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(data->filter), isRowVisible, data, NULL);
view = gtk_tree_view_new_with_model(data->sort);
g_object_unref(data->sort);
g_signal_connect(view, "button-release-event", G_CALLBACK(on_tree_view_button_released), NULL);

View File

@ -6,7 +6,6 @@
*
*/
#pragma once
#include "tr-core.h"

View File

@ -22,11 +22,11 @@ static GDBusProxy* proxy = NULL;
static GHashTable* active_notifications = NULL;
static gboolean server_supports_actions = FALSE;
typedef struct _TrNotification
typedef struct TrNotification
{
guint id;
guint id;
TrCore* core;
int torrent_id;
int torrent_id;
}
TrNotification;
@ -84,7 +84,7 @@ static void g_signal_callback(GDBusProxy* proxy UNUSED, char* sender_name UNUSED
g_return_if_fail(g_variant_is_of_type(params, G_VARIANT_TYPE("(u*)")));
g_variant_get(params, "(u*)", &id, NULL);
n = g_hash_table_lookup(active_notifications, GINT_TO_POINTER((int*) &id));
n = g_hash_table_lookup(active_notifications, GINT_TO_POINTER((int*)&id));
if (n == NULL)
{
@ -93,7 +93,7 @@ static void g_signal_callback(GDBusProxy* proxy UNUSED, char* sender_name UNUSED
if (g_strcmp0(signal_name, "NotificationClosed") == 0)
{
g_hash_table_remove(active_notifications, GINT_TO_POINTER((int*) &n->id));
g_hash_table_remove(active_notifications, GINT_TO_POINTER((int*)&n->id));
}
else if (g_strcmp0(signal_name, "ActionInvoked") == 0 && g_variant_is_of_type(params, G_VARIANT_TYPE("(us)")))
{
@ -135,8 +135,8 @@ static void dbus_proxy_ready_callback(GObject* source UNUSED, GAsyncResult* res,
}
g_signal_connect(proxy, "g-signal", G_CALLBACK(g_signal_callback), NULL);
g_dbus_proxy_call(proxy, "GetCapabilities", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, get_capabilities_callback,
NULL);
g_dbus_proxy_call(proxy, "GetCapabilities", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, NULL,
get_capabilities_callback, NULL);
}
void gtr_notify_init(void)
@ -214,7 +214,8 @@ void gtr_notify_torrent_completed(TrCore* core, int torrent_id)
}
g_dbus_proxy_call(proxy, "Notify", g_variant_new("(susssasa{sv}i)", "Transmission", n->id, "transmission",
_("Torrent Complete"), tr_torrentName(tor), &actions_builder, NULL, -1), G_DBUS_CALL_FLAGS_NONE, -1, NULL, notify_callback, n);
_("Torrent Complete"), tr_torrentName(tor), &actions_builder, NULL, -1), G_DBUS_CALL_FLAGS_NONE, -1, NULL,
notify_callback, n);
}
void gtr_notify_torrent_added(char const* name)
@ -229,6 +230,6 @@ void gtr_notify_torrent_added(char const* name)
}
n = g_new0(TrNotification, 1);
g_dbus_proxy_call(proxy, "Notify", g_variant_new("(susssasa{sv}i)", "Transmission", 0, "transmission", _("Torrent Added"), name,
NULL, NULL, -1), G_DBUS_CALL_FLAGS_NONE, -1, NULL, notify_callback, n);
g_dbus_proxy_call(proxy, "Notify", g_variant_new("(susssasa{sv}i)", "Transmission", 0, "transmission", _("Torrent Added"),
name, NULL, NULL, -1), G_DBUS_CALL_FLAGS_NONE, -1, NULL, notify_callback, n);
}

View File

@ -12,14 +12,14 @@
#include <string.h>
#include <libtransmission/transmission.h>
#include <libtransmission/file.h> /* tr_sys_path_is_same () */
#include <libtransmission/file.h> /* tr_sys_path_is_same() */
#include "conf.h"
#include "file-list.h"
#include "hig.h"
#include "open-dialog.h"
#include "tr-prefs.h"
#include "util.h" /* gtr_priority_combo_get_value () */
#include "util.h" /* gtr_priority_combo_get_value() */
/****
*****
@ -68,7 +68,7 @@ static void save_recent_destination(TrCore* core, char const* dir)
list = g_slist_prepend(list, (void*)dir);
/* make local copies of the strings that aren't
* invalidated by gtr_pref_string_set () */
* invalidated by gtr_pref_string_set() */
for (l = list; l; l = l->next)
{
l->data = g_strdup(l->data);
@ -284,7 +284,7 @@ GtkWidget* gtr_torrent_options_dialog_new(GtkWindow* parent, TrCore* core, tr_ct
/* make the dialog */
d = gtk_dialog_new_with_buttons(_("Torrent Options"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
gtk_dialog_set_default_response(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT);
gtk_dialog_set_alternative_button_order(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT, GTK_RESPONSE_CANCEL, -1);
@ -456,7 +456,7 @@ GtkWidget* gtr_torrent_open_from_file_dialog_new(GtkWindow* parent, TrCore* core
char const* folder;
w = gtk_file_chooser_dialog_new(_("Open a Torrent"), parent, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
gtk_dialog_set_alternative_button_order(GTK_DIALOG(w), GTK_RESPONSE_ACCEPT, GTK_RESPONSE_CANCEL, -1);
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(w), TRUE);
addTorrentFilters(GTK_FILE_CHOOSER(w));
@ -519,8 +519,8 @@ GtkWidget* gtr_torrent_open_from_url_dialog_new(GtkWindow* parent, TrCore* core)
GtkWidget* t;
GtkWidget* w;
w = gtk_dialog_new_with_buttons(_("Open URL"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
w = gtk_dialog_new_with_buttons(_("Open URL"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
gtk_dialog_set_alternative_button_order(GTK_DIALOG(w), GTK_RESPONSE_ACCEPT, GTK_RESPONSE_CANCEL, -1);
g_signal_connect(w, "response", G_CALLBACK(onOpenURLResponse), core);

View File

@ -72,8 +72,8 @@ static gboolean onTimer(gpointer gdata)
if (done == TR_LOC_ERROR)
{
int const flags = GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
GtkWidget* w = gtk_message_dialog_new(GTK_WINDOW(data->message_dialog), flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s",
_("Couldn't move torrent"));
GtkWidget* w = gtk_message_dialog_new(GTK_WINDOW(data->message_dialog), flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
"%s", _("Couldn't move torrent"));
gtk_dialog_run(GTK_DIALOG(w));
gtk_widget_destroy(GTK_WIDGET(data->message_dialog));
}
@ -107,7 +107,7 @@ static void onResponse(GtkDialog* dialog, int response, gpointer unused UNUSED)
/* pop up a dialog saying that the work is in progress */
w = gtk_message_dialog_new(GTK_WINDOW(dialog), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE, NULL);
GTK_BUTTONS_CLOSE, NULL);
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(w), _("This may take a moment…"));
gtk_dialog_set_response_sensitive(GTK_DIALOG(w), GTK_RESPONSE_CLOSE, FALSE);
gtk_widget_show(w);
@ -137,7 +137,7 @@ GtkWidget* gtr_relocate_dialog_new(GtkWindow* parent, TrCore* core, GSList* torr
struct relocate_dialog_data* data;
d = gtk_dialog_new_with_buttons(_("Set Torrent Location"), parent, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, NULL);
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, NULL);
gtk_dialog_set_default_response(GTK_DIALOG(d), GTK_RESPONSE_CANCEL);
gtk_dialog_set_alternative_button_order(GTK_DIALOG(d), GTK_RESPONSE_APPLY, GTK_RESPONSE_CANCEL, -1);
g_signal_connect(d, "response", G_CALLBACK(onResponse), NULL);

View File

@ -89,7 +89,7 @@ static void dialogResponse(GtkDialog* dialog, gint response, gpointer gdata)
{
char const* primary = _("Reset your statistics?");
char const* secondary = _("These statistics are for your information only. "
"Resetting them doesn't affect the statistics logged by your BitTorrent trackers.");
"Resetting them doesn't affect the statistics logged by your BitTorrent trackers.");
int const flags = GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL;
GtkWidget* w = gtk_message_dialog_new(GTK_WINDOW(dialog), flags, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", primary);
gtk_dialog_add_buttons(GTK_DIALOG(w), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Reset"), TR_RESPONSE_RESET, NULL);
@ -119,7 +119,8 @@ GtkWidget* gtr_stats_dialog_new(GtkWindow* parent, TrCore* core)
guint row = 0;
struct stat_ui* ui = g_new0(struct stat_ui, 1);
d = gtk_dialog_new_with_buttons(_("Statistics"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, _("_Reset"), TR_RESPONSE_RESET, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
d = gtk_dialog_new_with_buttons(_("Statistics"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, _("_Reset"), TR_RESPONSE_RESET,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
gtk_dialog_set_default_response(GTK_DIALOG(d), GTK_RESPONSE_CLOSE);
gtk_dialog_set_alternative_button_order(GTK_DIALOG(d), GTK_RESPONSE_CLOSE, TR_RESPONSE_RESET, -1);
t = hig_workarea_create();

View File

@ -10,7 +10,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <libtransmission/transmission.h>
#include <libtransmission/utils.h> /* tr_truncd () */
#include <libtransmission/utils.h> /* tr_truncd() */
#include "hig.h"
#include "icons.h"
#include "torrent-cell-renderer.h"
@ -235,6 +235,7 @@ static void getStatusString(GString* gstr, tr_torrent const* tor, tr_stat const*
g_string_append_printf(gstr, _(fmt[st->error]), st->errorString);
}
else
{
switch (st->activity)
{
case TR_STATUS_STOPPED:
@ -258,8 +259,8 @@ static void getStatusString(GString* gstr, tr_torrent const* tor, tr_stat const*
else if (st->peersSendingToUs && st->webseedsSendingToUs)
{
/* Downloading from 2 of 3 peer (s) and 2 webseed (s) */
g_string_append_printf(gstr, _("Downloading from %1$'d of %2$'d %3$s and %4$'d %5$s"), st->peersSendingToUs, st->peersConnected,
ngettext("peer", "peers", st->peersConnected), st->webseedsSendingToUs,
g_string_append_printf(gstr, _("Downloading from %1$'d of %2$'d %3$s and %4$'d %5$s"), st->peersSendingToUs,
st->peersConnected, ngettext("peer", "peers", st->peersConnected), st->webseedsSendingToUs,
ngettext("web seed", "web seeds", st->webseedsSendingToUs));
}
else if (st->webseedsSendingToUs)
@ -271,21 +272,23 @@ static void getStatusString(GString* gstr, tr_torrent const* tor, tr_stat const*
else
{
/* Downloading from 2 of 3 peer (s) */
g_string_append_printf(gstr, _("Downloading from %1$'d of %2$'d %3$s"), st->peersSendingToUs, st->peersConnected,
ngettext("peer", "peers", st->peersConnected));
g_string_append_printf(gstr, _("Downloading from %1$'d of %2$'d %3$s"), st->peersSendingToUs,
st->peersConnected, ngettext("peer", "peers", st->peersConnected));
}
break;
}
case TR_STATUS_SEED:
g_string_append_printf(gstr, ngettext("Seeding to %1$'d of %2$'d connected peer", "Seeding to %1$'d of %2$'d connected peers",
st->peersConnected), st->peersGettingFromUs, st->peersConnected);
g_string_append_printf(gstr, ngettext("Seeding to %1$'d of %2$'d connected peer",
"Seeding to %1$'d of %2$'d connected peers", st->peersConnected), st->peersGettingFromUs, st->peersConnected);
break;
}
}
if ((st->activity != TR_STATUS_CHECK_WAIT) && (st->activity != TR_STATUS_CHECK) && (st->activity != TR_STATUS_DOWNLOAD_WAIT) &&
(st->activity != TR_STATUS_SEED_WAIT) && (st->activity != TR_STATUS_STOPPED))
if ((st->activity != TR_STATUS_CHECK_WAIT) && (st->activity != TR_STATUS_CHECK) &&
(st->activity != TR_STATUS_DOWNLOAD_WAIT) && (st->activity != TR_STATUS_SEED_WAIT) &&
(st->activity != TR_STATUS_STOPPED))
{
char buf[256];
getShortTransferString(tor, st, uploadSpeed_KBps, downloadSpeed_KBps, buf, sizeof(buf));
@ -385,7 +388,7 @@ static void get_size_compact(TorrentCellRenderer* cell, GtkWidget* widget, gint*
/* get the idealized cell dimensions */
g_object_set(p->icon_renderer, "pixbuf", icon, NULL);
gtr_cell_renderer_get_preferred_size(p->icon_renderer, widget, NULL, &icon_size);
g_object_set(p->text_renderer, "text", name, "ellipsize", PANGO_ELLIPSIZE_NONE, "scale", 1.0, NULL);
g_object_set(p->text_renderer, "text", name, "ellipsize", PANGO_ELLIPSIZE_NONE, "scale", 1.0, NULL);
gtr_cell_renderer_get_preferred_size(p->text_renderer, widget, NULL, &name_size);
g_object_set(p->text_renderer, "text", gstr_stat->str, "scale", SMALL_SCALE, NULL);
gtr_cell_renderer_get_preferred_size(p->text_renderer, widget, NULL, &stat_size);
@ -459,7 +462,8 @@ static void get_size_full(TorrentCellRenderer* cell, GtkWidget* widget, gint* wi
if (height != NULL)
{
*height = ypad * 2 + name_size.height + prog_size.height + GUI_PAD_SMALL + p->bar_height + GUI_PAD_SMALL + stat_size.height;
*height = ypad * 2 + name_size.height + prog_size.height + GUI_PAD_SMALL + p->bar_height + GUI_PAD_SMALL +
stat_size.height;
}
/* cleanup */
@ -530,7 +534,6 @@ static void get_text_color(GtkWidget* w, tr_stat const* st, GtrColor* setme)
}
}
static double get_percent_done(tr_torrent const* tor, tr_stat const* st, bool* seed)
{
double d;
@ -727,8 +730,8 @@ static void render_full(TorrentCellRenderer* cell, GtrDrawable* window, GtkWidge
g_object_set(p->icon_renderer, "pixbuf", icon, "sensitive", sensitive, NULL);
gtr_cell_renderer_render(p->icon_renderer, window, widget, &icon_area, flags);
g_object_set(p->text_renderer, "text", name, "scale", 1.0, FOREGROUND_COLOR_KEY, &text_color, "ellipsize", PANGO_ELLIPSIZE_END,
"weight", PANGO_WEIGHT_BOLD, NULL);
g_object_set(p->text_renderer, "text", name, "scale", 1.0, FOREGROUND_COLOR_KEY, &text_color, "ellipsize",
PANGO_ELLIPSIZE_END, "weight", PANGO_WEIGHT_BOLD, NULL);
gtr_cell_renderer_render(p->text_renderer, window, widget, &name_area, flags);
g_object_set(p->text_renderer, "text", gstr_prog->str, "scale", SMALL_SCALE, "weight", PANGO_WEIGHT_NORMAL, NULL);
gtr_cell_renderer_render(p->text_renderer, window, widget, &prog_area, flags);
@ -904,7 +907,6 @@ static void torrent_cell_renderer_init(TorrentCellRenderer* self)
p->bar_height = DEFAULT_BAR_HEIGHT;
}
GtkCellRenderer* torrent_cell_renderer_new(void)
{
return (GtkCellRenderer*)g_object_new(TORRENT_CELL_RENDERER_TYPE, NULL);

View File

@ -20,7 +20,7 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <math.h> /* pow () */
#include <math.h> /* pow() */
#include <string.h> /* strlen */
#include <gtk/gtk.h>
@ -54,7 +54,6 @@ enum
BUSY_SIGNAL,
PORT_SIGNAL,
PREFS_SIGNAL,
LAST_SIGNAL
};
@ -124,22 +123,22 @@ static void tr_core_class_init(TrCoreClass* core_class)
gobject_class->finalize = core_finalize;
signals[ADD_ERROR_SIGNAL] = g_signal_new("add-error", core_type, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(TrCoreClass, add_error),
NULL, NULL, g_cclosure_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
NULL, NULL, g_cclosure_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
signals[ADD_PROMPT_SIGNAL] = g_signal_new("add-prompt", core_type, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(TrCoreClass, add_prompt),
NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
signals[ADD_PROMPT_SIGNAL] = g_signal_new("add-prompt", core_type, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(TrCoreClass,
add_prompt), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
signals[BUSY_SIGNAL] = g_signal_new("busy", core_type, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(TrCoreClass, busy), NULL, NULL,
g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[BLOCKLIST_SIGNAL] = g_signal_new("blocklist-updated", core_type, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(TrCoreClass,
blocklist_updated), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
blocklist_updated), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
signals[PORT_SIGNAL] = g_signal_new("port-tested", core_type, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(TrCoreClass, port_tested),
NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[PREFS_SIGNAL] = g_signal_new("prefs-changed", core_type, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(TrCoreClass, prefs_changed),
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
signals[PREFS_SIGNAL] = g_signal_new("prefs-changed", core_type, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(TrCoreClass,
prefs_changed), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}
static void tr_core_init(TrCore* core)
@ -403,7 +402,7 @@ static int compare_time(time_t a, time_t b)
static int compare_by_name(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpointer user_data UNUSED)
{
char const* ca, *cb;
char const* ca, * cb;
gtk_tree_model_get(m, a, MC_NAME_COLLATED, &ca, -1);
gtk_tree_model_get(m, b, MC_NAME_COLLATED, &cb, -1);
return g_strcmp0(ca, cb);
@ -411,8 +410,8 @@ static int compare_by_name(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpoi
static int compare_by_queue(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpointer user_data UNUSED)
{
tr_torrent* ta, *tb;
tr_stat const* sa, *sb;
tr_torrent* ta, * tb;
tr_stat const* sa, * sb;
gtk_tree_model_get(m, a, MC_TORRENT, &ta, -1);
sa = tr_torrentStatCached(ta);
@ -425,8 +424,8 @@ static int compare_by_queue(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpo
static int compare_by_ratio(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpointer user_data)
{
int ret = 0;
tr_torrent* ta, *tb;
tr_stat const* sa, *sb;
tr_torrent* ta, * tb;
tr_stat const* sa, * sb;
gtk_tree_model_get(m, a, MC_TORRENT, &ta, -1);
sa = tr_torrentStatCached(ta);
@ -449,7 +448,7 @@ static int compare_by_ratio(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpo
static int compare_by_activity(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpointer user_data)
{
int ret = 0;
tr_torrent* ta, *tb;
tr_torrent* ta, * tb;
double aUp, aDown, bUp, bDown;
gtk_tree_model_get(m, a, MC_SPEED_UP, &aUp, MC_SPEED_DOWN, &aDown, MC_TORRENT, &ta, -1);
@ -475,7 +474,7 @@ static int compare_by_activity(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b,
static int compare_by_age(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpointer u)
{
int ret = 0;
tr_torrent* ta, *tb;
tr_torrent* ta, * tb;
gtk_tree_model_get(m, a, MC_TORRENT, &ta, -1);
gtk_tree_model_get(m, b, MC_TORRENT, &tb, -1);
@ -497,7 +496,7 @@ static int compare_by_size(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpoi
{
int ret = 0;
tr_torrent* t;
tr_info const* ia, *ib;
tr_info const* ia, * ib;
gtk_tree_model_get(m, a, MC_TORRENT, &t, -1);
ia = tr_torrentInfo(t);
@ -521,7 +520,7 @@ static int compare_by_progress(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b,
{
int ret = 0;
tr_torrent* t;
tr_stat const* sa, *sb;
tr_stat const* sa, * sb;
gtk_tree_model_get(m, a, MC_TORRENT, &t, -1);
sa = tr_torrentStatCached(t);
@ -549,7 +548,7 @@ static int compare_by_progress(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b,
static int compare_by_eta(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpointer u)
{
int ret = 0;
tr_torrent* ta, *tb;
tr_torrent* ta, * tb;
gtk_tree_model_get(m, a, MC_TORRENT, &ta, -1);
gtk_tree_model_get(m, b, MC_TORRENT, &tb, -1);
@ -571,7 +570,7 @@ static int compare_by_state(GtkTreeModel* m, GtkTreeIter* a, GtkTreeIter* b, gpo
{
int ret = 0;
int sa, sb;
tr_torrent* ta, *tb;
tr_torrent* ta, * tb;
gtk_tree_model_get(m, a, MC_ACTIVITY, &sa, MC_TORRENT, &ta, -1);
gtk_tree_model_get(m, b, MC_ACTIVITY, &sb, MC_TORRENT, &tb, -1);
@ -1059,8 +1058,7 @@ static unsigned int build_torrent_trackers_hash(tr_torrent* tor)
return hash;
}
static gboolean
is_torrent_active(tr_stat const* st)
static gboolean is_torrent_active(tr_stat const* st)
{
return (st->peersSendingToUs > 0) || (st->peersGettingFromUs > 0) || (st->activity == TR_STATUS_CHECK);
}
@ -1159,6 +1157,7 @@ static int core_add_ctor(TrCore* core, tr_ctor* ctor, gboolean do_prompt, gboole
break;
default:
if (do_prompt)
{
g_signal_emit(core, signals[ADD_PROMPT_SIGNAL], 0, ctor);
@ -1306,7 +1305,8 @@ static bool add_file(TrCore* core, GFile* file, gboolean do_start, gboolean do_p
handled = true;
core_add_ctor(core, ctor, do_prompt, do_notify);
}
else if (g_file_has_uri_scheme(file, "http") || g_file_has_uri_scheme(file, "https") || g_file_has_uri_scheme(file, "ftp"))
else if (g_file_has_uri_scheme(file, "http") || g_file_has_uri_scheme(file, "https") ||
g_file_has_uri_scheme(file, "ftp"))
{
struct add_from_url_data* data;
@ -1507,9 +1507,10 @@ static void update_foreach(GtkTreeModel* model, GtkTreeIter* iter)
/* updating the model triggers off resort/refresh,
so don't do it unless something's actually changed... */
if ((newActive != oldActive) || (newActivity != oldActivity) || (newFinished != oldFinished) || (newPriority != oldPriority) ||
(newQueuePosition != oldQueuePosition) || (newError != oldError) || (newActivePeerCount != oldActivePeerCount) ||
(newDownloadPeerCount != oldDownloadPeerCount) || (newUploadPeerCount != oldUploadPeerCount) || (newTrackers != oldTrackers) ||
if ((newActive != oldActive) || (newActivity != oldActivity) || (newFinished != oldFinished) ||
(newPriority != oldPriority) || (newQueuePosition != oldQueuePosition) || (newError != oldError) ||
(newActivePeerCount != oldActivePeerCount) || (newDownloadPeerCount != oldDownloadPeerCount) ||
(newUploadPeerCount != oldUploadPeerCount) || (newTrackers != oldTrackers) ||
gtr_compare_double(newUpSpeed, oldUpSpeed, 2) || gtr_compare_double(newDownSpeed, oldDownSpeed, 2) ||
gtr_compare_double(newRecheckProgress, oldRecheckProgress, 2))
{
@ -1574,8 +1575,8 @@ static gboolean gtr_inhibit_hibernation(guint* cookie)
connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &err);
response = g_dbus_connection_call_sync(connection, SESSION_MANAGER_SERVICE_NAME, SESSION_MANAGER_OBJECT_PATH,
SESSION_MANAGER_INTERFACE, "Inhibit", g_variant_new("(susu)", application, toplevel_xid, reason, flags), NULL,
G_DBUS_CALL_FLAGS_NONE, 1000, NULL, &err);
SESSION_MANAGER_INTERFACE, "Inhibit", g_variant_new("(susu)", application, toplevel_xid, reason, flags), NULL,
G_DBUS_CALL_FLAGS_NONE, 1000, NULL, &err);
if (response != NULL)
{
@ -1618,7 +1619,8 @@ static void gtr_uninhibit_hibernation(guint inhibit_cookie)
connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &err);
response = g_dbus_connection_call_sync(connection, SESSION_MANAGER_SERVICE_NAME, SESSION_MANAGER_OBJECT_PATH,
SESSION_MANAGER_INTERFACE, "Uninhibit", g_variant_new("(u)", inhibit_cookie), NULL, G_DBUS_CALL_FLAGS_NONE, 1000, NULL, &err);
SESSION_MANAGER_INTERFACE, "Uninhibit", g_variant_new("(u)", inhibit_cookie), NULL, G_DBUS_CALL_FLAGS_NONE, 1000, NULL,
&err);
/* logging */
if (err == NULL)
@ -1728,7 +1730,7 @@ void gtr_core_set_pref_double(TrCore* self, tr_quark const key, double newval)
static int nextTag = 1;
typedef void (*server_response_func)(TrCore* core, tr_variant* response, gpointer user_data);
typedef void (* server_response_func)(TrCore* core, tr_variant* response, gpointer user_data);
struct pending_request_data
{
@ -1804,7 +1806,7 @@ static void core_send_rpc_request(TrCore* core, tr_variant const* request, int t
{
struct evbuffer* buf = tr_variantToBuf(request, TR_VARIANT_FMT_JSON_LEAN);
size_t const buf_len = evbuffer_get_length(buf);
g_message("request: [%*.*s]", (int) buf_len, (int) buf_len, evbuffer_pullup(buf, -1));
g_message("request: [%*.*s]", (int)buf_len, (int)buf_len, evbuffer_pullup(buf, -1));
evbuffer_free(buf);
}
#endif

View File

@ -54,13 +54,13 @@ typedef struct _TrCoreClass
{
GObjectClass parent_class;
void (*add_error)(TrCore*, enum tr_core_err, char const* name);
void (*add_prompt)(TrCore*, gpointer ctor);
void (*blocklist_updated)(TrCore*, int ruleCount);
void (*busy)(TrCore*, gboolean is_busy);
void (*prefs_changed)(TrCore*, tr_quark const key);
void (*port_tested)(TrCore*, gboolean is_open);
void (*quit)(TrCore*);
void (* add_error)(TrCore*, enum tr_core_err, char const* name);
void (* add_prompt)(TrCore*, gpointer ctor);
void (* blocklist_updated)(TrCore*, int ruleCount);
void (* busy)(TrCore*, gboolean is_busy);
void (* prefs_changed)(TrCore*, tr_quark const key);
void (* port_tested)(TrCore*, gboolean is_open);
void (* quit)(TrCore*);
}
TrCoreClass;
@ -85,7 +85,6 @@ tr_torrent* gtr_core_find_torrent(TrCore* core, int id);
void gtr_core_pref_changed(TrCore* core, tr_quark const key);
/******
*******
******/
@ -159,7 +158,7 @@ void gtr_core_open_folder(TrCore* core, int torrent_id);
**/
/* column names for the model used to store torrent information */
/* keep this in sync with the type array in tr_core_init () in tr_core.c */
/* keep this in sync with the type array in tr_core_init() in tr_core.c */
enum
{
MC_NAME_COLLATED,
@ -176,15 +175,13 @@ enum
MC_PRIORITY,
MC_QUEUE_POSITION,
MC_TRACKERS,
/* tr_stat.error
* Tracked because ACTIVITY_FILTER_ERROR needs the row-changed events */
MC_ERROR,
/* tr_stat.{ peersSendingToUs + peersGettingFromUs + webseedsSendingToUs }
* Tracked because ACTIVITY_FILTER_ACTIVE needs the row-changed events */
MC_ACTIVE_PEER_COUNT,
/* */
MC_ROW_COUNT
};

View File

@ -6,7 +6,6 @@
*
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#ifdef HAVE_LIBAPPINDICATOR

View File

@ -36,7 +36,6 @@ struct prefs_dialog_data
GtkWidget* port_spin;
};
/**
***
**/
@ -223,7 +222,7 @@ static GtkWidget* new_path_chooser_button(tr_quark const key, gpointer core)
static GtkWidget* new_file_chooser_button(tr_quark const key, gpointer core)
{
GtkWidget* w = gtk_file_chooser_button_new(NULL, GTK_FILE_CHOOSER_ACTION_OPEN);
GtkWidget* w = gtk_file_chooser_button_new(NULL, GTK_FILE_CHOOSER_ACTION_OPEN);
char const* path = gtr_pref_string_get(key);
g_object_set_data(G_OBJECT(w), PREF_KEY, GINT_TO_POINTER(key));
@ -458,8 +457,8 @@ static void onBlocklistUpdate(GtkButton* w, gpointer gdata)
{
GtkWidget* d;
struct blocklist_data* data = gdata;
d = gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(w))), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE, "%s", _("Update Blocklist"));
d = gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(w))), GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s", _("Update Blocklist"));
gtk_widget_set_sensitive(data->updateBlocklistButton, FALSE);
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(d), "%s", _("Getting new blocklist…"));
data->updateBlocklistDialog = d;
@ -486,8 +485,8 @@ static void onIntComboChanged(GtkComboBox* combo_box, gpointer core)
static GtkWidget* new_encryption_combo(GObject* core, tr_quark const key)
{
GtkWidget* w = gtr_combo_box_new_enum(_("Allow encryption"), TR_CLEAR_PREFERRED, _("Prefer encryption"),
TR_ENCRYPTION_PREFERRED, _("Require encryption"), TR_ENCRYPTION_REQUIRED, NULL);
GtkWidget* w = gtr_combo_box_new_enum(_("Allow encryption"), TR_CLEAR_PREFERRED, _("Prefer encryption"),
TR_ENCRYPTION_PREFERRED, _("Require encryption"), TR_ENCRYPTION_REQUIRED, NULL);
gtr_combo_box_set_active_enum(GTK_COMBO_BOX(w), gtr_pref_int_get(key));
g_object_set_data(G_OBJECT(w), PREF_KEY, GINT_TO_POINTER(key));
g_signal_connect(w, "changed", G_CALLBACK(onIntComboChanged), core);
@ -569,8 +568,8 @@ static GtkTreeModel* whitelist_tree_model_new(char const* whitelist)
int i;
char** rules;
GtkListStore* store = gtk_list_store_new(N_COLS,
G_TYPE_STRING,
G_TYPE_STRING);
G_TYPE_STRING,
G_TYPE_STRING);
rules = g_strsplit(whitelist, ",", 0);
@ -625,7 +624,7 @@ static void refreshWhitelist(struct remote_page* page)
while (gtk_tree_model_iter_next(model, &iter));
}
g_string_truncate(gstr, gstr->len - 1); /* remove the trailing comma */
g_string_truncate(gstr, gstr->len - 1); /* remove the trailing comma */
gtr_core_set_pref(page->core, TR_KEY_rpc_whitelist, gstr->str);
@ -655,7 +654,7 @@ static void onAddWhitelistClicked(GtkButton* b UNUSED, gpointer gpage)
struct remote_page* page = gpage;
gtk_list_store_append(page->store, &iter);
gtk_list_store_set(page->store, &iter, COL_ADDRESS, "0.0.0.0", -1);
gtk_list_store_set(page->store, &iter, COL_ADDRESS, "0.0.0.0", -1);
path = gtk_tree_model_get_path(GTK_TREE_MODEL(page->store), &iter);
gtk_tree_view_set_cursor(page->view, path, gtk_tree_view_get_column(page->view, COL_ADDRESS), TRUE);
@ -939,17 +938,17 @@ static GtkWidget* new_time_combo(GObject* core, tr_quark const key)
static GtkWidget* new_week_combo(GObject* core, tr_quark const key)
{
GtkWidget* w = gtr_combo_box_new_enum(
_("Every Day"), TR_SCHED_ALL,
_("Weekdays"), TR_SCHED_WEEKDAY,
_("Weekends"), TR_SCHED_WEEKEND,
_("Sunday"), TR_SCHED_SUN,
_("Monday"), TR_SCHED_MON,
_("Tuesday"), TR_SCHED_TUES,
_("Wednesday"), TR_SCHED_WED,
_("Thursday"), TR_SCHED_THURS,
_("Friday"), TR_SCHED_FRI,
_("Saturday"), TR_SCHED_SAT,
NULL);
_("Every Day"), TR_SCHED_ALL,
_("Weekdays"), TR_SCHED_WEEKDAY,
_("Weekends"), TR_SCHED_WEEKEND,
_("Sunday"), TR_SCHED_SUN,
_("Monday"), TR_SCHED_MON,
_("Tuesday"), TR_SCHED_TUES,
_("Wednesday"), TR_SCHED_WED,
_("Thursday"), TR_SCHED_THURS,
_("Friday"), TR_SCHED_FRI,
_("Saturday"), TR_SCHED_SAT,
NULL);
gtr_combo_box_set_active_enum(GTK_COMBO_BOX(w), gtr_pref_int_get(key));
g_object_set_data(G_OBJECT(w), PREF_KEY, GINT_TO_POINTER(key));
g_signal_connect(w, "changed", G_CALLBACK(onIntComboChanged), core);
@ -1094,11 +1093,11 @@ static void onPortTested(TrCore* core UNUSED, gboolean isOpen, gpointer vdata)
struct network_page_data* data = vdata;
char const* markup = isOpen ? _("Port is <b>open</b>") : _("Port is <b>closed</b>");
//gdk_threads_enter ();
// gdk_threads_enter();
gtk_label_set_markup(GTK_LABEL(data->portLabel), markup);
gtk_widget_set_sensitive(data->portButton, TRUE);
gtk_widget_set_sensitive(data->portSpin, TRUE);
//gdk_threads_leave ();
// gdk_threads_leave();
}
static void onPortTest(GtkButton* button UNUSED, gpointer vdata)
@ -1248,7 +1247,7 @@ GtkWidget* gtr_prefs_dialog_new(GtkWindow* parent, GObject* core)
data->core_prefs_tag = g_signal_connect(TR_CORE(core), "prefs-changed", G_CALLBACK(on_core_prefs_changed), data);
d = gtk_dialog_new_with_buttons(_("Transmission Preferences"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_HELP,
GTK_RESPONSE_HELP, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
GTK_RESPONSE_HELP, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
g_object_weak_ref(G_OBJECT(d), on_prefs_dialog_destroyed, data);
gtk_window_set_role(GTK_WINDOW(d), "transmission-preferences-dialog");
gtk_container_set_border_width(GTK_CONTAINER(d), GUI_PAD);

View File

@ -13,7 +13,7 @@
GtkWidget* gtr_prefs_dialog_new(GtkWindow* parent, GObject* core);
/* if you add a key here, you /must/ add its
* default in tr_prefs_init_defaults (void) */
* default in tr_prefs_init_defaults(void) */
#define PREF_KEY_BLOCKLIST_UPDATES_ENABLED "blocklist-updates-enabled"
#define PREF_KEY_COMPACT_VIEW "compact-view"
@ -47,6 +47,5 @@ GtkWidget* gtr_prefs_dialog_new(GtkWindow* parent, GObject* core);
enum
{
MAIN_WINDOW_REFRESH_INTERVAL_SECONDS = 2,
SECONDARY_WINDOW_REFRESH_INTERVAL_SECONDS = 2
};

View File

@ -26,7 +26,7 @@
#include <glib/gi18n.h>
#include <libtransmission/transmission.h>
#include <libtransmission/utils.h> /* tr_formatter_speed_KBps () */
#include <libtransmission/utils.h> /* tr_formatter_speed_KBps() */
#include "actions.h"
#include "conf.h"
@ -66,7 +66,7 @@ PrivateData;
static TR_DEFINE_QUARK(private_data, private_data)
static PrivateData* get_private_data(GtkWindow* w)
static PrivateData* get_private_data(GtkWindow * w)
{
return g_object_get_qdata(G_OBJECT(w), private_data_quark());
}
@ -121,7 +121,7 @@ static GtkWidget* makeview(PrivateData* p)
p->selection = gtk_tree_view_get_selection(tree_view);
p->column = col = GTK_TREE_VIEW_COLUMN(g_object_new(GTK_TYPE_TREE_VIEW_COLUMN, "title", _("Torrent"), "resizable", TRUE,
"sizing", GTK_TREE_VIEW_COLUMN_FIXED, NULL));
"sizing", GTK_TREE_VIEW_COLUMN_FIXED, NULL));
p->renderer = r = torrent_cell_renderer_new();
gtk_tree_view_column_pack_start(col, r, FALSE);
@ -137,7 +137,7 @@ static GtkWidget* makeview(PrivateData* p)
gtk_tree_selection_set_mode(GTK_TREE_SELECTION(sel), GTK_SELECTION_MULTIPLE);
g_signal_connect(view, "popup-menu", G_CALLBACK(on_popup_menu), NULL);
g_signal_connect(view, "button-press-event", G_CALLBACK(on_tree_view_button_pressed), (void*) on_popup_menu);
g_signal_connect(view, "button-press-event", G_CALLBACK(on_tree_view_button_pressed), (void*)on_popup_menu);
g_signal_connect(view, "button-release-event", G_CALLBACK(on_tree_view_button_released), NULL);
g_signal_connect(view, "row-activated", G_CALLBACK(view_row_activated), NULL);
@ -212,7 +212,7 @@ static void onYinYangReleased(GtkWidget* w UNUSED, gpointer vprivate)
static struct
{
char const* val, *i18n;
char const* val, * i18n;
}
stats_modes[] =
{
@ -260,7 +260,7 @@ static void alt_speed_toggled_cb(GtkToggleButton* button, gpointer vprivate)
{
PrivateData* p = vprivate;
gboolean const b = gtk_toggle_button_get_active(button);
gtr_core_set_pref_bool(p->core, TR_KEY_alt_speed_enabled, b);
gtr_core_set_pref_bool(p->core, TR_KEY_alt_speed_enabled, b);
}
/***
@ -434,7 +434,7 @@ static void onRatioSet(GtkCheckMenuItem* check, gpointer vp)
static GtkWidget* createRatioMenu(PrivateData* p)
{
int i, n;
GtkWidget* m, *w;
GtkWidget* m, * w;
GtkMenuShell* menu_shell;
m = gtk_menu_new();
@ -542,8 +542,8 @@ GtkWidget* gtr_window_new(GtkApplication* app, GtkUIManager* ui_mgr, TrCore* cor
PrivateData* p;
GtkWidget* sibling = NULL;
GtkWidget* ul_lb, * dl_lb;
GtkWidget* mainmenu, *toolbar, *filter, *list, *status;
GtkWidget* vbox, *w, *self, *menu;
GtkWidget* mainmenu, * toolbar, * filter, * list, * status;
GtkWidget* vbox, * w, * self, * menu;
GtkWidget* grid_w;
GtkWindow* win;
GtkCssProvider* css_provider;

View File

@ -6,20 +6,20 @@
*
*/
#include <ctype.h> /* isxdigit () */
#include <ctype.h> /* isxdigit() */
#include <errno.h>
#include <limits.h> /* INT_MAX */
#include <stdarg.h>
#include <string.h> /* strchr (), strrchr (), strlen (), strstr () */
#include <string.h> /* strchr(), strrchr(), strlen(), strstr() */
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gio/gio.h> /* g_file_trash () */
#include <gio/gio.h> /* g_file_trash() */
#include <libtransmission/transmission.h> /* TR_RATIO_NA, TR_RATIO_INF */
#include <libtransmission/error.h>
#include <libtransmission/utils.h> /* tr_strratio () */
#include <libtransmission/web.h> /* tr_webResponseStr () */
#include <libtransmission/utils.h> /* tr_strratio() */
#include <libtransmission/web.h> /* tr_webResponseStr() */
#include <libtransmission/version.h> /* SHORT_VERSION_STRING */
#include "conf.h"
@ -200,8 +200,8 @@ void gtr_get_host_from_url(char* buf, size_t buflen, char const* url)
static gboolean gtr_is_supported_url(char const* str)
{
return ((str != NULL) && (g_str_has_prefix(str, "ftp://") || g_str_has_prefix(str, "http://") ||
g_str_has_prefix(str, "https://")));
return (str != NULL) && (g_str_has_prefix(str, "ftp://") || g_str_has_prefix(str, "http://") ||
g_str_has_prefix(str, "https://"));
}
gboolean gtr_is_magnet_link(char const* str)
@ -257,7 +257,7 @@ void gtr_add_torrent_error_dialog(GtkWidget* child, int err, tr_torrent* duplica
else if (err == TR_PARSE_DUPLICATE)
{
secondary = g_strdup_printf(_("The torrent file \"%s\" is already in use by \"%s.\""), filename,
tr_torrentName(duplicate_torrent));
tr_torrentName(duplicate_torrent));
}
else
{
@ -265,7 +265,7 @@ void gtr_add_torrent_error_dialog(GtkWidget* child, int err, tr_torrent* duplica
}
w = gtk_message_dialog_new(win, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s",
_("Error opening torrent"));
_("Error opening torrent"));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(w), "%s", secondary);
g_signal_connect_swapped(w, "response", G_CALLBACK(gtk_widget_destroy), w);
gtk_widget_show_all(w);
@ -281,12 +281,12 @@ gboolean on_tree_view_button_pressed(GtkWidget* view, GdkEventButton* event, gpo
{
GtkTreeView* tv = GTK_TREE_VIEW(view);
if (event->type == GDK_BUTTON_PRESS && event->button == 3)
if (event->type == GDK_BUTTON_PRESS && event->button == 3)
{
GtkTreePath* path;
GtkTreeSelection* selection = gtk_tree_view_get_selection(tv);
if (gtk_tree_view_get_path_at_pos(tv, (gint) event->x, (gint) event->y, &path, NULL, NULL, NULL))
if (gtk_tree_view_get_path_at_pos(tv, (gint)event->x, (gint)event->y, &path, NULL, NULL, NULL))
{
if (!gtk_tree_selection_path_is_selected(selection, path))
{
@ -314,7 +314,7 @@ gboolean on_tree_view_button_released(GtkWidget* view, GdkEventButton* event, gp
{
GtkTreeView* tv = GTK_TREE_VIEW(view);
if (!gtk_tree_view_get_path_at_pos(tv, (gint) event->x, (gint) event->y, NULL, NULL, NULL, NULL))
if (!gtk_tree_view_get_path_at_pos(tv, (gint)event->x, (gint)event->y, NULL, NULL, NULL, NULL))
{
GtkTreeSelection* selection = gtk_tree_view_get_selection(tv);
gtk_tree_selection_unselect_all(selection);
@ -454,7 +454,6 @@ void gtr_combo_box_set_active_enum(GtkComboBox* combo_box, int value)
}
}
GtkWidget* gtr_combo_box_new_enum(char const* text_1, ...)
{
GtkWidget* w;
@ -509,10 +508,10 @@ int gtr_combo_box_get_active_enum(GtkComboBox* combo_box)
GtkWidget* gtr_priority_combo_new(void)
{
return gtr_combo_box_new_enum(
_("High"), TR_PRI_HIGH,
_("Normal"), TR_PRI_NORMAL,
_("Low"), TR_PRI_LOW,
NULL);
_("High"), TR_PRI_HIGH,
_("Normal"), TR_PRI_NORMAL,
_("Low"), TR_PRI_LOW,
NULL);
}
/***
@ -604,9 +603,8 @@ void gtr_unrecognized_url_dialog(GtkWidget* parent, char const* url)
if (gtr_is_magnet_link(url) && (strstr(url, xt) == NULL))
{
g_string_append_printf(gstr, "\n \n");
g_string_append_printf(gstr,
_("This magnet link appears to be intended for something other than BitTorrent. BitTorrent magnet links have a section containing \"%s\"."),
xt);
g_string_append_printf(gstr, _("This magnet link appears to be intended for something other than BitTorrent. "
"BitTorrent magnet links have a section containing \"%s\"."), xt);
}
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(w), "%s", gstr->str);

View File

@ -39,7 +39,7 @@ extern char const* speed_T_str;
#else
#define TR_DEFINE_QUARK(QN, q_n) \
GQuark q_n##_quark(void) \
GQuark q_n ## _quark(void) \
{ \
static GQuark q; \
\
@ -55,7 +55,7 @@ extern char const* speed_T_str;
/* macro to shut up "unused parameter" warnings */
#ifndef UNUSED
#define UNUSED G_GNUC_UNUSED
#define UNUSED G_GNUC_UNUSED
#endif
enum
@ -72,7 +72,7 @@ char const* gtr_get_unicode_string(int);
char* tr_strlpercent(char* buf, double x, size_t buflen);
/* return a human-readable string for the size given in bytes. */
char* tr_strlsize(char* buf, guint64 size, size_t buflen);
char* tr_strlsize(char* buf, guint64 size, size_t buflen);
/* return a human-readable string for the given ratio. */
char* tr_strlratio(char* buf, double ratio, size_t buflen);
@ -105,7 +105,7 @@ char const* gtr_get_help_uri(void);
****
***/
/* backwards-compatible wrapper around gtk_widget_set_visible () */
/* backwards-compatible wrapper around gtk_widget_set_visible() */
void gtr_widget_set_visible(GtkWidget*, gboolean);
void gtr_dialog_set_content(GtkDialog* dialog, GtkWidget* content);
@ -116,7 +116,7 @@ void gtr_dialog_set_content(GtkDialog* dialog, GtkWidget* content);
GtkWidget* gtr_priority_combo_new(void);
#define gtr_priority_combo_get_value(w) gtr_combo_box_get_active_enum(w)
#define gtr_priority_combo_set_value(w,val) gtr_combo_box_set_active_enum(w,val)
#define gtr_priority_combo_set_value(w, val) gtr_combo_box_set_active_enum(w, val)
GtkWidget* gtr_combo_box_new_enum(char const* text_1, ...);
int gtr_combo_box_get_active_enum(GtkComboBox*);
@ -154,7 +154,7 @@ bool gtr_file_trash_or_remove(char const* filename, struct tr_error** error);
void gtr_paste_clipboard_url_into_entry(GtkWidget* entry);
/* Only call gtk_label_set_text () if the new text differs from the old.
/* Only call gtk_label_set_text() if the new text differs from the old.
* This prevents the label from having to recalculate its size
* and prevents selected text in the label from being deselected */
void gtr_label_set_text(GtkLabel* lb, char const* text);

View File

@ -7,8 +7,8 @@
*/
#include <limits.h> /* USHRT_MAX */
#include <stdio.h> /* fprintf () */
#include <string.h> /* strchr (), memcmp (), memcpy () */
#include <stdio.h> /* fprintf() */
#include <string.h> /* strchr(), memcmp(), memcpy() */
#include <event2/buffer.h>
#include <event2/http.h> /* for HTTP_OK */
@ -18,13 +18,13 @@
#include "transmission.h"
#include "announcer-common.h"
#include "log.h"
#include "net.h" /* tr_globalIPv6 () */
#include "net.h" /* tr_globalIPv6() */
#include "peer-mgr.h" /* pex */
#include "torrent.h"
#include "trevent.h" /* tr_runInEventThread () */
#include "trevent.h" /* tr_runInEventThread() */
#include "utils.h"
#include "variant.h"
#include "web.h" /* tr_http_escape () */
#include "web.h" /* tr_http_escape() */
#define dbgmsg(name, ...) \
do \

View File

@ -9,7 +9,7 @@
#define __LIBTRANSMISSION_ANNOUNCER_MODULE__
#include <errno.h> /* errno, EAFNOSUPPORT */
#include <string.h> /* memcpy (), memset () */
#include <string.h> /* memcpy(), memset() */
#include <event2/buffer.h>
#include <event2/dns.h>
@ -18,10 +18,10 @@
#include "transmission.h"
#include "announcer.h"
#include "announcer-common.h"
#include "crypto-utils.h" /* tr_rand_buffer () */
#include "crypto-utils.h" /* tr_rand_buffer() */
#include "log.h"
#include "peer-io.h"
#include "peer-mgr.h" /* tr_peerMgrCompactToPex () */
#include "peer-mgr.h" /* tr_peerMgrCompactToPex() */
#include "ptrarray.h"
#include "tr-udp.h"
#include "utils.h"
@ -913,7 +913,7 @@ bool tau_handle_message(tr_session* session, uint8_t const* msg, size_t msglen)
tau_transaction_t transaction_id;
struct evbuffer* buf;
/*fprintf (stderr, "got an incoming udp message w/len %zu\n", msglen);*/
/*fprintf(stderr, "got an incoming udp message w/len %zu\n", msglen);*/
if (!session || !session->announcer_udp)
{
@ -940,7 +940,7 @@ bool tau_handle_message(tr_session* session, uint8_t const* msg, size_t msglen)
tau = session->announcer_udp;
transaction_id = evbuffer_read_ntoh_32(buf);
/*fprintf (stderr, "UDP got a transaction_id %u...\n", transaction_id);*/
/*fprintf(stderr, "UDP got a transaction_id %u...\n", transaction_id);*/
for (i = 0, n = tr_ptrArraySize(&tau->trackers); i < n; ++i)
{
int j, jn;

View File

@ -9,8 +9,8 @@
#include <assert.h>
#include <limits.h> /* INT_MAX */
#include <stdio.h>
#include <stdlib.h> /* qsort () */
#include <string.h> /* strcmp (), memcpy (), strncmp () */
#include <stdlib.h> /* qsort() */
#include <string.h> /* strcmp(), memcpy(), strncmp() */
#include <event2/buffer.h>
#include <event2/event.h> /* evtimer */
@ -20,9 +20,9 @@
#include "transmission.h"
#include "announcer.h"
#include "announcer-common.h"
#include "crypto-utils.h" /* tr_rand_int (), tr_rand_int_weak () */
#include "crypto-utils.h" /* tr_rand_int(), tr_rand_int_weak() */
#include "log.h"
#include "peer-mgr.h" /* tr_peerMgrCompactToPex () */
#include "peer-mgr.h" /* tr_peerMgrCompactToPex() */
#include "ptrarray.h"
#include "session.h"
#include "torrent.h"
@ -573,7 +573,12 @@ static tr_tracker_info* filter_trackers(tr_tracker_info* input, int input_count,
struct tr_tracker_info* ret;
struct ann_tracker_info* tmp = tr_new0(struct ann_tracker_info, input_count);
/*for (i=0, in=input_count; i<in; ++i) fprintf (stderr, "IN: [%d][%s]\n", input[i].tier, input[i].announce);*/
/*
for (i = 0, in = input_count; i < in; ++i)
{
fprintf(stderr, "IN: [%d][%s]\n", input[i].tier, input[i].announce);
}
*/
/* build a list of valid trackers */
for (i = 0, in = input_count; i < in; ++i)

View File

@ -7,11 +7,11 @@
*/
#include <assert.h>
#include <string.h> /* memset () */
#include <string.h> /* memset() */
#include "transmission.h"
#include "bandwidth.h"
#include "crypto-utils.h" /* tr_rand_int_weak () */
#include "crypto-utils.h" /* tr_rand_int_weak() */
#include "log.h"
#include "peer-io.h"
#include "utils.h"

View File

@ -16,7 +16,7 @@
#include "transmission.h"
#include "ptrarray.h"
#include "utils.h" /* tr_new (), tr_free () */
#include "utils.h" /* tr_new(), tr_free() */
struct tr_peerIo;
@ -89,16 +89,16 @@ struct tr_band
*
* CONSTRAINING
*
* Call tr_bandwidthAllocate () periodically. tr_bandwidth knows its current
* Call tr_bandwidthAllocate() periodically. tr_bandwidth knows its current
* speed and will decide how many bytes to make available over the
* user-specified period to reach the user-specified desired speed.
* If appropriate, it notifies its peer-ios that new bandwidth is available.
*
* tr_bandwidthAllocate () operates on the tr_bandwidth subtree, so usually
* tr_bandwidthAllocate() operates on the tr_bandwidth subtree, so usually
* you'll only need to invoke it for the top-level tr_session bandwidth.
*
* The peer-ios all have a pointer to their associated tr_bandwidth object,
* and call tr_bandwidthClamp () before performing I/O to see how much
* and call tr_bandwidthClamp() before performing I/O to see how much
* bandwidth they can safely use.
*/
typedef struct tr_bandwidth

View File

@ -6,7 +6,7 @@
*
*/
#include <string.h> /* strlen () */
#include <string.h> /* strlen() */
#include "transmission.h"
#include "crypto-utils.h"
#include "bitfield.h"

View File

@ -11,7 +11,7 @@
#include "transmission.h"
#include "bitfield.h"
#include "utils.h" /* tr_new0 () */
#include "utils.h" /* tr_new0() */
tr_bitfield const TR_BITFIELD_INIT = { NULL, 0, 0, 0, false, false };

View File

@ -8,7 +8,7 @@
#include <assert.h>
#include <stdio.h>
#include <string.h> /* strlen () */
#include <string.h> /* strlen() */
#include "transmission.h"
#include "blocklist.h"

View File

@ -9,7 +9,7 @@
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h> /* bsearch (), qsort () */
#include <stdlib.h> /* bsearch(), qsort() */
#include <string.h>
#include "transmission.h"

View File

@ -6,7 +6,7 @@
*
*/
#include <stdlib.h> /* qsort () */
#include <stdlib.h> /* qsort() */
#include <event2/buffer.h>

View File

@ -8,13 +8,13 @@
/* thanks amc1! */
#include <ctype.h> /* isprint () */
#include <stdlib.h> /* strtol () */
#include <ctype.h> /* isprint() */
#include <stdlib.h> /* strtol() */
#include <string.h>
#include "transmission.h"
#include "clients.h"
#include "utils.h" /* tr_snprintf (), tr_strlcpy () */
#include "utils.h" /* tr_snprintf(), tr_strlcpy() */
static int charint(uint8_t ch)
{

View File

@ -267,7 +267,7 @@ size_t tr_cpMissingBytesInPiece(tr_completion const* cp, tr_piece_index_t piece)
if (f != l)
{
/* nb: we don't pass the usual l+1 here to tr_bitfieldCountRange ().
/* nb: we don't pass the usual l+1 here to tr_bitfieldCountRange().
It's faster to handle the last block separately because its size
needs to be checked separately. */
haveBytes = tr_bitfieldCountRange(&cp->blockBitfield, f, l);

View File

@ -14,7 +14,7 @@
#include "transmission.h"
#include "bitfield.h"
#include "utils.h" /* tr_getRatio () */
#include "utils.h" /* tr_getRatio() */
typedef struct tr_completion
{
@ -24,7 +24,7 @@ typedef struct tr_completion
/* number of bytes we'll have when done downloading. [0..info.totalSize]
DON'T access this directly; it's a lazy field.
use tr_cpSizeWhenDone () instead! */
use tr_cpSizeWhenDone() instead! */
uint64_t sizeWhenDoneLazy;
/* whether or not sizeWhenDone needs to be recalculated */
@ -32,7 +32,7 @@ typedef struct tr_completion
/* number of bytes we'll have when done downloading. [0..info.totalSize]
DON'T access this directly; it's a lazy field.
use tr_cpHaveValid () instead! */
use tr_cpHaveValid() instead! */
uint64_t haveValidLazy;
/* whether or not haveValidLazy needs to be recalculated */

View File

@ -200,7 +200,7 @@ static int test_random(void)
{
int i;
/* test that tr_rand_int () stays in-bounds */
/* test that tr_rand_int() stays in-bounds */
for (i = 0; i < 100000; ++i)
{
int const val = tr_rand_int(100);

View File

@ -8,8 +8,8 @@
#include <assert.h>
#include <stdarg.h>
#include <stdlib.h> /* abs (), srand (), rand () */
#include <string.h> /* memcpy (), memmove (), memset (), strcmp (), strlen () */
#include <stdlib.h> /* abs(), srand(), rand() */
#include <string.h> /* memcpy(), memmove(), memset(), strcmp(), strlen() */
#include <b64/cdecode.h>
#include <b64/cencode.h>

View File

@ -120,8 +120,8 @@ int tr_rand_int(int upper_bound);
/**
* @brief Returns a pseudorandom number in the range of [0...upper_bound).
*
* This is faster, BUT WEAKER, than tr_rand_int () and never be used in sensitive cases.
* @see tr_rand_int ()
* This is faster, BUT WEAKER, than tr_rand_int() and never be used in sensitive cases.
* @see tr_rand_int()
*/
int tr_rand_int_weak(int upper_bound);
@ -142,30 +142,30 @@ bool tr_ssha1_matches(char const* ssha1, char const* plain_text);
/**
* @brief Translate a block of bytes into base64.
* @return a newly-allocated null-terminated string that can be freed with tr_free ()
* @return a newly-allocated null-terminated string that can be freed with tr_free()
*/
void* tr_base64_encode(void const* input, size_t input_length, size_t* output_length) TR_GNUC_MALLOC;
/**
* @brief Translate null-terminated string into base64.
* @return a newly-allocated null-terminated string that can be freed with tr_free ()
* @return a newly-allocated null-terminated string that can be freed with tr_free()
*/
void* tr_base64_encode_str(char const* input, size_t* output_length) TR_GNUC_MALLOC;
/**
* @brief Translate a block of bytes from base64 into raw form.
* @return a newly-allocated null-terminated string that can be freed with tr_free ()
* @return a newly-allocated null-terminated string that can be freed with tr_free()
*/
void* tr_base64_decode(void const* input, size_t input_length, size_t* output_length) TR_GNUC_MALLOC;
/**
* @brief Translate null-terminated string from base64 into raw form.
* @return a newly-allocated null-terminated string that can be freed with tr_free ()
* @return a newly-allocated null-terminated string that can be freed with tr_free()
*/
void* tr_base64_decode_str(char const* input, size_t* output_length) TR_GNUC_MALLOC;
/**
* @brief Wrapper around tr_binary_to_hex () for SHA_DIGEST_LENGTH.
* @brief Wrapper around tr_binary_to_hex() for SHA_DIGEST_LENGTH.
*/
static inline void tr_sha1_to_hex(char* hex, uint8_t const* sha1)
{
@ -173,7 +173,7 @@ static inline void tr_sha1_to_hex(char* hex, uint8_t const* sha1)
}
/**
* @brief Wrapper around tr_hex_to_binary () for SHA_DIGEST_LENGTH.
* @brief Wrapper around tr_hex_to_binary() for SHA_DIGEST_LENGTH.
*/
static inline void tr_hex_to_sha1(uint8_t* sha1, char const* hex)
{

View File

@ -7,7 +7,7 @@
*/
#include <assert.h>
#include <string.h> /* memcpy (), memmove (), memset () */
#include <string.h> /* memcpy(), memmove(), memset() */
#include "transmission.h"
#include "crypto.h"

View File

@ -23,7 +23,7 @@
#include "file.h"
#include "log.h"
#include "session.h"
#include "torrent.h" /* tr_isTorrent () */
#include "torrent.h" /* tr_isTorrent() */
#define dbgmsg(...) \
do \

View File

@ -48,7 +48,7 @@ bool tr_fdFileGetCachedMTime(tr_session* session, int torrent_id, tr_file_index_
/**
* Closes a file that's being held by our file repository.
*
* If the file isn't checked out, it's fsync ()ed and close ()d immediately.
* If the file isn't checked out, it's fsync()ed and close()d immediately.
* If the file is currently checked out, it will be closed upon its return.
*
* @see tr_fdFileCheckout

View File

@ -12,17 +12,17 @@
#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h> /* O_LARGEFILE, posix_fadvise (), [posix_]fallocate () */
#include <libgen.h> /* basename (), dirname () */
#include <fcntl.h> /* O_LARGEFILE, posix_fadvise(), [posix_]fallocate() */
#include <libgen.h> /* basename(), dirname() */
#include <limits.h> /* PATH_MAX */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/file.h> /* flock () */
#include <sys/mman.h> /* mmap (), munmap () */
#include <sys/file.h> /* flock() */
#include <sys/mman.h> /* mmap(), munmap() */
#include <sys/stat.h>
#include <unistd.h> /* lseek (), write (), ftruncate (), pread (), pwrite (), pathconf (), etc */
#include <unistd.h> /* lseek(), write(), ftruncate(), pread(), pwrite(), pathconf(), etc */
#ifdef HAVE_XFS_XFS_H
#include <xfs/xfs.h>
@ -304,7 +304,7 @@ char* tr_sys_path_resolve(char const* path, tr_error** error)
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L
/* Better safe than sorry: realpath () officially supports NULL as destination
/* Better safe than sorry: realpath() officially supports NULL as destination
starting off POSIX.1-2008. */
if (ret == NULL)

View File

@ -767,7 +767,7 @@ static int test_path_basename_dirname(void)
return 1;
}
/* TODO: is_same (dirname (x) + '/' + basename (x), x) */
/* TODO: is_same(dirname(x) + '/' + basename(x), x) */
return 0;
}

View File

@ -7,13 +7,13 @@
*/
#include <assert.h>
#include <ctype.h> /* isalpha () */
#include <ctype.h> /* isalpha() */
#include <shlobj.h> /* SHCreateDirectoryEx () */
#include <shlobj.h> /* SHCreateDirectoryEx() */
#include <winioctl.h> /* FSCTL_SET_SPARSE */
#include "transmission.h"
#include "crypto-utils.h" /* tr_rand_int () */
#include "crypto-utils.h" /* tr_rand_int() */
#include "error.h"
#include "file.h"
#include "utils.h"
@ -156,7 +156,7 @@ static wchar_t* path_to_native_path_ex(char const* path, int extra_chars_after,
/* `-2` for UNC since we overwrite existing prefix slashes */
int const extra_chars_before = is_relative ? 0 : (is_unc ? ARRAYSIZE(unc_prefix) - 2 : ARRAYSIZE(local_prefix));
/* TODO (?): assert (!is_relative); */
/* TODO (?): assert(!is_relative); */
wchar_t* const wide_path = tr_win32_utf8_to_native_ex(path, -1, extra_chars_before, extra_chars_after, real_result_size);

View File

@ -7,7 +7,7 @@
*/
#include <assert.h>
#include <string.h> /* strlen () */
#include <string.h> /* strlen() */
#include "transmission.h"
#include "error.h"

View File

@ -139,7 +139,7 @@ tr_sys_path_info;
/* Path-related wrappers */
/**
* @brief Portability wrapper for `stat ()`.
* @brief Portability wrapper for `stat()`.
*
* @param[in] path Path to file or directory.
* @param[in] flags Combination of @ref tr_sys_path_get_info_flags_t values.
@ -152,7 +152,7 @@ tr_sys_path_info;
bool tr_sys_path_get_info(char const* path, int flags, tr_sys_path_info* info, struct tr_error** error);
/**
* @brief Portability wrapper for `access ()`.
* @brief Portability wrapper for `access()`.
*
* @param[in] path Path to file or directory.
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are
@ -191,7 +191,7 @@ bool tr_sys_path_is_relative(char const* path);
bool tr_sys_path_is_same(char const* path1, char const* path2, struct tr_error** error);
/**
* @brief Portability wrapper for `realpath ()`.
* @brief Portability wrapper for `realpath()`.
*
* @param[in] path Path to file or directory.
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are
@ -205,7 +205,7 @@ bool tr_sys_path_is_same(char const* path1, char const* path2, struct tr_error**
char* tr_sys_path_resolve(char const* path, struct tr_error** error);
/**
* @brief Portability wrapper for `basename ()`.
* @brief Portability wrapper for `basename()`.
*
* @param[in] path Path to file or directory.
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are
@ -219,7 +219,7 @@ char* tr_sys_path_resolve(char const* path, struct tr_error** error);
char* tr_sys_path_basename(char const* path, struct tr_error** error);
/**
* @brief Portability wrapper for `dirname ()`.
* @brief Portability wrapper for `dirname()`.
*
* @param[in] path Path to file or directory.
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are
@ -233,7 +233,7 @@ char* tr_sys_path_basename(char const* path, struct tr_error** error);
char* tr_sys_path_dirname(char const* path, struct tr_error** error);
/**
* @brief Portability wrapper for `rename ()`.
* @brief Portability wrapper for `rename()`.
*
* @param[in] src_path Path to source file or directory.
* @param[in] dst_path Path to destination file or directory.
@ -247,7 +247,7 @@ char* tr_sys_path_dirname(char const* path, struct tr_error** error);
bool tr_sys_path_rename(char const* src_path, char const* dst_path, struct tr_error** error);
/**
* @brief Portability wrapper for `remove ()`.
* @brief Portability wrapper for `remove()`.
*
* @param[in] path Path to file or directory.
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are
@ -275,7 +275,7 @@ bool tr_sys_path_remove(char const* path, struct tr_error** error);
tr_sys_file_t tr_sys_file_get_std(tr_std_sys_file_t std_file, struct tr_error** error);
/**
* @brief Portability wrapper for `open ()`.
* @brief Portability wrapper for `open()`.
*
* @param[in] path Path to file.
* @param[in] flags Combination of @ref tr_sys_file_open_flags_t values.
@ -290,7 +290,7 @@ tr_sys_file_t tr_sys_file_get_std(tr_std_sys_file_t std_file, struct tr_error**
tr_sys_file_t tr_sys_file_open(char const* path, int flags, int permissions, struct tr_error** error);
/**
* @brief Portability wrapper for `mkstemp ()`.
* @brief Portability wrapper for `mkstemp()`.
*
* @param[in,out] path_template Template path to file. Should end with at least
* six 'X' characters. Upon success, trailing 'X'
@ -306,7 +306,7 @@ tr_sys_file_t tr_sys_file_open(char const* path, int flags, int permissions, str
tr_sys_file_t tr_sys_file_open_temp(char* path_template, struct tr_error** error);
/**
* @brief Portability wrapper for `close ()`.
* @brief Portability wrapper for `close()`.
*
* @param[in] handle Valid file descriptor.
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are
@ -317,7 +317,7 @@ tr_sys_file_t tr_sys_file_open_temp(char* path_template, struct tr_error** error
bool tr_sys_file_close(tr_sys_file_t handle, struct tr_error** error);
/**
* @brief Portability wrapper for `fstat ()`.
* @brief Portability wrapper for `fstat()`.
*
* @param[in] handle Valid file descriptor.
* @param[out] info Result buffer.
@ -329,7 +329,7 @@ bool tr_sys_file_close(tr_sys_file_t handle, struct tr_error** error);
bool tr_sys_file_get_info(tr_sys_file_t handle, tr_sys_path_info* info, struct tr_error** error);
/**
* @brief Portability wrapper for `lseek ()`.
* @brief Portability wrapper for `lseek()`.
*
* @param[in] handle Valid file descriptor.
* @param[in] offset Relative file offset in bytes to seek to.
@ -345,7 +345,7 @@ bool tr_sys_file_seek(tr_sys_file_t handle, int64_t offset, tr_seek_origin_t ori
struct tr_error** error);
/**
* @brief Portability wrapper for `read ()`.
* @brief Portability wrapper for `read()`.
*
* @param[in] handle Valid file descriptor.
* @param[out] buffer Buffer to store read data to.
@ -360,7 +360,7 @@ bool tr_sys_file_seek(tr_sys_file_t handle, int64_t offset, tr_seek_origin_t ori
bool tr_sys_file_read(tr_sys_file_t handle, void* buffer, uint64_t size, uint64_t* bytes_read, struct tr_error** error);
/**
* @brief Like `pread ()`, except that the position is undefined afterwards.
* @brief Like `pread()`, except that the position is undefined afterwards.
* Not thread-safe.
*
* @param[in] handle Valid file descriptor.
@ -378,7 +378,7 @@ bool tr_sys_file_read_at(tr_sys_file_t handle, void* buffer, uint64_t size, uint
struct tr_error** error);
/**
* @brief Portability wrapper for `write ()`.
* @brief Portability wrapper for `write()`.
*
* @param[in] handle Valid file descriptor.
* @param[in] buffer Buffer to get data being written from.
@ -394,7 +394,7 @@ bool tr_sys_file_write(tr_sys_file_t handle, void const* buffer, uint64_t size,
struct tr_error** error);
/**
* @brief Like `pwrite ()`, except that the position is undefined afterwards.
* @brief Like `pwrite()`, except that the position is undefined afterwards.
* Not thread-safe.
*
* @param[in] handle Valid file descriptor.
@ -412,7 +412,7 @@ bool tr_sys_file_write_at(tr_sys_file_t handle, void const* buffer, uint64_t siz
struct tr_error** error);
/**
* @brief Portability wrapper for `fsync ()`.
* @brief Portability wrapper for `fsync()`.
*
* @param[in] handle Valid file descriptor.
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are
@ -423,7 +423,7 @@ bool tr_sys_file_write_at(tr_sys_file_t handle, void const* buffer, uint64_t siz
bool tr_sys_file_flush(tr_sys_file_t handle, struct tr_error** error);
/**
* @brief Portability wrapper for `ftruncate ()`.
* @brief Portability wrapper for `ftruncate()`.
*
* @param[in] handle Valid file descriptor.
* @param[in] size Number of bytes to truncate (or extend) file to.
@ -461,7 +461,7 @@ bool tr_sys_file_prefetch(tr_sys_file_t handle, uint64_t offset, uint64_t size,
bool tr_sys_file_preallocate(tr_sys_file_t handle, uint64_t size, int flags, struct tr_error** error);
/**
* @brief Portability wrapper for `mmap ()` for files.
* @brief Portability wrapper for `mmap()` for files.
*
* @param[in] handle Valid file descriptor.
* @param[in] offset Offset in file to map from.
@ -475,7 +475,7 @@ bool tr_sys_file_preallocate(tr_sys_file_t handle, uint64_t size, int flags, str
void* tr_sys_file_map_for_reading(tr_sys_file_t handle, uint64_t offset, uint64_t size, struct tr_error** error);
/**
* @brief Portability wrapper for `munmap ()` for files.
* @brief Portability wrapper for `munmap()` for files.
*
* @param[in] address Pointer to mapped file data.
* @param[in] size Size of mapped data in bytes.
@ -487,7 +487,7 @@ void* tr_sys_file_map_for_reading(tr_sys_file_t handle, uint64_t offset, uint64_
bool tr_sys_file_unmap(void const* address, uint64_t size, struct tr_error** error);
/**
* @brief Portability wrapper for `flock ()`.
* @brief Portability wrapper for `flock()`.
*
* Don't try to upgrade or downgrade the lock unless you know what you are
* doing, as behavior varies a bit between platforms.
@ -504,7 +504,7 @@ bool tr_sys_file_lock(tr_sys_file_t handle, int operation, struct tr_error** err
/* File-related wrappers (utility) */
/**
* @brief Portability wrapper for `fgets ()`, removing EOL internally.
* @brief Portability wrapper for `fgets()`, removing EOL internally.
*
* Special care should be taken when reading from one of standard input streams
* (@ref tr_std_sys_file_t) since no UTF-8 conversion is currently being made.
@ -527,7 +527,7 @@ bool tr_sys_file_lock(tr_sys_file_t handle, int operation, struct tr_error** err
bool tr_sys_file_read_line(tr_sys_file_t handle, char* buffer, size_t buffer_size, struct tr_error** error);
/**
* @brief Portability wrapper for `fputs ()`, appending EOL internally.
* @brief Portability wrapper for `fputs()`, appending EOL internally.
*
* Special care should be taken when writing to one of standard output streams
* (@ref tr_std_sys_file_t) since no UTF-8 conversion is currently being made.
@ -545,7 +545,7 @@ bool tr_sys_file_read_line(tr_sys_file_t handle, char* buffer, size_t buffer_siz
bool tr_sys_file_write_line(tr_sys_file_t handle, char const* buffer, struct tr_error** error);
/**
* @brief Portability wrapper for `fprintf ()`.
* @brief Portability wrapper for `fprintf()`.
*
* Special care should be taken when writing to one of standard output streams
* (@ref tr_std_sys_file_t) since no UTF-8 conversion is currently being made.
@ -566,7 +566,7 @@ bool tr_sys_file_write_fmt(tr_sys_file_t handle, char const* format, struct tr_e
/* Directory-related wrappers */
/**
* @brief Portability wrapper for `getcwd ()`.
* @brief Portability wrapper for `getcwd()`.
*
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are
* not interested in error details.
@ -578,7 +578,7 @@ bool tr_sys_file_write_fmt(tr_sys_file_t handle, char const* format, struct tr_e
char* tr_sys_dir_get_current(struct tr_error** error);
/**
* @brief Like `mkdir ()`, but makes parent directories if needed.
* @brief Like `mkdir()`, but makes parent directories if needed.
*
* @param[in] path Path to directory.
* @param[in] flags Combination of @ref tr_sys_dir_create_flags_t values.
@ -592,7 +592,7 @@ char* tr_sys_dir_get_current(struct tr_error** error);
bool tr_sys_dir_create(char const* path, int flags, int permissions, struct tr_error** error);
/**
* @brief Portability wrapper for `mkdtemp ()`.
* @brief Portability wrapper for `mkdtemp()`.
*
* @param[in,out] path_template Template path to directory. Should end with at
* least six 'X' characters. Upon success, trailing
@ -607,7 +607,7 @@ bool tr_sys_dir_create(char const* path, int flags, int permissions, struct tr_e
bool tr_sys_dir_create_temp(char* path_template, struct tr_error** error);
/**
* @brief Portability wrapper for `opendir ()`.
* @brief Portability wrapper for `opendir()`.
*
* @param[in] path Path to directory.
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are
@ -619,7 +619,7 @@ bool tr_sys_dir_create_temp(char* path_template, struct tr_error** error);
tr_sys_dir_t tr_sys_dir_open(char const* path, struct tr_error** error);
/**
* @brief Portability wrapper for `readdir ()`.
* @brief Portability wrapper for `readdir()`.
*
* @param[in] handle Valid directory descriptor.
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are
@ -634,7 +634,7 @@ tr_sys_dir_t tr_sys_dir_open(char const* path, struct tr_error** error);
char const* tr_sys_dir_read_name(tr_sys_dir_t handle, struct tr_error** error);
/**
* @brief Portability wrapper for `closedir ()`.
* @brief Portability wrapper for `closedir()`.
*
* @param[in] handle Valid directory descriptor.
* @param[out] error Pointer to error object. Optional, pass `NULL` if you are

View File

@ -8,7 +8,7 @@
#include <assert.h>
#include <errno.h>
#include <string.h> /* strcmp (), strlen (), strncmp () */
#include <string.h> /* strcmp(), strlen(), strncmp() */
#include <event2/buffer.h>
#include <event2/event.h>
@ -437,18 +437,18 @@ static ReadState readYb(tr_handshake* handshake, struct evbuffer* inbuf)
return tr_handshakeDone(handshake, false);
}
/* now send these: HASH ('req1', S), HASH ('req2', SKEY) xor HASH ('req3', S),
* ENCRYPT (VC, crypto_provide, len (PadC), PadC, len (IA)), ENCRYPT (IA) */
/* now send these: HASH('req1', S), HASH('req2', SKEY) xor HASH('req3', S),
* ENCRYPT(VC, crypto_provide, len(PadC), PadC, len(IA)), ENCRYPT(IA) */
outbuf = evbuffer_new();
/* HASH ('req1', S) */
/* HASH('req1', S) */
{
uint8_t req1[SHA_DIGEST_LENGTH];
computeRequestHash(handshake, "req1", req1);
evbuffer_add(outbuf, req1, SHA_DIGEST_LENGTH);
}
/* HASH ('req2', SKEY) xor HASH ('req3', S) */
/* HASH('req2', SKEY) xor HASH('req3', S) */
{
int i;
uint8_t req2[SHA_DIGEST_LENGTH];
@ -466,7 +466,7 @@ static ReadState readYb(tr_handshake* handshake, struct evbuffer* inbuf)
evbuffer_add(outbuf, buf, SHA_DIGEST_LENGTH);
}
/* ENCRYPT (VC, crypto_provide, len (PadC), PadC
/* ENCRYPT(VC, crypto_provide, len(PadC), PadC
* PadC is reserved for future extensions to the handshake...
* standard practice at this time is for it to be zero-length */
{
@ -481,7 +481,7 @@ static ReadState readYb(tr_handshake* handshake, struct evbuffer* inbuf)
evbuffer_add_uint16(outbuf, 0);
}
/* ENCRYPT len (IA)), ENCRYPT (IA) */
/* ENCRYPT len(IA)), ENCRYPT(IA) */
{
uint8_t msg[HANDSHAKE_SIZE];
@ -788,7 +788,7 @@ static ReadState readYa(tr_handshake* handshake, struct evbuffer* inbuf)
static ReadState readPadA(tr_handshake* handshake, struct evbuffer* inbuf)
{
/* resynchronizing on HASH ('req1',S) */
/* resynchronizing on HASH('req1',S) */
struct evbuffer_ptr ptr = evbuffer_search(inbuf, (char const*)handshake->myReq1, SHA_DIGEST_LENGTH, NULL);
if (ptr.pos != -1) /* match */
@ -813,7 +813,7 @@ static ReadState readPadA(tr_handshake* handshake, struct evbuffer* inbuf)
static ReadState readCryptoProvide(tr_handshake* handshake, struct evbuffer* inbuf)
{
/* HASH ('req2', SKEY) xor HASH ('req3', S), ENCRYPT (VC, crypto_provide, len (PadC)) */
/* HASH('req2', SKEY) xor HASH('req3', S), ENCRYPT(VC, crypto_provide, len(PadC)) */
int i;
uint8_t vc_in[VC_LENGTH];
@ -823,8 +823,8 @@ static ReadState readCryptoProvide(tr_handshake* handshake, struct evbuffer* inb
uint16_t padc_len = 0;
uint32_t crypto_provide = 0;
tr_torrent* tor;
size_t const needlen = SHA_DIGEST_LENGTH + /* HASH ('req1',s) */
SHA_DIGEST_LENGTH + /* HASH ('req2', SKEY) xor HASH ('req3', S) */
size_t const needlen = SHA_DIGEST_LENGTH + /* HASH('req1',s) */
SHA_DIGEST_LENGTH + /* HASH('req2', SKEY) xor HASH('req3', S) */
VC_LENGTH + sizeof(crypto_provide) + sizeof(padc_len);
if (evbuffer_get_length(inbuf) < needlen)
@ -832,10 +832,10 @@ static ReadState readCryptoProvide(tr_handshake* handshake, struct evbuffer* inb
return READ_LATER;
}
/* TODO: confirm they sent HASH ('req1',S) here? */
/* TODO: confirm they sent HASH('req1',S) here? */
evbuffer_drain(inbuf, SHA_DIGEST_LENGTH);
/* This next piece is HASH ('req2', SKEY) xor HASH ('req3', S) ...
/* This next piece is HASH('req2', SKEY) xor HASH('req3', S) ...
* we can get the first half of that (the obufscatedTorrentHash)
* by building the latter and xor'ing it with what the peer sent us */
dbgmsg(handshake, "reading obfuscated torrent hash...");
@ -866,7 +866,7 @@ static ReadState readCryptoProvide(tr_handshake* handshake, struct evbuffer* inb
return tr_handshakeDone(handshake, false);
}
/* next part: ENCRYPT (VC, crypto_provide, len (PadC), */
/* next part: ENCRYPT(VC, crypto_provide, len(PadC), */
tr_cryptoDecryptInit(handshake->crypto);
@ -921,7 +921,7 @@ static ReadState readIA(tr_handshake* handshake, struct evbuffer* inbuf)
}
/**
*** B->A: ENCRYPT (VC, crypto_select, len (padD), padD), ENCRYPT2 (Payload Stream)
*** B->A: ENCRYPT(VC, crypto_select, len(padD), padD), ENCRYPT2(Payload Stream)
**/
tr_cryptoEncryptInit(handshake->crypto);
@ -952,7 +952,7 @@ static ReadState readIA(tr_handshake* handshake, struct evbuffer* inbuf)
dbgmsg(handshake, "sending pad d");
/* ENCRYPT (VC, crypto_provide, len (PadD), PadD
/* ENCRYPT(VC, crypto_provide, len(PadD), PadD
* PadD is reserved for future extensions to the handshake...
* standard practice at this time is for it to be zero-length */
{

View File

@ -6,7 +6,7 @@
*
*/
#include <string.h> /* memset () */
#include <string.h> /* memset() */
#include "transmission.h"
#include "history.h"

View File

@ -7,7 +7,7 @@
*/
#include <assert.h>
#include <string.h> /* memset () */
#include <string.h> /* memset() */
#include "transmission.h"
#include "history.h"

View File

@ -42,14 +42,14 @@ tr_recentHistory;
/**
* @brief add a counter to the recent history object.
* @param when the current time in sec, such as from tr_time ()
* @param when the current time in sec, such as from tr_time()
* @param n how many items to add to the history's counter
*/
void tr_historyAdd(tr_recentHistory*, time_t when, unsigned int n);
/**
* @brief count how many events have occurred in the last N seconds.
* @param when the current time in sec, such as from tr_time ()
* @param when the current time in sec, such as from tr_time()
* @param seconds how many seconds to count back through.
*/
unsigned int tr_historyGet(tr_recentHistory const*, time_t when, unsigned int seconds);

View File

@ -8,11 +8,11 @@
#include <assert.h>
#include <errno.h>
#include <stdlib.h> /* bsearch () */
#include <string.h> /* memcmp () */
#include <stdlib.h> /* bsearch() */
#include <string.h> /* memcmp() */
#include "transmission.h"
#include "cache.h" /* tr_cacheReadBlock () */
#include "cache.h" /* tr_cacheReadBlock() */
#include "crypto-utils.h"
#include "error.h"
#include "fdlimit.h"
@ -20,7 +20,7 @@
#include "inout.h"
#include "log.h"
#include "peer-common.h" /* MAX_BLOCK_SIZE */
#include "stats.h" /* tr_statsFileCreated () */
#include "stats.h" /* tr_statsFileCreated() */
#include "torrent.h"
#include "utils.h"

View File

@ -6,7 +6,7 @@
*
*/
#include <string.h> /* strlen () */
#include <string.h> /* strlen() */
#include <locale.h> /* setlocale() */

View File

@ -14,7 +14,7 @@
#include <string.h> /* strlen() */
#include "transmission.h"
#include "utils.h" /* tr_strcmp0 () */
#include "utils.h" /* tr_strcmp0() */
extern int current_test;

View File

@ -7,11 +7,11 @@
*/
#include <assert.h>
#include <string.h> /* strchr () */
#include <stdio.h> /* sscanf () */
#include <string.h> /* strchr() */
#include <stdio.h> /* sscanf() */
#include "transmission.h"
#include "crypto-utils.h" /* tr_hex_to_sha1 () */
#include "crypto-utils.h" /* tr_hex_to_sha1() */
#include "magnet.h"
#include "variant.h"
#include "web.h"

View File

@ -11,7 +11,7 @@
#include <stdlib.h> /* qsort */
#include <string.h> /* strcmp, strlen */
#include <event2/util.h> /* evutil_ascii_strcasecmp () */
#include <event2/util.h> /* evutil_ascii_strcasecmp() */
#include "transmission.h"
#include "crypto-utils.h" /* tr_sha1 */

View File

@ -33,8 +33,8 @@ tr_metainfo_builder_err;
typedef struct tr_metainfo_builder
{
/**
*** These are set by tr_makeMetaInfoBuilderCreate ()
*** and cleaned up by tr_metaInfoBuilderFree ()
*** These are set by tr_makeMetaInfoBuilderCreate()
*** and cleaned up by tr_metaInfoBuilderFree()
**/
char* top;
@ -46,9 +46,9 @@ typedef struct tr_metainfo_builder
bool isFolder;
/**
*** These are set inside tr_makeMetaInfo ()
*** These are set inside tr_makeMetaInfo()
*** by copying the arguments passed to it,
*** and cleaned up by tr_metaInfoBuilderFree ()
*** and cleaned up by tr_metaInfoBuilderFree()
**/
tr_tracker_info* trackers;
@ -58,10 +58,10 @@ typedef struct tr_metainfo_builder
bool isPrivate;
/**
*** These are set inside tr_makeMetaInfo () so the client
*** These are set inside tr_makeMetaInfo() so the client
*** can poll periodically to see what the status is.
*** The client can also set abortFlag to nonzero to
*** tell tr_makeMetaInfo () to abort and clean up after itself.
*** tell tr_makeMetaInfo() to abort and clean up after itself.
**/
uint32_t pieceIndex;
@ -105,7 +105,7 @@ void tr_metaInfoBuilderFree(tr_metainfo_builder*);
*
* It is the caller's responsibility to poll builder->isDone
* from time to time! When the worker thread sets that flag,
* the caller must pass the builder to tr_metaInfoBuilderFree ().
* the caller must pass the builder to tr_metaInfoBuilderFree().
*
* @param outputFile if NULL, builder->top + ".torrent" will be used.

View File

@ -7,7 +7,7 @@
*/
#include <assert.h>
#include <string.h> /* strlen () */
#include <string.h> /* strlen() */
#include <event2/buffer.h>
@ -16,7 +16,7 @@
#include "file.h"
#include "log.h"
#include "metainfo.h"
#include "platform.h" /* tr_getTorrentDir () */
#include "platform.h" /* tr_getTorrentDir() */
#include "session.h"
#include "utils.h"
#include "variant.h"
@ -121,7 +121,7 @@ static bool getfile(char** setme, char const* root, tr_variant* path, struct evb
if (success)
{
*setme = tr_utf8clean((char*)evbuffer_pullup(buf, -1), evbuffer_get_length(buf));
/*fprintf (stderr, "[%s]\n", *setme);*/
/* fprintf(stderr, "[%s]\n", *setme); */
}
return success;
@ -336,7 +336,7 @@ static char const* getannounce(tr_info* inf, tr_variant* meta)
trackers[trackerCount].scrape = tr_convertAnnounceToScrape(url);
trackers[trackerCount].id = 0;
trackerCount++;
/*fprintf (stderr, "single announce: [%s]\n", url);*/
/* fprintf(stderr, "single announce: [%s]\n", url); */
}
}

View File

@ -10,7 +10,7 @@
#include <time.h>
#include <inttypes.h>
#include <event2/util.h> /* evutil_inet_ntop () */
#include <event2/util.h> /* evutil_inet_ntop() */
#define ENABLE_STRNATPMPERR
#include "natpmp.h"

View File

@ -37,13 +37,13 @@
#include <libutp/utp.h>
#include "transmission.h"
#include "fdlimit.h" /* tr_fdSocketClose () */
#include "fdlimit.h" /* tr_fdSocketClose() */
#include "net.h"
#include "peer-io.h" /* tr_peerIoAddrStr () FIXME this should be moved to net.h */
#include "session.h" /* tr_sessionGetPublicAddress () */
#include "tr-utp.h" /* tr_utpSendTo () */
#include "peer-io.h" /* tr_peerIoAddrStr() FIXME this should be moved to net.h */
#include "session.h" /* tr_sessionGetPublicAddress() */
#include "tr-utp.h" /* tr_utpSendTo() */
#include "log.h"
#include "utils.h" /* tr_time (), tr_logAddDebug () */
#include "utils.h" /* tr_time(), tr_logAddDebug() */
#ifndef IN_MULTICAST
#define IN_MULTICAST(a) (((a) & 0xf0000000) == 0xe0000000)
@ -89,7 +89,7 @@ char const* tr_address_to_string_with_buf(tr_address const* addr, char* buf, siz
}
/*
* Non-threadsafe version of tr_address_to_string_with_buf ()
* Non-threadsafe version of tr_address_to_string_with_buf()
* and uses a static memory area for a buffer.
* This function is suitable to be called from libTransmission's networking code,
* which is single-threaded.
@ -494,7 +494,7 @@ void tr_netClose(tr_session* session, tr_socket_t s)
}
/*
get_source_address () and global_unicast_address () were written by
get_source_address() and global_unicast_address() were written by
Juliusz Chroboczek, and are covered under the same license as dht.c.
Please feel free to copy them into your software if it can help
unbreaking the double-stack Internet. */

View File

@ -23,7 +23,7 @@
#include "net.h"
#include "peer-common.h" /* MAX_BLOCK_SIZE */
#include "peer-io.h"
#include "trevent.h" /* tr_runInEventThread () */
#include "trevent.h" /* tr_runInEventThread() */
#include "tr-utp.h"
#include "utils.h"
@ -364,7 +364,7 @@ static void event_write_cb(evutil_socket_t fd, short event UNUSED, void* vio)
dbgmsg(io, "libevent says this peer is ready to write");
/* Write as much as possible, since the socket is non-blocking, write () will
/* Write as much as possible, since the socket is non-blocking, write() will
* return if it can't write any more data without blocking */
howmuch = tr_bandwidthClamp(&io->bandwidth, dir, evbuffer_get_length(io->outbuf));

View File

@ -22,7 +22,7 @@
#include "bandwidth.h"
#include "crypto.h"
#include "net.h" /* tr_address */
#include "utils.h" /* tr_time () */
#include "utils.h" /* tr_time() */
struct evbuffer;
struct tr_bandwidth;

View File

@ -45,7 +45,7 @@ enum
/* how frequently to change which peers are choked */
RECHOKE_PERIOD_MSEC = (10 * 1000),
/* an optimistically unchoked peer is immune from rechoking
for this many calls to rechokeUploads (). */
for this many calls to rechokeUploads(). */
OPTIMISTIC_UNCHOKE_MULTIPLIER = 4,
/* how frequently to reallocate bandwidth */
BANDWIDTH_PERIOD_MSEC = 500,
@ -551,7 +551,7 @@ void tr_peerMgrFree(tr_peerMgr* manager)
deleteTimers(manager);
/* free the handshakes. Abort invokes handshakeDoneCB (), which removes
/* free the handshakes. Abort invokes handshakeDoneCB(), which removes
* the item from manager->handshakes, so this is a little roundabout... */
while (!tr_ptrArrayEmpty(&manager->incomingHandshakes))
{
@ -682,7 +682,7 @@ void tr_peerMgrSetUtpFailed(tr_torrent* tor, tr_address const* addr, bool failed
***
*** 2. tr_swarm::pieces, an array of "struct weighted_piece" which lists the
*** pieces that we want to request. It's used to decide which blocks to
*** return next when tr_peerMgrGetBlockRequests () is called.
*** return next when tr_peerMgrGetBlockRequests() is called.
**/
/**
@ -1997,7 +1997,7 @@ static int getMaxPeerCount(tr_torrent const* tor)
static int getPeerCount(tr_swarm const* s)
{
return tr_ptrArraySize(&s->peers); /* + tr_ptrArraySize (&t->outgoingHandshakes); */
return tr_ptrArraySize(&s->peers); /* + tr_ptrArraySize(&t->outgoingHandshakes); */
}
static void createBitTorrentPeer(tr_torrent* tor, struct tr_peerIo* io, struct peer_atom* atom, tr_quark client)
@ -2135,7 +2135,7 @@ static bool myHandshakeDoneCB(tr_handshake* handshake, tr_peerIo* io, bool readA
client = TR_KEY_NONE;
}
io = tr_handshakeStealIO(handshake); /* this steals its refcount too, which is balanced by our unref in peerDelete () */
io = tr_handshakeStealIO(handshake); /* this steals its refcount too, which is balanced by our unref in peerDelete() */
tr_peerIoSetParent(io, &s->tor->bandwidth);
createBitTorrentPeer(s->tor, io, atom, client);
@ -2195,7 +2195,7 @@ void tr_peerMgrAddIncoming(tr_peerMgr* manager, tr_address* addr, tr_port port,
handshake = tr_handshakeNew(io, session->encryptionMode, myHandshakeDoneCB, manager);
tr_peerIoUnref(io); /* balanced by the implicit ref in tr_peerIoNewIncoming () */
tr_peerIoUnref(io); /* balanced by the implicit ref in tr_peerIoNewIncoming() */
tr_ptrArrayInsertSorted(&manager->incomingHandshakes, handshake, handshakeCompare);
}
@ -2554,7 +2554,7 @@ static void stopSwarm(tr_swarm* swarm)
removeAllPeers(swarm);
/* disconnect the handshakes. handshakeAbort calls handshakeDoneCB (),
/* disconnect the handshakes. handshakeAbort calls handshakeDoneCB(),
* which removes the handshake from t->outgoingHandshakes... */
while (!tr_ptrArrayEmpty(&swarm->outgoingHandshakes))
{
@ -3299,7 +3299,7 @@ static void rechokeUploads(tr_swarm* s, uint64_t const now)
assert(swarmIsLocked(s));
/* an optimistic unchoke peer's "optimistic"
* state lasts for N calls to rechokeUploads (). */
* state lasts for N calls to rechokeUploads(). */
if (s->optimisticUnchokeTimeScaler > 0)
{
s->optimisticUnchokeTimeScaler--;
@ -3477,7 +3477,12 @@ static bool shouldPeerBeClosed(tr_swarm const* s, tr_peer const* peer, int peerC
int const limit = hi - ((hi - lo) * strictness);
int const idleTime = now - MAX(atom->time, atom->piece_data_time);
/*fprintf (stderr, "strictness is %.3f, limit is %d seconds... time since connect is %d, time since piece is %d ... idleTime is %d, doPurge is %d\n", (double)strictness, limit, (int)(now - atom->time), (int)(now - atom->piece_data_time), idleTime, idleTime > limit);*/
/*
fprintf(stderr, "strictness is %.3f, limit is %d seconds... time since connect is %d, time since piece is %d ... "
"idleTime is %d, doPurge is %d\n", (double)strictness, limit, (int)(now - atom->time),
(int)(now - atom->piece_data_time), idleTime, idleTime > limit);
*/
if (idleTime > limit)
{
tordbg(s, "purging peer %s because it's been %d secs since we shared anything", tr_atomAddrStr(atom), idleTime);
@ -4410,7 +4415,7 @@ static void initiateConnection(tr_peerMgr* mgr, tr_swarm* s, struct peer_atom* a
assert(tr_peerIoGetTorrentHash(io));
tr_peerIoUnref(io); /* balanced by the initial ref in tr_peerIoNewOutgoing () */
tr_peerIoUnref(io); /* balanced by the initial ref in tr_peerIoNewOutgoing() */
tr_ptrArrayInsertSorted(&s->outgoingHandshakes, handshake, handshakeCompare);
}

View File

@ -72,7 +72,7 @@ enum
/* idle seconds before we send a keepalive */
KEEPALIVE_INTERVAL_SECS = 100,
/* */
PEX_INTERVAL_SECS = 90, /* sec between sendPex () calls */
PEX_INTERVAL_SECS = 90, /* sec between sendPex() calls */
/* */
REQQ = 512,
/* */
@ -1328,7 +1328,7 @@ static void updatePeerProgress(tr_peerMsgs* msgs)
{
tr_peerUpdateProgress(msgs->torrent, &msgs->peer);
/*updateFastSet (msgs);*/
/* updateFastSet(msgs); */
updateInterest(msgs);
}
@ -2550,7 +2550,7 @@ static void sendPex(tr_peerMsgs* msgs)
tr_free(diffs6.dropped);
tr_free(newPex6);
/*msgs->clientSentPexAt = tr_time ();*/
/* msgs->clientSentPexAt = tr_time(); */
}
}
@ -2609,7 +2609,7 @@ static void peermsgs_destruct(tr_peer* peer)
if (msgs->io)
{
tr_peerIoClear(msgs->io);
tr_peerIoUnref(msgs->io); /* balanced by the ref in handshakeDoneCB () */
tr_peerIoUnref(msgs->io); /* balanced by the ref in handshakeDoneCB() */
}
evbuffer_free(msgs->outMessages);

View File

@ -10,7 +10,7 @@
#include <stdlib.h>
#include <string.h>
#include <event2/util.h> /* evutil_ascii_strcasecmp () */
#include <event2/util.h> /* evutil_ascii_strcasecmp() */
#ifndef _WIN32
#include <unistd.h> /* getuid() */
@ -380,7 +380,7 @@ static int64_t getquota(char const* device)
#ifdef __APPLE__
return (freespace < 0) ? 0 : freespace;
#else
return (freespace < 0) ? 0 : freespace* 1024;
return (freespace < 0) ? 0 : freespace * 1024;
#endif
}
@ -420,7 +420,7 @@ static int64_t getxfsquota(char* device)
}
freespace = limit - (dq.d_bcount >> 1);
return (freespace < 0) ? 0 : freespace* 1024;
return (freespace < 0) ? 0 : freespace * 1024;
}
/* something went wrong */

View File

@ -20,9 +20,9 @@
#endif
#ifdef _WIN32
#include <process.h> /* _beginthreadex (), _endthreadex () */
#include <process.h> /* _beginthreadex(), _endthreadex() */
#include <windows.h>
#include <shlobj.h> /* SHGetKnownFolderPath (), FOLDERID_... */
#include <shlobj.h> /* SHGetKnownFolderPath(), FOLDERID_... */
#else
#include <unistd.h> /* getuid() */
#ifdef BUILD_MAC_CLIENT

View File

@ -21,10 +21,10 @@
*/
/**
* @brief invoked by tr_sessionInit () to set up the locations of the resume, torrent, and clutch directories.
* @see tr_getResumeDir ()
* @see tr_getTorrentDir ()
* @see tr_getWebClientDir ()
* @brief invoked by tr_sessionInit() to set up the locations of the resume, torrent, and clutch directories.
* @see tr_getResumeDir()
* @see tr_getTorrentDir()
* @see tr_getWebClientDir()
*/
void tr_setConfigDir(tr_session* session, char const* configDir);

View File

@ -59,12 +59,12 @@ static inline void* tr_ptrArrayNth(tr_ptrArray* array, int i)
/** @brief Remove the last item from the array and return it
@return the pointer that's been removed from the array
@see tr_ptrArrayBack () */
@see tr_ptrArrayBack() */
void* tr_ptrArrayPop(tr_ptrArray* array);
/** @brief Return the last item in a tr_ptrArray
@return the last item in a tr_ptrArray, or NULL if the array is empty
@see tr_ptrArrayPop () */
@see tr_ptrArrayPop() */
static inline void* tr_ptrArrayBack(tr_ptrArray* array)
{
return array->n_items > 0 ? tr_ptrArrayNth(array, array->n_items - 1) : NULL;

View File

@ -13,9 +13,9 @@
#include "error.h"
#include "file.h"
#include "log.h"
#include "metainfo.h" /* tr_metainfoGetBasename () */
#include "metainfo.h" /* tr_metainfoGetBasename() */
#include "peer-mgr.h" /* pex */
#include "platform.h" /* tr_getResumeDir () */
#include "platform.h" /* tr_getResumeDir() */
#include "resume.h"
#include "session.h"
#include "torrent.h"

View File

@ -18,14 +18,14 @@
#include <event2/http_struct.h> /* TODO: eventually remove this */
#include "transmission.h"
#include "crypto.h" /* tr_ssha1_matches () */
#include "crypto-utils.h" /* tr_rand_buffer () */
#include "crypto.h" /* tr_ssha1_matches() */
#include "crypto-utils.h" /* tr_rand_buffer() */
#include "error.h"
#include "fdlimit.h"
#include "list.h"
#include "log.h"
#include "net.h"
#include "platform.h" /* tr_getWebClientDir () */
#include "platform.h" /* tr_getWebClientDir() */
#include "ptrarray.h"
#include "rpcimpl.h"
#include "rpc-server.h"
@ -347,9 +347,9 @@ static void add_response(struct evhttp_request* req, struct tr_rpc_server* serve
server->stream.next_in = content_ptr;
server->stream.avail_in = content_len;
/* allocate space for the raw data and call deflate () just once --
/* allocate space for the raw data and call deflate() just once --
* we won't use the deflated data if it's longer than the raw data,
* so it's okay to let deflate () run out of output buffer space */
* so it's okay to let deflate() run out of output buffer space */
evbuffer_reserve_space(out, content_len, iovec, 1);
server->stream.next_out = iovec[0].iov_base;
server->stream.avail_out = iovec[0].iov_len;
@ -454,7 +454,7 @@ static void handle_web_client(struct evhttp_request* req, struct tr_rpc_server*
"index.html is located.</p>"
"<p>Package Builders: to set a custom default at compile time, "
"#define PACKAGE_DATA_DIR in libtransmission/platform.c "
"or tweak tr_getClutchDir () by hand.</p>");
"or tweak tr_getClutchDir() by hand.</p>");
}
else
{

View File

@ -1560,7 +1560,7 @@ static void gotNewBlocklist(tr_session* session, bool did_connect UNUSED, bool d
tr_error* error = NULL;
/* this is an odd Magic Number required by zlib to enable gz support.
See zlib's inflateInit2 () documentation for a full description */
See zlib's inflateInit2() documentation for a full description */
int const windowBits = 15 + 32;
stream.zalloc = (alloc_func)Z_NULL;

View File

@ -23,7 +23,7 @@
#include "session-id.h"
#include "utils.h"
#define SESSION_ID_SIZE 48
#define SESSION_ID_SIZE 48
#define SESSION_ID_DURATION_SEC (60 * 60) /* expire in an hour */
struct tr_session_id

View File

@ -15,11 +15,11 @@
#include <signal.h>
#ifndef _WIN32
#include <sys/types.h> /* umask () */
#include <sys/stat.h> /* umask () */
#include <sys/types.h> /* umask() */
#include <sys/stat.h> /* umask() */
#endif
#include <event2/dns.h> /* evdns_base_free () */
#include <event2/dns.h> /* evdns_base_free() */
#include <event2/event.h>
#include <libutp/utp.h>
@ -40,7 +40,7 @@
#include "net.h"
#include "peer-io.h"
#include "peer-mgr.h"
#include "platform.h" /* tr_lock, tr_getTorrentDir () */
#include "platform.h" /* tr_lock, tr_getTorrentDir() */
#include "platform-quota.h" /* tr_device_info_free() */
#include "port-forwarding.h"
#include "rpc-server.h"
@ -48,7 +48,7 @@
#include "session-id.h"
#include "stats.h"
#include "torrent.h"
#include "tr-dht.h" /* tr_dhtUpkeep () */
#include "tr-dht.h" /* tr_dhtUpkeep() */
#include "tr-udp.h"
#include "tr-utp.h"
#include "tr-lpd.h"
@ -1972,7 +1972,7 @@ static void sessionCloseImplStart(tr_session* session)
/* Close the announcer *after* closing the torrents
so that all the &event=stopped messages will be
queued to be sent by tr_announcerClose () */
queued to be sent by tr_announcerClose() */
tr_announcerClose(session);
/* and this goes *after* announcer close so that
@ -2087,7 +2087,7 @@ void tr_sessionClose(tr_session* session)
if (deadlineReached(deadline) && !forced)
{
dbgmsg("calling event_loopbreak ()");
dbgmsg("calling event_loopbreak()");
forced = true;
event_base_loopbreak(session->event_base);
}
@ -2721,7 +2721,7 @@ char const* tr_sessionFindTorrentFile(tr_session const* session, char const* has
void tr_sessionSetTorrentFile(tr_session* session, char const* hashString, char const* filename)
{
/* since we walk session->configDir/torrents/ to build the lookup table,
* and tr_sessionSetTorrentFile () is just to tell us there's a new file
* and tr_sessionSetTorrentFile() is just to tell us there's a new file
* in that same directory, we don't need to do anything here if the
* lookup table hasn't been built yet */
if (session->metainfoLookup)

View File

@ -9,7 +9,7 @@
#include "transmission.h"
#include "session.h"
#include "log.h"
#include "platform.h" /* tr_sessionGetConfigDir () */
#include "platform.h" /* tr_sessionGetConfigDir() */
#include "stats.h"
#include "utils.h" /* tr_buildPath */
#include "variant.h"

View File

@ -11,8 +11,8 @@
#include "transmission.h"
#include "file.h"
#include "magnet.h"
#include "session.h" /* tr_sessionFindTorrentFile () */
#include "torrent.h" /* tr_ctorGetSave () */
#include "session.h" /* tr_sessionFindTorrentFile() */
#include "torrent.h" /* tr_ctorGetSave() */
#include "utils.h" /* tr_new0 */
#include "variant.h"

View File

@ -7,12 +7,12 @@
*/
#include <assert.h>
#include <string.h> /* memcpy (), memset (), memcmp () */
#include <string.h> /* memcpy(), memset(), memcmp() */
#include <event2/buffer.h>
#include "transmission.h"
#include "crypto-utils.h" /* tr_sha1 () */
#include "crypto-utils.h" /* tr_sha1() */
#include "file.h"
#include "log.h"
#include "magnet.h"

View File

@ -7,13 +7,13 @@
*/
#include <errno.h> /* EINVAL */
#include <signal.h> /* signal () */
#include <signal.h> /* signal() */
#ifndef _WIN32
#include <sys/wait.h> /* wait () */
#include <unistd.h> /* fork (), execvp (), _exit () */
#include <sys/wait.h> /* wait() */
#include <unistd.h> /* fork(), execvp(), _exit() */
#else
#include <windows.h> /* CreateProcess (), GetLastError () */
#include <windows.h> /* CreateProcess(), GetLastError() */
#endif
#include <assert.h>
@ -23,7 +23,7 @@
#include <stdlib.h> /* qsort */
#include <limits.h> /* INT_MAX */
#include <event2/util.h> /* evutil_vsnprintf () */
#include <event2/util.h> /* evutil_vsnprintf() */
#include "transmission.h"
#include "announcer.h"
@ -34,7 +34,7 @@
#include "error.h"
#include "fdlimit.h" /* tr_fdTorrentClose */
#include "file.h"
#include "inout.h" /* tr_ioTestPiece () */
#include "inout.h" /* tr_ioTestPiece() */
#include "log.h"
#include "magnet.h"
#include "metainfo.h"
@ -46,7 +46,7 @@
#include "session.h"
#include "torrent.h"
#include "torrent-magnet.h"
#include "trevent.h" /* tr_runInEventThread () */
#include "trevent.h" /* tr_runInEventThread() */
#include "utils.h"
#include "variant.h"
#include "verify.h"

View File

@ -14,7 +14,7 @@
#include "bandwidth.h" /* tr_bandwidth */
#include "completion.h" /* tr_completion */
#include "session.h" /* tr_sessionLock (), tr_sessionUnlock () */
#include "session.h" /* tr_sessionLock(), tr_sessionUnlock() */
#include "utils.h" /* TR_GNUC_PRINTF */
struct tr_torrent_tiers;
@ -93,7 +93,7 @@ tr_verify_state;
void tr_torrentSetVerifyState(tr_torrent* tor, tr_verify_state state);
tr_torrent_activity tr_torrentGetActivity(tr_torrent const* tor);
tr_torrent_activity tr_torrentGetActivity(tr_torrent const* tor);
struct tr_incomplete_metadata;
@ -345,9 +345,9 @@ uint32_t tr_getBlockSize(uint32_t pieceSize);
void tr_torrentGotBlock(tr_torrent* tor, tr_block_index_t blockIndex);
/**
* @brief Like tr_torrentFindFile (), but splits the filename into base and subpath;
* @brief Like tr_torrentFindFile(), but splits the filename into base and subpath;
*
* If the file is found, "tr_buildPath (base, subpath, NULL)"
* If the file is found, "tr_buildPath(base, subpath, NULL)"
* will generate the complete filename.
*
* @return true if the file is found, false otherwise.

View File

@ -25,8 +25,8 @@
/* ansi */
#include <errno.h>
#include <stdio.h>
#include <string.h> /* memcpy (), memset (), memchr (), strlen () */
#include <stdlib.h> /* atoi () */
#include <string.h> /* memcpy(), memset(), memchr(), strlen() */
#include <stdlib.h> /* atoi() */
/* posix */
#include <signal.h> /* sig_atomic_t */
@ -39,7 +39,7 @@
#else
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h> /* socket (), bind () */
#include <sys/socket.h> /* socket(), bind() */
#include <netdb.h>
#include <netinet/in.h> /* sockaddr_in */
#endif
@ -54,12 +54,12 @@
#include "file.h"
#include "log.h"
#include "net.h"
#include "peer-mgr.h" /* tr_peerMgrCompactToPex () */
#include "platform.h" /* tr_threadNew () */
#include "peer-mgr.h" /* tr_peerMgrCompactToPex() */
#include "platform.h" /* tr_threadNew() */
#include "session.h"
#include "torrent.h" /* tr_torrentFindFromHash () */
#include "torrent.h" /* tr_torrentFindFromHash() */
#include "tr-dht.h"
#include "trevent.h" /* tr_runInEventThread () */
#include "trevent.h" /* tr_runInEventThread() */
#include "utils.h"
#include "variant.h"

View File

@ -6,9 +6,9 @@
*
*/
#include <ctype.h> /* isspace () */
#include <ctype.h> /* isspace() */
#include <stdio.h>
#include <stdlib.h> /* exit () */
#include <stdlib.h> /* exit() */
#include <string.h>
#include "tr-getopt.h"

View File

@ -23,12 +23,12 @@ extern int tr_optind;
typedef struct tr_option
{
int val; /* the value to return from tr_getopt () */
int val; /* the value to return from tr_getopt() */
char const* longName; /* --long-form */
char const* description; /* option's description for tr_getopt_usage () */
char const* description; /* option's description for tr_getopt_usage() */
char const* shortName; /* short form */
int has_arg; /* 0 for no argument, 1 for argument */
char const* argName; /* argument's description for tr_getopt_usage () */
char const* argName; /* argument's description for tr_getopt_usage() */
}
tr_option;
@ -44,7 +44,7 @@ enum
};
/**
* @brief similar to getopt ()
* @brief similar to getopt()
* @return TR_GETOPT_DONE, TR_GETOPT_ERR, TR_GETOPT_UNK, or the matching tr_option's `val' field
*/
int tr_getopt(char const* summary, int argc, char const* const* argv, tr_option const* opts, char const** setme_optarg);

View File

@ -23,11 +23,11 @@ THE SOFTWARE.
/* ansi */
#include <errno.h>
#include <stdio.h>
#include <string.h> /* strlen (), strncpy (), strstr (), memset () */
#include <string.h> /* strlen(), strncpy(), strstr(), memset() */
/* posix */
#include <signal.h> /* sig_atomic_t */
#include <ctype.h> /* toupper () */
#include <ctype.h> /* toupper() */
#ifdef _WIN32
#include <inttypes.h>
@ -35,9 +35,9 @@ THE SOFTWARE.
typedef uint16_t in_port_t; /* all missing */
#else
#include <sys/time.h>
#include <unistd.h> /* close () */
#include <unistd.h> /* close() */
#include <sys/types.h>
#include <sys/socket.h> /* socket (), bind () */
#include <sys/socket.h> /* socket(), bind() */
#include <netinet/in.h> /* sockaddr_in */
#endif
@ -49,9 +49,9 @@ typedef uint16_t in_port_t; /* all missing */
#include "transmission.h"
#include "log.h"
#include "net.h"
#include "peer-mgr.h" /* tr_peerMgrAddPex () */
#include "peer-mgr.h" /* tr_peerMgrAddPex() */
#include "session.h"
#include "torrent.h" /* tr_torrentFindFromHash () */
#include "torrent.h" /* tr_torrentFindFromHash() */
#include "tr-lpd.h"
#include "utils.h"
#include "version.h"
@ -511,7 +511,7 @@ bool tr_lpdSendAnnounce(tr_torrent const* t)
{
int const len = strlen(query);
/* destination address info has already been set up in tr_lpdInit (),
/* destination address info has already been set up in tr_lpdInit(),
* so we refrain from preparing another sockaddr_in here */
int res = sendto(lpd_socket2, (void const*)query, len, 0, (struct sockaddr const*)&lpd_mcastAddr, sizeof lpd_mcastAddr);
@ -593,7 +593,7 @@ static int tr_lpdConsiderAnnounce(tr_pex* peer, char const* const msg)
tr_peerMgrAddPex(tor, TR_PEER_FROM_LPD, peer, -1);
tr_logAddTorDbg(tor, "Learned %d local peer from LPD (%s:%u)", 1, tr_address_to_string(&peer->addr), peerPort);
/* periodic reconnectPulse () deals with the rest... */
/* periodic reconnectPulse() deals with the rest... */
return 1;
}

View File

@ -37,7 +37,7 @@ bool tr_lpdSendAnnounce(tr_torrent const*);
*
* @def lengthof
* @brief returns the static length of a C array type
* @note A lower case macro name is tolerable here since this definition of lengthof ()
* @note A lower case macro name is tolerable here since this definition of lengthof()
* is intimately related to sizeof semantics.
* Meaningful return values are only guaranteed for true array types. */
#define lengthof(arr) (sizeof(*(arr)) > 0 ? sizeof(arr) / sizeof(*(arr)) : 0)

View File

@ -22,13 +22,13 @@ THE SOFTWARE.
*/
#include <assert.h>
#include <string.h> /* memcmp (), memcpy (), memset () */
#include <stdlib.h> /* malloc (), free () */
#include <string.h> /* memcmp(), memcpy(), memset() */
#include <stdlib.h> /* malloc(), free() */
#ifdef _WIN32
#include <io.h> /* dup2 () */
#include <io.h> /* dup2() */
#else
#include <unistd.h> /* dup2 () */
#include <unistd.h> /* dup2() */
#endif
#include <event2/event.h>

View File

@ -31,7 +31,7 @@ THE SOFTWARE.
#include "log.h"
#include "net.h"
#include "session.h"
#include "crypto-utils.h" /* tr_rand_int_weak () */
#include "crypto-utils.h" /* tr_rand_int_weak() */
#include "peer-mgr.h"
#include "tr-utp.h"
#include "utils.h"
@ -52,22 +52,22 @@ THE SOFTWARE.
void UTP_Close(struct UTPSocket* socket)
{
tr_logAddNamedError(MY_NAME, "UTP_Close (%p) was called.", socket);
dbgmsg("UTP_Close (%p) was called.", socket);
tr_logAddNamedError(MY_NAME, "UTP_Close(%p) was called.", socket);
dbgmsg("UTP_Close(%p) was called.", socket);
assert(0); /* FIXME: this is too much for the long term, but probably needed in the short term */
}
void UTP_RBDrained(struct UTPSocket* socket)
{
tr_logAddNamedError(MY_NAME, "UTP_RBDrained (%p) was called.", socket);
dbgmsg("UTP_RBDrained (%p) was called.", socket);
tr_logAddNamedError(MY_NAME, "UTP_RBDrained(%p) was called.", socket);
dbgmsg("UTP_RBDrained(%p) was called.", socket);
assert(0); /* FIXME: this is too much for the long term, but probably needed in the short term */
}
bool UTP_Write(struct UTPSocket* socket, size_t count)
{
tr_logAddNamedError(MY_NAME, "UTP_RBDrained (%p, %zu) was called.", socket, count);
dbgmsg("UTP_RBDrained (%p, %zu) was called.", socket, count);
tr_logAddNamedError(MY_NAME, "UTP_RBDrained(%p, %zu) was called.", socket, count);
dbgmsg("UTP_RBDrained(%p, %zu) was called.", socket, count);
assert(0); /* FIXME: this is too much for the long term, but probably needed in the short term */
return false;
}

View File

@ -95,10 +95,10 @@ tr_encryption_mode;
/**
* @addtogroup tr_session Session
*
* A libtransmission session is created by calling tr_sessionInit ().
* A libtransmission session is created by calling tr_sessionInit().
* libtransmission creates a thread for itself so that it can operate
* independently of the caller's event loop. The session will continue
* until tr_sessionClose () is called.
* until tr_sessionClose() is called.
*
* @{
*/
@ -121,7 +121,7 @@ char const* tr_getDefaultConfigDir(char const* appname);
* The default download directory is determined this way:
* -# If the HOME environment variable is set, "${HOME}/Downloads" is used.
* -# On Windows, "${CSIDL_MYDOCUMENTS}/Downloads" is used.
* -# Otherwise, getpwuid (getuid ())->pw_dir + "/Downloads" is used.
* -# Otherwise, getpwuid(getuid())->pw_dir + "/Downloads" is used.
*/
char const* tr_getDefaultDownloadDir(void);
@ -143,17 +143,17 @@ char const* tr_getDefaultDownloadDir(void);
* tr_variant settings;
* int64_t i;
*
* tr_variantInitDict (&settings, 0);
* tr_sessionGetDefaultSettings (&settings);
* if (tr_variantDictFindInt (&settings, TR_PREFS_KEY_PEER_PORT, &i))
* fprintf (stderr, "the default peer port is %d\n", (int)i);
* tr_variantFree (&settings);
* tr_variantInitDict(&settings, 0);
* tr_sessionGetDefaultSettings(&settings);
* if (tr_variantDictFindInt(&settings, TR_PREFS_KEY_PEER_PORT, &i))
* fprintf(stderr, "the default peer port is %d\n", (int)i);
* tr_variantFree(&settings);
* @endcode
*
* @param setme_dictionary pointer to a tr_variant dictionary
* @see tr_sessionLoadSettings ()
* @see tr_sessionInit ()
* @see tr_getDefaultConfigDir ()
* @see tr_sessionLoadSettings()
* @see tr_sessionInit()
* @see tr_getDefaultConfigDir()
*/
void tr_sessionGetDefaultSettings(struct tr_variant* setme_dictionary);
@ -164,7 +164,7 @@ void tr_sessionGetDefaultSettings(struct tr_variant* setme_dictionary);
*
* @param session the session to query
* @param setme_dictionary the dictionary to populate
* @see tr_sessionGetDefaultSettings ()
* @see tr_sessionGetDefaultSettings()
*/
void tr_sessionGetSettings(tr_session* session, struct tr_variant* setme_dictionary);
@ -178,9 +178,9 @@ void tr_sessionGetSettings(tr_session* session, struct tr_variant* setme_diction
* @param configDir the configuration directory to find settings.json
* @param appName if configDir is empty, appName is used to find the default dir.
* @return success true if the settings were loaded, false otherwise
* @see tr_sessionGetDefaultSettings ()
* @see tr_sessionInit ()
* @see tr_sessionSaveSettings ()
* @see tr_sessionGetDefaultSettings()
* @see tr_sessionInit()
* @see tr_sessionSaveSettings()
*/
bool tr_sessionLoadSettings(struct tr_variant* dictionary, char const* configDir, char const* appName);
@ -193,7 +193,7 @@ bool tr_sessionLoadSettings(struct tr_variant* dictionary, char const* configDir
* @param session the session to save
* @param configDir the directory to write to
* @param dictionary the dictionary to save
* @see tr_sessionLoadSettings ()
* @see tr_sessionLoadSettings()
*/
void tr_sessionSaveSettings(tr_session* session, char const* configDir, struct tr_variant const* dictionary);
@ -206,25 +206,25 @@ void tr_sessionSaveSettings(tr_session* session, char const* configDir, struct t
* tr_session* session;
* char const* configDir;
*
* tr_variantInitDict (&settings, 0);
* tr_sessionGetDefaultSettings (&settings);
* configDir = tr_getDefaultConfigDir ("Transmission");
* session = tr_sessionInit (configDir, true, &settings);
* tr_variantInitDict(&settings, 0);
* tr_sessionGetDefaultSettings(&settings);
* configDir = tr_getDefaultConfigDir("Transmission");
* session = tr_sessionInit(configDir, true, &settings);
*
* tr_variantFree (&settings);
* tr_variantFree(&settings);
* @endcode
*
* @param configDir where Transmission will look for resume files, blocklists, etc.
* @param messageQueueingEnabled if false, messages will be dumped to stderr
* @param settings libtransmission settings
* @see tr_sessionGetDefaultSettings ()
* @see tr_sessionLoadSettings ()
* @see tr_getDefaultConfigDir ()
* @see tr_sessionGetDefaultSettings()
* @see tr_sessionLoadSettings()
* @see tr_getDefaultConfigDir()
*/
tr_session* tr_sessionInit(char const* configDir, bool messageQueueingEnabled, struct tr_variant* settings);
/** @brief Update a session's settings from a benc dictionary
like to the one used in tr_sessionInit () */
like to the one used in tr_sessionInit() */
void tr_sessionSet(tr_session* session, struct tr_variant* settings);
/** @brief Rescan the blocklists directory and
@ -232,31 +232,31 @@ void tr_sessionSet(tr_session* session, struct tr_variant* settings);
void tr_sessionReloadBlocklists(tr_session* session);
/** @brief End a libtransmission session
@see tr_sessionInit () */
@see tr_sessionInit() */
void tr_sessionClose(tr_session*);
/**
* @brief Return the session's configuration directory.
*
* This is where transmission stores its .torrent files, .resume files,
* blocklists, etc. It's set in tr_transmissionInit () and is immutable
* blocklists, etc. It's set in tr_transmissionInit() and is immutable
* during the session.
*/
char const* tr_sessionGetConfigDir(tr_session const*);
/**
* @brief Set the per-session default download folder for new torrents.
* @see tr_sessionInit ()
* @see tr_sessionGetDownloadDir ()
* @see tr_ctorSetDownloadDir ()
* @see tr_sessionInit()
* @see tr_sessionGetDownloadDir()
* @see tr_ctorSetDownloadDir()
*/
void tr_sessionSetDownloadDir(tr_session* session, char const* downloadDir);
/**
* @brief Get the default download folder for new torrents.
*
* This is set by tr_sessionInit () or tr_sessionSetDownloadDir (),
* and can be overridden on a per-torrent basis by tr_ctorSetDownloadDir ().
* This is set by tr_sessionInit() or tr_sessionSetDownloadDir(),
* and can be overridden on a per-torrent basis by tr_ctorSetDownloadDir().
*/
char const* tr_sessionGetDownloadDir(tr_session const* session);
@ -286,14 +286,14 @@ tr_priority_t tr_ctorGetBandwidthPriority(tr_ctor const* ctor);
* Torrents aren't moved as a result of changing the session's incomplete dir --
* it's applied to new torrents, not existing ones.
*
* tr_torrentSetLocation () overrules the incomplete dir: when a user specifies
* tr_torrentSetLocation() overrules the incomplete dir: when a user specifies
* a new location, that becomes the torrent's new downloadDir and the torrent
* is moved there immediately regardless of whether or not it's complete.
*
* @see tr_sessionInit ()
* @see tr_sessionGetIncompleteDir ()
* @see tr_sessionSetIncompleteDirEnabled ()
* @see tr_sessionGetIncompleteDirEnabled ()
* @see tr_sessionInit()
* @see tr_sessionGetIncompleteDir()
* @see tr_sessionSetIncompleteDirEnabled()
* @see tr_sessionGetIncompleteDirEnabled()
*/
void tr_sessionSetIncompleteDir(tr_session* session, char const* dir);
@ -313,7 +313,7 @@ bool tr_sessionIsIncompleteDirEnabled(tr_session const* session);
* This is not retroactive -- toggling this will not rename existing files.
* It only applies to new files created by Transmission after this API call.
*
* @see tr_sessionIsIncompleteFileNamingEnabled ()
* @see tr_sessionIsIncompleteFileNamingEnabled()
*/
void tr_sessionSetIncompleteFileNamingEnabled(tr_session* session, bool);
@ -326,23 +326,23 @@ bool tr_sessionIsIncompleteFileNamingEnabled(tr_session const* session);
* @details If true, libtransmission will open a server socket to listen
* for incoming http RPC requests as described in docs/rpc-spec.txt.
*
* This is intially set by tr_sessionInit () and can be
* queried by tr_sessionIsRPCEnabled ().
* This is intially set by tr_sessionInit() and can be
* queried by tr_sessionIsRPCEnabled().
*/
void tr_sessionSetRPCEnabled(tr_session* session, bool isEnabled);
/** @brief Get whether or not RPC calls are allowed in this session.
@see tr_sessionInit ()
@see tr_sessionSetRPCEnabled () */
@see tr_sessionInit()
@see tr_sessionSetRPCEnabled() */
bool tr_sessionIsRPCEnabled(tr_session const* session);
/** @brief Specify which port to listen for RPC requests on.
@see tr_sessionInit ()
@see tr_sessionInit()
@see tr_sessionGetRPCPort */
void tr_sessionSetRPCPort(tr_session* session, tr_port port);
/** @brief Get which port to listen for RPC requests on.
@see tr_sessionInit ()
@see tr_sessionInit()
@see tr_sessionSetRPCPort */
tr_port tr_sessionGetRPCPort(tr_session const* session);
@ -358,7 +358,7 @@ void tr_sessionSetRPCUrl(tr_session* session, char const* url);
/**
* @brief Get the base URL.
* @see tr_sessionInit ()
* @see tr_sessionInit()
* @see tr_sessionSetRPCUrl
*/
char const* tr_sessionGetRPCUrl(tr_session const* session);
@ -389,8 +389,8 @@ void tr_sessionSetRPCUsername(tr_session* session, char const* username);
/** @brief get the password used to restrict RPC requests.
@return the password string.
@see tr_sessionInit ()
@see tr_sessionSetRPCPassword () */
@see tr_sessionInit()
@see tr_sessionSetRPCPassword() */
char const* tr_sessionGetRPCPassword(tr_session const* session);
char const* tr_sessionGetRPCUsername(tr_session const* session);
@ -446,7 +446,7 @@ void tr_sessionSetRPCCallback(tr_session* session, tr_rpc_func func, void* user_
***
**/
/** @brief Used by tr_sessionGetStats () and tr_sessionGetCumulativeStats () */
/** @brief Used by tr_sessionGetStats() and tr_sessionGetCumulativeStats() */
typedef struct tr_session_stats
{
float ratio; /* TR_RATIO_INF, TR_RATIO_NA, or total up/down */
@ -627,19 +627,19 @@ void tr_torrentSetPriority(tr_torrent*, tr_priority_t);
**** There are independent queues for seeding (TR_UP) and leeching (TR_DOWN).
****
**** If the session already has enough non-stalled seeds/leeches when
**** tr_torrentStart () is called, the torrent will be moved into the
**** tr_torrentStart() is called, the torrent will be moved into the
**** appropriate queue and its state will be TR_STATUS_{DOWNLOAD,SEED}_WAIT.
****
**** To bypass the queue and unconditionally start the torrent use
**** tr_torrentStartNow ().
**** tr_torrentStartNow().
****
**** Torrents can be moved in the queue using the simple functions
**** tr_torrentQueueMove{Top,Up,Down,Bottom}. They can be moved to
**** arbitrary points in the queue with tr_torrentSetQueuePosition ().
**** arbitrary points in the queue with tr_torrentSetQueuePosition().
****
***/
/** @brief Like tr_torrentStart (), but resumes right away regardless of the queues. */
/** @brief Like tr_torrentStart(), but resumes right away regardless of the queues. */
void tr_torrentStartNow(tr_torrent*);
/** @brief Return the queued torrent's position in the queue it's in. [0...n) */
@ -652,16 +652,16 @@ void tr_torrentSetQueuePosition(tr_torrent*, int queuePosition);
/**
**/
/** @brief Convenience function for moving a batch of torrents to the front of their queue (s) */
/** @brief Convenience function for moving a batch of torrents to the front of their queue(s) */
void tr_torrentsQueueMoveTop(tr_torrent** torrents, int torrentCount);
/** @brief Convenience function for moving a batch of torrents ahead one step in their queue (s) */
/** @brief Convenience function for moving a batch of torrents ahead one step in their queue(s) */
void tr_torrentsQueueMoveUp(tr_torrent** torrents, int torrentCount);
/** @brief Convenience function for moving a batch of torrents back one step in their queue (s) */
/** @brief Convenience function for moving a batch of torrents back one step in their queue(s) */
void tr_torrentsQueueMoveDown(tr_torrent** torrents, int torrentCount);
/** @brief Convenience function for moving a batch of torrents to the back of their queue (s) */
/** @brief Convenience function for moving a batch of torrents to the back of their queue(s) */
void tr_torrentsQueueMoveBottom(tr_torrent** torrents, int torrentCount);
/**
@ -683,7 +683,7 @@ bool tr_sessionGetQueueEnabled(tr_session const*, tr_direction);
**/
/** @brief Consider torrent as 'stalled' when it's been inactive for N minutes.
Stalled torrents are left running but are not counted by tr_sessionGetQueueSize (). */
Stalled torrents are left running but are not counted by tr_sessionGetQueueSize(). */
void tr_sessionSetQueueStalledMinutes(tr_session*, int minutes);
/** @return the number of minutes a torrent can be idle before being considered as stalled */
@ -707,7 +707,7 @@ void tr_torrentSetQueueStartCallback(tr_torrent* torrent, void (* callback)(tr_t
***/
/**
* Load all the torrents in tr_getTorrentDir ().
* Load all the torrents in tr_getTorrentDir().
* This can be used at startup to kickstart all the torrents
* from the previous session.
*/
@ -814,7 +814,7 @@ void tr_blocklistSetURL(tr_session*, char const* url);
char const* tr_blocklistGetURL(tr_session const*);
/** @brief the file in the $config/blocklists/ directory that's
used by tr_blocklistSetContent () and "blocklist-update" */
used by tr_blocklistSetContent() and "blocklist-update" */
#define DEFAULT_BLOCKLIST_FILENAME "blocklist.bin"
/** @} */
@ -827,20 +827,20 @@ char const* tr_blocklistGetURL(tr_session const*);
to create a tr_torrent object.
To remedy this, a Torrent Constructor (struct tr_ctor) has been introduced:
- Simplifies the API to two functions: tr_torrentParse () and tr_torrentNew ()
- Simplifies the API to two functions: tr_torrentParse() and tr_torrentNew()
- You can set the fields you want; the system sets defaults for the rest.
- You can specify whether or not your fields should supercede resume's.
- We can add new features to tr_ctor without breaking tr_torrentNew ()'s API.
- We can add new features to tr_ctor without breaking tr_torrentNew()'s API.
All the tr_ctor{Get,Set}* () functions with a return value return
an error number, or zero if no error occurred.
You must call one of the SetMetainfo () functions before creating
You must call one of the SetMetainfo() functions before creating
a torrent with a tr_ctor. The other functions are optional.
You can reuse a single tr_ctor to create a batch of torrents --
just call one of the SetMetainfo () functions between each
tr_torrentNew () call.
just call one of the SetMetainfo() functions between each
tr_torrentNew() call.
Every call to tr_ctorSetMetainfo* () frees the previous metainfo.
*/
@ -854,9 +854,9 @@ tr_ctorMode;
/** @brief Create a torrent constructor object used to instantiate a tr_torrent
@param session_or_NULL the tr_session.
This is required if you're going to call tr_torrentNew (),
but you can use NULL for tr_torrentParse ().
@see tr_torrentNew (), tr_torrentParse () */
This is required if you're going to call tr_torrentNew(),
but you can use NULL for tr_torrentParse().
@see tr_torrentNew(), tr_torrentParse() */
tr_ctor* tr_ctorNew(tr_session const* session_or_NULL);
/** @brief Free a torrent constructor object */
@ -876,7 +876,7 @@ int tr_ctorSetMetainfo(tr_ctor* ctor, uint8_t const* metainfo, size_t len);
int tr_ctorSetMetainfoFromFile(tr_ctor* ctor, char const* filename);
/**
* @brief Set the metainfo from an existing file in tr_getTorrentDir ().
* @brief Set the metainfo from an existing file in tr_getTorrentDir().
*
* This is used by the Mac client on startup to pick and choose which
* torrents to load
@ -887,8 +887,8 @@ int tr_ctorSetMetainfoFromHash(tr_ctor* ctor, char const* hashString);
void tr_ctorSetPeerLimit(tr_ctor* ctor, tr_ctorMode mode, uint16_t limit);
/** @brief Set the download folder for the torrent being added with this ctor.
@see tr_ctorSetDownloadDir ()
@see tr_sessionInit () */
@see tr_ctorSetDownloadDir()
@see tr_sessionInit() */
void tr_ctorSetDownloadDir(tr_ctor* ctor, tr_ctorMode mode, char const* directory);
/**
@ -933,7 +933,7 @@ bool tr_ctorGetDeleteSource(tr_ctor const* ctor, bool* setmeDoDelete);
tr_session* tr_ctorGetSession(tr_ctor const* ctor);
/** @brief Get the .torrent file that this ctor's metainfo came from,
or NULL if tr_ctorSetMetainfoFromFile () wasn't used */
or NULL if tr_ctorSetMetainfoFromFile() wasn't used */
char const* tr_ctorGetSourceFile(tr_ctor const* ctor);
typedef enum
@ -953,11 +953,11 @@ tr_parse_result;
*
* @param setme_info_or_NULL If parsing is successful and setme_info is non-NULL,
* the parsed metainfo is stored there and sould be freed
* by calling tr_metainfoFree () when no longer needed.
* by calling tr_metainfoFree() when no longer needed.
*
* Notes:
*
* 1. tr_torrentParse () won't be able to check for duplicates -- and therefore
* 1. tr_torrentParse() won't be able to check for duplicates -- and therefore
* won't return TR_PARSE_DUPLICATE -- unless ctor's "download-dir" and
* session variable is set.
*
@ -1026,11 +1026,11 @@ typedef void (* tr_torrent_rename_done_func)(tr_torrent* torrent, char const* ol
* info.files[0].name is "frobnitz-linux/checksum" and
* info.files[1].name is "frobnitz-linux/frobnitz.iso".
*
* 1. tr_torrentRenamePath (tor, "frobnitz-linux", "foo") will rename
* 1. tr_torrentRenamePath(tor, "frobnitz-linux", "foo") will rename
* the "frotbnitz-linux" folder as "foo", and update both info.name
* and info.files[*].name.
*
* 2. tr_torrentRenamePath (tor, "frobnitz-linux/checksum", "foo") will
* 2. tr_torrentRenamePath(tor, "frobnitz-linux/checksum", "foo") will
* rename the "frobnitz-linux/checksum" file as "foo" and update
* files[0].name to "frobnitz-linux/foo".
*
@ -1084,7 +1084,7 @@ tr_torrent* tr_torrentFindFromId(tr_session* session, int id);
tr_torrent* tr_torrentFindFromHash(tr_session* session, uint8_t const* hash);
/** @brief Convenience function similar to tr_torrentFindFromHash () */
/** @brief Convenience function similar to tr_torrentFindFromHash() */
tr_torrent* tr_torrentFindFromMagnetLink(tr_session* session, char const* link);
/**
@ -1095,7 +1095,7 @@ char const* tr_torrentName(tr_torrent const*);
/**
* @brief find the location of a torrent's file by looking with and without
* the ".part" suffix, looking in downloadDir and incompleteDir, etc.
* @return a newly-allocated string (that must be tr_freed () by the caller
* @return a newly-allocated string (that must be tr_free()d by the caller
* when done) that gives the location of this file on disk,
* or NULL if no file exists yet.
* @param tor the torrent whose file we're looking for
@ -1197,9 +1197,9 @@ void tr_torrentSetFilePriorities(tr_torrent* torrent, tr_file_index_t const* fil
/**
* @brief Get this torrent's file priorities.
*
* @return A malloc ()ed array of tor->info.fileCount items,
* @return A malloc()ed array of tor->info.fileCount items,
* each holding a TR_PRI_NORMAL, TR_PRI_HIGH, or TR_PRI_LOW.
* It's the caller's responsibility to free () this.
* It's the caller's responsibility to free() this.
*/
tr_priority_t* tr_torrentGetFilePriorities(tr_torrent const* torrent);
@ -1228,7 +1228,7 @@ char* tr_torrentInfoGetMagnetLink(tr_info const* inf);
/**
* Returns a newly-allocated string with a magnet link of the torrent.
* Use tr_free () to free the string when done.
* Use tr_free() to free the string when done.
*/
static inline char* tr_torrentGetMagnetLink(tr_torrent const* tor)
{
@ -1253,7 +1253,7 @@ tr_tracker_info;
* @brief Modify a torrent's tracker list.
*
* This updates both the `torrent' object's tracker list
* and the metainfo file in tr_sessionGetConfigDir ()'s torrent subdirectory.
* and the metainfo file in tr_sessionGetConfigDir()'s torrent subdirectory.
*
* @param torrent The torrent whose tracker list is to be modified
* @param trackers An array of trackers, sorted by tier from first to last.
@ -1340,12 +1340,12 @@ void tr_torrentClearIdleLimitHitCallback(tr_torrent* torrent);
*
* Trackers usually set an announce interval of 15 or 30 minutes.
* Users can send one-time announce requests that override this
* interval by calling tr_torrentManualUpdate ().
* interval by calling tr_torrentManualUpdate().
*
* The wait interval for tr_torrentManualUpdate () is much smaller.
* The wait interval for tr_torrentManualUpdate() is much smaller.
* You can test whether or not a manual update is possible
* (for example, to desensitize the button) by calling
* tr_torrentCanManualUpdate ().
* tr_torrentCanManualUpdate().
*/
void tr_torrentManualUpdate(tr_torrent* torrent);
@ -1533,7 +1533,7 @@ void tr_torrentTrackersFree(tr_tracker_stat* trackerStats, int trackerCount);
* array index in tor->info.webseeds.
* To differentiate "idle" and "stalled" status, idle webseeds will
* return -1 instead of 0 KiB/s.
* NOTE: always free this array with tr_free () when you're done with it.
* NOTE: always free this array with tr_free() when you're done with it.
*/
double* tr_torrentWebSpeeds_KBps(tr_torrent const* torrent);
@ -1700,11 +1700,11 @@ typedef enum
}
tr_stat_errtype;
/** @brief Used by tr_torrentStat () to tell clients about a torrent's state and statistics */
/** @brief Used by tr_torrentStat() to tell clients about a torrent's state and statistics */
typedef struct tr_stat
{
/** The torrent's unique Id.
@see tr_torrentId () */
@see tr_torrentId() */
int id;
/** What is this torrent doing right now? */
@ -1863,7 +1863,7 @@ typedef struct tr_stat
int queuePosition;
/** True if the torrent is running, but has been idle for long enough
to be considered stalled. @see tr_sessionGetQueueStalledMinutes () */
to be considered stalled. @see tr_sessionGetQueueStalledMinutes() */
bool isStalled;
}
tr_stat;
@ -1873,9 +1873,9 @@ tr_stat;
second or so to get a new snapshot of the torrent's status. */
tr_stat const* tr_torrentStat(tr_torrent* torrent);
/** Like tr_torrentStat (), but only recalculates the statistics if it's
/** Like tr_torrentStat(), but only recalculates the statistics if it's
been longer than a second since they were last calculated. This can
reduce the CPU load if you're calling tr_torrentStat () frequently. */
reduce the CPU load if you're calling tr_torrentStat() frequently. */
tr_stat const* tr_torrentStatCached(tr_torrent* torrent);
/** @deprecated */

View File

@ -15,7 +15,7 @@
#ifdef _WIN32
#include <winsock2.h>
#else
#include <unistd.h> /* read (), write (), pipe () */
#include <unistd.h> /* read(), write(), pipe() */
#endif
#include <event2/dns.h>
@ -27,7 +27,7 @@
#include "session.h"
#include "transmission.h"
#include "platform.h" /* tr_lockLock () */
#include "platform.h" /* tr_lockLock() */
#include "trevent.h"
#include "utils.h"

View File

@ -7,9 +7,9 @@
*/
#include <limits.h> /* INT_MAX */
#include <math.h> /* sqrt () */
#include <string.h> /* strlen () */
#include <stdlib.h> /* setenv (), unsetenv () */
#include <math.h> /* sqrt() */
#include <string.h> /* strlen() */
#include <stdlib.h> /* setenv(), unsetenv() */
#ifdef _WIN32
#include <windows.h>

View File

@ -16,23 +16,23 @@
#endif
#include <assert.h>
#include <ctype.h> /* isdigit (), tolower () */
#include <ctype.h> /* isdigit(), tolower() */
#include <errno.h>
#include <float.h> /* DBL_EPSILON */
#include <locale.h> /* localeconv () */
#include <math.h> /* pow (), fabs (), floor () */
#include <locale.h> /* localeconv() */
#include <math.h> /* pow(), fabs(), floor() */
#include <stdio.h>
#include <stdlib.h> /* getenv () */
#include <string.h> /* strerror (), memset (), memmem () */
#include <time.h> /* nanosleep () */
#include <stdlib.h> /* getenv() */
#include <string.h> /* strerror(), memset(), memmem() */
#include <time.h> /* nanosleep() */
#ifdef _WIN32
#include <ws2tcpip.h> /* WSAStartup () */
#include <windows.h> /* Sleep (), GetSystemTimeAsFileTime (), GetEnvironmentVariable () */
#include <shellapi.h> /* CommandLineToArgv () */
#include <ws2tcpip.h> /* WSAStartup() */
#include <windows.h> /* Sleep(), GetSystemTimeAsFileTime(), GetEnvironmentVariable() */
#include <shellapi.h> /* CommandLineToArgv() */
#else
#include <sys/time.h>
#include <unistd.h> /* getpagesize () */
#include <unistd.h> /* getpagesize() */
#endif
#ifdef HAVE_ICONV
@ -51,7 +51,7 @@
#include "log.h"
#include "net.h"
#include "utils.h"
#include "platform.h" /* tr_lockLock () */
#include "platform.h" /* tr_lockLock() */
#include "platform-quota.h" /* tr_device_info_create(), tr_device_info_get_free_space(), tr_device_info_free() */
#include "variant.h"
#include "version.h"

View File

@ -157,7 +157,7 @@ char* tr_buildPath(char const* first_element, ...) TR_GNUC_NULL_TERMINATED TR_GN
int64_t tr_getDirFreeSpace(char const* path);
/**
* @brief Convenience wrapper around timer_add () to have a timer wake up in a number of seconds and microseconds
* @brief Convenience wrapper around timer_add() to have a timer wake up in a number of seconds and microseconds
* @param timer the timer to set
* @param seconds seconds to wait
* @param microseconds microseconds to wait
@ -165,7 +165,7 @@ int64_t tr_getDirFreeSpace(char const* path);
void tr_timerAdd(struct event* timer, int seconds, int microseconds) TR_GNUC_NONNULL(1);
/**
* @brief Convenience wrapper around timer_add () to have a timer wake up in a number of milliseconds
* @brief Convenience wrapper around timer_add() to have a timer wake up in a number of milliseconds
* @param timer the timer to set
* @param milliseconds milliseconds to wait
*/
@ -179,7 +179,7 @@ void tr_wait_msec(long int delay_milliseconds);
/**
* @brief make a copy of 'str' whose non-utf8 content has been corrected or stripped
* @return a newly-allocated string that must be freed with tr_free ()
* @return a newly-allocated string that must be freed with tr_free()
* @param str the string to make a clean copy of
* @param len the length of the string to copy. If -1, the entire string is used.
*/
@ -228,23 +228,23 @@ int tr_main_win32(int argc, char** argv, int (* real_main)(int, char**));
****
***/
/** @brief Portability wrapper around malloc () in which `0' is a safe argument */
/** @brief Portability wrapper around malloc() in which `0' is a safe argument */
void* tr_malloc(size_t size);
/** @brief Portability wrapper around calloc () in which `0' is a safe argument */
/** @brief Portability wrapper around calloc() in which `0' is a safe argument */
void* tr_malloc0(size_t size);
/** @brief Portability wrapper around reallocf () in which `0' is a safe argument */
/** @brief Portability wrapper around reallocf() in which `0' is a safe argument */
void* tr_realloc(void* p, size_t size);
/** @brief Portability wrapper around free () in which `NULL' is a safe argument */
/** @brief Portability wrapper around free() in which `NULL' is a safe argument */
void tr_free(void* p);
/**
* @brief make a newly-allocated copy of a chunk of memory
* @param src the memory to copy
* @param byteCount the number of bytes to copy
* @return a newly-allocated copy of `src' that can be freed with tr_free ()
* @return a newly-allocated copy of `src' that can be freed with tr_free()
*/
void* tr_memdup(void const* src, size_t byteCount);
@ -262,26 +262,26 @@ void* tr_valloc(size_t bufLen);
/**
* @brief make a newly-allocated copy of a substring
* @param in is a void* so that callers can pass in both signed & unsigned without a cast
* @param len length of the substring to copy. if a length less than zero is passed in, strlen (len) is used
* @return a newly-allocated copy of `in' that can be freed with tr_free ()
* @param len length of the substring to copy. if a length less than zero is passed in, strlen(len) is used
* @return a newly-allocated copy of `in' that can be freed with tr_free()
*/
char* tr_strndup(void const* in, size_t len) TR_GNUC_MALLOC;
/**
* @brief make a newly-allocated copy of a string
* @param in is a void* so that callers can pass in both signed & unsigned without a cast
* @return a newly-allocated copy of `in' that can be freed with tr_free ()
* @return a newly-allocated copy of `in' that can be freed with tr_free()
*/
char* tr_strdup(void const* in);
/**
* @brief like strcmp () but gracefully handles NULL strings
* @brief like strcmp() but gracefully handles NULL strings
*/
int tr_strcmp0(char const* str1, char const* str2);
char* evbuffer_free_to_str(struct evbuffer* buf, size_t* result_len);
/** @brief similar to bsearch () but returns the index of the lower bound */
/** @brief similar to bsearch() but returns the index of the lower bound */
int tr_lowerBound(void const* key, void const* base, size_t nmemb, size_t size, int (* compar)(void const* key,
void const* arrayMember), bool* exact_match) TR_GNUC_HOT TR_GNUC_NONNULL(1, 5, 6);
@ -289,19 +289,19 @@ int tr_lowerBound(void const* key, void const* base, size_t nmemb, size_t size,
void tr_quickfindFirstK(void* base, size_t nmemb, size_t size, int (* compar)(void const*, void const*), size_t k);
/**
* @brief sprintf () a string into a newly-allocated buffer large enough to hold it
* @return a newly-allocated string that can be freed with tr_free ()
* @brief sprintf() a string into a newly-allocated buffer large enough to hold it
* @return a newly-allocated string that can be freed with tr_free()
*/
char* tr_strdup_printf(char const* fmt, ...) TR_GNUC_PRINTF(1, 2) TR_GNUC_MALLOC;
char* tr_strdup_vprintf(char const* fmt, va_list args) TR_GNUC_MALLOC;
/** @brief Portability wrapper for strlcpy () that uses the system implementation if available */
/** @brief Portability wrapper for strlcpy() that uses the system implementation if available */
size_t tr_strlcpy(char* dst, void const* src, size_t siz);
/** @brief Portability wrapper for snprintf () that uses the system implementation if available */
/** @brief Portability wrapper for snprintf() that uses the system implementation if available */
int tr_snprintf(char* buf, size_t buflen, char const* fmt, ...) TR_GNUC_PRINTF(3, 4) TR_GNUC_NONNULL(1, 3);
/** @brief Convenience wrapper around strerorr () guaranteed to not return NULL
/** @brief Convenience wrapper around strerorr() guaranteed to not return NULL
@param errnum the error number to describe */
char const* tr_strerror(int errnum);
@ -312,10 +312,10 @@ char* tr_strstrip(char* str);
/** @brief Returns true if the string ends with the specified case-insensitive suffix */
bool tr_str_has_suffix(char const* str, char const* suffix);
/** @brief Portability wrapper for memmem () that uses the system implementation if available */
/** @brief Portability wrapper for memmem() that uses the system implementation if available */
char const* tr_memmem(char const* haystack, size_t haystack_len, char const* needle, size_t needle_len);
/** @brief Portability wrapper for strsep () that uses the system implementation if available */
/** @brief Portability wrapper for strsep() that uses the system implementation if available */
char* tr_strsep(char** str, char const* delim);
/***
@ -348,7 +348,7 @@ double tr_getRatio(uint64_t numerator, uint64_t denominator);
/**
* @brief Given a string like "1-4" or "1-4,6,9,14-51", this returns a
* newly-allocated array of all the integers in the set.
* @return a newly-allocated array of integers that must be freed with tr_free (),
* @return a newly-allocated array of integers that must be freed with tr_free(),
* or NULL if a fragment of the string can't be parsed.
*
* For example, "5-8" will return [ 5, 6, 7, 8 ] and setmeCount will be 4.
@ -358,13 +358,13 @@ int* tr_parseNumberRange(char const* str, size_t str_len, int* setmeCount) TR_GN
/**
* @brief truncate a double value at a given number of decimal places.
*
* this can be used to prevent a printf () call from rounding up:
* this can be used to prevent a printf() call from rounding up:
* call with the decimal_places argument equal to the number of
* decimal places in the printf ()'s precision:
* decimal places in the printf()'s precision:
*
* - printf ("%.2f%%", 99.999 ) ==> "100.00%"
* - printf("%.2f%%", 99.999) ==> "100.00%"
*
* - printf ("%.2f%%", tr_truncd (99.999, 2)) ==> "99.99%"
* - printf("%.2f%%", tr_truncd(99.999, 2)) ==> "99.99%"
* ^ ^
* | These should match |
* +------------------------+
@ -382,10 +382,10 @@ char* tr_strpercent(char* buf, double x, size_t buflen);
*/
char* tr_strratio(char* buf, size_t buflen, double ratio, char const* infinity) TR_GNUC_NONNULL(1, 4);
/** @brief Portability wrapper for localtime_r () that uses the system implementation if available */
/** @brief Portability wrapper for localtime_r() that uses the system implementation if available */
struct tm* tr_localtime_r(time_t const* _clock, struct tm* _result);
/** @brief Portability wrapper for gettimeofday (), with tz argument dropped */
/** @brief Portability wrapper for gettimeofday(), with tz argument dropped */
int tr_gettimeofday(struct timeval* tv);
/**
@ -401,11 +401,11 @@ void tr_removeElementFromArray(void* array, unsigned int index_to_remove, size_t
****
***/
/** @brief Private libtransmission variable that's visible only for inlining in tr_time () */
/** @brief Private libtransmission variable that's visible only for inlining in tr_time() */
extern time_t __tr_current_time;
/**
* @brief very inexpensive form of time (NULL)
* @brief very inexpensive form of time(NULL)
* @return the current epoch time in seconds
*
* This function returns a second counter that is updated once per second.
@ -419,23 +419,23 @@ static inline time_t tr_time(void)
return __tr_current_time;
}
/** @brief Private libtransmission function to update tr_time ()'s counter */
/** @brief Private libtransmission function to update tr_time()'s counter */
static inline void tr_timeUpdate(time_t now)
{
__tr_current_time = now;
}
/** @brief Portability wrapper for htonll () that uses the system implementation if available */
/** @brief Portability wrapper for htonll() that uses the system implementation if available */
uint64_t tr_htonll(uint64_t);
/** @brief Portability wrapper for htonll () that uses the system implementation if available */
/** @brief Portability wrapper for htonll() that uses the system implementation if available */
uint64_t tr_ntohll(uint64_t);
/***
****
***/
/* example: tr_formatter_size_init (1024, _ ("KiB"), _ ("MiB"), _ ("GiB"), _ ("TiB")); */
/* example: tr_formatter_size_init(1024, _("KiB"), _("MiB"), _("GiB"), _("TiB")); */
void tr_formatter_size_init(unsigned int kilo, char const* kb, char const* mb, char const* gb, char const* tb);

View File

@ -14,7 +14,7 @@
#include <errno.h> /* EILSEQ, EINVAL */
#include <event2/buffer.h> /* evbuffer_add() */
#include <event2/util.h> /* evutil_strtoll () */
#include <event2/util.h> /* evutil_strtoll() */
#define JSONSL_STATE_USER_FIELDS /* no fields */
#include "jsonsl.h"

View File

@ -6,9 +6,9 @@
*
*/
#include <ctype.h> /* isspace () */
#include <ctype.h> /* isspace() */
#include <errno.h> /* EILSEQ */
#include <string.h> /* strlen (), strncmp () */
#include <string.h> /* strlen(), strncmp() */
#include <event2/buffer.h>

Some files were not shown because too many files have changed in this diff Show More