Ignore:
Timestamp:
Jul 6, 2010, 8:25:54 PM (12 years ago)
Author:
charles
Message:

(trunk T) #3045 "units" -- modify the formatter functions based on feedback from BMW

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r10937 r10955  
    15171517{
    15181518    char * name;
    1519     unsigned int value;
     1519    unsigned long value;
    15201520};
    15211521 
     
    15251525};
    15261526
    1527 enum { TR_FMT_B, TR_FMT_KB, TR_FMT_MB, TR_FMT_GB };
     1527enum { TR_FMT_KB, TR_FMT_MB, TR_FMT_GB, TR_FMT_TB };
    15281528
    15291529static void
    15301530formatter_init( struct formatter_units * units,
    15311531                unsigned int kilo,
    1532                 const char * b, const char * kb,
    1533                 const char * mb, const char * gb )
    1534 {
    1535     units->units[TR_FMT_B].name = tr_strdup( b );
    1536     units->units[TR_FMT_B].value = 1;
    1537 
     1532                const char * kb, const char * mb,
     1533                const char * gb, const char * tb )
     1534{
     1535    unsigned long value = kilo;
    15381536    units->units[TR_FMT_KB].name = tr_strdup( kb );
    1539     units->units[TR_FMT_KB].value = kilo;
    1540 
     1537    units->units[TR_FMT_KB].value = value;
     1538
     1539    value *= kilo;
    15411540    units->units[TR_FMT_MB].name = tr_strdup( mb );
    1542     units->units[TR_FMT_MB].value = kilo * kilo;
    1543 
     1541    units->units[TR_FMT_MB].value = value;
     1542
     1543    value *= kilo;
    15441544    units->units[TR_FMT_GB].name = tr_strdup( gb );
    1545     units->units[TR_FMT_GB].value = kilo * kilo * kilo;
     1545    units->units[TR_FMT_GB].value = value;
     1546
     1547    value *= kilo;
     1548    units->units[TR_FMT_TB].name = tr_strdup( tb );
     1549    units->units[TR_FMT_TB].value = value;
    15461550}
    15471551
Note: See TracChangeset for help on using the changeset viewer.