Changeset 2245


Ignore:
Timestamp:
Jun 30, 2007, 1:36:58 PM (15 years ago)
Author:
charles
Message:

make tr_torrentInfo() a const function

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/transmissioncli.c

    r2206 r2245  
    164164    if( showInfo )
    165165    {
    166         tr_info_t * info = tr_torrentInfo( tor );
     166        const tr_info_t * info = tr_torrentInfo( tor );
    167167
    168168        s = tr_torrentStat( tor );
  • trunk/daemon/server.c

    r2227 r2245  
    444444    size_t          buflen;
    445445    uint8_t       * buf;
    446     tr_info_t     * inf;
    447446
    448447    if( NULL == val || TYPE_LIST != val->type )
     
    471470        if( TORRENT_ID_VALID( tor ) )
    472471        {
    473             inf = torrent_info( tor );
     472            const tr_info_t * inf = torrent_info( tor );
    474473            if( 0 > ipc_addinfo( added, tor, inf, 0 ) )
    475474            {
     
    497496    uint8_t       * buf;
    498497    const char    * dir;
    499     tr_info_t     * inf;
    500498
    501499    if( NULL == dict || TYPE_DICT != dict->type )
     
    531529    if( TORRENT_ID_VALID( tor ) )
    532530    {
     531        const tr_info_t * inf;
    533532        val = ipc_initval( client->ipc, IPC_MSG_INFO, tag, &pk, TYPE_LIST );
    534533        if( NULL == val )
     
    750749addinfo( benc_val_t * list, int id, int types )
    751750{
    752     tr_info_t * inf;
    753 
    754     inf = torrent_info( id );
    755     if( NULL == inf )
    756     {
    757         return 0;
    758     }
    759 
    760     return ipc_addinfo( list, id, inf, types );
     751    const tr_info_t * inf = torrent_info( id );
     752    return inf ? ipc_addinfo( list, id, inf, types ) : 0;
    761753}
    762754
     
    764756addstat( benc_val_t * list, int id, int types )
    765757{
    766     tr_stat_t * st;
    767 
    768     st = torrent_stat( id );
    769     if( NULL == st )
    770     {
    771         return 0;
    772     }
    773 
    774     return ipc_addstat( list, id, st, types );
     758    const tr_stat_t * st = torrent_stat( id );
     759    return st ? ipc_addstat( list, id, st, types ) : 0;
    775760}
    776761
     
    850835    benc_val_t    * hash, pk, * pkinf;
    851836    int64_t         found;
    852     tr_info_t     * inf;
    853837
    854838    if( NULL == val || TYPE_LIST != val->type )
     
    868852    for( ii = 0; val->val.l.count > ii; ii++ )
    869853    {
     854        const tr_info_t * inf;
    870855        hash = &val->val.l.vals[ii];
    871856        if( NULL == hash || TYPE_STR != hash->type ||
  • trunk/daemon/torrents.c

    r2206 r2245  
    238238}
    239239
    240 tr_info_t *
     240const tr_info_t *
    241241torrent_info( int id )
    242242{
     
    255255}
    256256
    257 tr_stat_t *
     257const tr_stat_t *
    258258torrent_stat( int id )
    259259{
     
    476476    struct tor * tor, * found;
    477477    int          errcode;
    478     tr_info_t  * inf;
     478    const tr_info_t  * inf;
    479479
    480480    assert( ( NULL != path && NULL == hash && NULL == data ) ||
     
    793793    benc_val_t   top, * list, * tor;
    794794    struct tor * ii;
    795     tr_info_t  * inf;
    796     tr_stat_t  * st;
    797795    uint8_t    * buf;
    798796    int          len, pexset;
     
    829827    RB_FOREACH( ii, tortree, &gl_tree )
    830828    {
     829        const tr_info_t * inf;
     830        const tr_stat_t * st;
    831831        tor = tr_bencListAdd( list );
    832832        assert( NULL != tor );
  • trunk/daemon/torrents.h

    r1635 r2245  
    3939void         torrent_stop                ( int );
    4040void         torrent_remove              ( int );
    41 tr_info_t  * torrent_info                ( int );
    42 tr_stat_t  * torrent_stat                ( int );
     41const tr_info_t  * torrent_info          ( int );
     42const tr_stat_t  * torrent_stat          ( int );
    4343int          torrent_lookup              ( const uint8_t * );
    4444void       * torrent_iter                ( void *, int * );
  • trunk/gtk/ipc.c

    r2227 r2245  
    808808    if( IPC_MSG_INFO == msgid )
    809809    {
    810         tr_info_t * inf = tr_torrent_info( tor );
     810        const tr_info_t * inf = tr_torrent_info( tor );
    811811        return ipc_addinfo( val, torid, inf, types );
    812812    }
     
    827827    int                    ii, torid;
    828828    TrTorrent            * tor;
    829     tr_info_t            * inf;
     829    const tr_info_t      * inf;
    830830    uint8_t              * buf;
    831831    size_t                 size;
  • trunk/gtk/torrent-inspector.c

    r2170 r2245  
    12571257    GtkWidget           * ret;
    12581258    FileData            * data;
    1259     tr_info_t           * inf;
     1259    const tr_info_t     * inf;
    12601260    tr_torrent_t        * tor;
    12611261    GtkTreeStore        * store;
  • trunk/gtk/tr_core.c

    r2208 r2245  
    570570{
    571571    GtkTreeIter iter;
    572     tr_info_t * inf;
     572    const tr_info_t * inf;
    573573
    574574    gtk_list_store_append( GTK_LIST_STORE( self->model ), &iter );
  • trunk/gtk/tr_torrent.c

    r2221 r2245  
    257257}
    258258
    259 tr_info_t *
     259const tr_info_t *
    260260tr_torrent_info(TrTorrent *tor) {
    261261  TR_IS_TORRENT(tor);
     
    465465tr_torrent_get_state( TrTorrent * tor, benc_val_t * state )
    466466{
    467     tr_info_t  * inf;
     467    const tr_info_t  * inf;
    468468
    469469    TR_IS_TORRENT( tor );
  • trunk/gtk/tr_torrent.h

    r2202 r2245  
    8686tr_torrent_stat(TrTorrent *tor);
    8787
    88 tr_info_t *
     88const tr_info_t *
    8989tr_torrent_info(TrTorrent *tor);
    9090
  • trunk/libtransmission/ipcparse.c

    r2227 r2245  
    585585
    586586int
    587 ipc_addinfo( benc_val_t * list, int tor, tr_info_t * inf, int types )
     587ipc_addinfo( benc_val_t * list, int tor, const tr_info_t * inf, int types )
    588588{
    589589    benc_val_t * dict, * item, * file, * tier;
  • trunk/libtransmission/ipcparse.h

    r2227 r2245  
    159159uint8_t *    ipc_mkgetinfo( struct ipc_info *, size_t *, enum ipc_msg, int64_t,
    160160                            int, const int * );
    161 int          ipc_addinfo  ( benc_val_t *, int, tr_info_t *, int );
     161int          ipc_addinfo  ( benc_val_t *, int, const tr_info_t *, int );
    162162int          ipc_addstat  ( benc_val_t *, int, const tr_stat_t *, int );
    163163
  • trunk/libtransmission/torrent.c

    r2243 r2245  
    416416}
    417417
    418 tr_info_t * tr_torrentInfo( tr_torrent_t * tor )
     418const tr_info_t *
     419tr_torrentInfo( const tr_torrent_t * tor )
    419420{
    420421    return &tor->info;
  • trunk/libtransmission/transmission.h

    r2222 r2245  
    340340 * Return torrent metainfo.
    341341 **********************************************************************/
    342 tr_info_t * tr_torrentInfo( tr_torrent_t * );
     342const tr_info_t * tr_torrentInfo( const tr_torrent_t * );
    343343
    344344/***********************************************************************
Note: See TracChangeset for help on using the changeset viewer.