John Marriott wrote:

> On 05-May-2019 05:09, Bram Moolenaar wrote:
> > Patch 8.1.1270
> > Problem:    Cannot see current match position.
> > Solution:   Show "3/44" when using the "n" command and "S" is not in
> >              'shortmess'. (Christian Brabandt, closes #4317)
> > Files:          runtime/doc/options.txt, runtime/doc/pattern.txt, 
> > src/option.c,
> >              src/option.h, src/search.c, src/testdir/Make_all.mak,
> >              src/testdir/test_search_stat.vim
> >
> >
> After this patch, mingw64 (gcc 8.3.1) throws up these warnings:
> gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -pipe -march=native -Wall 
> -O3 -fomit-frame-pointer -freg-struct-return search.c -o objnative/search.o
> In file included from search.c:13:
> search.c: In function 'do_search':
> vim.h:1568:29: warning: 'strncpy' output truncated before terminating 
> nul copying as many bytes from a string as its length 
> [-Wstringop-truncation]
>   #define STRNCPY(d, s, n)    strncpy((char *)(d), (char *)(s), 
> (size_t)(n))
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> vim.h:1568:29: note: in definition of macro 'STRNCPY'
>   #define STRNCPY(d, s, n)    strncpy((char *)(d), (char *)(s), 
> (size_t)(n))
> ^~~~~~~
> vim.h:1566:23: note: length computed here
>   #define STRLEN(s)     strlen((char *)(s))
> ^
> vim.h:1568:72: note: in definition of macro 'STRNCPY'
>   #define STRNCPY(d, s, n)    strncpy((char *)(d), (char *)(s), 
> (size_t)(n))
> ^
> search.c:1418:30: note: in expansion of macro 'STRLEN'
>         STRNCPY(msgbuf + 2, p, STRLEN(p));
> ^~~~~~
> vim.h:1568:29: warning: 'strncpy' output truncated before terminating 
> nul copying as many bytes from a string as its length 
> [-Wstringop-truncation]
>   #define STRNCPY(d, s, n)    strncpy((char *)(d), (char *)(s), 
> (size_t)(n))
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> vim.h:1568:29: note: in definition of macro 'STRNCPY'
>   #define STRNCPY(d, s, n)    strncpy((char *)(d), (char *)(s), 
> (size_t)(n))
> ^~~~~~~
> vim.h:1566:23: note: length computed here
>   #define STRLEN(s)     strlen((char *)(s))
> ^
> vim.h:1568:72: note: in definition of macro 'STRNCPY'
>   #define STRNCPY(d, s, n)    strncpy((char *)(d), (char *)(s), 
> (size_t)(n))
> ^
> search.c:1421:30: note: in expansion of macro 'STRLEN'
>         STRNCPY(msgbuf + 1, p, STRLEN(p));
> ^~~~~~
> In function 'search_stat',
>      inlined from 'do_search' at search.c:1584:6:
> vim.h:1568:29: warning: 'strncpy' output truncated before terminating 
> nul copying as many bytes from a string as its length 
> [-Wstringop-truncation]
>   #define STRNCPY(d, s, n)    strncpy((char *)(d), (char *)(s), 
> (size_t)(n))
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> vim.h:1568:29: note: in definition of macro 'STRNCPY'
>   #define STRNCPY(d, s, n)    strncpy((char *)(d), (char *)(s), 
> (size_t)(n))
> ^~~~~~~
> search.c: In function 'do_search':
> vim.h:1566:23: note: length computed here
>   #define STRLEN(s)     strlen((char *)(s))
> ^
> vim.h:1568:72: note: in definition of macro 'STRNCPY'
>   #define STRNCPY(d, s, n)    strncpy((char *)(d), (char *)(s), 
> (size_t)(n))
> ^
> search.c:5009:50: note: in expansion of macro 'STRLEN'
>    STRNCPY(msgbuf + STRLEN(msgbuf) - STRLEN(t), t, STRLEN(t));
> ^~~~~~
> 
> Please check the attached patch which tries to correct it.

Hmm, that doesn't look like the right fix.  I think replacing STRNCPY()
with mch_memmove() will do the trick.

-- 
I bought a book on hair loss, but the pages kept falling out.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui