tweaks: adjust the type of two arguments
Convert digits() to take a ssize_t instead of an int, since it's used on ssize_t line numbers. And properly use the long modifier when displaying a line number. Also, conditionalize the digits() prototype.master
parent
29e094cd21
commit
bd920b1f49
|
@ -651,7 +651,9 @@ void complete_a_word(void);
|
|||
|
||||
/* All functions in utils.c. */
|
||||
void get_homedir(void);
|
||||
int digits(int n);
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
int digits(ssize_t n);
|
||||
#endif
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
|
||||
void align(char **str);
|
||||
|
|
|
@ -54,7 +54,7 @@ void get_homedir(void)
|
|||
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
/* Return the number of digits that the given integer n takes up. */
|
||||
int digits(int n)
|
||||
int digits(ssize_t n)
|
||||
{
|
||||
if (n < 100000) {
|
||||
if (n < 1000) {
|
||||
|
|
|
@ -2323,7 +2323,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
|||
if (margin > 0) {
|
||||
wattron(edit, interface_color_pair[LINE_NUMBER]);
|
||||
if (last_drawn_line != fileptr->lineno || last_line_y >= line)
|
||||
mvwprintw(edit, line, 0, "%*i", margin - 1, fileptr->lineno);
|
||||
mvwprintw(edit, line, 0, "%*ld", margin - 1, (long)fileptr->lineno);
|
||||
else
|
||||
mvwprintw(edit, line, 0, "%*s", margin - 1, " ");
|
||||
wattroff(edit, interface_color_pair[LINE_NUMBER]);
|
||||
|
|
Loading…
Reference in New Issue