diff options
Diffstat (limited to 'Swiften/Base/FileSize.cpp')
-rw-r--r-- | Swiften/Base/FileSize.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Swiften/Base/FileSize.cpp b/Swiften/Base/FileSize.cpp index 32ab5f5..d9ab5ec 100644 --- a/Swiften/Base/FileSize.cpp +++ b/Swiften/Base/FileSize.cpp @@ -11,14 +11,14 @@ namespace Swift { std::string formatSize(const boost::uintmax_t bytes) { - static const char *siPrefix[] = {"k", "M", "G", "T", "P", "E", "Z", "Y", NULL}; - int power = 0; - double engBytes = bytes; - while (engBytes >= 1000) { - ++power; - engBytes = engBytes / 1000.0; - } - return str( boost::format("%.1lf %sB") % engBytes % (power > 0 ? siPrefix[power-1] : "") ); + static const char *siPrefix[] = {"k", "M", "G", "T", "P", "E", "Z", "Y", NULL}; + int power = 0; + double engBytes = bytes; + while (engBytes >= 1000) { + ++power; + engBytes = engBytes / 1000.0; + } + return str( boost::format("%.1lf %sB") % engBytes % (power > 0 ? siPrefix[power-1] : "") ); } } |