Mercurial > vim
comparison src/screen.c @ 15939:8013b532a1f7 v8.1.0975
patch 8.1.0975: using STRNCPY() wrongly. Warning for uninitialized variable
commit https://github.com/vim/vim/commit/c666388367282c3c7d1d7af24883cfa0d40b046e
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 22 19:14:54 2019 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 22 Feb 2019 19:15:12 +0100 |
parents | 7fad90423bd2 |
children | 4aaf68cbed32 |
comparison
equal
deleted
inserted
replaced
15938:d44981435a1a | 15939:8013b532a1f7 |
---|---|
2545 len = wp->w_width - col; | 2545 len = wp->w_width - col; |
2546 if (len > 0) | 2546 if (len > 0) |
2547 { | 2547 { |
2548 #ifdef FEAT_RIGHTLEFT | 2548 #ifdef FEAT_RIGHTLEFT |
2549 if (wp->w_p_rl) | 2549 if (wp->w_p_rl) |
2550 STRNCPY(current_ScreenLine, text, len); | 2550 mch_memmove(current_ScreenLine, text, len); |
2551 else | 2551 else |
2552 #endif | 2552 #endif |
2553 STRNCPY(current_ScreenLine + col, text, len); | 2553 mch_memmove(current_ScreenLine + col, text, len); |
2554 col += len; | 2554 col += len; |
2555 } | 2555 } |
2556 } | 2556 } |
2557 return col; | 2557 return col; |
2558 } | 2558 } |
3394 && lnum >= curwin->w_cursor.lnum | 3394 && lnum >= curwin->w_cursor.lnum |
3395 && lnum <= curwin->w_cursor.lnum + search_match_lines) | 3395 && lnum <= curwin->w_cursor.lnum + search_match_lines) |
3396 { | 3396 { |
3397 if (lnum == curwin->w_cursor.lnum) | 3397 if (lnum == curwin->w_cursor.lnum) |
3398 getvcol(curwin, &(curwin->w_cursor), | 3398 getvcol(curwin, &(curwin->w_cursor), |
3399 (colnr_T *)&fromcol, NULL, NULL); | 3399 (colnr_T *)&fromcol, NULL, NULL); |
3400 else | 3400 else |
3401 fromcol = 0; | 3401 fromcol = 0; |
3402 if (lnum == curwin->w_cursor.lnum + search_match_lines) | 3402 if (lnum == curwin->w_cursor.lnum + search_match_lines) |
3403 { | 3403 { |
3404 pos.lnum = lnum; | 3404 pos.lnum = lnum; |