@@ -2198,23 +2198,23 @@ find_tags(
21982198#endif
21992199
22002200#ifdef FEAT_TAG_BINS
2201- /*
2202- * When starting a binary search, get the size of the file and
2203- * compute the first offset.
2204- */
2201+ // When starting a binary search, get the size of the file and
2202+ // compute the first offset.
22052203 if (state == TS_BINARY )
22062204 {
2207- /* Get the tag file size (don't use mch_fstat(), it's not
2208- * portable). */
2209- if ((filesize = vim_lseek (fileno (fp ),
2210- (off_T )0L , SEEK_END )) <= 0 )
2205+ if (vim_fseek (fp , 0L , SEEK_END ) != 0 )
2206+ // can't seek, don't use binary search
22112207 state = TS_LINEAR ;
22122208 else
22132209 {
2214- vim_lseek (fileno (fp ), (off_T )0L , SEEK_SET );
2215-
2216- /* Calculate the first read offset in the file. Start
2217- * the search in the middle of the file. */
2210+ // Get the tag file size (don't use mch_fstat(), it's
2211+ // not portable). Don't use lseek(), it doesn't work
2212+ // properly on MacOS Catalina.
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.
22182218 search_info .low_offset = 0 ;
22192219 search_info .low_char = 0 ;
22202220 search_info .high_offset = filesize ;
0 commit comments