diff --git a/gtk/details.c b/gtk/details.c index e8c0b2fee..e54e23983 100644 --- a/gtk/details.c +++ b/gtk/details.c @@ -611,7 +611,7 @@ gtr_text_buffer_set_text (GtkTextBuffer * b, const char * str) gtk_text_buffer_get_bounds (b, &start, &end); old_str = gtk_text_buffer_get_text (b, &start, &end, FALSE); - if ((old_str == NULL) || strcmp (old_str, str)) + if ((old_str == NULL) || g_strcmp0 (old_str, str)) gtk_text_buffer_set_text (b, str, -1); g_free (old_str); @@ -688,7 +688,7 @@ refreshInfo (struct DetailsImpl * di, tr_torrent ** torrents, int n) for (i=1; icreator ? infos[i]->creator : ""); + mixed_creator |= g_strcmp0 (creator, infos[i]->creator ? infos[i]->creator : ""); mixed_date |= (date != infos[i]->dateCreated); } @@ -722,7 +722,7 @@ refreshInfo (struct DetailsImpl * di, tr_torrent ** torrents, int n) const char * baseline = infos[0]->comment ? infos[0]->comment : ""; for (i=1; icomment ? infos[i]->comment : "")) + if (g_strcmp0 (baseline, infos[i]->comment ? infos[i]->comment : "")) break; if (i==n) @@ -742,7 +742,7 @@ refreshInfo (struct DetailsImpl * di, tr_torrent ** torrents, int n) const char * baseline = tr_torrentGetDownloadDir (torrents[0]); for (i=1; ierrorString; for (i=1; ierrorString)) + if (g_strcmp0 (baseline, stats[i]->errorString)) break; if (i==n) @@ -1281,7 +1281,7 @@ initPeerRow (GtkListStore * store, char collated_name[128]; const char * client = peer->client; - if (!client || !strcmp (client, "Unknown Client")) + if (!client || !g_strcmp0 (client, "Unknown Client")) client = ""; if (sscanf (peer->addr, "%d.%d.%d.%d", q, q+1, q+2, q+3) != 4) diff --git a/gtk/file-list.c b/gtk/file-list.c index a3432e052..68f3c1610 100644 --- a/gtk/file-list.c +++ b/gtk/file-list.c @@ -484,7 +484,7 @@ find_child (GNode* parent, const char * name) GNode * child = parent->children; while (child) { const struct row_struct * child_data = child->data; - if ((*child_data->name == *name) && !strcmp (child_data->name, name)) + if ((*child_data->name == *name) && !g_strcmp0 (child_data->name, name)) break; child = child->next; } diff --git a/gtk/filter.c b/gtk/filter.c index 5924fe3be..21c86af6d 100644 --- a/gtk/filter.c +++ b/gtk/filter.c @@ -55,7 +55,7 @@ enum static int pstrcmp (const void * a, const void * b) { - return strcmp (* (const char**)a, * (const char**)b); + return g_strcmp0 (* (const char**)a, * (const char**)b); } /* human-readable name; ie, Legaltorrents */ @@ -163,7 +163,7 @@ tracker_filter_model_update (gpointer gstore) } for (k=0; kpdata[i]); + cmp = g_strcmp0 (host, hosts->pdata[i]); if (cmp < 0) remove_row = TRUE; @@ -447,7 +447,7 @@ test_tracker (tr_torrent * tor, int active_tracker_type, const char * host) for (i=0; itrackerCount; ++i) { gtr_get_host_from_url (tmp, sizeof (tmp), inf->trackers[i].announce); - if (!strcmp (tmp, host)) + if (!g_strcmp0 (tmp, host)) break; } diff --git a/gtk/icons.c b/gtk/icons.c index e69457f92..52314baea 100644 --- a/gtk/icons.c +++ b/gtk/icons.c @@ -6,7 +6,6 @@ * $Id$ */ -#include /* strcmp */ #include #include #include diff --git a/gtk/main.c b/gtk/main.c index 7bf2a6db8..6cb387c89 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -160,7 +160,7 @@ show_details_dialog_for_selected_torrents (struct cbdata * data) char * key = get_details_dialog_key (ids); for (l=data->details; dialog==NULL && l!=NULL; l=l->next) - if (!strcmp (key, g_object_get_data (l->data, "key"))) + if (!g_strcmp0 (key, g_object_get_data (l->data, "key"))) dialog = l->data; if (dialog == NULL) @@ -393,7 +393,7 @@ on_rpc_changed_idle (gpointer gdata) { char * a = tr_variantToStr (oldval, TR_VARIANT_FMT_BENC, NULL); char * b = tr_variantToStr (newval, TR_VARIANT_FMT_BENC, NULL); - changed = strcmp (a, b) != 0; + changed = g_strcmp0 (a, b) != 0; tr_free (b); tr_free (a); } @@ -1492,35 +1492,35 @@ gtr_actions_handler (const char * action_name, gpointer user_data) gboolean changed = FALSE; struct cbdata * data = user_data; - if (!strcmp (action_name, "open-torrent-from-url")) + if (!g_strcmp0 (action_name, "open-torrent-from-url")) { GtkWidget * w = gtr_torrent_open_from_url_dialog_new (data->wind, data->core); gtk_widget_show (w); } - else if (!strcmp (action_name, "open-torrent-menu") - || !strcmp (action_name, "open-torrent-toolbar")) + else if (!g_strcmp0 (action_name, "open-torrent-menu") + || !g_strcmp0 (action_name, "open-torrent-toolbar")) { GtkWidget * w = gtr_torrent_open_from_file_dialog_new (data->wind, data->core); gtk_widget_show (w); } - else if (!strcmp (action_name, "show-stats")) + else if (!g_strcmp0 (action_name, "show-stats")) { GtkWidget * dialog = gtr_stats_dialog_new (data->wind, data->core); gtk_widget_show (dialog); } - else if (!strcmp (action_name, "donate")) + else if (!g_strcmp0 (action_name, "donate")) { gtr_open_uri ("http://www.transmissionbt.com/donate.php"); } - else if (!strcmp (action_name, "pause-all-torrents")) + else if (!g_strcmp0 (action_name, "pause-all-torrents")) { pause_all_torrents (data); } - else if (!strcmp (action_name, "start-all-torrents")) + else if (!g_strcmp0 (action_name, "start-all-torrents")) { start_all_torrents (data); } - else if (!strcmp (action_name, "copy-magnet-link-to-clipboard")) + else if (!g_strcmp0 (action_name, "copy-magnet-link-to-clipboard")) { tr_torrent * tor = get_first_selected_torrent (data); if (tor != NULL) @@ -1528,7 +1528,7 @@ gtr_actions_handler (const char * action_name, gpointer user_data) copy_magnet_link_to_clipboard (GTK_WIDGET (data->wind), tor); } } - else if (!strcmp (action_name, "relocate-torrent")) + else if (!g_strcmp0 (action_name, "relocate-torrent")) { GSList * ids = get_selected_torrent_ids (data); if (ids != NULL) @@ -1538,52 +1538,52 @@ gtr_actions_handler (const char * action_name, gpointer user_data) gtk_widget_show (w); } } - else if (!strcmp (action_name, "torrent-start") - || !strcmp (action_name, "torrent-start-now") - || !strcmp (action_name, "torrent-stop") - || !strcmp (action_name, "torrent-reannounce") - || !strcmp (action_name, "torrent-verify") - || !strcmp (action_name, "queue-move-top") - || !strcmp (action_name, "queue-move-up") - || !strcmp (action_name, "queue-move-down") - || !strcmp (action_name, "queue-move-bottom")) + else if (!g_strcmp0 (action_name, "torrent-start") + || !g_strcmp0 (action_name, "torrent-start-now") + || !g_strcmp0 (action_name, "torrent-stop") + || !g_strcmp0 (action_name, "torrent-reannounce") + || !g_strcmp0 (action_name, "torrent-verify") + || !g_strcmp0 (action_name, "queue-move-top") + || !g_strcmp0 (action_name, "queue-move-up") + || !g_strcmp0 (action_name, "queue-move-down") + || !g_strcmp0 (action_name, "queue-move-bottom")) { changed |= call_rpc_for_selected_torrents (data, action_name); } - else if (!strcmp (action_name, "open-torrent-folder")) + else if (!g_strcmp0 (action_name, "open-torrent-folder")) { gtk_tree_selection_selected_foreach (data->sel, open_folder_foreach, data->core); } - else if (!strcmp (action_name, "show-torrent-properties")) + else if (!g_strcmp0 (action_name, "show-torrent-properties")) { show_details_dialog_for_selected_torrents (data); } - else if (!strcmp (action_name, "new-torrent")) + else if (!g_strcmp0 (action_name, "new-torrent")) { GtkWidget * w = gtr_torrent_creation_dialog_new (data->wind, data->core); gtk_widget_show (w); } - else if (!strcmp (action_name, "remove-torrent")) + else if (!g_strcmp0 (action_name, "remove-torrent")) { remove_selected (data, FALSE); } - else if (!strcmp (action_name, "delete-torrent")) + else if (!g_strcmp0 (action_name, "delete-torrent")) { remove_selected (data, TRUE); } - else if (!strcmp (action_name, "quit")) + else if (!g_strcmp0 (action_name, "quit")) { on_app_exit (data); } - else if (!strcmp (action_name, "select-all")) + else if (!g_strcmp0 (action_name, "select-all")) { gtk_tree_selection_select_all (data->sel); } - else if (!strcmp (action_name, "deselect-all")) + else if (!g_strcmp0 (action_name, "deselect-all")) { gtk_tree_selection_unselect_all (data->sel); } - else if (!strcmp (action_name, "edit-preferences")) + else if (!g_strcmp0 (action_name, "edit-preferences")) { if (NULL == data->prefs) { @@ -1593,7 +1593,7 @@ gtr_actions_handler (const char * action_name, gpointer user_data) } gtr_window_present (GTK_WINDOW (data->prefs)); } - else if (!strcmp (action_name, "toggle-message-log")) + else if (!g_strcmp0 (action_name, "toggle-message-log")) { if (!data->msgwin) { @@ -1608,19 +1608,19 @@ gtr_actions_handler (const char * action_name, gpointer user_data) data->msgwin = NULL; } } - else if (!strcmp (action_name, "show-about-dialog")) + else if (!g_strcmp0 (action_name, "show-about-dialog")) { show_about_dialog (data->wind); } - else if (!strcmp (action_name, "help")) + else if (!g_strcmp0 (action_name, "help")) { gtr_open_uri (gtr_get_help_uri ()); } - else if (!strcmp (action_name, "toggle-main-window")) + else if (!g_strcmp0 (action_name, "toggle-main-window")) { toggleMainWindow (data); } - else if (!strcmp (action_name, "present-main-window")) + else if (!g_strcmp0 (action_name, "present-main-window")) { presentMainWindow (data); } diff --git a/gtk/notify.c b/gtk/notify.c index bbe0b8ed7..937bbffe2 100644 --- a/gtk/notify.c +++ b/gtk/notify.c @@ -10,8 +10,6 @@ * $Id$ */ -#include /* strcmp () */ - #include #include @@ -67,7 +65,7 @@ get_capabilities_callback (GObject * source, g_variant_get (result, "(^a&s)", &caps); for (i=0; caps[i]; i++) { - if (strcmp (caps[i], "actions") == 0) + if (g_strcmp0 (caps[i], "actions") == 0) { server_supports_actions = TRUE; break; @@ -96,12 +94,12 @@ g_signal_callback (GDBusProxy * proxy UNUSED, if (n == NULL) return; - if (strcmp (signal_name, "NotificationClosed") == 0) + if (g_strcmp0 (signal_name, "NotificationClosed") == 0) { g_hash_table_remove (active_notifications, GINT_TO_POINTER ((int *) &n->id)); } - else if (strcmp (signal_name, "ActionInvoked") == 0 && + else if (g_strcmp0 (signal_name, "ActionInvoked") == 0 && g_variant_is_of_type (params, G_VARIANT_TYPE ("(us)"))) { char * action; @@ -112,11 +110,11 @@ g_signal_callback (GDBusProxy * proxy UNUSED, return; g_variant_get (params, "(u&s)", NULL, &action); - if (strcmp (action, "folder") == 0) + if (g_strcmp0 (action, "folder") == 0) { gtr_core_open_folder (n->core, n->torrent_id); } - else if (strcmp (action, "file") == 0) + else if (g_strcmp0 (action, "file") == 0) { const tr_info * inf = tr_torrentInfo (tor); const char * dir = tr_torrentGetDownloadDir (tor); diff --git a/gtk/open-dialog.c b/gtk/open-dialog.c index 64f5c8eda..8633a2e69 100644 --- a/gtk/open-dialog.c +++ b/gtk/open-dialog.c @@ -59,7 +59,7 @@ save_recent_destination (TrCore * core, const char * dir) return; /* if it was already in the list, remove it */ - if ((l = g_slist_find_custom (list, dir, (GCompareFunc)strcmp))) + if ((l = g_slist_find_custom (list, dir, (GCompareFunc)g_strcmp0))) list = g_slist_delete_link (list, l); /* add it to the front of the list */ diff --git a/gtk/tr-core.c b/gtk/tr-core.c index 448d9b6f1..5b1c4e6dc 100644 --- a/gtk/tr-core.c +++ b/gtk/tr-core.c @@ -423,7 +423,7 @@ compare_by_name (GtkTreeModel * m, const char *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 tr_strcmp0 (ca, cb); + return g_strcmp0 (ca, cb); } static int @@ -1666,7 +1666,7 @@ core_commit_prefs_change (TrCore * core, const tr_quark key) void gtr_core_set_pref (TrCore * self, const tr_quark key, const char * newval) { - if (tr_strcmp0 (newval, gtr_pref_string_get (key))) + if (g_strcmp0 (newval, gtr_pref_string_get (key))) { gtr_pref_string_set (key, newval); core_commit_prefs_change (self, key); diff --git a/gtk/tr-prefs.c b/gtk/tr-prefs.c index dd8d58c02..92fdd2e0a 100644 --- a/gtk/tr-prefs.c +++ b/gtk/tr-prefs.c @@ -12,7 +12,6 @@ #include /* isspace */ #include /* USHRT_MAX */ -#include /* strcmp () */ #include #include #include diff --git a/gtk/tr-window.c b/gtk/tr-window.c index 72dc7bf1a..c4e1232fb 100644 --- a/gtk/tr-window.c +++ b/gtk/tr-window.c @@ -22,7 +22,7 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ -#include +#include /* strlen() */ #include #include @@ -673,7 +673,7 @@ gtr_window_new (GtkApplication * app, GtkUIManager * ui_mgr, TrCore * core) const char * val = stats_modes[i].val; w = gtk_radio_menu_item_new_with_label (l, _ (stats_modes[i].i18n)); l = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (w)); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w), !strcmp (val, pch)); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w), !g_strcmp0 (val, pch)); g_object_set_data (G_OBJECT (w), STATS_MODE, (gpointer)stats_modes[i].val); g_signal_connect (w, "toggled", G_CALLBACK (status_menu_toggled_cb), p); gtk_menu_shell_append (GTK_MENU_SHELL (menu), w); @@ -806,13 +806,13 @@ updateStats (PrivateData * p) /* update the stats */ pch = gtr_pref_string_get (TR_KEY_statusbar_stats); - if (!strcmp (pch, "session-ratio")) + if (!g_strcmp0 (pch, "session-ratio")) { tr_sessionGetStats (session, &stats); tr_strlratio (ratio, stats.ratio, sizeof (ratio)); g_snprintf (buf, sizeof (buf), _("Ratio: %s"), ratio); } - else if (!strcmp (pch, "session-transfer")) + else if (!g_strcmp0 (pch, "session-transfer")) { tr_sessionGetStats (session, &stats); tr_strlsize (up, stats.uploadedBytes, sizeof (up)); @@ -823,7 +823,7 @@ updateStats (PrivateData * p) g_snprintf (buf, sizeof (buf), Q_("Down: %1$s, Up: %2$s"), down, up); } - else if (!strcmp (pch, "total-transfer")) + else if (!g_strcmp0 (pch, "total-transfer")) { tr_sessionGetCumulativeStats (session, &stats); tr_strlsize (up, stats.uploadedBytes, sizeof (up)); diff --git a/gtk/util.c b/gtk/util.c index 5973e2501..a3f0486ab 100644 --- a/gtk/util.c +++ b/gtk/util.c @@ -629,7 +629,7 @@ gtr_label_set_text (GtkLabel * lb, const char * newstr) { const char * oldstr = gtk_label_get_text (lb); - if (tr_strcmp0 (oldstr, newstr)) + if (g_strcmp0 (oldstr, newstr)) gtk_label_set_text (lb, newstr); }