Open masatake opened 1 year ago
You may need to consider that long
is 32 bits on Windows.
Windows has the 64-bit version of fseek:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fseek-fseeki64?view=msvc-170
If we don't need to consider the files that are larger than 2 GB, simply using long
should be okay.
Otherwise, the source code of Vim might be helpful:
https://github.com/vim/vim/blob/c0da540466c89e388e7a15a12bab2f9fc42d9671/src/vim.h#L384-L416
(MSWIN
is defined inside Vim. Normally we can use _WIN32
instead. PROTO
is used for the cproto
command, so this can be ignored.)
@k-takata, thank you for the suggestion. Only about input, I think 2GB is large enough. For output, 2GB is too small.
Oh, I remember that we've already done this in readtag: https://github.com/universal-ctags/ctags/blob/3547021a009d3c4b89f17dfb7e6ffd4cacacfa0c/libreadtags/readtags.c#L111-L135
Nice! We should reuse it.
fpos_t has caused making our code complicated.
Will ctags deal with files larger than sizeof(long)? I think it will not.
So I would like to use only ftell/fseek, not together with fsetpos/fgetpos.
Anjuta-ctags took the way I like.
https://gitlab.gnome.org/Archive/anjuta/-/commit/91f5e7fe0a6e4d548f4888711cdaaf7bedab6f85 https://gitlab.gnome.org/Archive/anjuta/-/commit/0adbb5451148027bc6cb283acbfd98c5dc79aad0
What do you think?