Changeset 10911


Ignore:
Timestamp:
Jun 30, 2010, 3:05:43 PM (11 years ago)
Author:
charles
Message:

(trunk libT) fix a couple of minor warnings found by -Wfloat-equal

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.h

    r10904 r10911  
    107107{
    108108    const double ratio = tr_getRatio( cp->sizeNow, tr_cpSizeWhenDone( cp ) );
    109     return (ratio == TR_RATIO_NA ||  ratio == TR_RATIO_INF) ? 0.0f : ratio;
     109    const int iratio = (int)ratio;
     110    return ((iratio == TR_RATIO_NA) || (iratio == TR_RATIO_INF)) ? 0.0f : ratio;
    110111}
    111112
  • trunk/libtransmission/utils.c

    r10909 r10911  
    2222
    2323#include <assert.h>
    24 #include <ctype.h> /* isalpha, tolower */
     24#include <ctype.h> /* isalpha(), tolower() */
    2525#include <errno.h>
    26 #include <math.h> /* pow */
     26#include <math.h> /* pow(), fabs() */
    2727#include <stdarg.h>
    2828#include <stdio.h>
    2929#include <stdlib.h>
    30 #include <string.h> /* strerror, memset, memmem */
    31 
    32 #include <libgen.h> /* basename */
     30#include <string.h> /* strerror(), memset(), memmem() */
     31
     32#include <libgen.h> /* basename() */
    3333#include <sys/time.h>
    3434#include <sys/types.h>
    3535#include <sys/stat.h>
    36 #include <unistd.h> /* usleep, stat, getcwd, getpagesize */
     36#include <unistd.h> /* usleep(), stat(), getcwd(), getpagesize() */
    3737
    3838#include "event.h"
     
    4040#ifdef WIN32
    4141 #include <w32api.h>
    42  #define WINVER WindowsXP /* freeaddrinfo(),getaddrinfo(),getnameinfo() */
    43  #include <direct.h> /* _getcwd */
    44  #include <windows.h> /* Sleep */
     42 #define WINVER WindowsXP /* freeaddrinfo(), getaddrinfo(), getnameinfo() */
     43 #include <direct.h> /* _getcwd() */
     44 #include <windows.h> /* Sleep() */
    4545#endif
    4646
     
    862862
    863863double
    864 tr_getRatio( double numerator,
    865              double denominator )
     864tr_getRatio( double numerator, double denominator )
    866865{
    867866    double ratio;
    868867
    869     if( denominator )
     868    if( fabs(denominator) > 0.01 )
    870869        ratio = numerator / denominator;
    871     else if( numerator )
     870    else if( fabs(numerator) > 0.01 )
    872871        ratio = TR_RATIO_INF;
    873872    else
Note: See TracChangeset for help on using the changeset viewer.