]> granicus.if.org Git - vim/commitdiff
patch 8.1.0975: using STRNCPY() wrongly. Warning for uninitialized variable v8.1.0975
authorBram Moolenaar <Bram@vim.org>
Fri, 22 Feb 2019 18:14:54 +0000 (19:14 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 22 Feb 2019 18:14:54 +0000 (19:14 +0100)
Problem:    Using STRNCPY() wrongly. Warning for uninitialized variable.
Solution:   Use mch_memmove(). Initialize variable. (Yasuhiro Matsumoto,
            closes #3979)

src/screen.c
src/textprop.c
src/version.c

index 4973b510deeb73ecc8df1307585dfe58fb432ced..aade363ea77d6c9fe2651c9ea469228d4d712084 100644 (file)
@@ -2547,10 +2547,10 @@ text_to_screenline(win_T *wp, char_u *text, int col)
        {
 #ifdef FEAT_RIGHTLEFT
            if (wp->w_p_rl)
-               STRNCPY(current_ScreenLine, text, len);
+               mch_memmove(current_ScreenLine, text, len);
            else
 #endif
-               STRNCPY(current_ScreenLine + col, text, len);
+               mch_memmove(current_ScreenLine + col, text, len);
            col += len;
        }
     }
@@ -3396,7 +3396,7 @@ win_line(
        {
            if (lnum == curwin->w_cursor.lnum)
                getvcol(curwin, &(curwin->w_cursor),
-                                                (colnr_T *)&fromcol, NULL, NULL);
+                                             (colnr_T *)&fromcol, NULL, NULL);
            else
                fromcol = 0;
            if (lnum == curwin->w_cursor.lnum + search_match_lines)
index 637ee7f39444a69f93f497af4760e914128c2bc9..674faebe248bc7ec1bd6ec7e837be55455263cdc 100644 (file)
@@ -17,6 +17,7 @@
  * Text properties have a type, which can be used to specify highlighting.
  *
  * TODO:
+ * - When using 'cursorline' attributes should be merged. (#3912)
  * - Adjust text property column and length when text is inserted/deleted.
  *   -> a :substitute with a multi-line match
  *   -> search for changed_bytes() from misc1.c
  *   the index, like DB_MARKED?
  * - Also test line2byte() with many lines, so that ml_updatechunk() is taken
  *   into account.
- * - add mechanism to keep track of changed lines.
+ * - Add mechanism to keep track of changed lines, so that plugin can update
+ *   text properties in these.
+ * - Perhaps have a window-local option to disable highlighting from text
+ *   properties?
  */
 
 #include "vim.h"
@@ -158,7 +162,7 @@ f_prop_add(typval_T *argvars, typval_T *rettv UNUSED)
     char_u     *newtext;
     int                proplen;
     size_t     textlen;
-    char_u     *props;
+    char_u     *props = NULL;
     char_u     *newprops;
     textprop_T tmp_prop;
     int                i;
index cd2554a979e06fe147c3e9041f8aca1b6661fe5f..0980420cadd96d1010304f470a198625f3560a88 100644 (file)
@@ -779,6 +779,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    975,
 /**/
     974,
 /**/