comparison src/tag.c @ 18315:6e8b7c58c526 v8.1.2152

patch 8.1.2152: problems navigating tags file on MacOS Catalina Commit: https://github.com/vim/vim/commit/27fc8cab227e30f649f52e74efd58ad56d21e9bb Author: Bram Moolenaar <Bram@vim.org> Date: Tue Oct 15 22:23:37 2019 +0200 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 https://github.com/vim/vim/issues/5061)
author Bram Moolenaar <Bram@vim.org>
date Tue, 15 Oct 2019 22:30:04 +0200
parents 59f8948b7590
children 34d5cd432cac
comparison
equal deleted inserted replaced
18314:27e0efc17757 18315:6e8b7c58c526
2196 #else 2196 #else
2197 state = TS_LINEAR; 2197 state = TS_LINEAR;
2198 #endif 2198 #endif
2199 2199
2200 #ifdef FEAT_TAG_BINS 2200 #ifdef FEAT_TAG_BINS
2201 /* 2201 // When starting a binary search, get the size of the file and
2202 * When starting a binary search, get the size of the file and 2202 // compute the first offset.
2203 * compute the first offset.
2204 */
2205 if (state == TS_BINARY) 2203 if (state == TS_BINARY)
2206 { 2204 {
2207 /* Get the tag file size (don't use mch_fstat(), it's not 2205 if (vim_fseek(fp, 0L, SEEK_END) != 0)
2208 * portable). */ 2206 // can't seek, don't use binary search
2209 if ((filesize = vim_lseek(fileno(fp),
2210 (off_T)0L, SEEK_END)) <= 0)
2211 state = TS_LINEAR; 2207 state = TS_LINEAR;
2212 else 2208 else
2213 { 2209 {
2214 vim_lseek(fileno(fp), (off_T)0L, SEEK_SET); 2210 // Get the tag file size (don't use mch_fstat(), it's
2215 2211 // not portable). Don't use lseek(), it doesn't work
2216 /* Calculate the first read offset in the file. Start 2212 // properly on MacOS Catalina.
2217 * the search in the middle of the file. */ 2213 filesize = vim_ftell(fp);
2214 vim_fseek(fp, 0L, SEEK_SET);
2215
2216 // Calculate the first read offset in the file. Start
2217 // the search in the middle of the file.
2218 search_info.low_offset = 0; 2218 search_info.low_offset = 0;
2219 search_info.low_char = 0; 2219 search_info.low_char = 0;
2220 search_info.high_offset = filesize; 2220 search_info.high_offset = filesize;
2221 search_info.curr_offset = 0; 2221 search_info.curr_offset = 0;
2222 search_info.high_char = 0xff; 2222 search_info.high_char = 0xff;