Changeset 14718


Ignore:
Timestamp:
Mar 13, 2016, 10:11:01 PM (18 months ago)
Author:
mikedld
Message:

Explicitly compare result of str(n)cmp/memcmp to signify that it's not boolean

Location:
trunk
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/cli.c

    r14581 r14718  
    291291      tr_ctorSetMetainfo (ctor, fileContents, fileLength);
    292292    }
    293   else if (!memcmp (torrentPath, "magnet:?", 8))
     293  else if (memcmp (torrentPath, "magnet:?", 8) == 0)
    294294    {
    295295      tr_ctorSetMetainfoFromMagnetLink (ctor, torrentPath);
    296296    }
    297   else if (!memcmp (torrentPath, "http", 4))
     297  else if (memcmp (torrentPath, "http", 4) == 0)
    298298    {
    299299      tr_webRun (h, torrentPath, onTorrentFileDownloaded, ctor);
  • trunk/daemon/remote.c

    r14707 r14718  
    520520    }
    521521
    522   if (!tr_strcmp0 (id, "active"))
     522  if (tr_strcmp0 (id, "active") == 0)
    523523    {
    524524      tr_variantDictAddStr (args, TR_KEY_ids, "recently-active");
    525525    }
    526   else if (strcmp (id, "all"))
     526  else if (strcmp (id, "all") != 0)
    527527    {
    528528      const char * pch;
     
    612612    }
    613613
    614   if (strcmp (arg, "all"))
     614  if (strcmp (arg, "all") != 0)
    615615    {
    616616      int i;
     
    719719    const size_t key_len = strlen (key);
    720720
    721     if ((line_len >= key_len) && !memcmp (line, key, key_len))
     721    if (line_len >= key_len && memcmp (line, key, key_len) == 0)
    722722    {
    723723        const char * begin = line + key_len;
     
    16421642        if (tr_variantDictFindStr (&top, TR_KEY_result, &str, NULL))
    16431643        {
    1644             if (strcmp (str, "success"))
     1644            if (strcmp (str, "success") != 0)
    16451645            {
    16461646                printf ("Error: %s\n", str);
     
    16941694                else {
    16951695                    printf ("%s responded: \"%s\"\n", rpcurl, str);
    1696                     if (strcmp (str, "success"))
     1696                    if (strcmp (str, "success") != 0)
    16971697                        status |= EXIT_FAILURE;
    16981698                }
     
    23282328        const char * s = argv[1];
    23292329        const char * delim = strchr (s, ':');
    2330         if (!strncmp (s, "http://", 7))   /* user passed in http rpc url */
     2330        if (strncmp (s, "http://", 7) == 0)   /* user passed in http rpc url */
    23312331        {
    23322332            *rpcurl = tr_strdup_printf ("%s/rpc/", s + 7);
    23332333        }
    2334         else if (!strncmp (s, "https://", 8)) /* user passed in https rpc url */
     2334        else if (strncmp (s, "https://", 8) == 0) /* user passed in https rpc url */
    23352335        {
    23362336            UseSSL = true;
  • trunk/gtk/actions.c

    r14681 r14718  
    211211    match = gtr_pref_string_get (TR_KEY_sort_mode);
    212212    for (i = 0, n = G_N_ELEMENTS (sort_radio_entries), active = -1; active == -1 && i < n; ++i)
    213         if (!g_strcmp0 (sort_radio_entries[i].name, match))
     213        if (g_strcmp0 (sort_radio_entries[i].name, match) == 0)
    214214            active = i;
    215215
  • trunk/gtk/details.c

    r14552 r14718  
    610610  old_str = gtk_text_buffer_get_text (b, &start, &end, FALSE);
    611611
    612   if ((old_str == NULL) || g_strcmp0 (old_str, str))
     612  if (old_str == NULL || g_strcmp0 (old_str, str) != 0)
    613613    gtk_text_buffer_set_text (b, str, -1);
    614614
     
    687687      for (i=1; i<n; ++i)
    688688        {
    689           mixed_creator |= g_strcmp0 (creator, infos[i]->creator ? infos[i]->creator : "");
     689          mixed_creator |= g_strcmp0 (creator, infos[i]->creator ? infos[i]->creator : "") != 0;
    690690          mixed_date |= (date != infos[i]->dateCreated);
    691691        }
     
    728728
    729729      for (i=1; i<n; ++i)
    730         if (g_strcmp0 (baseline, infos[i]->comment ? infos[i]->comment : ""))
     730        if (g_strcmp0 (baseline, infos[i]->comment ? infos[i]->comment : "") != 0)
    731731          break;
    732732
     
    748748
    749749      for (i=1; i<n; ++i)
    750         if (g_strcmp0 (baseline, tr_torrentGetDownloadDir (torrents[i])))
     750        if (g_strcmp0 (baseline, tr_torrentGetDownloadDir (torrents[i])) != 0)
    751751          break;
    752752
     
    987987
    988988      for (i=1; i<n; ++i)
    989         if (g_strcmp0 (baseline, stats[i]->errorString))
     989        if (g_strcmp0 (baseline, stats[i]->errorString) != 0)
    990990          break;
    991991
     
    12871287  const char * client = peer->client;
    12881288
    1289   if (!client || !g_strcmp0 (client, "Unknown Client"))
     1289  if (client == NULL || g_strcmp0 (client, "Unknown Client") == 0)
    12901290    client = "";
    12911291
  • trunk/gtk/file-list.c

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

    r14613 r14718  
    161161
    162162          for (k=0; k<keyCount; ++k)
    163             if (!g_strcmp0 (keys[k], key))
     163            if (g_strcmp0 (keys[k], key) == 0)
    164164              break;
    165165
     
    445445        {
    446446          gtr_get_host_from_url (tmp, sizeof (tmp), inf->trackers[i].announce);
    447           if (!g_strcmp0 (tmp, host))
     447          if (g_strcmp0 (tmp, host) == 0)
    448448            break;
    449449        }
  • trunk/gtk/main.c

    r14689 r14718  
    168168
    169169  for (l=data->details; dialog==NULL && l!=NULL; l=l->next)
    170     if (!g_strcmp0 (key, g_object_get_data (l->data, "key")))
     170    if (g_strcmp0 (key, g_object_get_data (l->data, "key")) == 0)
    171171      dialog = l->data;
    172172
     
    15301530  struct cbdata * data = user_data;
    15311531
    1532   if (!g_strcmp0 (action_name, "open-torrent-from-url"))
     1532  if (g_strcmp0 (action_name, "open-torrent-from-url") == 0)
    15331533    {
    15341534      GtkWidget * w = gtr_torrent_open_from_url_dialog_new (data->wind, data->core);
    15351535      gtk_widget_show (w);
    15361536    }
    1537   else if (!g_strcmp0 (action_name, "open-torrent-menu")
    1538         || !g_strcmp0 (action_name, "open-torrent-toolbar"))
     1537  else if (g_strcmp0 (action_name, "open-torrent-menu") == 0
     1538        || g_strcmp0 (action_name, "open-torrent-toolbar") == 0)
    15391539    {
    15401540      GtkWidget * w = gtr_torrent_open_from_file_dialog_new (data->wind, data->core);
    15411541      gtk_widget_show (w);
    15421542    }
    1543     else if (!g_strcmp0 (action_name, "show-stats"))
     1543    else if (g_strcmp0 (action_name, "show-stats") == 0)
    15441544    {
    15451545        GtkWidget * dialog = gtr_stats_dialog_new (data->wind, data->core);
    15461546        gtk_widget_show (dialog);
    15471547    }
    1548   else if (!g_strcmp0 (action_name, "donate"))
     1548  else if (g_strcmp0 (action_name, "donate") == 0)
    15491549    {
    15501550      gtr_open_uri ("http://www.transmissionbt.com/donate.php");
    15511551    }
    1552   else if (!g_strcmp0 (action_name, "pause-all-torrents"))
     1552  else if (g_strcmp0 (action_name, "pause-all-torrents") == 0)
    15531553    {
    15541554      pause_all_torrents (data);
    15551555    }
    1556   else if (!g_strcmp0 (action_name, "start-all-torrents"))
     1556  else if (g_strcmp0 (action_name, "start-all-torrents") == 0)
    15571557    {
    15581558      start_all_torrents (data);
    15591559    }
    1560   else if (!g_strcmp0 (action_name, "copy-magnet-link-to-clipboard"))
     1560  else if (g_strcmp0 (action_name, "copy-magnet-link-to-clipboard") == 0)
    15611561    {
    15621562      tr_torrent * tor = get_first_selected_torrent (data);
     
    15661566        }
    15671567    }
    1568   else if (!g_strcmp0 (action_name, "relocate-torrent"))
     1568  else if (g_strcmp0 (action_name, "relocate-torrent") == 0)
    15691569    {
    15701570      GSList * ids = get_selected_torrent_ids (data);
     
    15761576        }
    15771577    }
    1578   else if (!g_strcmp0 (action_name, "torrent-start")
    1579         || !g_strcmp0 (action_name, "torrent-start-now")
    1580         || !g_strcmp0 (action_name, "torrent-stop")
    1581         || !g_strcmp0 (action_name, "torrent-reannounce")
    1582         || !g_strcmp0 (action_name, "torrent-verify")
    1583         || !g_strcmp0 (action_name, "queue-move-top")
    1584         || !g_strcmp0 (action_name, "queue-move-up")
    1585         || !g_strcmp0 (action_name, "queue-move-down")
    1586         || !g_strcmp0 (action_name, "queue-move-bottom"))
     1578  else if (g_strcmp0 (action_name, "torrent-start") == 0
     1579        || g_strcmp0 (action_name, "torrent-start-now") == 0
     1580        || g_strcmp0 (action_name, "torrent-stop") == 0
     1581        || g_strcmp0 (action_name, "torrent-reannounce") == 0
     1582        || g_strcmp0 (action_name, "torrent-verify") == 0
     1583        || g_strcmp0 (action_name, "queue-move-top") == 0
     1584        || g_strcmp0 (action_name, "queue-move-up") == 0
     1585        || g_strcmp0 (action_name, "queue-move-down") == 0
     1586        || g_strcmp0 (action_name, "queue-move-bottom") == 0)
    15871587    {
    15881588      changed |= call_rpc_for_selected_torrents (data, action_name);
    15891589    }
    1590   else if (!g_strcmp0 (action_name, "open-torrent-folder"))
     1590  else if (g_strcmp0 (action_name, "open-torrent-folder") == 0)
    15911591    {
    15921592      gtk_tree_selection_selected_foreach (data->sel, open_folder_foreach, data->core);
    15931593    }
    1594   else if (!g_strcmp0 (action_name, "show-torrent-properties"))
     1594  else if (g_strcmp0 (action_name, "show-torrent-properties") == 0)
    15951595    {
    15961596      show_details_dialog_for_selected_torrents (data);
    15971597    }
    1598   else if (!g_strcmp0 (action_name, "new-torrent"))
     1598  else if (g_strcmp0 (action_name, "new-torrent") == 0)
    15991599    {
    16001600      GtkWidget * w = gtr_torrent_creation_dialog_new (data->wind, data->core);
    16011601      gtk_widget_show (w);
    16021602    }
    1603   else if (!g_strcmp0 (action_name, "remove-torrent"))
     1603  else if (g_strcmp0 (action_name, "remove-torrent") == 0)
    16041604    {
    16051605      remove_selected (data, FALSE);
    16061606    }
    1607   else if (!g_strcmp0 (action_name, "delete-torrent"))
     1607  else if (g_strcmp0 (action_name, "delete-torrent") == 0)
    16081608    {
    16091609      remove_selected (data, TRUE);
    16101610    }
    1611   else if (!g_strcmp0 (action_name, "quit"))
     1611  else if (g_strcmp0 (action_name, "quit") == 0)
    16121612    {
    16131613      on_app_exit (data);
    16141614    }
    1615   else if (!g_strcmp0 (action_name, "select-all"))
     1615  else if (g_strcmp0 (action_name, "select-all") == 0)
    16161616    {
    16171617      gtk_tree_selection_select_all (data->sel);
    16181618    }
    1619   else if (!g_strcmp0 (action_name, "deselect-all"))
     1619  else if (g_strcmp0 (action_name, "deselect-all") == 0)
    16201620    {
    16211621      gtk_tree_selection_unselect_all (data->sel);
    16221622    }
    1623   else if (!g_strcmp0 (action_name, "edit-preferences"))
     1623  else if (g_strcmp0 (action_name, "edit-preferences") == 0)
    16241624    {
    16251625      if (NULL == data->prefs)
     
    16311631        gtr_window_present (GTK_WINDOW (data->prefs));
    16321632    }
    1633   else if (!g_strcmp0 (action_name, "toggle-message-log"))
     1633  else if (g_strcmp0 (action_name, "toggle-message-log") == 0)
    16341634    {
    16351635      if (!data->msgwin)
     
    16461646        }
    16471647    }
    1648   else if (!g_strcmp0 (action_name, "show-about-dialog"))
     1648  else if (g_strcmp0 (action_name, "show-about-dialog") == 0)
    16491649    {
    16501650      show_about_dialog (data->wind);
    16511651    }
    1652   else if (!g_strcmp0 (action_name, "help"))
     1652  else if (g_strcmp0 (action_name, "help") == 0)
    16531653    {
    16541654      gtr_open_uri (gtr_get_help_uri ());
    16551655    }
    1656   else if (!g_strcmp0 (action_name, "toggle-main-window"))
     1656  else if (g_strcmp0 (action_name, "toggle-main-window") == 0)
    16571657    {
    16581658      toggleMainWindow (data);
    16591659    }
    1660   else if (!g_strcmp0 (action_name, "present-main-window"))
     1660  else if (g_strcmp0 (action_name, "present-main-window") == 0)
    16611661    {
    16621662      presentMainWindow (data);
  • trunk/gtk/tr-core.c

    r14587 r14718  
    619619  GtkTreeSortable * sortable = GTK_TREE_SORTABLE (gtr_core_model (core));
    620620
    621   if (!g_strcmp0 (mode, "sort-by-activity"))
     621  if (g_strcmp0 (mode, "sort-by-activity") == 0)
    622622    sort_func = compare_by_activity;
    623   else if (!g_strcmp0 (mode, "sort-by-age"))
     623  else if (g_strcmp0 (mode, "sort-by-age") == 0)
    624624    sort_func = compare_by_age;
    625   else if (!g_strcmp0 (mode, "sort-by-progress"))
     625  else if (g_strcmp0 (mode, "sort-by-progress") == 0)
    626626    sort_func = compare_by_progress;
    627   else if (!g_strcmp0 (mode, "sort-by-queue"))
     627  else if (g_strcmp0 (mode, "sort-by-queue") == 0)
    628628    sort_func = compare_by_queue;
    629   else if (!g_strcmp0 (mode, "sort-by-time-left"))
     629  else if (g_strcmp0 (mode, "sort-by-time-left") == 0)
    630630    sort_func = compare_by_eta;
    631   else if (!g_strcmp0 (mode, "sort-by-ratio"))
     631  else if (g_strcmp0 (mode, "sort-by-ratio") == 0)
    632632    sort_func = compare_by_ratio;
    633   else if (!g_strcmp0 (mode, "sort-by-state"))
     633  else if (g_strcmp0 (mode, "sort-by-state") == 0)
    634634    sort_func = compare_by_state;
    635   else if (!g_strcmp0 (mode, "sort-by-size"))
     635  else if (g_strcmp0 (mode, "sort-by-size") == 0)
    636636    sort_func = compare_by_size;
    637637  else {
     
    16661666gtr_core_set_pref (TrCore * self, const tr_quark key, const char * newval)
    16671667{
    1668   if (g_strcmp0 (newval, gtr_pref_string_get (key)))
     1668  if (g_strcmp0 (newval, gtr_pref_string_get (key)) != 0)
    16691669    {
    16701670      gtr_pref_string_set (key, newval);
  • trunk/gtk/tr-window.c

    r14519 r14718  
    665665      w = gtk_radio_menu_item_new_with_label (l, _ (stats_modes[i].i18n));
    666666      l = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (w));
    667       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w), !g_strcmp0 (val, pch));
     667      gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w), g_strcmp0 (val, pch) == 0);
    668668      g_object_set_data (G_OBJECT (w), STATS_MODE, (gpointer)stats_modes[i].val);
    669669      g_signal_connect (w, "toggled", G_CALLBACK (status_menu_toggled_cb), p);
     
    798798  /* update the stats */
    799799  pch = gtr_pref_string_get (TR_KEY_statusbar_stats);
    800   if (!g_strcmp0 (pch, "session-ratio"))
     800  if (g_strcmp0 (pch, "session-ratio") == 0)
    801801    {
    802802      tr_sessionGetStats (session, &stats);
     
    804804      g_snprintf (buf, sizeof (buf), _("Ratio: %s"), ratio);
    805805    }
    806   else if (!g_strcmp0 (pch, "session-transfer"))
     806  else if (g_strcmp0 (pch, "session-transfer") == 0)
    807807    {
    808808      tr_sessionGetStats (session, &stats);
     
    815815                  Q_("Down: %1$s, Up: %2$s"), down, up);
    816816    }
    817   else if (!g_strcmp0 (pch, "total-transfer"))
     817  else if (g_strcmp0 (pch, "total-transfer") == 0)
    818818    {
    819819      tr_sessionGetCumulativeStats (session, &stats);
  • trunk/gtk/util.c

    r14587 r14718  
    627627  const char * oldstr = gtk_label_get_text (lb);
    628628
    629   if (g_strcmp0 (oldstr, newstr))
     629  if (g_strcmp0 (oldstr, newstr) != 0)
    630630    gtk_label_set_text (lb, newstr);
    631631}
  • trunk/libtransmission/announcer-http.c

    r14644 r14718  
    408408                    {
    409409                        struct tr_scrape_response_row * row = &response->rows[j];
    410                         if (!memcmp (tr_quark_get_string(key,NULL), row->info_hash, SHA_DIGEST_LENGTH))
     410                        if (memcmp (tr_quark_get_string (key, NULL), row->info_hash, SHA_DIGEST_LENGTH) == 0)
    411411                        {
    412412                            if (tr_variantDictFindInt (val, TR_KEY_complete, &intVal))
  • trunk/libtransmission/announcer-udp.c

    r14648 r14718  
    770770    for (i=0, n=tr_ptrArraySize (&tau->trackers); !tracker && i<n; ++i) {
    771771        struct tau_tracker * tmp = tr_ptrArrayNth (&tau->trackers, i);
    772         if (!tr_strcmp0 (tmp->key, key))
     772        if (tr_strcmp0 (tmp->key, key) == 0)
    773773            tracker = tmp;
    774774    }
  • trunk/libtransmission/announcer.c

    r14644 r14718  
    124124
    125125    /* secondary key: the torrent's info_hash */
    126     if ((i = memcmp (a->info_hash, b->info_hash, SHA_DIGEST_LENGTH)))
     126    if ((i = memcmp (a->info_hash, b->info_hash, SHA_DIGEST_LENGTH)) != 0)
    127127        return i;
    128128
     
    592592            for (j=0, jn=n; !is_duplicate && j<jn; ++j)
    593593                is_duplicate = (tmp[j].port==port)
    594                             && !strcmp (tmp[j].scheme,scheme)
    595                             && !strcmp (tmp[j].host,host)
    596                             && !strcmp (tmp[j].path,path);
     594                            && strcmp (tmp[j].scheme, scheme) == 0
     595                            && strcmp (tmp[j].host, host) == 0
     596                            && strcmp (tmp[j].path, path) == 0;
    597597
    598598            if (is_duplicate) {
     
    618618            if ((tmp[i].info.tier!=tmp[j].info.tier)
    619619                       && (tmp[i].port==tmp[j].port)
    620                        && !tr_strcmp0 (tmp[i].host,tmp[j].host)
    621                        && !tr_strcmp0 (tmp[i].path,tmp[j].path))
     620                       && tr_strcmp0 (tmp[i].host, tmp[j].host) == 0
     621                       && tr_strcmp0 (tmp[i].path, tmp[j].path) == 0)
    622622                tmp[j].info.tier = tmp[i].info.tier;
    623623
     
    12211221#endif
    12221222
    1223     if (!memcmp (request->url, "http", 4))
     1223    if (memcmp (request->url, "http", 4) == 0)
    12241224        tr_tracker_http_announce (session, request, callback, callback_data);
    1225     else if (!memcmp (request->url, "udp://", 6))
     1225    else if (memcmp (request->url, "udp://", 6) == 0)
    12261226        tr_tracker_udp_announce (session, request, callback, callback_data);
    12271227    else
     
    12991299    for (i=0; tt && i<tt->tier_count; ++i) {
    13001300        const tr_tracker * const tracker = tt->tiers[i].currentTracker;
    1301         if (tracker && !tr_strcmp0 (scrape, tracker->scrape))
     1301        if (tracker != NULL && tr_strcmp0 (scrape, tracker->scrape) == 0)
    13021302            return &tt->tiers[i];
    13031303    }
     
    14001400    tr_session * session = announcer->session;
    14011401
    1402     if (!memcmp (request->url, "http", 4))
     1402    if (memcmp (request->url, "http", 4) == 0)
    14031403        tr_tracker_http_scrape (session, request, callback, callback_data);
    1404     else if (!memcmp (request->url, "udp://", 6))
     1404    else if (memcmp (request->url, "udp://", 6) == 0)
    14051405        tr_tracker_udp_scrape (session, request, callback, callback_data);
    14061406    else
     
    14331433            if (req->info_hash_count >= TR_MULTISCRAPE_MAX)
    14341434                continue;
    1435             if (tr_strcmp0 (req->url, url))
     1435            if (tr_strcmp0 (req->url, url) != 0)
    14361436                continue;
    14371437
     
    17141714    /* sanity clause */
    17151715    assert (trackerIndex < tgt->tracker_count);
    1716     assert (!tr_strcmp0 (tgt->trackers[trackerIndex].announce, src->currentTracker->announce));
     1716    assert (tr_strcmp0 (tgt->trackers[trackerIndex].announce, src->currentTracker->announce) == 0);
    17171717
    17181718    /* bitwise copy will handle most of tr_tier's fields... */
     
    17431743    for (i=0; !found && i<tt->tier_count; ++i)
    17441744        for (j=0; !found && j<tt->tiers[i].tracker_count; ++j)
    1745             if ((found = !tr_strcmp0 (src->currentTracker->announce, tt->tiers[i].trackers[j].announce)))
     1745            if ((found = tr_strcmp0 (src->currentTracker->announce, tt->tiers[i].trackers[j].announce) == 0))
    17461746                copy_tier_attributes_impl (&tt->tiers[i], j, src);
    17471747}
  • trunk/libtransmission/clients.c

    r14546 r14718  
    114114decodeBitCometClient (char * buf, size_t buflen, const uint8_t * id)
    115115{
    116     int is_bitlord;
     116    bool is_bitlord;
    117117    int major, minor;
    118118    const char * name;
    119119    const char * mod = NULL;
    120120
    121     if (!memcmp (id, "exbc", 4)) mod = "";
    122     else if (!memcmp (id, "FUTB", 4)) mod = " (Solidox Mod) ";
    123     else if (!memcmp (id, "xUTB", 4)) mod = " (Mod 2) ";
     121    if (memcmp (id, "exbc", 4) == 0) mod = "";
     122    else if (memcmp (id, "FUTB", 4) == 0) mod = " (Solidox Mod) ";
     123    else if (memcmp (id, "xUTB", 4) == 0) mod = " (Mod 2) ";
    124124    else return false;
    125125
    126     is_bitlord = !memcmp (id+6, "LORD", 4);
     126    is_bitlord = memcmp (id+6, "LORD", 4) == 0;
    127127    name = (is_bitlord) ? "BitLord " : "BitComet ";
    128128    major = id[4];
     
    154154    if (id[0] == '-' && id[7] == '-')
    155155    {
    156         if (!memcmp (id+1, "TR", 2))
    157         {
    158             if (!memcmp (id+3, "000", 3)) /* very old client style: -TR0006- is 0.6 */
     156        if (memcmp (id+1, "TR", 2) == 0)
     157        {
     158            if (memcmp (id+3, "000", 3) == 0) /* very old client style: -TR0006- is 0.6 */
    159159                tr_snprintf (buf, buflen, "Transmission 0.%c", id[6]);
    160             else if (!memcmp (id+3, "00", 2)) /* previous client style: -TR0072- is 0.72 */
     160            else if (memcmp (id+3, "00", 2) == 0) /* previous client style: -TR0072- is 0.72 */
    161161                tr_snprintf (buf, buflen, "Transmission 0.%02d", strint (id+5,2));
    162162            else /* current client style: -TR111Z- is 1.11+ */
     
    164164                          id[6]=='Z' || id[6]=='X' ? "+" : "");
    165165        }
    166         else if (!memcmp (id+1, "UT", 2))
     166        else if (memcmp (id+1, "UT", 2) == 0)
    167167        {
    168168            tr_snprintf (buf, buflen, "\xc2\xb5Torrent %d.%d.%d%s",
    169169                         strint (id+3,1), strint (id+4,1), strint (id+5,1), getMnemonicEnd (id[6]));
    170170        }
    171         else if (!memcmp (id+1, "BT", 2))
     171        else if (memcmp (id+1, "BT", 2) == 0)
    172172        {
    173173            tr_snprintf (buf, buflen, "BitTorrent %d.%d.%d%s",
    174174                         strint (id+3,1), strint (id+4,1), strint (id+5,1), getMnemonicEnd (id[6]));
    175175        }
    176         else if (!memcmp (id+1, "UM", 2))
     176        else if (memcmp (id+1, "UM", 2) == 0)
    177177        {
    178178            tr_snprintf (buf, buflen, "\xc2\xb5Torrent Mac %d.%d.%d%s",
    179179                         strint (id+3,1), strint (id+4,1), strint (id+5,1), getMnemonicEnd (id[6]));
    180180        }
    181         else if (!memcmp (id+1, "UE", 2))
     181        else if (memcmp (id+1, "UE", 2) == 0)
    182182        {
    183183            tr_snprintf (buf, buflen, "\xc2\xb5Torrent Embedded %d.%d.%d%s",
     
    185185        }
    186186
    187         else if (!memcmp (id+1, "AZ", 2))
     187        else if (memcmp (id+1, "AZ", 2) == 0)
    188188        {
    189189            if (id[3] > '3' || (id[3] == '3' && id[4] >= '1')) /* Vuze starts at version 3.1.0.0 */
     
    193193        }
    194194
    195         else if (!memcmp (id+1, "KT", 2))
     195        else if (memcmp (id+1, "KT", 2) == 0)
    196196        {
    197197            if (id[5] == 'D')
     
    203203        }
    204204
    205         else if (!memcmp (id+1, "AG", 2)) four_digits (buf, buflen, "Ares", id+3);
    206         else if (!memcmp (id+1, "AR", 2)) four_digits (buf, buflen, "Arctic", id+3);
    207         else if (!memcmp (id+1, "AT", 2)) four_digits (buf, buflen, "Artemis", id+3);
    208         else if (!memcmp (id+1, "AV", 2)) four_digits (buf, buflen, "Avicora", id+3);
    209         else if (!memcmp (id+1, "BB", 2)) four_digits (buf, buflen, "BitBuddy", id+3);
    210         else if (!memcmp (id+1, "BE", 2)) four_digits (buf, buflen, "BitTorrent SDK", id+3);
    211         else if (!memcmp (id+1, "BG", 2)) four_digits (buf, buflen, "BTGetit", id+3);
    212         else if (!memcmp (id+1, "BH", 2)) four_digits (buf, buflen, "BitZilla", id+3);
    213         else if (!memcmp (id+1, "BM", 2)) four_digits (buf, buflen, "BitMagnet", id+3);
    214         else if (!memcmp (id+1, "BP", 2)) four_digits (buf, buflen, "BitTorrent Pro (Azureus + Spyware)", id+3);
    215         else if (!memcmp (id+1, "BX", 2)) four_digits (buf, buflen, "BittorrentX", id+3);
    216         else if (!memcmp (id+1, "bk", 2)) four_digits (buf, buflen, "BitKitten (libtorrent)", id+3);
    217         else if (!memcmp (id+1, "BS", 2)) four_digits (buf, buflen, "BTSlave", id+3);
    218         else if (!memcmp (id+1, "BW", 2)) four_digits (buf, buflen, "BitWombat", id+3);
    219         else if (!memcmp (id+1, "BX", 2)) four_digits (buf, buflen, "BittorrentX", id+3);
    220         else if (!memcmp (id+1, "EB", 2)) four_digits (buf, buflen, "EBit", id+3);
    221         else if (!memcmp (id+1, "DE", 2)) four_digits (buf, buflen, "Deluge", id+3);
    222         else if (!memcmp (id+1, "DP", 2)) four_digits (buf, buflen, "Propogate Data Client", id+3);
    223         else if (!memcmp (id+1, "FC", 2)) four_digits (buf, buflen, "FileCroc", id+3);
    224         else if (!memcmp (id+1, "FT", 2)) four_digits (buf, buflen, "FoxTorrent/RedSwoosh", id+3);
    225         else if (!memcmp (id+1, "GR", 2)) four_digits (buf, buflen, "GetRight", id+3);
    226         else if (!memcmp (id+1, "GS", 2)) four_digits (buf, buflen, "GSTorrent", id+3);
    227         else if (!memcmp (id+1, "HK", 2)) four_digits (buf, buflen, "Hekate", id+3);
    228         else if (!memcmp (id+1, "HN", 2)) four_digits (buf, buflen, "Hydranode", id+3);
    229         else if (!memcmp (id+1, "KG", 2)) four_digits (buf, buflen, "KGet", id+3);
    230         else if (!memcmp (id+1, "LC", 2)) four_digits (buf, buflen, "LeechCraft", id+3);
    231         else if (!memcmp (id+1, "LH", 2)) four_digits (buf, buflen, "LH-ABC", id+3);
    232         else if (!memcmp (id+1, "NX", 2)) four_digits (buf, buflen, "Net Transport", id+3);
    233         else if (!memcmp (id+1, "MK", 2)) four_digits (buf, buflen, "Meerkat", id+3);
    234         else if (!memcmp (id+1, "MO", 2)) four_digits (buf, buflen, "MonoTorrent", id+3);
    235         else if (!memcmp (id+1, "MR", 2)) four_digits (buf, buflen, "Miro", id+3);
    236         else if (!memcmp (id+1, "MT", 2)) four_digits (buf, buflen, "Moonlight", id+3);
    237         else if (!memcmp (id+1, "OS", 2)) four_digits (buf, buflen, "OneSwarm", id+3);
    238         else if (!memcmp (id+1, "OT", 2)) four_digits (buf, buflen, "OmegaTorrent", id+3);
    239         else if (!memcmp (id+1, "PD", 2)) four_digits (buf, buflen, "Pando", id+3);
    240         else if (!memcmp (id+1, "QD", 2)) four_digits (buf, buflen, "QQDownload", id+3);
    241         else if (!memcmp (id+1, "RS", 2)) four_digits (buf, buflen, "Rufus", id+3);
    242         else if (!memcmp (id+1, "RT", 2)) four_digits (buf, buflen, "Retriever", id+3);
    243         else if (!memcmp (id+1, "RZ", 2)) four_digits (buf, buflen, "RezTorrent", id+3);
    244         else if (!memcmp (id+1, "SD", 2)) four_digits (buf, buflen, "Thunder", id+3);
    245         else if (!memcmp (id+1, "SM", 2)) four_digits (buf, buflen, "SoMud", id+3);
    246         else if (!memcmp (id+1, "SS", 2)) four_digits (buf, buflen, "SwarmScope", id+3);
    247         else if (!memcmp (id+1, "ST", 2)) four_digits (buf, buflen, "SymTorrent", id+3);
    248         else if (!memcmp (id+1, "SZ", 2)) four_digits (buf, buflen, "Shareaza", id+3);
    249         else if (!memcmp (id+1, "S~", 2)) four_digits (buf, buflen, "Shareaza", id+3);
    250         else if (!memcmp (id+1, "st", 2)) four_digits (buf, buflen, "SharkTorrent", id+3);
    251         else if (!memcmp (id+1, "TN", 2)) four_digits (buf, buflen, "Torrent .NET", id+3);
    252         else if (!memcmp (id+1, "TS", 2)) four_digits (buf, buflen, "TorrentStorm", id+3);
    253         else if (!memcmp (id+1, "TT", 2)) four_digits (buf, buflen, "TuoTu", id+3);
    254         else if (!memcmp (id+1, "UL", 2)) four_digits (buf, buflen, "uLeecher!", id+3);
    255         else if (!memcmp (id+1, "VG", 2)) four_digits (buf, buflen, "Vagaa", id+3);
    256         else if (!memcmp (id+1, "WT", 2)) four_digits (buf, buflen, "BitLet", id+3);
    257         else if (!memcmp (id+1, "WY", 2)) four_digits (buf, buflen, "FireTorrent", id+3);
    258         else if (!memcmp (id+1, "XL", 2)) four_digits (buf, buflen, "Xunlei", id+3);
    259         else if (!memcmp (id+1, "XS", 2)) four_digits (buf, buflen, "XSwifter", id+3);
    260         else if (!memcmp (id+1, "XT", 2)) four_digits (buf, buflen, "XanTorrent", id+3);
    261         else if (!memcmp (id+1, "XX", 2)) four_digits (buf, buflen, "Xtorrent", id+3);
    262         else if (!memcmp (id+1, "ZT", 2)) four_digits (buf, buflen, "Zip Torrent", id+3);
    263         else if (!memcmp (id+1, "ZO", 2)) four_digits (buf, buflen, "Zona", id+3);
    264 
    265         else if (!memcmp (id+1, "AG", 2)) three_digits (buf, buflen, "Ares", id+3);
    266         else if (!memcmp (id+1, "A~", 2)) three_digits (buf, buflen, "Ares", id+3);
    267         else if (!memcmp (id+1, "ES", 2)) three_digits (buf, buflen, "Electric Sheep", id+3);
    268         else if (!memcmp (id+1, "HL", 2)) three_digits (buf, buflen, "Halite", id+3);
    269         else if (!memcmp (id+1, "LT", 2)) three_digits (buf, buflen, "libtorrent (Rasterbar)", id+3);
    270         else if (!memcmp (id+1, "lt", 2)) three_digits (buf, buflen, "libTorrent (Rakshasa)", id+3);
    271         else if (!memcmp (id+1, "MP", 2)) three_digits (buf, buflen, "MooPolice", id+3);
    272         else if (!memcmp (id+1, "pb", 2)) three_digits (buf, buflen, "pbTorrent", id+3);
    273         else if (!memcmp (id+1, "TT", 2)) three_digits (buf, buflen, "TuoTu", id+3);
    274         else if (!memcmp (id+1, "qB", 2)) three_digits (buf, buflen, "qBittorrent", id+3);
    275 
    276         else if (!memcmp (id+1, "AX", 2)) two_major_two_minor (buf, buflen, "BitPump", id+3);
    277         else if (!memcmp (id+1, "BC", 2)) two_major_two_minor (buf, buflen, "BitComet", id+3);
    278         else if (!memcmp (id+1, "CD", 2)) two_major_two_minor (buf, buflen, "Enhanced CTorrent", id+3);
    279         else if (!memcmp (id+1, "LP", 2)) two_major_two_minor (buf, buflen, "Lphant", id+3);
    280 
    281         else if (!memcmp (id+1, "BF", 2)) no_version (buf, buflen, "BitFlu");
    282         else if (!memcmp (id+1, "LW", 2)) no_version (buf, buflen, "LimeWire");
    283 
    284         else if (!memcmp (id+1, "BB", 2))
     205        else if (memcmp (id+1, "AG", 2) == 0) four_digits (buf, buflen, "Ares", id+3);
     206        else if (memcmp (id+1, "AR", 2) == 0) four_digits (buf, buflen, "Arctic", id+3);
     207        else if (memcmp (id+1, "AT", 2) == 0) four_digits (buf, buflen, "Artemis", id+3);
     208        else if (memcmp (id+1, "AV", 2) == 0) four_digits (buf, buflen, "Avicora", id+3);
     209        else if (memcmp (id+1, "BB", 2) == 0) four_digits (buf, buflen, "BitBuddy", id+3);
     210        else if (memcmp (id+1, "BE", 2) == 0) four_digits (buf, buflen, "BitTorrent SDK", id+3);
     211        else if (memcmp (id+1, "BG", 2) == 0) four_digits (buf, buflen, "BTGetit", id+3);
     212        else if (memcmp (id+1, "BH", 2) == 0) four_digits (buf, buflen, "BitZilla", id+3);
     213        else if (memcmp (id+1, "BM", 2) == 0) four_digits (buf, buflen, "BitMagnet", id+3);
     214        else if (memcmp (id+1, "BP", 2) == 0) four_digits (buf, buflen, "BitTorrent Pro (Azureus + Spyware)", id+3);
     215        else if (memcmp (id+1, "BX", 2) == 0) four_digits (buf, buflen, "BittorrentX", id+3);
     216        else if (memcmp (id+1, "bk", 2) == 0) four_digits (buf, buflen, "BitKitten (libtorrent)", id+3);
     217        else if (memcmp (id+1, "BS", 2) == 0) four_digits (buf, buflen, "BTSlave", id+3);
     218        else if (memcmp (id+1, "BW", 2) == 0) four_digits (buf, buflen, "BitWombat", id+3);
     219        else if (memcmp (id+1, "BX", 2) == 0) four_digits (buf, buflen, "BittorrentX", id+3);
     220        else if (memcmp (id+1, "EB", 2) == 0) four_digits (buf, buflen, "EBit", id+3);
     221        else if (memcmp (id+1, "DE", 2) == 0) four_digits (buf, buflen, "Deluge", id+3);
     222        else if (memcmp (id+1, "DP", 2) == 0) four_digits (buf, buflen, "Propogate Data Client", id+3);
     223        else if (memcmp (id+1, "FC", 2) == 0) four_digits (buf, buflen, "FileCroc", id+3);
     224        else if (memcmp (id+1, "FT", 2) == 0) four_digits (buf, buflen, "FoxTorrent/RedSwoosh", id+3);
     225        else if (memcmp (id+1, "GR", 2) == 0) four_digits (buf, buflen, "GetRight", id+3);
     226        else if (memcmp (id+1, "GS", 2) == 0) four_digits (buf, buflen, "GSTorrent", id+3);
     227        else if (memcmp (id+1, "HK", 2) == 0) four_digits (buf, buflen, "Hekate", id+3);
     228        else if (memcmp (id+1, "HN", 2) == 0) four_digits (buf, buflen, "Hydranode", id+3);
     229        else if (memcmp (id+1, "KG", 2) == 0) four_digits (buf, buflen, "KGet", id+3);
     230        else if (memcmp (id+1, "LC", 2) == 0) four_digits (buf, buflen, "LeechCraft", id+3);
     231        else if (memcmp (id+1, "LH", 2) == 0) four_digits (buf, buflen, "LH-ABC", id+3);
     232        else if (memcmp (id+1, "NX", 2) == 0) four_digits (buf, buflen, "Net Transport", id+3);
     233        else if (memcmp (id+1, "MK", 2) == 0) four_digits (buf, buflen, "Meerkat", id+3);
     234        else if (memcmp (id+1, "MO", 2) == 0) four_digits (buf, buflen, "MonoTorrent", id+3);
     235        else if (memcmp (id+1, "MR", 2) == 0) four_digits (buf, buflen, "Miro", id+3);
     236        else if (memcmp (id+1, "MT", 2) == 0) four_digits (buf, buflen, "Moonlight", id+3);
     237        else if (memcmp (id+1, "OS", 2) == 0) four_digits (buf, buflen, "OneSwarm", id+3);
     238        else if (memcmp (id+1, "OT", 2) == 0) four_digits (buf, buflen, "OmegaTorrent", id+3);
     239        else if (memcmp (id+1, "PD", 2) == 0) four_digits (buf, buflen, "Pando", id+3);
     240        else if (memcmp (id+1, "QD", 2) == 0) four_digits (buf, buflen, "QQDownload", id+3);
     241        else if (memcmp (id+1, "RS", 2) == 0) four_digits (buf, buflen, "Rufus", id+3);
     242        else if (memcmp (id+1, "RT", 2) == 0) four_digits (buf, buflen, "Retriever", id+3);
     243        else if (memcmp (id+1, "RZ", 2) == 0) four_digits (buf, buflen, "RezTorrent", id+3);
     244        else if (memcmp (id+1, "SD", 2) == 0) four_digits (buf, buflen, "Thunder", id+3);
     245        else if (memcmp (id+1, "SM", 2) == 0) four_digits (buf, buflen, "SoMud", id+3);
     246        else if (memcmp (id+1, "SS", 2) == 0) four_digits (buf, buflen, "SwarmScope", id+3);
     247        else if (memcmp (id+1, "ST", 2) == 0) four_digits (buf, buflen, "SymTorrent", id+3);
     248        else if (memcmp (id+1, "SZ", 2) == 0) four_digits (buf, buflen, "Shareaza", id+3);
     249        else if (memcmp (id+1, "S~", 2) == 0) four_digits (buf, buflen, "Shareaza", id+3);
     250        else if (memcmp (id+1, "st", 2) == 0) four_digits (buf, buflen, "SharkTorrent", id+3);
     251        else if (memcmp (id+1, "TN", 2) == 0) four_digits (buf, buflen, "Torrent .NET", id+3);
     252        else if (memcmp (id+1, "TS", 2) == 0) four_digits (buf, buflen, "TorrentStorm", id+3);
     253        else if (memcmp (id+1, "TT", 2) == 0) four_digits (buf, buflen, "TuoTu", id+3);
     254        else if (memcmp (id+1, "UL", 2) == 0) four_digits (buf, buflen, "uLeecher!", id+3);
     255        else if (memcmp (id+1, "VG", 2) == 0) four_digits (buf, buflen, "Vagaa", id+3);
     256        else if (memcmp (id+1, "WT", 2) == 0) four_digits (buf, buflen, "BitLet", id+3);
     257        else if (memcmp (id+1, "WY", 2) == 0) four_digits (buf, buflen, "FireTorrent", id+3);
     258        else if (memcmp (id+1, "XL", 2) == 0) four_digits (buf, buflen, "Xunlei", id+3);
     259        else if (memcmp (id+1, "XS", 2) == 0) four_digits (buf, buflen, "XSwifter", id+3);
     260        else if (memcmp (id+1, "XT", 2) == 0) four_digits (buf, buflen, "XanTorrent", id+3);
     261        else if (memcmp (id+1, "XX", 2) == 0) four_digits (buf, buflen, "Xtorrent", id+3);
     262        else if (memcmp (id+1, "ZT", 2) == 0) four_digits (buf, buflen, "Zip Torrent", id+3);
     263        else if (memcmp (id+1, "ZO", 2) == 0) four_digits (buf, buflen, "Zona", id+3);
     264
     265        else if (memcmp (id+1, "AG", 2) == 0) three_digits (buf, buflen, "Ares", id+3);
     266        else if (memcmp (id+1, "A~", 2) == 0) three_digits (buf, buflen, "Ares", id+3);
     267        else if (memcmp (id+1, "ES", 2) == 0) three_digits (buf, buflen, "Electric Sheep", id+3);
     268        else if (memcmp (id+1, "HL", 2) == 0) three_digits (buf, buflen, "Halite", id+3);
     269        else if (memcmp (id+1, "LT", 2) == 0) three_digits (buf, buflen, "libtorrent (Rasterbar)", id+3);
     270        else if (memcmp (id+1, "lt", 2) == 0) three_digits (buf, buflen, "libTorrent (Rakshasa)", id+3);
     271        else if (memcmp (id+1, "MP", 2) == 0) three_digits (buf, buflen, "MooPolice", id+3);
     272        else if (memcmp (id+1, "pb", 2) == 0) three_digits (buf, buflen, "pbTorrent", id+3);
     273        else if (memcmp (id+1, "TT", 2) == 0) three_digits (buf, buflen, "TuoTu", id+3);
     274        else if (memcmp (id+1, "qB", 2) == 0) three_digits (buf, buflen, "qBittorrent", id+3);
     275
     276        else if (memcmp (id+1, "AX", 2) == 0) two_major_two_minor (buf, buflen, "BitPump", id+3);
     277        else if (memcmp (id+1, "BC", 2) == 0) two_major_two_minor (buf, buflen, "BitComet", id+3);
     278        else if (memcmp (id+1, "CD", 2) == 0) two_major_two_minor (buf, buflen, "Enhanced CTorrent", id+3);
     279        else if (memcmp (id+1, "LP", 2) == 0) two_major_two_minor (buf, buflen, "Lphant", id+3);
     280
     281        else if (memcmp (id+1, "BF", 2) == 0) no_version (buf, buflen, "BitFlu");
     282        else if (memcmp (id+1, "LW", 2) == 0) no_version (buf, buflen, "LimeWire");
     283
     284        else if (memcmp (id+1, "BB", 2) == 0)
    285285        {
    286286            tr_snprintf (buf, buflen, "BitBuddy %c.%c%c%c", id[3], id[4], id[5], id[6]);
    287287        }
    288         else if (!memcmp (id+1, "BR", 2))
     288        else if (memcmp (id+1, "BR", 2) == 0)
    289289        {
    290290            tr_snprintf (buf, buflen, "BitRocket %c.%c (%c%c)", id[3], id[4], id[5], id[6]);
    291291        }
    292         else if (!memcmp (id+1, "CT", 2))
     292        else if (memcmp (id+1, "CT", 2) == 0)
    293293        {
    294294            tr_snprintf (buf, buflen, "CTorrent %d.%d.%02d", charint (id[3]), charint (id[4]), strint (id+5,2));
    295295        }
    296         else if (!memcmp (id+1, "XC", 2) || !memcmp (id+1, "XX", 2))
     296        else if (memcmp (id+1, "XC", 2) == 0 || memcmp (id+1, "XX", 2) == 0)
    297297        {
    298298            tr_snprintf (buf, buflen, "Xtorrent %d.%d (%d)", charint (id[3]), charint (id[4]), strint (id+5,2));
    299299        }
    300         else if (!memcmp (id+1, "BOW", 3))
    301         {
    302                  if (!memcmp (&id[4], "A0B", 3)) tr_snprintf (buf, buflen, "Bits on Wheels 1.0.5");
    303             else if (!memcmp (&id[4], "A0C", 3)) tr_snprintf (buf, buflen, "Bits on Wheels 1.0.6");
     300        else if (memcmp (id+1, "BOW", 3) == 0)
     301        {
     302                 if (memcmp (&id[4], "A0B", 3) == 0) tr_snprintf (buf, buflen, "Bits on Wheels 1.0.5");
     303            else if (memcmp (&id[4], "A0C", 3) == 0) tr_snprintf (buf, buflen, "Bits on Wheels 1.0.6");
    304304            else                                   tr_snprintf (buf, buflen, "Bits on Wheels %c.%c.%c", id[4], id[5], id[5]);
    305305        }
    306         else if (!memcmp (id+1, "MG", 2))
     306        else if (memcmp (id+1, "MG", 2) == 0)
    307307        {
    308308            tr_snprintf (buf, buflen, "MediaGet %d.%02d", charint (id[3]), charint (id[4]));
     
    316316    if (id[0] == '-')
    317317    {
    318         if (!memcmp (id+1, "UT", 2))
     318        if (memcmp (id+1, "UT", 2) == 0)
    319319        {
    320320            tr_snprintf (buf, buflen, "\xc2\xb5Torrent %d.%d.%d%s",
    321321                        strint (id+3,1), strint (id+4,1), strint (id+5,2), getMnemonicEnd (id[7]));
    322322        }
    323         else if (!memcmp (id+1, "UM", 2))
     323        else if (memcmp (id+1, "UM", 2) == 0)
    324324        {
    325325            tr_snprintf (buf, buflen, "\xc2\xb5Torrent Mac %d.%d.%d%s",
    326326                        strint (id+3,1), strint (id+4,1), strint (id+5,2), getMnemonicEnd (id[7]));
    327327        }
    328         else if (!memcmp (id+1, "UE", 2))
     328        else if (memcmp (id+1, "UE", 2) == 0)
    329329        {
    330330            tr_snprintf (buf, buflen, "\xc2\xb5Torrent Embedded %d.%d.%d%s",
     
    348348
    349349    /* Clients with no version */
    350          if (!memcmp (id, "AZ2500BT", 8))  no_version (buf, buflen, "BitTyrant (Azureus Mod)");
    351     else if (!memcmp (id, "LIME", 4))      no_version (buf, buflen, "Limewire");
    352     else if (!memcmp (id, "martini", 7))   no_version (buf, buflen, "Martini Man");
    353     else if (!memcmp (id, "Pando", 5))     no_version (buf, buflen, "Pando");
    354     else if (!memcmp (id, "a00---0", 7))   no_version (buf, buflen, "Swarmy");
    355     else if (!memcmp (id, "a02---0", 7))   no_version (buf, buflen, "Swarmy");
    356     else if (!memcmp (id, "-G3", 3))       no_version (buf, buflen, "G3 Torrent");
    357     else if (!memcmp (id, "10-------", 9)) no_version (buf, buflen, "JVtorrent");
    358     else if (!memcmp (id, "346-", 4))      no_version (buf, buflen, "TorrentTopia");
    359     else if (!memcmp (id, "eX", 2))        no_version (buf, buflen, "eXeem");
    360     else if (!memcmp (id, "aria2-", 6))    no_version (buf, buflen, "aria2");
    361     else if (!memcmp (id, "-WT-", 4))      no_version (buf, buflen, "BitLet");
    362     else if (!memcmp (id, "-FG", 3))       two_major_two_minor (buf, buflen, "FlashGet", id+3);
     350         if (memcmp (id, "AZ2500BT", 8) == 0)  no_version (buf, buflen, "BitTyrant (Azureus Mod)");
     351    else if (memcmp (id, "LIME", 4) == 0)      no_version (buf, buflen, "Limewire");
     352    else if (memcmp (id, "martini", 7) == 0)   no_version (buf, buflen, "Martini Man");
     353    else if (memcmp (id, "Pando", 5) == 0)     no_version (buf, buflen, "Pando");
     354    else if (memcmp (id, "a00---0", 7) == 0)   no_version (buf, buflen, "Swarmy");
     355    else if (memcmp (id, "a02---0", 7) == 0)   no_version (buf, buflen, "Swarmy");
     356    else if (memcmp (id, "-G3", 3) == 0)       no_version (buf, buflen, "G3 Torrent");
     357    else if (memcmp (id, "10-------", 9) == 0) no_version (buf, buflen, "JVtorrent");
     358    else if (memcmp (id, "346-", 4) == 0)      no_version (buf, buflen, "TorrentTopia");
     359    else if (memcmp (id, "eX", 2) == 0)        no_version (buf, buflen, "eXeem");
     360    else if (memcmp (id, "aria2-", 6) == 0)    no_version (buf, buflen, "aria2");
     361    else if (memcmp (id, "-WT-", 4) == 0)      no_version (buf, buflen, "BitLet");
     362    else if (memcmp (id, "-FG", 3) == 0)       two_major_two_minor (buf, buflen, "FlashGet", id+3);
    363363
    364364    /* Everything else */
    365     else if (!memcmp (id, "S3", 2) && id[2] == '-' && id[4] == '-' && id[6] == '-')
     365    else if (memcmp (id, "S3", 2) == 0 && id[2] == '-' && id[4] == '-' && id[6] == '-')
    366366    {
    367367        tr_snprintf (buf, buflen, "Amazon S3 %c.%c.%c", id[3], id[5], id[7]);
    368368    }
    369     else if (!memcmp (id, "OP", 2))
     369    else if (memcmp (id, "OP", 2) == 0)
    370370    {
    371371        tr_snprintf (buf, buflen, "Opera (Build %c%c%c%c)", id[2], id[3], id[4], id[5]);
    372372    }
    373     else if (!memcmp (id, "-ML", 3))
     373    else if (memcmp (id, "-ML", 3) == 0)
    374374    {
    375375        tr_snprintf (buf, buflen, "MLDonkey %c%c%c%c%c", id[3], id[4], id[5], id[6], id[7]);
    376376    }
    377     else if (!memcmp (id, "DNA", 3))
     377    else if (memcmp (id, "DNA", 3) == 0)
    378378    {
    379379        tr_snprintf (buf, buflen, "BitTorrent DNA %d.%d.%d", strint (id+3,2),
     
    381381                                                             strint (id+7,2));
    382382    }
    383     else if (!memcmp (id, "Plus", 4))
     383    else if (memcmp (id, "Plus", 4) == 0)
    384384    {
    385385        tr_snprintf (buf, buflen, "Plus! v2 %c.%c%c", id[4], id[5], id[6]);
    386386    }
    387     else if (!memcmp (id, "XBT", 3))
     387    else if (memcmp (id, "XBT", 3) == 0)
    388388    {
    389389        tr_snprintf (buf, buflen, "XBT Client %c.%c.%c%s", id[3], id[4], id[5], getMnemonicEnd (id[6]));
    390390    }
    391     else if (!memcmp (id, "Mbrst", 5))
     391    else if (memcmp (id, "Mbrst", 5) == 0)
    392392    {
    393393        tr_snprintf (buf, buflen, "burst! %c.%c.%c", id[5], id[7], id[9]);
    394394    }
    395     else if (!memcmp (id, "btpd", 4))
     395    else if (memcmp (id, "btpd", 4) == 0)
    396396    {
    397397        tr_snprintf (buf, buflen, "BT Protocol Daemon %c%c%c", id[5], id[6], id[7]);
    398398    }
    399     else if (!memcmp (id, "BLZ", 3))
     399    else if (memcmp (id, "BLZ", 3) == 0)
    400400    {
    401401        tr_snprintf (buf, buflen, "Blizzard Downloader %d.%d", id[3]+1, id[4]);
    402402    }
    403     else if (!memcmp (id, "-SP", 3))
     403    else if (memcmp (id, "-SP", 3) == 0)
    404404    {
    405405        three_digits (buf, buflen, "BitSpirit", id+3);
    406406    }
    407     else if ('\0' == id[0] && !memcmp (id+2, "BS", 2))
     407    else if ('\0' == id[0] && memcmp (id+2, "BS", 2) == 0)
    408408    {
    409409        tr_snprintf (buf, buflen, "BitSpirit %u", (id[1] == 0 ? 1 : id[1]));
    410410    }
    411     else if (!memcmp (id, "QVOD", 4))
     411    else if (memcmp (id, "QVOD", 4) == 0)
    412412    {
    413413        four_digits (buf, buflen, "QVOD", id+4);
    414414    }
    415     else if (!memcmp (id, "-NE", 3))
     415    else if (memcmp (id, "-NE", 3) == 0)
    416416    {
    417417        four_digits (buf, buflen, "BT Next Evolution", id+3);
    418418    }
    419     else if (!memcmp (id, "TIX", 3))
     419    else if (memcmp (id, "TIX", 3) == 0)
    420420    {
    421421        two_major_two_minor (buf, buflen, "Tixati", id+3);
  • trunk/libtransmission/handshake.c

    r14644 r14718  
    259259  /* confirm the protocol */
    260260  tr_peerIoReadBytes (handshake->io, inbuf, name, HANDSHAKE_NAME_LEN);
    261   if (memcmp (name, HANDSHAKE_NAME, HANDSHAKE_NAME_LEN))
     261  if (memcmp (name, HANDSHAKE_NAME, HANDSHAKE_NAME_LEN) != 0)
    262262    return HANDSHAKE_ENCRYPTION_WRONG;
    263263
     
    269269  assert (tr_peerIoHasTorrentHash (handshake->io));
    270270  if (!tr_torrentExists (handshake->session, hash)
    271       || memcmp (hash, tr_peerIoGetTorrentHash (handshake->io), SHA_DIGEST_LENGTH))
     271      || memcmp (hash, tr_peerIoGetTorrentHash (handshake->io), SHA_DIGEST_LENGTH) != 0)
    272272    {
    273273      dbgmsg (handshake, "peer returned the wrong hash. wtf?");
     
    284284
    285285  tor = tr_torrentFindFromHash (handshake->session, hash);
    286   if (!memcmp (peer_id, tr_torrentGetPeerId(tor), PEER_ID_LEN))
     286  if (memcmp (peer_id, tr_torrentGetPeerId(tor), PEER_ID_LEN) == 0)
    287287    {
    288288      dbgmsg (handshake, "streuth!  we've connected to ourselves.");
     
    515515      tr_cryptoDecryptInit (handshake->crypto);
    516516      tr_cryptoDecrypt (handshake->crypto, key_len, tmp, tmp);
    517       if (!memcmp (tmp, key, key_len))
     517      if (memcmp (tmp, key, key_len) == 0)
    518518        break;
    519519
     
    643643  tr_peerIoReadBytes (handshake->io, inbuf, pstr, pstrlen);
    644644  pstr[pstrlen] = '\0';
    645   if (memcmp (pstr, "BitTorrent protocol", 19))
     645  if (memcmp (pstr, "BitTorrent protocol", 19) != 0)
    646646    return tr_handshakeDone (handshake, false);
    647647
     
    676676      assert (tr_peerIoHasTorrentHash (handshake->io));
    677677
    678       if (memcmp (hash, tr_peerIoGetTorrentHash (handshake->io), SHA_DIGEST_LENGTH))
     678      if (memcmp (hash, tr_peerIoGetTorrentHash (handshake->io), SHA_DIGEST_LENGTH) != 0)
    679679        {
    680680          dbgmsg (handshake, "peer returned the wrong hash. wtf?");
     
    722722  /* if we've somehow connected to ourselves, don't keep the connection */
    723723  tor = tr_torrentFindFromHash (handshake->session, tr_peerIoGetTorrentHash (handshake->io));
    724   connected_to_self = (tor != NULL) && !memcmp (peer_id, tr_torrentGetPeerId(tor), PEER_ID_LEN);
     724  connected_to_self = (tor != NULL) && memcmp (peer_id, tr_torrentGetPeerId(tor), PEER_ID_LEN) == 0;
    725725
    726726  return tr_handshakeDone (handshake, !connected_to_self);
  • trunk/libtransmission/inout.c

    r14476 r14718  
    314314
    315315  return recalculateHash (tor, piece, hash)
    316       && !memcmp (hash, tor->info.pieces[piece].hash, SHA_DIGEST_LENGTH);
    317 }
     316      && memcmp (hash, tor->info.pieces[piece].hash, SHA_DIGEST_LENGTH) == 0;
     317}
  • trunk/libtransmission/libtransmission-test.c

    r14581 r14718  
    6363check_streq_impl (const char * file, int line, const char * expected, const char * actual)
    6464{
    65   const bool pass = !tr_strcmp0 (expected, actual);
     65  const bool pass = tr_strcmp0 (expected, actual) == 0;
    6666
    6767  if (should_print (pass)) {
  • trunk/libtransmission/magnet.c

    r14634 r14718  
    112112  tr_magnet_info * info = NULL;
    113113
    114   if ((uri != NULL) && !memcmp (uri, "magnet:?", 8))
     114  if (uri != NULL && memcmp (uri, "magnet:?", 8) == 0)
    115115    {
    116116      const char * walk;
     
    138138            vallen = strlen (val);
    139139
    140           if ((keylen==2) && !memcmp (key, "xt", 2) && val && !memcmp (val, "urn:btih:", 9))
     140          if (keylen == 2 && memcmp (key, "xt", 2) == 0 && val != NULL && memcmp (val, "urn:btih:", 9) == 0)
    141141            {
    142142              const char * hash = val + 9;
     
    155155            }
    156156
    157           if ((vallen > 0) && (keylen==2) && !memcmp (key, "dn", 2))
     157          if (vallen > 0 && keylen == 2 && memcmp (key, "dn", 2) == 0)
    158158            displayName = tr_http_unescape (val, vallen);
    159159
     
    161161            {
    162162              int i;
    163               if ((keylen==2) && !memcmp (key, "tr", 2))
     163              if (keylen == 2 && memcmp (key, "tr", 2) == 0)
    164164                tr[trCount++] = tr_http_unescape (val, vallen);
    165165              else if ((sscanf (key, "tr.%d=", &i) == 1) && (i >= 0)) /* ticket #3341 and #5134 */
     
    167167            }
    168168
    169           if ((vallen > 0) && (keylen==2) && !memcmp (key, "ws", 2) && (wsCount < MAX_WEBSEEDS))
     169          if (vallen > 0 && keylen == 2 && memcmp (key, "ws", 2) == 0 && wsCount < MAX_WEBSEEDS)
    170170            ws[wsCount++] = tr_http_unescape (val, vallen);
    171171
  • trunk/libtransmission/metainfo.c

    r14634 r14718  
    226226   * the scrape convention. If it does, substitute 'scrape' for
    227227   * 'announce' to find the scrape page. */
    228   if (((s = strrchr (announce, '/'))) && !strncmp (++s, "announce", 8))
     228  if (((s = strrchr (announce, '/')) != NULL) && strncmp (++s, "announce", 8) == 0)
    229229    {
    230230      const char * prefix = announce;
     
    241241    }
    242242  /* Some torrents with UDP annouce URLs don't have /announce. */
    243   else if (!strncmp (announce, "udp:", 4))
     243  else if (strncmp (announce, "udp:", 4) == 0)
    244244    {
    245245      scrape = tr_strdup (announce);
  • trunk/libtransmission/platform-quota.c

    r14480 r14718  
    8888
    8989  while (getmntent(fp, &mnt))
    90     if (!tr_strcmp0 (path, mnt.mnt_mountp))
     90    if (tr_strcmp0 (path, mnt.mnt_mountp) == 0)
    9191      break;
    9292  fclose(fp);
     
    100100
    101101  while ((mnt = getmntent(fp)) != NULL)
    102     if (!tr_strcmp0 (path, mnt->mnt_dir))
     102    if (tr_strcmp0 (path, mnt->mnt_dir) == 0)
    103103      break;
    104104
     
    117117
    118118  for (i=0; i<n; i++)
    119     if (!tr_strcmp0 (path, mnt[i].f_mntonname))
     119    if (tr_strcmp0 (path, mnt[i].f_mntonname) == 0)
    120120      break;
    121121
     
    138138    return NULL;
    139139  while (getmntent(fp, &mnt))
    140     if (!tr_strcmp0 (device, mnt.mnt_mountp))
     140    if (tr_strcmp0 (device, mnt.mnt_mountp) == 0)
    141141      break;
    142142  fclose(fp);
     
    150150
    151151  while ((mnt = getmntent (fp)) != NULL)
    152     if (!tr_strcmp0 (device, mnt->mnt_fsname))
     152    if (tr_strcmp0 (device, mnt->mnt_fsname) == 0)
    153153      break;
    154154
     
    167167
    168168  for (i=0; i<n; i++)
    169     if (!tr_strcmp0 (device, mnt[i].f_mntfromname))
     169    if (tr_strcmp0 (device, mnt[i].f_mntfromname) == 0)
    170170      break;
    171171
  • trunk/libtransmission/platform.c

    r14633 r14718  
    390390                  *end = '\0';
    391391
    392                   if (!memcmp (value, "$HOME/", 6))
     392                  if (memcmp (value, "$HOME/", 6) == 0)
    393393                    user_dir = tr_buildPath (getHomeDir (), value+6, NULL);
    394                   else if (!strcmp (value, "$HOME"))
     394                  else if (strcmp (value, "$HOME") == 0)
    395395                    user_dir = tr_strdup (getHomeDir ());
    396396                  else
  • trunk/libtransmission/quark.c

    r14666 r14718  
    412412  ret = memcmp (a->str, b->str, MIN (a->len, b->len));
    413413
    414   if (!ret && (a->len != b->len))
     414  if (ret == 0 && a->len != b->len)
    415415    ret = a->len < b->len ? -1 : 1;
    416416
  • trunk/libtransmission/rename-test.c

    r14491 r14718  
    5757
    5858      success = contents != NULL
    59              && (str_len == contents_len)
    60              && (!memcmp (contents, str, contents_len));
     59             && str_len == contents_len
     60             && memcmp (contents, str, contents_len) == 0;
    6161
    6262      tr_free (contents);
  • trunk/libtransmission/resume.c

    r14644 r14718  
    352352      ret = TR_FR_NAME;
    353353
    354       if (tr_strcmp0 (tr_torrentName(tor), name))
     354      if (tr_strcmp0 (tr_torrentName(tor), name) != 0)
    355355        {
    356356          tr_free (tor->info.name);
     
    615615          if (!tr_variantGetRaw (b, &buf, &buflen))
    616616            err = "Invalid value for \"blocks\"";
    617           else if ((buflen == 3) && !memcmp (buf, "all", 3))
     617          else if (buflen == 3 && memcmp (buf, "all", 3) == 0)
    618618            tr_bitfieldSetHasAll (&blocks);
    619           else if ((buflen == 4) && !memcmp (buf, "none", 4))
     619          else if (buflen == 4 && memcmp (buf, "none", 4) == 0)
    620620            tr_bitfieldSetHasNone (&blocks);
    621621          else
     
    624624      else if (tr_variantDictFindStr (prog, TR_KEY_have, &str, NULL))
    625625        {
    626           if (!strcmp (str, "all"))
     626          if (strcmp (str, "all") == 0)
    627627            tr_bitfieldSetHasAll (&blocks);
    628628          else
  • trunk/libtransmission/rpc-server.c

    r14663 r14718  
    225225          const char * ours = get_current_session_id (server);
    226226          const size_t ourlen = strlen (ours);
    227           hasSessionId = ourlen<=p->body_len && !memcmp (p->body, ours, ourlen);
     227          hasSessionId = ourlen <= p->body_len && memcmp (p->body, ours, ourlen) == 0;
    228228        }
    229229
     
    246246          char * body = p->body;
    247247
    248           if (body_len >= 2 && !memcmp (&body[body_len - 2], "\r\n", 2))
     248          if (body_len >= 2 && memcmp (&body[body_len - 2], "\r\n", 2) == 0)
    249249            body_len -= 2;
    250250
     
    311311
    312312  for (i = 0; dot && i < TR_N_ELEMENTS (types); ++i)
    313     if (!strcmp (dot + 1, types[i].suffix))
     313    if (strcmp (dot + 1, types[i].suffix) == 0)
    314314      return types[i].mime_type;
    315315
     
    594594  const char * ours = get_current_session_id (server);
    595595  const char * theirs = evhttp_find_header (req->input_headers, TR_RPC_SESSION_ID_HEADER);
    596   const bool success =  theirs && !strcmp (theirs, ours);
     596  const bool success =  theirs != NULL && strcmp (theirs, ours) == 0;
    597597  return success;
    598598}
     
    639639        }
    640640      else if (server->isPasswordEnabled
    641                  && (!pass || !user || strcmp (server->username, user)
     641                 && (pass == NULL || user == NULL || strcmp (server->username, user) != 0
    642642                                     || !tr_ssha1_matches (server->password,
    643643                                                           pass)))
     
    648648          send_simple_response (req, 401, "Unauthorized User");
    649649        }
    650       else if (strncmp (req->uri, server->url, strlen (server->url)))
     650      else if (strncmp (req->uri, server->url, strlen (server->url)) != 0)
    651651        {
    652652          char * location = tr_strdup_printf ("%sweb/", server->url);
     
    655655          tr_free (location);
    656656        }
    657       else if (!strncmp (req->uri + strlen (server->url), "web/", 4))
     657      else if (strncmp (req->uri + strlen (server->url), "web/", 4) == 0)
    658658        {
    659659          handle_web_client (req, server);
    660660        }
    661       else if (!strcmp (req->uri + strlen (server->url), "upload"))
     661      else if (strcmp (req->uri + strlen (server->url), "upload") == 0)
    662662        {
    663663          handle_upload (req, server);
     
    684684        }
    685685#endif
    686       else if (!strncmp (req->uri + strlen (server->url), "rpc", 3))
     686      else if (strncmp (req->uri + strlen (server->url), "rpc", 3) == 0)
    687687        {
    688688          handle_rpc (req, server);
  • trunk/libtransmission/rpcimpl.c

    r14644 r14718  
    155155  else if (tr_variantDictFindStr (args, TR_KEY_ids, &str, NULL))
    156156    {
    157       if (!strcmp (str, "recently-active"))
     157      if (strcmp (str, "recently-active") == 0)
    158158        {
    159159          tr_torrent * tor = NULL;
     
    936936  assert (idle_data == NULL);
    937937
    938   if (tr_variantDictFindStr (args_in, TR_KEY_ids, &strVal, NULL) && !strcmp (strVal, "recently-active"))
     938  if (tr_variantDictFindStr (args_in, TR_KEY_ids, &strVal, NULL) && strcmp (strVal, "recently-active") == 0)
    939939    {
    940940      int n = 0;
     
    10541054  for (i=0; i<n; ++i)
    10551055    {
    1056       if (!strcmp (t[i].announce, url))
     1056      if (strcmp (t[i].announce, url) == 0)
    10571057        {
    10581058          found = true;
     
    16751675    return false;
    16761676
    1677   return !strncmp (filename, "ftp://", 6) ||
    1678          !strncmp (filename, "http://", 7) ||
    1679          !strncmp (filename, "https://", 8);
     1677  return strncmp (filename, "ftp://", 6) == 0 ||
     1678         strncmp (filename, "http://", 7) == 0 ||
     1679         strncmp (filename, "https://", 8) == 0;
    16801680}
    16811681
     
    18051805          tr_free (metainfo);
    18061806        }
    1807       else if (!strncmp (fname, "magnet:?", 8))
     1807      else if (strncmp (fname, "magnet:?", 8) == 0)
    18081808        {
    18091809          tr_ctorSetMetainfoFromMagnetLink (ctor, fname);
     
    19791979  if (tr_variantDictFindStr (args_in, TR_KEY_encryption, &str, NULL))
    19801980    {
    1981       if (!tr_strcmp0 (str, "required"))
     1981      if (tr_strcmp0 (str, "required") == 0)
    19821982        tr_sessionSetEncryption (session, TR_ENCRYPTION_REQUIRED);
    1983       else if (!tr_strcmp0 (str, "tolerated"))
     1983      else if (tr_strcmp0 (str, "tolerated") == 0)
    19841984        tr_sessionSetEncryption (session, TR_CLEAR_PREFERRED);
    19851985      else
     
    22262226
    22272227      for (i=0; i<n; ++i)
    2228         if (!strcmp (str, methods[i].name))
     2228        if (strcmp (str, methods[i].name) == 0)
    22292229          break;
    22302230
     
    23512351        {
    23522352          char * key = tr_strndup (pch, (size_t) (delim - pch));
    2353           int isArg = strcmp (key, "method") && strcmp (key, "tag");
     2353          bool isArg = strcmp (key, "method") != 0 && strcmp (key, "tag") != 0;
    23542354          tr_variant * parent = isArg ? args : &top;
    23552355
  • trunk/libtransmission/session-test.c

    r14241 r14718  
    3333
    3434        check (strlen ((char*)peer_id) == PEER_ID_LEN);
    35         check (!memcmp (peer_id, PEERID_PREFIX, 8));
     35        check (memcmp (peer_id, PEERID_PREFIX, 8) == 0);
    3636
    3737        for (j = 8; j < PEER_ID_LEN; ++j)
  • trunk/libtransmission/session.c

    r14666 r14718  
    251251
    252252  if (is_default_value && bindinfo)
    253     *is_default_value = !tr_strcmp0 (default_value, tr_address_to_string (&bindinfo->addr));
     253    *is_default_value = tr_strcmp0 (default_value, tr_address_to_string (&bindinfo->addr)) == 0;
    254254
    255255  return bindinfo ? &bindinfo->addr : NULL;
     
    992992  int64_t free_space;
    993993
    994   if (!tr_strcmp0 (dir, tr_sessionGetDownloadDir (session)))
     994  if (tr_strcmp0 (dir, tr_sessionGetDownloadDir (session)) == 0)
    995995    free_space = tr_device_info_get_free_space (session->downloadDir);
    996996  else
     
    22642264  const size_t elen = strlen (end);
    22652265
    2266   return slen >= elen && !memcmp (&str[slen - elen], end, elen);
     2266  return slen >= elen && memcmp (&str[slen - elen], end, elen) == 0;
    22672267}
    22682268
  • trunk/libtransmission/torrent-magnet.c

    r14664 r14718  
    265265      dbgmsg (tor, "metainfo piece %d was the last one", piece);
    266266      tr_sha1 (sha1, m->metadata, m->metadata_size, NULL);
    267       if ((checksumPassed = !memcmp (sha1, tor->info.hash, SHA_DIGEST_LENGTH)))
     267      if ((checksumPassed = memcmp (sha1, tor->info.hash, SHA_DIGEST_LENGTH) == 0))
    268268        {
    269269          /* checksum passed; now try to parse it as benc */
  • trunk/libtransmission/torrent.c

    r14717 r14718  
    113113  while ((tor = tr_torrentNext (session, tor)))
    114114    if (*tor->info.hash == *torrentHash)
    115       if (!memcmp (tor->info.hash, torrentHash, SHA_DIGEST_LENGTH))
     115      if (memcmp (tor->info.hash, torrentHash, SHA_DIGEST_LENGTH) == 0)
    116116        return tor;
    117117
     
    141141
    142142  while ((tor = tr_torrentNext (session, tor)))
    143     if (!memcmp (tor->obfuscatedHash, obfuscatedTorrentHash, SHA_DIGEST_LENGTH))
     143    if (memcmp (tor->obfuscatedHash, obfuscatedTorrentHash, SHA_DIGEST_LENGTH) == 0)
    144144      return tor;
    145145
     
    10811081  assert (tr_isTorrent (tor));
    10821082
    1083   if (!path || !tor->downloadDir || strcmp (path, tor->downloadDir))
     1083  if (path == NULL || tor->downloadDir == NULL || strcmp (path, tor->downloadDir) != 0)
    10841084    {
    10851085      tr_free (tor->downloadDir);
     
    27862786
    27872787          for (i=0; clear && i<trackerCount; ++i)
    2788             if (!strcmp (trackers[i].announce, tor->errorTracker))
     2788            if (strcmp (trackers[i].announce, tor->errorTracker) == 0)
    27892789              clear = false;
    27902790
     
    28832883
    28842884  for (i=0; i<file_count; ++i)
    2885     if (!strcmp (base, files[i]))
     2885    if (strcmp (base, files[i]) == 0)
    28862886      return true;
    28872887
    28882888#ifdef __APPLE__
    28892889  /* check for resource forks. <http://support.apple.com/kb/TA20578> */
    2890   if (!memcmp (base, "._", 2))
     2890  if (memcmp (base, "._", 2) == 0)
    28912891    return true;
    28922892#endif
     
    32633263  if (tr_torrentFindFile2 (tor, fileIndex, &base, &sub, NULL))
    32643264    {
    3265       if (strcmp (sub, f->name))
     3265      if (strcmp (sub, f->name) != 0)
    32663266        {
    32673267          char * oldpath = tr_buildPath (base, sub, NULL);
     
    36493649  return (oldpath && *oldpath)
    36503650      && (newname && *newname)
    3651       && (strcmp (newname, "."))
    3652       && (strcmp (newname, ".."))
     3651      && (strcmp (newname, ".") != 0)
     3652      && (strcmp (newname, "..") != 0)
    36533653      && (strchr (newname, TR_PATH_DELIMITER) == NULL);
    36543654}
     
    36693669      const size_t len = strlen (name);
    36703670      if ((len == oldpath_len || (len > oldpath_len && name[oldpath_len] == '/')) &&
    3671           !memcmp (oldpath, name, oldpath_len))
     3671          memcmp (oldpath, name, oldpath_len) == 0)
    36723672        indices[n++] = i;
    36733673    }
     
    37693769    }
    37703770
    3771   if (!strcmp (file->name, name))
     3771  if (strcmp (file->name, name) == 0)
    37723772    {
    37733773      tr_free (name);
  • trunk/libtransmission/tr-getopt.c

    r14615 r14718  
    150150          && (str[0] == '-')
    151151          && (str[1] == '-')
    152           && !strncmp (str+2, o->longName, len)
     152          && strncmp (str+2, o->longName, len) == 0
    153153          && (str[len + 2] == '\0' || (o->has_arg && str[len + 2] == '=')))
    154154        {
     
    162162        if ((matchlen < len)
    163163          && (str[0] == '-')
    164           && !strncmp (str+1, o->shortName, len)
     164          && strncmp (str+1, o->shortName, len) == 0
    165165          && (str[len + 1] == '\0' || o->has_arg))
    166166        {
     
    203203    for (i = 1; i < argc; ++i)
    204204    {
    205         if (!strcmp (argv[i], "-h") || !strcmp (argv[i], "--help"))
     205        if (strcmp (argv[i], "-h") == 0 || strcmp (argv[i], "--help") == 0)
    206206        {
    207207            tr_getopt_usage (argv[0], usage, opts);
  • trunk/libtransmission/utils.c

    r14717 r14718  
    189189
    190190  *out = '\0';
    191   return !in || strcmp (buf, in) ? buf : in;
     191  return (in == NULL || strcmp (buf, in) != 0) ? buf : in;
    192192}
    193193
     
    404404    return NULL;
    405405  for (i=0; i<=haystacklen-needlelen; ++i)
    406     if (!memcmp (haystack+i, needle, needlelen))
     406    if (memcmp (haystack + i, needle, needlelen) == 0)
    407407      return haystack+i;
    408408  return NULL;
  • trunk/libtransmission/variant-test.c

    r14666 r14718  
    114114  check_int_eq (0, err);
    115115  check_int_eq (4, len);
    116   check (!strncmp ((const char*)str, "boat", len));
     116  check (strncmp ((const char*)str, "boat", len) == 0);
    117117  check (end == buf + 6);
    118118  str = NULL;
     
    144144  check_int_eq (0, err);
    145145  check_int_eq (3, len);
    146   check (!strncmp ((const char*)str, "boa", len));
     146  check (strncmp ((const char*)str, "boa", len) == 0);
    147147  check (end == buf + 5);
    148148  str = NULL;
  • trunk/libtransmission/variant.c

    r14634 r14718  
    360360
    361361  if (!success && tr_variantGetStr (v, &str, NULL))
    362     if ((success = (!strcmp (str,"true") || !strcmp (str,"false"))))
    363       *setme = !strcmp (str,"true");
     362    if ((success = (strcmp (str,"true") == 0 || strcmp (str,"false") == 0)))
     363      *setme = strcmp (str,"true") == 0;
    364364
    365365  return success;
  • trunk/libtransmission/verify.c

    r14543 r14718  
    117117
    118118          tr_sha1_final (sha, hash);
    119           hasPiece = !memcmp (hash, tor->info.pieces[pieceIndex].hash, SHA_DIGEST_LENGTH);
     119          hasPiece = memcmp (hash, tor->info.pieces[pieceIndex].hash, SHA_DIGEST_LENGTH) == 0;
    120120
    121121          if (hasPiece || hadPiece)
  • trunk/macosx/main.m

    r13162 r14718  
    2727int main( int argc, char ** argv )
    2828{
    29     if( argc > 1 && !strncmp( argv[1], "-v", 2 ) )
     29    if( argc > 1 && strncmp( argv[1], "-v", 2 ) == 0 )
    3030    {
    3131        char * env;
  • trunk/qt/OptionsDialog.cc

    r14561 r14718  
    399399    {
    400400      const QByteArray result (myVerifyHash.result ());
    401       const bool matches = !memcmp (result.constData (),
    402                                     myInfo.pieces[myVerifyPieceIndex].hash,
    403                                     SHA_DIGEST_LENGTH);
     401      const bool matches = memcmp (result.constData (),
     402                                   myInfo.pieces[myVerifyPieceIndex].hash,
     403                                   SHA_DIGEST_LENGTH) == 0;
    404404      myVerifyFlags[myVerifyPieceIndex] = matches;
    405405      myVerifyPiecePos = 0;
  • trunk/qt/Session.cc

    r14581 r14718  
    775775          if (tr_variantGetStr (b, &val, NULL))
    776776            {
    777               if (!qstrcmp (val , "required"))
     777              if (qstrcmp (val , "required") == 0)
    778778                myPrefs.set (i, 2);
    779               else if (!qstrcmp (val , "preferred"))
     779              else if (qstrcmp (val , "preferred") == 0)
    780780                myPrefs.set (i, 1);
    781               else if (!qstrcmp (val , "tolerated"))
     781              else if (qstrcmp (val , "tolerated") == 0)
    782782                myPrefs.set (i, 0);
    783783            }
  • trunk/utils/edit.c

    r14644 r14718  
    9494  bool changed = false;
    9595
    96   if (tr_variantDictFindStr (metainfo, TR_KEY_announce, &str, NULL) && !strcmp (str, url))
     96  if (tr_variantDictFindStr (metainfo, TR_KEY_announce, &str, NULL) && strcmp (str, url) == 0)
    9797    {
    9898      printf ("\tRemoved \"%s\" from \"announce\"\n", str);
     
    111111          while ((node = tr_variantListChild (tier, nodeIndex)))
    112112            {
    113               if (tr_variantGetStr (node, &str, NULL) && !strcmp (str, url))
     113              if (tr_variantGetStr (node, &str, NULL) && strcmp (str, url) == 0)
    114114                {
    115115                  printf ("\tRemoved \"%s\" from \"announce-list\" tier #%d\n", str, (tierIndex+1));
     
    234234      int nodeCount = 0;
    235235      while ((node = tr_variantListChild (tier, nodeCount++)))
    236         if (tr_variantGetStr (node, &str, NULL) && !strcmp (str, url))
     236        if (tr_variantGetStr (node, &str, NULL) && strcmp (str, url) == 0)
    237237          return true;
    238238    }
  • trunk/utils/show.c

    r14615 r14718  
    257257                      while (tr_variantDictChild (files, i++, &key, &val))
    258258                        {
    259                           if (!memcmp (inf->hash, tr_quark_get_string(key,NULL), SHA_DIGEST_LENGTH))
     259                          if (memcmp (inf->hash, tr_quark_get_string (key, NULL), SHA_DIGEST_LENGTH) == 0)
    260260                            {
    261261                              int64_t seeders = -1;
Note: See TracChangeset for help on using the changeset viewer.