1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 08:13:27 +00:00

(trunk qt) #4236 "Update formatter functions to operate with signed integers" -- patch by taem

This commit is contained in:
Jordan Lee 2011-05-12 20:21:27 +00:00
parent a4ab013568
commit 72d9d74517
2 changed files with 10 additions and 6 deletions

View file

@ -92,9 +92,11 @@ Speed :: fromKBps( double KBps )
***/
QString
Formatter :: memToString( uint64_t bytes )
Formatter :: memToString( int64_t bytes )
{
if( !bytes )
if( bytes < 1 )
return tr( "Unknown" );
else if( !bytes )
return tr( "None" );
else {
char buf[128];
@ -104,9 +106,11 @@ Formatter :: memToString( uint64_t bytes )
}
QString
Formatter :: sizeToString( uint64_t bytes )
Formatter :: sizeToString( int64_t bytes )
{
if( !bytes )
if( bytes < 1 )
return tr( "Unknown" );
else if( !bytes )
return tr( "None" );
else {
char buf[128];

View file

@ -32,8 +32,8 @@ class Formatter: public QObject
public:
static QString memToString( uint64_t bytes );
static QString sizeToString( uint64_t bytes );
static QString memToString( int64_t bytes );
static QString sizeToString( int64_t bytes );
static QString speedToString( const Speed& speed );
static QString percentToString( double x );
static QString ratioToString( double ratio );