Changeset 14018


Ignore:
Timestamp:
Feb 14, 2013, 3:17:42 PM (9 years ago)
Author:
jordan
Message:

(gtk) use replace strcmp() with g_strcmp0() everywhere

Location:
trunk/gtk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r13761 r14018  
    612612  old_str = gtk_text_buffer_get_text (b, &start, &end, FALSE);
    613613
    614   if ((old_str == NULL) || strcmp (old_str, str))
     614  if ((old_str == NULL) || g_strcmp0 (old_str, str))
    615615    gtk_text_buffer_set_text (b, str, -1);
    616616
     
    689689      for (i=1; i<n; ++i)
    690690        {
    691           mixed_creator |= strcmp (creator, infos[i]->creator ? infos[i]->creator : "");
     691          mixed_creator |= g_strcmp0 (creator, infos[i]->creator ? infos[i]->creator : "");
    692692          mixed_date |= (date != infos[i]->dateCreated);
    693693        }
     
    723723
    724724      for (i=1; i<n; ++i)
    725         if (strcmp (baseline, infos[i]->comment ? infos[i]->comment : ""))
     725        if (g_strcmp0 (baseline, infos[i]->comment ? infos[i]->comment : ""))
    726726          break;
    727727
     
    743743
    744744      for (i=1; i<n; ++i)
    745         if (strcmp (baseline, tr_torrentGetDownloadDir (torrents[i])))
     745        if (g_strcmp0 (baseline, tr_torrentGetDownloadDir (torrents[i])))
    746746          break;
    747747
     
    982982
    983983      for (i=1; i<n; ++i)
    984         if (strcmp (baseline, stats[i]->errorString))
     984        if (g_strcmp0 (baseline, stats[i]->errorString))
    985985          break;
    986986
     
    12821282  const char * client = peer->client;
    12831283
    1284   if (!client || !strcmp (client, "Unknown Client"))
     1284  if (!client || !g_strcmp0 (client, "Unknown Client"))
    12851285    client = "";
    12861286
  • trunk/gtk/file-list.c

    r13999 r14018  
    485485    while (child) {
    486486        const struct row_struct * child_data = child->data;
    487         if ((*child_data->name == *name) && !strcmp (child_data->name, name))
     487        if ((*child_data->name == *name) && !g_strcmp0 (child_data->name, name))
    488488            break;
    489489        child = child->next;
  • trunk/gtk/filter.c

    r13952 r14018  
    5656pstrcmp (const void * a, const void * b)
    5757{
    58   return strcmp (* (const char**)a, * (const char**)b);
     58  return g_strcmp0 (* (const char**)a, * (const char**)b);
    5959}
    6060
     
    164164
    165165          for (k=0; k<keyCount; ++k)
    166             if (!strcmp (keys[k], key))
     166            if (!g_strcmp0 (keys[k], key))
    167167              break;
    168168
     
    215215          char * host;
    216216          gtk_tree_model_get (model, &iter, TRACKER_FILTER_COL_HOST, &host,  -1);
    217           cmp = strcmp (host, hosts->pdata[i]);
     217          cmp = g_strcmp0 (host, hosts->pdata[i]);
    218218
    219219          if (cmp < 0)
     
    448448        {
    449449          gtr_get_host_from_url (tmp, sizeof (tmp), inf->trackers[i].announce);
    450           if (!strcmp (tmp, host))
     450          if (!g_strcmp0 (tmp, host))
    451451            break;
    452452        }
  • trunk/gtk/icons.c

    r13625 r14018  
    77 */
    88
    9 #include <string.h> /* strcmp */
    109#include <glib.h>
    1110#include <gtk/gtk.h>
  • trunk/gtk/main.c

    r13956 r14018  
    161161
    162162  for (l=data->details; dialog==NULL && l!=NULL; l=l->next)
    163     if (!strcmp (key, g_object_get_data (l->data, "key")))
     163    if (!g_strcmp0 (key, g_object_get_data (l->data, "key")))
    164164      dialog = l->data;
    165165
     
    394394                char * a = tr_variantToStr (oldval, TR_VARIANT_FMT_BENC, NULL);
    395395                char * b = tr_variantToStr (newval, TR_VARIANT_FMT_BENC, NULL);
    396                 changed = strcmp (a, b) != 0;
     396                changed = g_strcmp0 (a, b) != 0;
    397397                tr_free (b);
    398398                tr_free (a);
     
    14931493  struct cbdata * data = user_data;
    14941494
    1495   if (!strcmp (action_name, "open-torrent-from-url"))
     1495  if (!g_strcmp0 (action_name, "open-torrent-from-url"))
    14961496    {
    14971497      GtkWidget * w = gtr_torrent_open_from_url_dialog_new (data->wind, data->core);
    14981498      gtk_widget_show (w);
    14991499    }
    1500   else if (!strcmp (action_name, "open-torrent-menu")
    1501         || !strcmp (action_name, "open-torrent-toolbar"))
     1500  else if (!g_strcmp0 (action_name, "open-torrent-menu")
     1501        || !g_strcmp0 (action_name, "open-torrent-toolbar"))
    15021502    {
    15031503      GtkWidget * w = gtr_torrent_open_from_file_dialog_new (data->wind, data->core);
    15041504      gtk_widget_show (w);
    15051505    }
    1506     else if (!strcmp (action_name, "show-stats"))
     1506    else if (!g_strcmp0 (action_name, "show-stats"))
    15071507    {
    15081508        GtkWidget * dialog = gtr_stats_dialog_new (data->wind, data->core);
    15091509        gtk_widget_show (dialog);
    15101510    }
    1511   else if (!strcmp (action_name, "donate"))
     1511  else if (!g_strcmp0 (action_name, "donate"))
    15121512    {
    15131513      gtr_open_uri ("http://www.transmissionbt.com/donate.php");
    15141514    }
    1515   else if (!strcmp (action_name, "pause-all-torrents"))
     1515  else if (!g_strcmp0 (action_name, "pause-all-torrents"))
    15161516    {
    15171517      pause_all_torrents (data);
    15181518    }
    1519   else if (!strcmp (action_name, "start-all-torrents"))
     1519  else if (!g_strcmp0 (action_name, "start-all-torrents"))
    15201520    {
    15211521      start_all_torrents (data);
    15221522    }
    1523   else if (!strcmp (action_name, "copy-magnet-link-to-clipboard"))
     1523  else if (!g_strcmp0 (action_name, "copy-magnet-link-to-clipboard"))
    15241524    {
    15251525      tr_torrent * tor = get_first_selected_torrent (data);
     
    15291529        }
    15301530    }
    1531   else if (!strcmp (action_name, "relocate-torrent"))
     1531  else if (!g_strcmp0 (action_name, "relocate-torrent"))
    15321532    {
    15331533      GSList * ids = get_selected_torrent_ids (data);
     
    15391539        }
    15401540    }
    1541   else if (!strcmp (action_name, "torrent-start")
    1542         || !strcmp (action_name, "torrent-start-now")
    1543         || !strcmp (action_name, "torrent-stop")
    1544         || !strcmp (action_name, "torrent-reannounce")
    1545         || !strcmp (action_name, "torrent-verify")
    1546         || !strcmp (action_name, "queue-move-top")
    1547         || !strcmp (action_name, "queue-move-up")
    1548         || !strcmp (action_name, "queue-move-down")
    1549         || !strcmp (action_name, "queue-move-bottom"))
     1541  else if (!g_strcmp0 (action_name, "torrent-start")
     1542        || !g_strcmp0 (action_name, "torrent-start-now")
     1543        || !g_strcmp0 (action_name, "torrent-stop")
     1544        || !g_strcmp0 (action_name, "torrent-reannounce")
     1545        || !g_strcmp0 (action_name, "torrent-verify")
     1546        || !g_strcmp0 (action_name, "queue-move-top")
     1547        || !g_strcmp0 (action_name, "queue-move-up")
     1548        || !g_strcmp0 (action_name, "queue-move-down")
     1549        || !g_strcmp0 (action_name, "queue-move-bottom"))
    15501550    {
    15511551      changed |= call_rpc_for_selected_torrents (data, action_name);
    15521552    }
    1553   else if (!strcmp (action_name, "open-torrent-folder"))
     1553  else if (!g_strcmp0 (action_name, "open-torrent-folder"))
    15541554    {
    15551555      gtk_tree_selection_selected_foreach (data->sel, open_folder_foreach, data->core);
    15561556    }
    1557   else if (!strcmp (action_name, "show-torrent-properties"))
     1557  else if (!g_strcmp0 (action_name, "show-torrent-properties"))
    15581558    {
    15591559      show_details_dialog_for_selected_torrents (data);
    15601560    }
    1561   else if (!strcmp (action_name, "new-torrent"))
     1561  else if (!g_strcmp0 (action_name, "new-torrent"))
    15621562    {
    15631563      GtkWidget * w = gtr_torrent_creation_dialog_new (data->wind, data->core);
    15641564      gtk_widget_show (w);
    15651565    }
    1566   else if (!strcmp (action_name, "remove-torrent"))
     1566  else if (!g_strcmp0 (action_name, "remove-torrent"))
    15671567    {
    15681568      remove_selected (data, FALSE);
    15691569    }
    1570   else if (!strcmp (action_name, "delete-torrent"))
     1570  else if (!g_strcmp0 (action_name, "delete-torrent"))
    15711571    {
    15721572      remove_selected (data, TRUE);
    15731573    }
    1574   else if (!strcmp (action_name, "quit"))
     1574  else if (!g_strcmp0 (action_name, "quit"))
    15751575    {
    15761576      on_app_exit (data);
    15771577    }
    1578   else if (!strcmp (action_name, "select-all"))
     1578  else if (!g_strcmp0 (action_name, "select-all"))
    15791579    {
    15801580      gtk_tree_selection_select_all (data->sel);
    15811581    }
    1582   else if (!strcmp (action_name, "deselect-all"))
     1582  else if (!g_strcmp0 (action_name, "deselect-all"))
    15831583    {
    15841584      gtk_tree_selection_unselect_all (data->sel);
    15851585    }
    1586   else if (!strcmp (action_name, "edit-preferences"))
     1586  else if (!g_strcmp0 (action_name, "edit-preferences"))
    15871587    {
    15881588      if (NULL == data->prefs)
     
    15941594        gtr_window_present (GTK_WINDOW (data->prefs));
    15951595    }
    1596   else if (!strcmp (action_name, "toggle-message-log"))
     1596  else if (!g_strcmp0 (action_name, "toggle-message-log"))
    15971597    {
    15981598      if (!data->msgwin)
     
    16091609        }
    16101610    }
    1611   else if (!strcmp (action_name, "show-about-dialog"))
     1611  else if (!g_strcmp0 (action_name, "show-about-dialog"))
    16121612    {
    16131613      show_about_dialog (data->wind);
    16141614    }
    1615   else if (!strcmp (action_name, "help"))
     1615  else if (!g_strcmp0 (action_name, "help"))
    16161616    {
    16171617      gtr_open_uri (gtr_get_help_uri ());
    16181618    }
    1619   else if (!strcmp (action_name, "toggle-main-window"))
     1619  else if (!g_strcmp0 (action_name, "toggle-main-window"))
    16201620    {
    16211621      toggleMainWindow (data);
    16221622    }
    1623   else if (!strcmp (action_name, "present-main-window"))
     1623  else if (!g_strcmp0 (action_name, "present-main-window"))
    16241624    {
    16251625      presentMainWindow (data);
  • trunk/gtk/notify.c

    r13683 r14018  
    1111 */
    1212
    13 #include <string.h> /* strcmp () */
    14 
    1513#include <gio/gio.h>
    1614
     
    6866  for (i=0; caps[i]; i++)
    6967    {
    70       if (strcmp (caps[i], "actions") == 0)
     68      if (g_strcmp0 (caps[i], "actions") == 0)
    7169        {
    7270          server_supports_actions = TRUE;
     
    9795    return;
    9896
    99   if (strcmp (signal_name, "NotificationClosed") == 0)
     97  if (g_strcmp0 (signal_name, "NotificationClosed") == 0)
    10098    {
    10199      g_hash_table_remove (active_notifications,
    102100                           GINT_TO_POINTER ((int *) &n->id));
    103101    }
    104   else if (strcmp (signal_name, "ActionInvoked") == 0 &&
     102  else if (g_strcmp0 (signal_name, "ActionInvoked") == 0 &&
    105103           g_variant_is_of_type (params, G_VARIANT_TYPE ("(us)")))
    106104    {
     
    113111
    114112      g_variant_get (params, "(u&s)", NULL, &action);
    115       if (strcmp (action, "folder") == 0)
     113      if (g_strcmp0 (action, "folder") == 0)
    116114        {
    117115          gtr_core_open_folder (n->core, n->torrent_id);
    118116        }
    119       else if (strcmp (action, "file") == 0)
     117      else if (g_strcmp0 (action, "file") == 0)
    120118        {
    121119          const tr_info * inf = tr_torrentInfo (tor);
  • trunk/gtk/open-dialog.c

    r13991 r14018  
    6060
    6161    /* if it was already in the list, remove it */
    62     if ((l = g_slist_find_custom (list, dir, (GCompareFunc)strcmp)))
     62    if ((l = g_slist_find_custom (list, dir, (GCompareFunc)g_strcmp0)))
    6363        list = g_slist_delete_link (list, l);
    6464
  • trunk/gtk/tr-core.c

    r14011 r14018  
    424424  gtk_tree_model_get (m, a, MC_NAME_COLLATED, &ca, -1);
    425425  gtk_tree_model_get (m, b, MC_NAME_COLLATED, &cb, -1);
    426   return tr_strcmp0 (ca, cb);
     426  return g_strcmp0 (ca, cb);
    427427}
    428428
     
    16671667gtr_core_set_pref (TrCore * self, const tr_quark key, const char * newval)
    16681668{
    1669   if (tr_strcmp0 (newval, gtr_pref_string_get (key)))
     1669  if (g_strcmp0 (newval, gtr_pref_string_get (key)))
    16701670    {
    16711671      gtr_pref_string_set (key, newval);
  • trunk/gtk/tr-prefs.c

    r13991 r14018  
    1313#include <ctype.h> /* isspace */
    1414#include <limits.h> /* USHRT_MAX */
    15 #include <string.h> /* strcmp () */
    1615#include <unistd.h>
    1716#include <glib/gi18n.h>
  • trunk/gtk/tr-window.c

    r13991 r14018  
    2323 *****************************************************************************/
    2424
    25 #include <string.h>
     25#include <string.h> /* strlen() */
    2626
    2727#include <gtk/gtk.h>
     
    674674      w = gtk_radio_menu_item_new_with_label (l, _ (stats_modes[i].i18n));
    675675      l = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (w));
    676       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w), !strcmp (val, pch));
     676      gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w), !g_strcmp0 (val, pch));
    677677      g_object_set_data (G_OBJECT (w), STATS_MODE, (gpointer)stats_modes[i].val);
    678678      g_signal_connect (w, "toggled", G_CALLBACK (status_menu_toggled_cb), p);
     
    807807  /* update the stats */
    808808  pch = gtr_pref_string_get (TR_KEY_statusbar_stats);
    809   if (!strcmp (pch, "session-ratio"))
     809  if (!g_strcmp0 (pch, "session-ratio"))
    810810    {
    811811      tr_sessionGetStats (session, &stats);
     
    813813      g_snprintf (buf, sizeof (buf), _("Ratio: %s"), ratio);
    814814    }
    815   else if (!strcmp (pch, "session-transfer"))
     815  else if (!g_strcmp0 (pch, "session-transfer"))
    816816    {
    817817      tr_sessionGetStats (session, &stats);
     
    824824                  Q_("Down: %1$s, Up: %2$s"), down, up);
    825825    }
    826   else if (!strcmp (pch, "total-transfer"))
     826  else if (!g_strcmp0 (pch, "total-transfer"))
    827827    {
    828828      tr_sessionGetCumulativeStats (session, &stats);
  • trunk/gtk/util.c

    r13991 r14018  
    630630  const char * oldstr = gtk_label_get_text (lb);
    631631
    632   if (tr_strcmp0 (oldstr, newstr))
     632  if (g_strcmp0 (oldstr, newstr))
    633633    gtk_label_set_text (lb, newstr);
    634634}
Note: See TracChangeset for help on using the changeset viewer.