diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2015-01-19 14:45:50 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-01-19 14:45:50 -0500 |
commit | 617c00bd49c2bdb05c8ef31f94e206ba3f80f694 (patch) | |
tree | 2804c90f676a47f3f8ca23a11f78e2b8c5446a66 /src/nvim/misc1.c | |
parent | d0debe243276804f59b24156c84174c394bc42bb (diff) | |
parent | dad1e39edf7f704dba40b182c7726ef4bc34c502 (diff) | |
download | rneovim-617c00bd49c2bdb05c8ef31f94e206ba3f80f694.tar.gz rneovim-617c00bd49c2bdb05c8ef31f94e206ba3f80f694.tar.bz2 rneovim-617c00bd49c2bdb05c8ef31f94e206ba3f80f694.zip |
Merge pull request #1812 from elmart/remove-long_u-5
Remove project-specific integer types: long_u. (5)
Diffstat (limited to 'src/nvim/misc1.c')
-rw-r--r-- | src/nvim/misc1.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index f756201efb..aa4d2b38db 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -10,6 +10,7 @@ * misc1.c: functions that didn't seem to fit elsewhere */ +#include <assert.h> #include <errno.h> #include <inttypes.h> #include <stdbool.h> @@ -1271,7 +1272,7 @@ plines_win_nofill ( int plines_win_nofold(win_T *wp, linenr_T lnum) { char_u *s; - long col; + unsigned int col; int width; s = ml_get_buf(wp->w_buffer, lnum, FALSE); @@ -1292,11 +1293,12 @@ int plines_win_nofold(win_T *wp, linenr_T lnum) width = wp->w_width - win_col_off(wp); if (width <= 0) return 32000; - if (col <= width) + if (col <= (unsigned int)width) return 1; col -= width; width += win_col_off2(wp); - return (col + (width - 1)) / width + 1; + assert(col <= INT_MAX && (int)col < INT_MAX - (width -1)); + return ((int)col + (width - 1)) / width + 1; } /* |