mirror of
https://github.com/transmission/transmission
synced 2024-12-27 10:07:40 +00:00
(trunk libT) fix a couple of minor warnings found by -Wfloat-equal
This commit is contained in:
parent
d9e4ca49b5
commit
77a2cf02f1
2 changed files with 13 additions and 13 deletions
|
@ -106,7 +106,8 @@ static inline float tr_cpPercentComplete( const tr_completion * cp )
|
||||||
static inline float tr_cpPercentDone( const tr_completion * cp )
|
static inline float tr_cpPercentDone( const tr_completion * cp )
|
||||||
{
|
{
|
||||||
const double ratio = tr_getRatio( cp->sizeNow, tr_cpSizeWhenDone( cp ) );
|
const double ratio = tr_getRatio( cp->sizeNow, tr_cpSizeWhenDone( cp ) );
|
||||||
return (ratio == TR_RATIO_NA || ratio == TR_RATIO_INF) ? 0.0f : ratio;
|
const int iratio = (int)ratio;
|
||||||
|
return ((iratio == TR_RATIO_NA) || (iratio == TR_RATIO_INF)) ? 0.0f : ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,27 +21,27 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h> /* isalpha, tolower */
|
#include <ctype.h> /* isalpha(), tolower() */
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h> /* pow */
|
#include <math.h> /* pow(), fabs() */
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h> /* strerror, memset, memmem */
|
#include <string.h> /* strerror(), memset(), memmem() */
|
||||||
|
|
||||||
#include <libgen.h> /* basename */
|
#include <libgen.h> /* basename() */
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h> /* usleep, stat, getcwd, getpagesize */
|
#include <unistd.h> /* usleep(), stat(), getcwd(), getpagesize() */
|
||||||
|
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <w32api.h>
|
#include <w32api.h>
|
||||||
#define WINVER WindowsXP /* freeaddrinfo(), getaddrinfo(), getnameinfo() */
|
#define WINVER WindowsXP /* freeaddrinfo(), getaddrinfo(), getnameinfo() */
|
||||||
#include <direct.h> /* _getcwd */
|
#include <direct.h> /* _getcwd() */
|
||||||
#include <windows.h> /* Sleep */
|
#include <windows.h> /* Sleep() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "transmission.h"
|
#include "transmission.h"
|
||||||
|
@ -861,14 +861,13 @@ tr_strlcpy( char * dst,
|
||||||
***/
|
***/
|
||||||
|
|
||||||
double
|
double
|
||||||
tr_getRatio( double numerator,
|
tr_getRatio( double numerator, double denominator )
|
||||||
double denominator )
|
|
||||||
{
|
{
|
||||||
double ratio;
|
double ratio;
|
||||||
|
|
||||||
if( denominator )
|
if( fabs(denominator) > 0.01 )
|
||||||
ratio = numerator / denominator;
|
ratio = numerator / denominator;
|
||||||
else if( numerator )
|
else if( fabs(numerator) > 0.01 )
|
||||||
ratio = TR_RATIO_INF;
|
ratio = TR_RATIO_INF;
|
||||||
else
|
else
|
||||||
ratio = TR_RATIO_NA;
|
ratio = TR_RATIO_NA;
|
||||||
|
|
Loading…
Reference in a new issue