Changeset 14613


Ignore:
Timestamp:
Dec 6, 2015, 10:13:10 PM (6 years ago)
Author:
jordan
Message:

const correctness

silence some qual-cast warnings by sprinkling more consts throughout,
e.g. casting a const void* to a const struct foo * const *

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/daemon.c

    r14581 r14613  
    663663    tr_variantInitDict (settings, 0);
    664664    tr_variantDictAddBool (settings, TR_KEY_rpc_enabled, true);
    665     *configDir = getConfigDir (argc, (const char**)argv);
     665    *configDir = getConfigDir (argc, (const char* const *)argv);
    666666    loaded = tr_sessionLoadSettings (settings, *configDir, MY_NAME);
    667667
  • trunk/daemon/remote.c

    r14584 r14613  
    16321632    {
    16331633        tr_logAddNamedError (MY_NAME, "Unable to parse response \"%*.*s\"", (int)len,
    1634                (int)len, (char*)response);
     1634               (int)len, (const char*)response);
    16351635        status |= EXIT_FAILURE;
    16361636    }
     
    23822382        rpcurl = tr_strdup_printf ("%s:%d%s", host, port, DEFAULT_URL);
    23832383
    2384     exit_status = processArgs (rpcurl, argc, (const char**)argv);
     2384    exit_status = processArgs (rpcurl, argc, (const char* const *)argv);
    23852385
    23862386    tr_free (host);
  • trunk/gtk/filter.c

    r14526 r14613  
    5353pstrcmp (const void * a, const void * b)
    5454{
    55   return g_strcmp0 (* (const char**)a, * (const char**)b);
     55  return g_strcmp0 (* (const char* const *)a, * (const char* const *)b);
    5656}
    5757
     
    924924on_filter_model_row_deleted (GtkTreeModel * tree_model UNUSED,
    925925                             GtkTreePath  * path       UNUSED,
    926                              gpointer       data       UNUSED)
     926                             gpointer       data)
    927927{
    928928  update_count_label_idle (data);
  • trunk/gtk/icons.c

    r14107 r14613  
    238238
    239239const char *
    240 gtr_get_mime_type_from_filename (const char * file G_GNUC_UNUSED)
     240gtr_get_mime_type_from_filename (const char * file)
    241241{
    242242    char * tmp = g_content_type_guess (file, NULL, 0, NULL);
  • trunk/libtransmission/cache.c

    r14532 r14613  
    8383  int i;
    8484  const int n = tr_ptrArraySize (&cache->blocks);
    85   const struct cache_block ** blocks = (const struct cache_block**) tr_ptrArrayBase (&cache->blocks);
     85  const struct cache_block * const * blocks = (const struct cache_block* const *) tr_ptrArrayBase (&cache->blocks);
    8686  const struct cache_block * ref = blocks[pos];
    8787  tr_block_index_t block = ref->block;
  • trunk/libtransmission/peer-mgr.c

    r14525 r14613  
    22572257compareAtomsByUsefulness (const void * va, const void *vb)
    22582258{
    2259   const struct peer_atom * a = * (const struct peer_atom**) va;
    2260   const struct peer_atom * b = * (const struct peer_atom**) vb;
     2259  const struct peer_atom * a = * (const struct peer_atom* const *) va;
     2260  const struct peer_atom * b = * (const struct peer_atom* const *) vb;
    22612261
    22622262  assert (tr_isAtom (a));
     
    36653665compareAtomPtrsByAddress (const void * va, const void *vb)
    36663666{
    3667   const struct peer_atom * a = * (const struct peer_atom**) va;
    3668   const struct peer_atom * b = * (const struct peer_atom**) vb;
     3667  const struct peer_atom * a = * (const struct peer_atom* const *) va;
     3668  const struct peer_atom * b = * (const struct peer_atom* const *) vb;
    36693669
    36703670  assert (tr_isAtom (a));
     
    36803680  time_t atime;
    36813681  time_t btime;
    3682   const struct peer_atom * a = * (const struct peer_atom**) va;
    3683   const struct peer_atom * b = * (const struct peer_atom**) vb;
     3682  const struct peer_atom * a = * (const struct peer_atom* const *) va;
     3683  const struct peer_atom * b = * (const struct peer_atom* const *) vb;
    36843684  const int data_time_cutoff_secs = 60 * 60;
    36853685  const time_t tr_now = tr_time ();
  • trunk/libtransmission/peer-msgs.c

    r14569 r14613  
    17461746
    17471747static void
    1748 didWrite (tr_peerIo * io UNUSED, size_t bytesWritten, bool wasPieceData, void * vmsgs)
     1748didWrite (tr_peerIo * io, size_t bytesWritten, bool wasPieceData, void * vmsgs)
    17491749{
    17501750    tr_peerMsgs * msgs = vmsgs;
  • trunk/libtransmission/session.c

    r14581 r14613  
    23252325      int i;
    23262326      const int n = tr_ptrArraySize (&loadme);
    2327       const char ** paths = (const char **) tr_ptrArrayBase (&loadme);
     2327      const char * const * paths = (const char * const *) tr_ptrArrayBase (&loadme);
    23282328
    23292329      for (i=0; i<n; ++i)
  • trunk/libtransmission/torrent.c

    r14587 r14613  
    34683468compareTorrentByQueuePosition (const void * va, const void * vb)
    34693469{
    3470   const tr_torrent * a = * (const tr_torrent **) va;
    3471   const tr_torrent * b = * (const tr_torrent **) vb;
     3470  const tr_torrent * a = * (const tr_torrent * const *) va;
     3471  const tr_torrent * b = * (const tr_torrent * const *) vb;
    34723472
    34733473  return a->queuePosition - b->queuePosition;
  • trunk/libtransmission/utils.c

    r14592 r14613  
    605605    }
    606606
    607   return s - (char*)src - 1;  /* count does not include NUL */
     607  return s - (const char*)src - 1;  /* count does not include NUL */
    608608#endif
    609609}
  • trunk/libtransmission/variant-test.c

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

    r14503 r14613  
    138138  tr_formatter_speed_init (SPEED_K, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR, SPEED_T_STR);
    139139
    140   if (parseCommandLine (argc, (const char**)argv))
     140  if (parseCommandLine (argc, (const char* const *)argv))
    141141    return EXIT_FAILURE;
    142142
  • trunk/utils/edit.c

    r14503 r14613  
    297297  tr_logSetLevel (TR_LOG_ERROR);
    298298
    299   if (parseCommandLine (argc, (const char**)argv))
     299  if (parseCommandLine (argc, (const char* const *)argv))
    300300    return EXIT_FAILURE;
    301301
  • trunk/utils/show.c

    r14503 r14613  
    9494compare_files_by_name (const void * va, const void * vb)
    9595{
    96   const tr_file * a = * (const tr_file**)va;
    97   const tr_file * b = * (const tr_file**)vb;
     96  const tr_file * a = * (const tr_file* const *)va;
     97  const tr_file * b = * (const tr_file* const *)vb;
    9898  return strcmp (a->name, b->name);
    9999}
     
    296296  tr_formatter_speed_init (SPEED_K, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR, SPEED_T_STR);
    297297
    298   if (parseCommandLine (argc, (const char**)argv))
     298  if (parseCommandLine (argc, (const char* const *)argv))
    299299    return EXIT_FAILURE;
    300300
Note: See TracChangeset for help on using the changeset viewer.