0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.2152: problems navigating tags file on MacOS Catalina

Problem:    Problems navigating tags file on MacOS Catalina.
Solution:   Use fseek instead of lseek. (John Lamb, fixes #5061)
This commit is contained in:
Bram Moolenaar 2019-10-15 22:23:37 +02:00
parent 3c8cd4a1dc
commit 27fc8cab22
2 changed files with 13 additions and 11 deletions

View File

@ -2198,23 +2198,23 @@ line_read_in:
#endif #endif
#ifdef FEAT_TAG_BINS #ifdef FEAT_TAG_BINS
/* // When starting a binary search, get the size of the file and
* When starting a binary search, get the size of the file and // compute the first offset.
* compute the first offset.
*/
if (state == TS_BINARY) if (state == TS_BINARY)
{ {
/* Get the tag file size (don't use mch_fstat(), it's not if (vim_fseek(fp, 0L, SEEK_END) != 0)
* portable). */ // can't seek, don't use binary search
if ((filesize = vim_lseek(fileno(fp),
(off_T)0L, SEEK_END)) <= 0)
state = TS_LINEAR; state = TS_LINEAR;
else else
{ {
vim_lseek(fileno(fp), (off_T)0L, SEEK_SET); // Get the tag file size (don't use mch_fstat(), it's
// not portable). Don't use lseek(), it doesn't work
// properly on MacOS Catalina.
filesize = vim_ftell(fp);
vim_fseek(fp, 0L, SEEK_SET);
/* Calculate the first read offset in the file. Start // Calculate the first read offset in the file. Start
* the search in the middle of the file. */ // the search in the middle of the file.
search_info.low_offset = 0; search_info.low_offset = 0;
search_info.low_char = 0; search_info.low_char = 0;
search_info.high_offset = filesize; search_info.high_offset = filesize;

View File

@ -753,6 +753,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2152,
/**/ /**/
2151, 2151,
/**/ /**/