Changeset 1191


Ignore:
Timestamp:
Dec 13, 2006, 2:42:41 AM (15 years ago)
Author:
joshe
Message:

Eliminate magic numbers for tracker address length.

Location:
branches/multitracker/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/multitracker/libtransmission/metainfo.c

    r1182 r1191  
    304304   
    305305    /* Announce-list */
    306     address = calloc( sizeof( char ), 256 );
     306    address = calloc( sizeof( char ), TR_ADDRLEN );
    307307    announce = calloc( sizeof( char ), MAX_PATH_LENGTH );
    308308   
     
    351351               
    352352                /* Set values */
    353                 snprintf( announceItem->address, 256, "%s", address );
     353                snprintf( announceItem->address, sizeof( announceItem->address ), "%s", address );
    354354                announceItem->port = port;
    355355                snprintf( announceItem->announce, MAX_PATH_LENGTH, "%s", announce );
     
    413413       
    414414        inf->trackerAnnounceList[0] = calloc( sizeof( tr_announce_list_item_t ), 1 );
    415         snprintf( inf->trackerAnnounceList[0]->address, 256, "%s", address );
     415        snprintf( inf->trackerAnnounceList[0]->address, sizeof( inf->trackerAnnounceList[0]->address ), "%s", address );
    416416        inf->trackerAnnounceList[0]->port = port;
    417417        snprintf( inf->trackerAnnounceList[0]->announce, MAX_PATH_LENGTH, "%s", announce );
  • branches/multitracker/libtransmission/tracker.c

    r1188 r1191  
    3939    char         * trackerid;
    4040   
    41     char           trackerAddress[256];
     41    char           trackerAddress[TR_ADDRLEN];
    4242    int            trackerPort;
    4343    char           trackerAnnounce[MAX_PATH_LENGTH];
     
    168168    tr_announce_list_item_t * announceItem = announcePtr->item;
    169169   
    170     snprintf( tc->trackerAddress, 256, "%s", announceItem->address );
     170    snprintf( tc->trackerAddress, sizeof( tc->trackerAddress ), "%s", announceItem->address );
    171171    tc->trackerPort = announceItem->port;
    172172    snprintf( tc->trackerAnnounce, MAX_PATH_LENGTH, "%s", announceItem->announce );
  • branches/multitracker/libtransmission/transmission.c

    r1175 r1191  
    478478    if( tor->tracker )
    479479    {
    480         snprintf( s->trackerAddress, 256, "%s", tr_trackerAddress( tor->tracker ) );
     480        snprintf( s->trackerAddress, sizeof( s->trackerAddress ), "%s", tr_trackerAddress( tor->tracker ) );
    481481        s->trackerPort = tr_trackerPort( tor->tracker );
    482482        snprintf( s->trackerAnnounce, MAX_PATH_LENGTH, "%s", tr_trackerAnnounce( tor->tracker ) );
     
    484484    else
    485485    {
    486         snprintf( s->trackerAddress, 256, "%s", inf->trackerAnnounceList[0]->address );
     486        snprintf( s->trackerAddress, sizeof( s->trackerAddress ), "%s", inf->trackerAnnounceList[0]->address );
    487487        s->trackerPort = inf->trackerAnnounceList[0]->port;
    488488        snprintf( s->trackerAnnounce, MAX_PATH_LENGTH, "%s", inf->trackerAnnounceList[0]->announce );
  • branches/multitracker/libtransmission/transmission.h

    r1173 r1191  
    5252#define TR_DEFAULT_PORT   9090
    5353#define TR_NOERROR        0
     54#define TR_ADDRLEN        256
    5455
    5556/***********************************************************************
     
    359360    char                trackerError[128];
    360361   
    361     char                trackerAddress[256];
     362    char                trackerAddress[TR_ADDRLEN];
    362363    int                 trackerPort;
    363364    char                trackerAnnounce[MAX_PATH_LENGTH];
     
    402403struct tr_announce_list_item_s
    403404{
    404     char address[256];
     405    char address[TR_ADDRLEN];
    405406    int port;
    406407    char announce[MAX_PATH_LENGTH];
Note: See TracChangeset for help on using the changeset viewer.