tweaks: use printf's z modifier for most of the size_t/ssize_t types
Also, properly refer to numreplaced as signed, since it's ssize_t (even though it's only shown when positive).master
parent
7d653e5a17
commit
477b246771
26
src/files.c
26
src/files.c
|
@ -891,24 +891,24 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable,
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (format == 3) {
|
else if (format == 3) {
|
||||||
/* TRANSLATORS: Keep the next four messages at most 78 characters. */
|
/* TRANSLATORS: Keep the next four messages at most 78 characters. */
|
||||||
statusline(HUSH, P_("Read %lu line (Converted from DOS and Mac format)",
|
statusline(HUSH, P_("Read %zu line (Converted from DOS and Mac format)",
|
||||||
"Read %lu lines (Converted from DOS and Mac format)",
|
"Read %zu lines (Converted from DOS and Mac format)",
|
||||||
(unsigned long)num_lines), (unsigned long)num_lines);
|
num_lines), num_lines);
|
||||||
} else if (format == 2) {
|
} else if (format == 2) {
|
||||||
openfile->fmt = MAC_FILE;
|
openfile->fmt = MAC_FILE;
|
||||||
statusline(HUSH, P_("Read %lu line (Converted from Mac format)",
|
statusline(HUSH, P_("Read %zu line (Converted from Mac format)",
|
||||||
"Read %lu lines (Converted from Mac format)",
|
"Read %zu lines (Converted from Mac format)",
|
||||||
(unsigned long)num_lines), (unsigned long)num_lines);
|
num_lines), num_lines);
|
||||||
} else if (format == 1) {
|
} else if (format == 1) {
|
||||||
openfile->fmt = DOS_FILE;
|
openfile->fmt = DOS_FILE;
|
||||||
statusline(HUSH, P_("Read %lu line (Converted from DOS format)",
|
statusline(HUSH, P_("Read %zu line (Converted from DOS format)",
|
||||||
"Read %lu lines (Converted from DOS format)",
|
"Read %zu lines (Converted from DOS format)",
|
||||||
(unsigned long)num_lines), (unsigned long)num_lines);
|
num_lines), num_lines);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
statusline(HUSH, P_("Read %lu line", "Read %lu lines",
|
statusline(HUSH, P_("Read %zu line", "Read %zu lines",
|
||||||
(unsigned long)num_lines), (unsigned long)num_lines);
|
num_lines), num_lines);
|
||||||
|
|
||||||
/* If we inserted less than a screenful, don't center the cursor. */
|
/* If we inserted less than a screenful, don't center the cursor. */
|
||||||
if (undoable && less_than_a_screenful(was_lineno, was_leftedge))
|
if (undoable && less_than_a_screenful(was_lineno, was_leftedge))
|
||||||
|
@ -1957,8 +1957,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||||
stat_with_alloc(realname, &openfile->current_stat);
|
stat_with_alloc(realname, &openfile->current_stat);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
statusline(HUSH, P_("Wrote %lu line", "Wrote %lu lines",
|
statusline(HUSH, P_("Wrote %zu line", "Wrote %zu lines",
|
||||||
(unsigned long)lineswritten), (unsigned long)lineswritten);
|
lineswritten), lineswritten);
|
||||||
openfile->modified = FALSE;
|
openfile->modified = FALSE;
|
||||||
titlebar(NULL);
|
titlebar(NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -472,8 +472,8 @@ void save_poshistory(void)
|
||||||
/* Assume 20 decimal positions each for line and column number,
|
/* Assume 20 decimal positions each for line and column number,
|
||||||
* plus two spaces, plus the line feed, plus the null byte. */
|
* plus two spaces, plus the line feed, plus the null byte. */
|
||||||
path_and_place = charalloc(strlen(posptr->filename) + 44);
|
path_and_place = charalloc(strlen(posptr->filename) + 44);
|
||||||
sprintf(path_and_place, "%s %ld %ld\n", posptr->filename,
|
sprintf(path_and_place, "%s %zd %zd\n",
|
||||||
(long)posptr->lineno, (long)posptr->xno);
|
posptr->filename, posptr->lineno, posptr->xno);
|
||||||
length = strlen(path_and_place);
|
length = strlen(path_and_place);
|
||||||
|
|
||||||
/* Encode newlines in filenames as nulls. */
|
/* Encode newlines in filenames as nulls. */
|
||||||
|
|
|
@ -778,9 +778,8 @@ void do_replace(void)
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
|
|
||||||
if (numreplaced >= 0)
|
if (numreplaced >= 0)
|
||||||
statusline(HUSH, P_("Replaced %lu occurrence",
|
statusline(HUSH, P_("Replaced %zd occurrence",
|
||||||
"Replaced %lu occurrences", (unsigned long)numreplaced),
|
"Replaced %zd occurrences", numreplaced), numreplaced);
|
||||||
(unsigned long)numreplaced);
|
|
||||||
|
|
||||||
search_replace_abort();
|
search_replace_abort();
|
||||||
}
|
}
|
||||||
|
|
|
@ -559,7 +559,7 @@ void dump_filestruct(const filestruct *inptr)
|
||||||
fprintf(stderr, "Dumping a buffer to stderr...\n");
|
fprintf(stderr, "Dumping a buffer to stderr...\n");
|
||||||
|
|
||||||
while (inptr != NULL) {
|
while (inptr != NULL) {
|
||||||
fprintf(stderr, "(%ld) %s\n", (long)inptr->lineno, inptr->data);
|
fprintf(stderr, "(%zd) %s\n", inptr->lineno, inptr->data);
|
||||||
inptr = inptr->next;
|
inptr = inptr->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,8 +570,7 @@ void dump_filestruct_reverse(void)
|
||||||
const filestruct *fileptr = openfile->filebot;
|
const filestruct *fileptr = openfile->filebot;
|
||||||
|
|
||||||
while (fileptr != NULL) {
|
while (fileptr != NULL) {
|
||||||
fprintf(stderr, "(%ld) %s\n", (long)fileptr->lineno,
|
fprintf(stderr, "(%zd) %s\n", fileptr->lineno, fileptr->data);
|
||||||
fileptr->data);
|
|
||||||
fileptr = fileptr->prev;
|
fileptr = fileptr->prev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2433,7 +2433,7 @@ void edit_draw(filestruct *fileptr, const char *converted,
|
||||||
mvwprintw(edit, row, 0, "%*s", margin - 1, " ");
|
mvwprintw(edit, row, 0, "%*s", margin - 1, " ");
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
mvwprintw(edit, row, 0, "%*ld", margin - 1, (long)fileptr->lineno);
|
mvwprintw(edit, row, 0, "%*zd", margin - 1, fileptr->lineno);
|
||||||
wattroff(edit, interface_color_pair[LINE_NUMBER]);
|
wattroff(edit, interface_color_pair[LINE_NUMBER]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue