Replaced all ocurrences of format_kb() by nice_unit_format()
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Tue, 1 Feb 2011 13:18:16 +0000 (14:18 +0100)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Tue, 1 Feb 2011 13:18:16 +0000 (14:18 +0100)
src/stringfunc.cpp
src/stringfunc.hxx

index 73de2cb..def77a7 100644 (file)
@@ -919,6 +919,7 @@ const string symbolFormatLong[MAX_SYMBOL_FORMATS] = {
         " YBytes"
 };
 
+
 string nice_unit_format(
         const int64_t input,
         const UnitSystem system,
@@ -972,60 +973,6 @@ string nice_unit_format(
 } // eo nice_unit_format(int input)
 
 
-string format_kb(long long bytes)
-{
-        int sizecount = 0;
-        long double calcTraffic = bytes;
-
-        /*
-        * Solange durch 1024 Teilen bis
-        * der naechste Teilschritt < 1 waere oder
-        * Abbruch bei Maximalumrechnung ->TB
-        */
-        while (calcTraffic > 1024 && sizecount<=6) {
-                calcTraffic = calcTraffic / 1024;
-                sizecount++;
-        }
-
-        long double tmp;                                                        // round
-        tmp = calcTraffic*10;
-        tmp += 0.5;
-        tmp = (long long) (tmp);
-        tmp = (long double)(tmp)/(long double)(10);
-        calcTraffic = tmp;
-
-        ostringstream out;
-
-        out.setf (ios::fixed);
-        out.precision(1);
-        switch (sizecount) {
-                case 1:
-                        out << calcTraffic << " KB";
-                        break;
-                case 2:
-                        out << calcTraffic << " MB";
-                        break;
-                case 3:
-                        out << calcTraffic << " GB";
-                        break;
-                case 4:
-                        out << calcTraffic << " TB";
-                        break;
-                case 5:
-                        out << calcTraffic << " PB";
-                        break;
-                case 6:
-                        out << calcTraffic << " EB";
-                        break;
-                default:
-                        out << calcTraffic << " B";
-                        break;
-        }
-
-        return out.str();
-}
-
-
 string escape(const string &s)
 {
    string out(s);
index 596f8c6..4c544ca 100644 (file)
@@ -207,7 +207,6 @@ std::string nice_unit_format(
         const UnitSystem system = US_SI,
         const UnitSymbolFormat symbolformat = USF_LONG
 );
-std::string format_kb(long long kb);
 
 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);