tweaks: use printf's z modifier for (s)size_t, instead of casting

master
David Lawrence Ramsey 2017-11-06 07:13:50 -06:00 committed by Benno Schulenberg
parent a10fdc3fb1
commit 62ebd93579
3 changed files with 6 additions and 9 deletions

View File

@ -146,7 +146,7 @@ void rcfile_error(const char *msg, ...)
rcfile_with_errors = strdup(nanorc);
if (lineno > 0)
fprintf(stderr, _("Error in %s on line %lu: "), nanorc, (unsigned long)lineno);
fprintf(stderr, _("Error in %s on line %zu: "), nanorc, lineno);
va_start(ap, msg);
vfprintf(stderr, _(msg), ap);

View File

@ -3523,9 +3523,8 @@ void do_wordlinechar_count(void)
openfile->placewewant = pww_save;
/* Display the total word, line, and character counts on the statusbar. */
statusline(HUSH, _("%sWords: %lu Lines: %ld Chars: %lu"), was_mark ?
_("In Selection: ") : "", (unsigned long)words, (long)nlines,
(unsigned long)chars);
statusline(HUSH, _("%sWords: %zu Lines: %zd Chars: %zu"), was_mark ?
_("In Selection: ") : "", words, nlines, chars);
}
#endif /* !NANO_TINY */

View File

@ -3390,11 +3390,9 @@ void do_cursorpos(bool force)
charpct = (openfile->totsize == 0) ? 0 : 100 * sum / openfile->totsize;
statusline(HUSH,
_("line %ld/%ld (%d%%), col %lu/%lu (%d%%), char %lu/%lu (%d%%)"),
(long)openfile->current->lineno,
(long)openfile->filebot->lineno, linepct,
(unsigned long)cur_xpt, (unsigned long)cur_lenpt, colpct,
(unsigned long)sum, (unsigned long)openfile->totsize, charpct);
_("line %zd/%zd (%d%%), col %zu/%zu (%d%%), char %zu/%zu (%d%%)"),
openfile->current->lineno, openfile->filebot->lineno, linepct,
cur_xpt, cur_lenpt, colpct, sum, openfile->totsize, charpct);
/* Displaying the cursor position should not suppress it next time. */
suppress_cursorpos = FALSE;