mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-10 11:32:11 +03:00
tweaks: change the type of a variable, to avoid a compiler warning
A newer compiler (gcc-10.3) said: browser.c:174:34: warning: field width specifier '*' expects argument of type 'int' It's fine for 'longest' to be an integer, as a filename in Unix is at most 255 bytes long, which can occupy at most 510 columns (when the name consists entirely of control codes), and that fits easily within an 'int', which has at least fifteen bits, unsigned. Well... in theory 'tabsize' could be set to an insanely high number, and if a filename contains several tabs, this could cause 'longest' to overflow. (Why doesn't the compiler warn about that?) If that were to occur, and the filename with the tabs were the last in the list, then 'longest' would get set to the minimum width: 15. That would not be correct, but... nothing bad would happen. This addresses https://savannah.gnu.org/bugs/?62014. Reported-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
c6ddae70f7
commit
27c8f13fc9
@ -36,7 +36,7 @@ static size_t usable_rows = 0;
|
||||
/* The number of screen rows we can use to display the list. */
|
||||
static size_t piles = 0;
|
||||
/* The number of files that we can display per screen row. */
|
||||
static size_t longest = 0;
|
||||
static int longest = 0;
|
||||
/* The number of columns in the longest filename in the list. */
|
||||
static size_t selected = 0;
|
||||
/* The currently selected filename in the list; zero-based. */
|
||||
|
Loading…
Reference in New Issue
Block a user