Commit 8cde95e1 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Using the proper type (off_t) for the size of a file,

and avoiding warnings about too large bit shifts.
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5303 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 10 additions and 5 deletions
+10 -5
2015-07-17 Mike Frysinger <vapier@gentoo.org>
* src/browser.c (browser_refresh): Use the proper type (off_t) for
the size of a file, and avoid warnings about too large bit shifts.
2015-07-15 Benno Schulenberg <bensberg@justemail.net> 2015-07-15 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c, src/rcfile.c, doc/nanorc.sample.in, doc/man/nano.1, * src/nano.c, src/rcfile.c, doc/nanorc.sample.in, doc/man/nano.1,
doc/man/nanorc.5, doc/texinfo/nano.texi, doc/syntax/nanorc.nanorc: doc/man/nanorc.5, doc/texinfo/nano.texi, doc/syntax/nanorc.nanorc:
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "proto.h" #include "proto.h"
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
...@@ -637,7 +638,7 @@ void browser_refresh(void) ...@@ -637,7 +638,7 @@ void browser_refresh(void)
} else } else
foo = mallocstrcpy(NULL, _("(dir)")); foo = mallocstrcpy(NULL, _("(dir)"));
} else { } else {
unsigned long result = st.st_size; off_t result = st.st_size;
char modifier; char modifier;
foo = charalloc(foomaxlen + 1); foo = charalloc(foomaxlen + 1);
...@@ -655,10 +656,10 @@ void browser_refresh(void) ...@@ -655,10 +656,10 @@ void browser_refresh(void)
modifier = 'G'; /* gigabytes */ modifier = 'G'; /* gigabytes */
} }
/* If less than a terabyte, or if numbers can't even go /* Show the size if less than a terabyte,
* that high, show the size, otherwise show "(huge)". */ * otherwise show "(huge)". */
if (st.st_size < (1 << 40) || (1 << 40) == 0) if (result < (1 << 10))
sprintf(foo, "%4lu %cB", result, modifier); sprintf(foo, "%4ju %cB", (intmax_t)result, modifier);
else else
/* TRANSLATORS: Try to keep this at most 7 characters. /* TRANSLATORS: Try to keep this at most 7 characters.
* If necessary, you can leave out the parentheses. */ * If necessary, you can leave out the parentheses. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment