-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crt/stdio/fseeki64: Copy-n-paste from
f{tell,seek}o64()
The old implementation of `_ftelli64()` was introduced in 518dd33 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 4d3b28a, we have had 64-bit tell/seek functions. They should be used to de-duplicate these implementations. Signed-off-by: Liu Hao <[email protected]>
- Loading branch information
Showing
1 changed file
with
30 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters