tweaks: avoid a comparison between signed and unsigned [coverity]

master
Benno Schulenberg 2019-09-30 19:30:54 +02:00
parent 2307b31887
commit 1861052234
3 changed files with 8 additions and 6 deletions

View File

@ -89,7 +89,7 @@ int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
#ifdef ENABLED_WRAPORJUSTIFY
ssize_t fill = -COLUMNS_FROM_EOL;
/* The relative column where we will wrap lines. */
ssize_t wrap_at = 0;
size_t wrap_at = 0;
/* The actual column where we will wrap lines, based on fill. */
#endif

View File

@ -649,11 +649,12 @@ void window_init(void)
#ifdef ENABLED_WRAPORJUSTIFY
/* Set up the wrapping point, accounting for screen width when negative. */
wrap_at = fill;
if (wrap_at <= 0)
wrap_at += COLS;
if (wrap_at < 0)
if (COLS + fill < 0)
wrap_at = 0;
else if (fill <= 0)
wrap_at = COLS + fill;
else
wrap_at = fill;
#endif
}

View File

@ -77,7 +77,8 @@ extern int shiftaltup, shiftaltdown;
#endif
#ifdef ENABLED_WRAPORJUSTIFY
extern ssize_t fill, wrap_at;
extern ssize_t fill;
extern size_t wrap_at;
#endif
extern char *last_search;