mirror of
https://github.com/transmission/transmission
synced 2025-02-20 21:26:53 +00:00
(trunk gtk) gtr_compare_double() is only used in one place, so make it a private function there instead of leaving it public in utils.h
This commit is contained in:
parent
a891136602
commit
433da8df9a
3 changed files with 11 additions and 18 deletions
|
@ -22,6 +22,7 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <math.h> /* pow() */
|
||||
#include <string.h> /* strcmp, strlen */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -1344,6 +1345,16 @@ gtr_core_clear( TrCore * self )
|
|||
****
|
||||
***/
|
||||
|
||||
static int
|
||||
gtr_compare_double( const double a, const double b, int decimal_places )
|
||||
{
|
||||
const int64_t ia = (int64_t)(a * pow( 10, decimal_places ) );
|
||||
const int64_t ib = (int64_t)(b * pow( 10, decimal_places ) );
|
||||
if( ia < ib ) return -1;
|
||||
if( ia > ib ) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_foreach( GtkTreeModel * model,
|
||||
GtkTreePath * path UNUSED,
|
||||
|
|
15
gtk/util.c
15
gtk/util.c
|
@ -12,7 +12,6 @@
|
|||
|
||||
#include <ctype.h> /* isxdigit() */
|
||||
#include <errno.h>
|
||||
#include <math.h> /* pow() */
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h> /* free() */
|
||||
#include <string.h> /* strcmp() */
|
||||
|
@ -115,20 +114,6 @@ gtr_lockfile( const char * filename )
|
|||
****
|
||||
***/
|
||||
|
||||
int
|
||||
gtr_compare_double( const double a, const double b, int decimal_places )
|
||||
{
|
||||
const int64_t ia = (int64_t)(a * pow( 10, decimal_places ) );
|
||||
const int64_t ib = (int64_t)(b * pow( 10, decimal_places ) );
|
||||
if( ia < ib ) return -1;
|
||||
if( ia > ib ) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
const char*
|
||||
gtr_get_unicode_string( int i )
|
||||
{
|
||||
|
|
|
@ -63,9 +63,6 @@ char* tr_strlratio( char * buf, double ratio, size_t buflen );
|
|||
/* return a human-readable string for the time given in seconds. */
|
||||
char* tr_strltime( char * buf, int secs, size_t buflen );
|
||||
|
||||
int gtr_compare_double( const double a, const double b, int decimal_places );
|
||||
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
|
Loading…
Reference in a new issue