Change nice_unit_format() to long long
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Fri, 28 Jan 2011 16:49:51 +0000 (17:49 +0100)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Fri, 28 Jan 2011 16:49:51 +0000 (17:49 +0100)
- increased variable size to accommodate bigger byte amounts

src/stringfunc.cpp
src/stringfunc.hxx

index 16cd6bd..d9050aa 100644 (file)
@@ -892,9 +892,9 @@ string to_upper(const string &src)
 }
 #endif
 
-string nice_unit_format(int input)
+string nice_unit_format(long long input)
 {
-   float size = input;
+   double size = input;
    int sizecount = 0;
 
    while (size > 1000)
@@ -903,11 +903,11 @@ string nice_unit_format(int input)
       sizecount++;
    }
 
-   float tmp;                       // round
+   double tmp;                       // round
    tmp = size*10;
    tmp += 0.5;
-   tmp = int (tmp);
-   tmp = float (tmp) /float (10);
+   tmp = (long long) (tmp);
+   tmp = double (tmp) /double (10);
    size = tmp;
 
    ostringstream out;
index b211a17..660c081 100644 (file)
@@ -190,7 +190,7 @@ using I2n::to_lower;
 using I2n::to_upper;
 #endif
 
-std::string nice_unit_format(int input);
+std::string nice_unit_format(long long input);
 
 bool replace_all(std::string &base, const std::string *ist, const std::string *soll);
 bool replace_all(std::string &base, const char *ist, const char *soll);