Safouane Baroudi wrote:

> When a tag is not found, cscope return the string "Unable to search
> database." but the cs_cnt_matches() does not handle this case.
> 
>     cs_cnt_matches():
>       When cscope does not find a tag, it returns "Unable to search
>       database", and thus:
>         if (strstr((const char *)stok, "cscope:") == NULL)
>           continue;
>       becomes:
>         if (strstr((const char *)stok, "cscope:") == NULL)
>           break;
>       and return nlines which must be initialized at zero.
>       Continuing does not make sens, and result in a buffer underflow on my
>       machine when the loop calls fgets for the second time.
> 
> cscope version: 15.8b
> vim version: v8.0.1437 (cloned from git)
> uname -r: 4.9.65
> 
> below is attached my git patch.
> 
> This is my first public patch ever in any project so I am new to this
> kind of thing and I am a total newbie, I am waiting for your remarks.

The comments indicate that Cscope sometimes adds lines before the line
with the count.  With your change this would cause the count not to be
found.

How about specifically checking for the "Unable to search database"
message and break out of the loop then?  Could this message be
translated?

-- 
ARTHUR: This new learning amazes me, Sir Bedevere.  Explain again how sheep's
        bladders may be employed to prevent earthquakes.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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