diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2004-05-02 17:06:59 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2004-05-02 17:06:59 +0000 |
commit | a054631f2d45c6a21dc956dc398e0c624f14ec39 (patch) | |
tree | 2f86c4e73c95f1544b7c3579499ab5add39b3526 /utils | |
parent | afb5e4209bce0dd6979e06593dc7ffb311365807 (diff) | |
download | netsurf-a054631f2d45c6a21dc956dc398e0c624f14ec39.tar.gz netsurf-a054631f2d45c6a21dc956dc398e0c624f14ec39.tar.bz2 |
[project @ 2004-05-02 17:06:59 by jmb]
No longer truncate bytesize.
svn path=/import/netsurf/; revision=817
Diffstat (limited to 'utils')
-rw-r--r-- | utils/utils.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/utils/utils.c b/utils/utils.c index 885b57ab7..92f064bc4 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -310,14 +310,16 @@ void clean_cookiejar(void) { * Does a simple conversion which assumes the user speaks English. The buffer * returned is one of two static ones so may change each time this call is * made. Don't store the buffer for later use. It's done this way for - * convenience and to fight possible memory leaks, it is not necesarily pretty. + * convenience and to fight possible memory leaks, it is not necessarily pretty. **/ -char *human_friendly_bytesize(unsigned long bytesize) { +char *human_friendly_bytesize(unsigned long bsize) { static char buffer1[BYTESIZE_BUFFER_SIZE]; static char buffer2[BYTESIZE_BUFFER_SIZE]; static char *curbuffer = buffer2; + float bytesize = (float)bsize; + if (curbuffer == buffer1) curbuffer = buffer2; else @@ -341,7 +343,7 @@ char *human_friendly_bytesize(unsigned long bytesize) { unit = gigabytes; } - sprintf(curbuffer, "%lu%s", bytesize, messages_get(units[unit])); + sprintf(curbuffer, "%3.2f%s", bytesize, messages_get(units[unit])); return curbuffer; } |