diff --git a/src/highlight.c b/src/highlight.c index a71a100dcd..d3ea2d2016 100644 --- a/src/highlight.c +++ b/src/highlight.c @@ -3351,8 +3351,8 @@ syn_list_header( if (msg_col >= endcol) // output at least one space endcol = msg_col + 1; - if (Columns <= endcol) // avoid hang for tiny window - endcol = Columns - 1; + if (Columns <= (long)endcol) // avoid hang for tiny window + endcol = (int)(Columns - 1); msg_advance(endcol); diff --git a/src/insexpand.c b/src/insexpand.c index 4ad1f41a64..2be63a58ef 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -3618,16 +3618,21 @@ get_next_filename_completion(void) } } - fuzzy_indices_data = (int *)fuzzy_indices.ga_data; - qsort(fuzzy_indices_data, fuzzy_indices.ga_len, sizeof(int), compare_scores); + // prevent qsort from deref NULL pointer + if (fuzzy_indices.ga_len > 0) + { + fuzzy_indices_data = (int *)fuzzy_indices.ga_data; + qsort(fuzzy_indices_data, fuzzy_indices.ga_len, sizeof(int), compare_scores); - sorted_matches = (char_u **)alloc(sizeof(char_u *) * fuzzy_indices.ga_len); - for (i = 0; i < fuzzy_indices.ga_len; ++i) - sorted_matches[i] = vim_strsave(matches[fuzzy_indices_data[i]]); + sorted_matches = (char_u **)alloc(sizeof(char_u *) * fuzzy_indices.ga_len); + for (i = 0; i < fuzzy_indices.ga_len; ++i) + sorted_matches[i] = vim_strsave(matches[fuzzy_indices_data[i]]); + + FreeWild(num_matches, matches); + matches = sorted_matches; + num_matches = fuzzy_indices.ga_len; + } - FreeWild(num_matches, matches); - matches = sorted_matches; - num_matches = fuzzy_indices.ga_len; vim_free(compl_fuzzy_scores); ga_clear(&fuzzy_indices); } diff --git a/src/ops.c b/src/ops.c index 2de2557fbd..eb8f64c1fb 100644 --- a/src/ops.c +++ b/src/ops.c @@ -240,8 +240,8 @@ shift_line( if (round) // round off indent { - i = count / sw_val; // number of 'shiftwidth' rounded down - j = count % sw_val; // extra spaces + i = trim_to_int(count) / sw_val; // number of 'shiftwidth' rounded down + j = trim_to_int(count) % sw_val; // extra spaces if (j && left) // first remove extra spaces --amount; if (left) diff --git a/src/spellfile.c b/src/spellfile.c index 51261abfb5..0b9536dc16 100644 --- a/src/spellfile.c +++ b/src/spellfile.c @@ -6434,7 +6434,13 @@ init_spellfile(void) l = (int)STRLEN(buf); vim_snprintf((char *)buf + l, MAXPATHL - l, "/spell"); if (filewritable(buf) != 2) - vim_mkdir(buf, 0755); + { + if (vim_mkdir(buf, 0755) != 0) + { + vim_free(buf); + return; + } + } l = (int)STRLEN(buf); vim_snprintf((char *)buf + l, MAXPATHL - l, diff --git a/src/syntax.c b/src/syntax.c index 48e7152011..02120529f3 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -4084,8 +4084,8 @@ syn_list_cluster(int id) if (msg_col >= endcol) // output at least one space endcol = msg_col + 1; - if (Columns <= endcol) // avoid hang for tiny window - endcol = Columns - 1; + if (Columns <= (long)endcol) // avoid hang for tiny window + endcol = (int)(Columns - 1); msg_advance(endcol); if (SYN_CLSTR(curwin->w_s)[id].scl_list != NULL) diff --git a/src/version.c b/src/version.c index e174c790a2..bd7457384b 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 608, /**/ 607, /**/