diff options
author | watiko <service@mail.watiko.net> | 2016-01-15 21:54:18 +0900 |
---|---|---|
committer | watiko <service@mail.watiko.net> | 2016-02-01 03:47:09 +0900 |
commit | cb724182fff5e9f4b9023f60da086d60eb706246 (patch) | |
tree | 505573ef4c67db97bf8c219f25dbba61aa735b17 | |
parent | 8f212568aa5083a77b3617f2cef5b438f3d90e42 (diff) | |
download | rneovim-cb724182fff5e9f4b9023f60da086d60eb706246.tar.gz rneovim-cb724182fff5e9f4b9023f60da086d60eb706246.tar.bz2 rneovim-cb724182fff5e9f4b9023f60da086d60eb706246.zip |
vim-patch:7.4.1088
Problem: Coverity warns for uninitialized variables. Only one is an actual
problem.
Solution: Move the conditions. Don't use endpos if handling an error.
https://github.com/vim/vim/commit/7ae4fbca552c972eb3645ece02a2807e517610d7
-rw-r--r-- | src/nvim/ops.c | 51 | ||||
-rw-r--r-- | src/nvim/version.c | 1 |
2 files changed, 27 insertions, 25 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index b08a5056e4..a5dc92ec53 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -4235,28 +4235,27 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd) block_prep(oap, &bd, pos.lnum, false); pos.col = bd.textcol; length = bd.textlen; + } else if (oap->motion_type == MLINE) { + curwin->w_cursor.col = 0; + pos.col = 0; + length = (colnr_T)STRLEN(ml_get(pos.lnum)); } else { - if (oap->motion_type == MLINE) { - curwin->w_cursor.col = 0; - pos.col = 0; - length = (colnr_T)STRLEN(ml_get(pos.lnum)); - } else if (oap->motion_type == MCHAR) { - if (!oap->inclusive) { - dec(&(oap->end)); - } - length = (colnr_T)STRLEN(ml_get(pos.lnum)); - pos.col = 0; - if (pos.lnum == oap->start.lnum) { - pos.col += oap->start.col; - length -= oap->start.col; - } - if (pos.lnum == oap->end.lnum) { - length = (int)STRLEN(ml_get(oap->end.lnum)); - if (oap->end.col >= length) { - oap->end.col = length - 1; - } - length = oap->end.col - pos.col + 1; + // oap->motion_type == MCHAR + if (!oap->inclusive) { + dec(&(oap->end)); + } + length = (colnr_T)STRLEN(ml_get(pos.lnum)); + pos.col = 0; + if (pos.lnum == oap->start.lnum) { + pos.col += oap->start.col; + length -= oap->start.col; + } + if (pos.lnum == oap->end.lnum) { + length = (int)STRLEN(ml_get(oap->end.lnum)); + if (oap->end.col >= length) { + oap->end.col = length - 1; } + length = oap->end.col - pos.col + 1; } } one_change = do_addsub(oap->op_type, &pos, length, amount); @@ -4327,7 +4326,7 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1) bool was_positive = true; bool visual = VIsual_active; bool did_change = false; - pos_T t = curwin->w_cursor; + pos_T save_cursor = curwin->w_cursor; int maxlen = 0; pos_T startpos; pos_T endpos; @@ -4624,10 +4623,6 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1) } } -theend: - if (visual) { - curwin->w_cursor = t; - } if (did_change) { // set the '[ and '] marks curbuf->b_op_start = startpos; @@ -4636,6 +4631,12 @@ theend: curbuf->b_op_end.col--; } } + +theend: + if (visual) { + curwin->w_cursor = save_cursor; + } + return did_change; } diff --git a/src/nvim/version.c b/src/nvim/version.c index 68165363ca..d64fb69415 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -73,6 +73,7 @@ static int included_patches[] = { + 1088, 1087, // 1086, 1085, |