Changeset 14011


Ignore:
Timestamp:
Feb 10, 2013, 11:06:05 PM (8 years ago)
Author:
jordan
Message:

use g_strcmp0() instead of strcmp() to guard against corrupt settings in the config file

Location:
trunk/gtk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/actions.c

    r13693 r14011  
    217217
    218218    match = gtr_pref_string_get (TR_KEY_sort_mode);
    219     for (i = 0, n = G_N_ELEMENTS (sort_radio_entries), active = -1;
    220          active == -1 && i < n; ++i)
    221         if (!strcmp (sort_radio_entries[i].name, match))
     219    for (i = 0, n = G_N_ELEMENTS (sort_radio_entries), active = -1; active == -1 && i < n; ++i)
     220        if (!g_strcmp0 (sort_radio_entries[i].name, match))
    222221            active = i;
    223222
  • trunk/gtk/tr-core.c

    r13983 r14011  
    2424
    2525#include <math.h> /* pow () */
    26 #include <string.h> /* strcmp, strlen */
     26#include <string.h> /* strlen */
    2727
    2828#include <gtk/gtk.h>
     
    619619  GtkTreeSortable * sortable = GTK_TREE_SORTABLE (gtr_core_model (core));
    620620
    621   if (!strcmp (mode, "sort-by-activity"))
     621  if (!g_strcmp0 (mode, "sort-by-activity"))
    622622    sort_func = compare_by_activity;
    623   else if (!strcmp (mode, "sort-by-age"))
     623  else if (!g_strcmp0 (mode, "sort-by-age"))
    624624    sort_func = compare_by_age;
    625   else if (!strcmp (mode, "sort-by-progress"))
     625  else if (!g_strcmp0 (mode, "sort-by-progress"))
    626626    sort_func = compare_by_progress;
    627   else if (!strcmp (mode, "sort-by-queue"))
     627  else if (!g_strcmp0 (mode, "sort-by-queue"))
    628628    sort_func = compare_by_queue;
    629   else if (!strcmp (mode, "sort-by-time-left"))
     629  else if (!g_strcmp0 (mode, "sort-by-time-left"))
    630630    sort_func = compare_by_eta;
    631   else if (!strcmp (mode, "sort-by-ratio"))
     631  else if (!g_strcmp0 (mode, "sort-by-ratio"))
    632632    sort_func = compare_by_ratio;
    633   else if (!strcmp (mode, "sort-by-state"))
     633  else if (!g_strcmp0 (mode, "sort-by-state"))
    634634    sort_func = compare_by_state;
    635   else if (!strcmp (mode, "sort-by-size"))
     635  else if (!g_strcmp0 (mode, "sort-by-size"))
    636636    sort_func = compare_by_size;
    637637  else {
Note: See TracChangeset for help on using the changeset viewer.