Skip to content

Commit c666388

Browse files
committed
patch 8.1.0975: using STRNCPY() wrongly. Warning for uninitialized variable
Problem: Using STRNCPY() wrongly. Warning for uninitialized variable. Solution: Use mch_memmove(). Initialize variable. (Yasuhiro Matsumoto, closes #3979)
1 parent 882d02e commit c666388

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/screen.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,10 +2547,10 @@ text_to_screenline(win_T *wp, char_u *text, int col)
25472547
{
25482548
#ifdef FEAT_RIGHTLEFT
25492549
if (wp->w_p_rl)
2550-
STRNCPY(current_ScreenLine, text, len);
2550+
mch_memmove(current_ScreenLine, text, len);
25512551
else
25522552
#endif
2553-
STRNCPY(current_ScreenLine + col, text, len);
2553+
mch_memmove(current_ScreenLine + col, text, len);
25542554
col += len;
25552555
}
25562556
}
@@ -3396,7 +3396,7 @@ win_line(
33963396
{
33973397
if (lnum == curwin->w_cursor.lnum)
33983398
getvcol(curwin, &(curwin->w_cursor),
3399-
(colnr_T *)&fromcol, NULL, NULL);
3399+
(colnr_T *)&fromcol, NULL, NULL);
34003400
else
34013401
fromcol = 0;
34023402
if (lnum == curwin->w_cursor.lnum + search_match_lines)

src/textprop.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Text properties have a type, which can be used to specify highlighting.
1818
*
1919
* TODO:
20+
* - When using 'cursorline' attributes should be merged. (#3912)
2021
* - Adjust text property column and length when text is inserted/deleted.
2122
* -> a :substitute with a multi-line match
2223
* -> search for changed_bytes() from misc1.c
@@ -27,7 +28,10 @@
2728
* the index, like DB_MARKED?
2829
* - Also test line2byte() with many lines, so that ml_updatechunk() is taken
2930
* into account.
30-
* - add mechanism to keep track of changed lines.
31+
* - Add mechanism to keep track of changed lines, so that plugin can update
32+
* text properties in these.
33+
* - Perhaps have a window-local option to disable highlighting from text
34+
* properties?
3135
*/
3236

3337
#include "vim.h"
@@ -158,7 +162,7 @@ f_prop_add(typval_T *argvars, typval_T *rettv UNUSED)
158162
char_u *newtext;
159163
int proplen;
160164
size_t textlen;
161-
char_u *props;
165+
char_u *props = NULL;
162166
char_u *newprops;
163167
textprop_T tmp_prop;
164168
int i;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,8 @@ static char *(features[]) =
779779

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
975,
782784
/**/
783785
974,
784786
/**/

0 commit comments

Comments
 (0)