Skip to content

Commit

Permalink
Merge pull request neovim#10541 from bfredl/conversion_getln
Browse files Browse the repository at this point in the history
refactor: enable -Wconversion for ex_getln.c and use int for Rows/Columns
  • Loading branch information
bfredl authored Jul 19, 2019
2 parents 7e4fd04 + aa28e07 commit d5f7099
Show file tree
Hide file tree
Showing 24 changed files with 207 additions and 190 deletions.
1 change: 0 additions & 1 deletion src/nvim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ set(CONV_SOURCES
eval.c
ex_cmds.c
ex_docmd.c
ex_getln.c
fileio.c
mbyte.c
memline.c
Expand Down
4 changes: 2 additions & 2 deletions src/nvim/digraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,8 +1497,8 @@ int get_digraph(int cmdline)
}

if (cmdline) {
if ((char2cells(c) == 1) && (cmdline_star == 0)) {
putcmdline(c, TRUE);
if ((char2cells(c) == 1) && c < 128 && (cmdline_star == 0)) {
putcmdline((char)c, true);
}
} else {
add_to_showcmd(c);
Expand Down
13 changes: 7 additions & 6 deletions src/nvim/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -10026,13 +10026,13 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)

if (strcmp(tv_get_string(&argvars[1]), "cmdline") == 0) {
set_one_cmd_context(&xpc, tv_get_string(&argvars[0]));
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
goto theend;
}

ExpandInit(&xpc);
xpc.xp_pattern = (char_u *)tv_get_string(&argvars[0]);
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
xpc.xp_context = cmdcomplete_str_to_type(
(char_u *)tv_get_string(&argvars[1]));
if (xpc.xp_context == EXPAND_NOTHING) {
Expand All @@ -10042,17 +10042,17 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)

if (xpc.xp_context == EXPAND_MENUS) {
set_context_in_menu_cmd(&xpc, (char_u *)"menu", xpc.xp_pattern, false);
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
}

if (xpc.xp_context == EXPAND_CSCOPE) {
set_context_in_cscope_cmd(&xpc, (const char *)xpc.xp_pattern, CMD_cscope);
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
}

if (xpc.xp_context == EXPAND_SIGN) {
set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
}

theend:
Expand Down Expand Up @@ -21138,7 +21138,8 @@ void ex_function(exarg_T *eap)
goto erret;
}
if (show_block) {
ui_ext_cmdline_block_append(indent, (const char *)theline);
assert(indent >= 0);
ui_ext_cmdline_block_append((size_t)indent, (const char *)theline);
}

/* Detect line continuation: sourcing_lnum increased more than one. */
Expand Down
2 changes: 1 addition & 1 deletion src/nvim/ex_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ static void do_filter(

/* Create the shell command in allocated memory. */
cmd_buf = make_filter_cmd(cmd, itmp, otmp);
ui_cursor_goto((int)Rows - 1, 0);
ui_cursor_goto(Rows - 1, 0);

if (do_out) {
if (u_save((linenr_T)(line2), (linenr_T)(line2 + 1)) == FAIL) {
Expand Down
2 changes: 1 addition & 1 deletion src/nvim/ex_cmds_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct exarg {
struct expand {
int xp_context; // type of expansion
char_u *xp_pattern; // start of item to expand
int xp_pattern_len; // bytes in xp_pattern before cursor
size_t xp_pattern_len; // bytes in xp_pattern before cursor
char_u *xp_arg; // completion function
int xp_scriptID; // SID for completion function
int xp_backslash; // one of the XP_BS_ values
Expand Down
2 changes: 1 addition & 1 deletion src/nvim/ex_docmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -6417,7 +6417,7 @@ static void ex_stop(exarg_T *eap)
apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, false, NULL);

// TODO(bfredl): the TUI should do this on suspend
ui_cursor_goto((int)Rows - 1, 0);
ui_cursor_goto(Rows - 1, 0);
ui_call_grid_scroll(1, 0, Rows, 0, Columns, 1, 0);
ui_flush();
ui_call_suspend(); // call machine specific function
Expand Down
Loading

0 comments on commit d5f7099

Please sign in to comment.