Skip to content

Commit

Permalink
Enable -Wconversion: popupmnu.c.
Browse files Browse the repository at this point in the history
Helped-by: oni-link <[email protected]>
  • Loading branch information
elmart committed Apr 7, 2015
1 parent 2cd7863 commit c5d7fa6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/nvim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ set(CONV_SOURCES
normal.c
ops.c
path.c
popupmnu.c
quickfix.c
regexp.c
screen.c
Expand Down
26 changes: 16 additions & 10 deletions src/nvim/popupmnu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
///
/// Popup menu (PUM)
//
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>

Expand Down Expand Up @@ -101,7 +102,7 @@ void pum_display(pumitem_T *array, int size, int selected)
}

if ((p_ph > 0) && (pum_height > p_ph)) {
pum_height = p_ph;
pum_height = (int)p_ph;
}

// Put the pum below "row" if possible. If there are few lines decide on
Expand All @@ -126,8 +127,8 @@ void pum_display(pumitem_T *array, int size, int selected)
}

if ((p_ph > 0) && (pum_height > p_ph)) {
pum_row += pum_height - p_ph;
pum_height = p_ph;
pum_row += pum_height - (int)p_ph;
pum_height = (int)p_ph;
}
} else {
// pum below "row"
Expand All @@ -148,7 +149,7 @@ void pum_display(pumitem_T *array, int size, int selected)
}

if ((p_ph > 0) && (pum_height > p_ph)) {
pum_height = p_ph;
pum_height = (int)p_ph;
}
}

Expand Down Expand Up @@ -219,7 +220,9 @@ void pum_display(pumitem_T *array, int size, int selected)
if (curwin->w_p_rl) {
pum_width = pum_col - pum_scrollbar + 1;
} else {
pum_width = Columns - pum_col - pum_scrollbar;
assert(Columns - pum_col - pum_scrollbar >= INT_MIN
&& Columns - pum_col - pum_scrollbar <= INT_MAX);
pum_width = (int)(Columns - pum_col - pum_scrollbar);
}

if ((pum_width > max_width + kind_width + extra_width + 1)
Expand All @@ -233,11 +236,13 @@ void pum_display(pumitem_T *array, int size, int selected)
} else if (Columns < def_width) {
// not enough room, will use what we have
if (curwin->w_p_rl) {
pum_col = Columns - 1;
assert(Columns - 1 >= INT_MIN);
pum_col = (int)(Columns - 1);
} else {
pum_col = 0;
}
pum_width = Columns - 1;
assert(Columns - 1 >= INT_MIN);
pum_width = (int)(Columns - 1);
} else {
if (max_width > PUM_DEF_WIDTH) {
// truncate
Expand All @@ -247,7 +252,8 @@ void pum_display(pumitem_T *array, int size, int selected)
if (curwin->w_p_rl) {
pum_col = max_width - 1;
} else {
pum_col = Columns - max_width;
assert(Columns - max_width >= INT_MIN && Columns - max_width <= INT_MAX);
pum_col = (int)(Columns - max_width);
}
pum_width = max_width - pum_scrollbar;
}
Expand Down Expand Up @@ -345,7 +351,7 @@ void pum_redraw(void)
// Display the text that fits or comes before a Tab.
// First convert it to printable characters.
char_u *st;
int saved = *p;
char_u saved = *p;

*p = NUL;
st = transstr(s);
Expand Down Expand Up @@ -535,7 +541,7 @@ static int pum_set_selected(int n, int repeat)
g_do_tagpreview = 3;

if ((p_pvh > 0) && (p_pvh < g_do_tagpreview)) {
g_do_tagpreview = p_pvh;
g_do_tagpreview = (int)p_pvh;
}
RedrawingDisabled++;
resized = prepare_tagpreview(false);
Expand Down

0 comments on commit c5d7fa6

Please sign in to comment.