Beispiel #1
0
void
gtr_label_set_text (GtkLabel * lb, const char * newstr)
{
  const char * oldstr = gtk_label_get_text (lb);

  if (tr_strcmp0 (oldstr, newstr))
    gtk_label_set_text (lb, newstr);
}
Beispiel #2
0
static int
compare_by_name (GtkTreeModel * m,
                 GtkTreeIter  * a,
                 GtkTreeIter  * b,
                 gpointer       user_data UNUSED)
{
  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);
}
bool
check_streq_impl (const char * file, int line, const char * expected, const char * actual)
{
  const bool pass = !tr_strcmp0 (expected, actual);

  if (should_print (pass)) {
    if (pass)
      fprintf (stderr, "PASS %s:%d\n", file, line);
    else
      fprintf (stderr, "FAIL %s:%d, expected \"%s\", got \"%s\"\n", file, line, expected?expected:" (null)", actual?actual:" (null)");
  }

  return pass;
}
Beispiel #4
0
static uint64_t loadName(tr_variant* dict, tr_torrent* tor)
{
    uint64_t ret = 0;
    char const* name;

    if (tr_variantDictFindStr(dict, TR_KEY_name, &name, NULL))
    {
        ret = TR_FR_NAME;

        if (tr_strcmp0(tr_torrentName(tor), name) != 0)
        {
            tr_free(tor->info.name);
            tor->info.name = tr_strdup(name);
        }
    }

    return ret;
}