Ticket #59: display file size in full precision.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2009-08-29 12:32:24 +04:00
parent a301a7c8a5
commit f559aeb6b9
3 changed files with 4 additions and 5 deletions

View File

@ -222,7 +222,7 @@ string_file_size (file_entry *fe, int len)
else else
#endif #endif
{ {
size_trunc_len (buffer, len, fe->st.st_size, 0); size_trunc_len (buffer, (unsigned int) len, fe->st.st_size, 0);
} }
return buffer; return buffer;
} }

View File

@ -320,7 +320,7 @@ size_trunc_sep (double size)
* 0=bytes, 1=Kbytes, 2=Mbytes, etc. * 0=bytes, 1=Kbytes, 2=Mbytes, etc.
*/ */
void void
size_trunc_len (char *buffer, int len, off_t size, int units) size_trunc_len (char *buffer, unsigned int len, off_t size, int units)
{ {
/* Avoid taking power for every file. */ /* Avoid taking power for every file. */
static const off_t power10 [] = static const off_t power10 [] =
@ -333,8 +333,7 @@ size_trunc_len (char *buffer, int len, off_t size, int units)
int j = 0; int j = 0;
int size_remain; int size_remain;
/* Don't print more than 9 digits - use suffix. */ if (len == 0)
if (len == 0 || len > 9)
len = 9; len = 9;
/* /*

View File

@ -66,7 +66,7 @@ const char *size_trunc_sep (double size);
* not including trailing 0. BUFFER should be at least LEN+1 long. * not including trailing 0. BUFFER should be at least LEN+1 long.
* *
* Units: size units (0=bytes, 1=Kbytes, 2=Mbytes, etc.) */ * Units: size units (0=bytes, 1=Kbytes, 2=Mbytes, etc.) */
void size_trunc_len (char *buffer, int len, off_t size, int units); void size_trunc_len (char *buffer, unsigned int len, off_t size, int units);
int is_exe (mode_t mode); int is_exe (mode_t mode);
const char *string_perm (mode_t mode_bits); const char *string_perm (mode_t mode_bits);