diff options
Diffstat (limited to 'winsup/mingw/mingwex/stdio')
-rwxr-xr-x | winsup/mingw/mingwex/stdio/fopen64.c | 7 | ||||
-rwxr-xr-x | winsup/mingw/mingwex/stdio/fseeko64.c | 27 | ||||
-rwxr-xr-x | winsup/mingw/mingwex/stdio/ftello64.c | 11 | ||||
-rwxr-xr-x | winsup/mingw/mingwex/stdio/lseek64.c | 8 |
4 files changed, 53 insertions, 0 deletions
diff --git a/winsup/mingw/mingwex/stdio/fopen64.c b/winsup/mingw/mingwex/stdio/fopen64.c new file mode 100755 index 000000000..d1dca885b --- /dev/null +++ b/winsup/mingw/mingwex/stdio/fopen64.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +FILE* __cdecl +fopen64 (const char* filename, const char* mode) +{ + return fopen (filename, mode); +} diff --git a/winsup/mingw/mingwex/stdio/fseeko64.c b/winsup/mingw/mingwex/stdio/fseeko64.c new file mode 100755 index 000000000..94e17e929 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/fseeko64.c @@ -0,0 +1,27 @@ +#include <stdio.h> +#include <io.h> +#include <errno.h> + +int __cdecl +fseeko64 (FILE* stream, off64_t offset, int whence) +{ + fpos_t pos; + if (whence == SEEK_CUR) + { + /* If stream is invalid, fgetpos sets errno. */ + if (fgetpos (stream, &pos)) + return (-1); + pos += (fpos_t) offset; + } + else if (whence == SEEK_END) + pos = (fpos_t) (_filelengthi64 (_fileno (stream)) + offset); + else if (whence == SEEK_SET) + pos = (fpos_t) offset; + else + { + errno = EINVAL; + return (-1); + } + return fsetpos (stream, &pos); +} + diff --git a/winsup/mingw/mingwex/stdio/ftello64.c b/winsup/mingw/mingwex/stdio/ftello64.c new file mode 100755 index 000000000..97a388cd6 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/ftello64.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +off64_t __cdecl +ftello64 (FILE * stream) +{ + fpos_t pos; + if (fgetpos(stream, &pos)) + return -1LL; + else + return ((off64_t) pos); +} diff --git a/winsup/mingw/mingwex/stdio/lseek64.c b/winsup/mingw/mingwex/stdio/lseek64.c new file mode 100755 index 000000000..8f8bfa5e4 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/lseek64.c @@ -0,0 +1,8 @@ +#include <io.h> + +off64_t lseek64 +(int fd, off64_t offset, int whence) +{ + return _lseeki64(fd, (__int64) offset, whence); +} + |