crt/stdio/fseeki64: Copy-n-paste from `f{tell,seek}o64()`
The old implementation of `_ftelli64()` was introduced in 518dd33c326 in
2007. However it sometimes reports incorrect values. This program, after
being compiled with `i686-w64-mingw32-gcc`, outputs `-15` on the second
line on my Windows 7 Professional:
#include <stdio.h>
#include <assert.h>
int main(void)
{
FILE* fp = fopen(__FILE__, "rb");
assert(fp);
printf("offset = %lld\n", (long long)_ftelli64(fp));
char buf[1];
ssize_t nread = fread(&buf, 1, 1, fp);
assert(nread == 1);
printf("offset = %lld\n", (long long)_ftelli64(fp));
fclose(fp);
}
This is apparently incorrect, as file offsets can't be negative.
If it was compiled with `x86_64-w64-mingw32-gcc`, it however outputs `1`
as expected.
Since 4d3b28a992, we have had 64-bit tell/seek functions. They should be
used to de-duplicate these implementations.
Signed-off-by: Liu Hao <lh_mouse@126.com>
1 file changed