Changeset 3750

Show
Ignore:
Timestamp:
08/31/08 21:12:45
Author:
robtaylor
Message:

Make the sofar/oftotal field in TnyProgress? more sensible when one of the is negative.
In general one of these ill be negative right at the start of an operation,
and if one is 0, then the other is generally gibberish, so 0/0 is more sensible.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymail/tny-progress-info.c

    r3304 r3750  
    118118        info->stopper = tny_idle_stopper_copy (stopper); 
    119119 
    120         if (info->oftotal < 1) 
    121                 info->oftotal = 1; 
    122  
    123         if (sofar < 1) 
    124                 info->sofar = 1; 
    125         else  
    126                 if (sofar > info->oftotal) 
    127                         info->sofar = info->oftotal; 
     120        if (oftotal < 1 || sofar < 1 ) { 
     121                info->oftotal = 0; 
     122                info->sofar = 0; 
     123        } else { 
     124                if (sofar > oftotal) 
     125                        info->sofar = oftotal; 
    128126                else 
    129127                        info->sofar = sofar; 
     128        } 
    130129 
    131130        return info;