]>
Commit | Line | Data |
---|---|---|
0c9e92e0 JB |
1 | --- gcc-7.5.0/libstdc++-v3/config/io/basic_file_stdio.cc.orig 2017-08-14 14:14:09.143001000 +0200 |
2 | +++ gcc-7.5.0/libstdc++-v3/config/io/basic_file_stdio.cc 2019-12-25 20:03:25.172581834 +0100 | |
3 | @@ -236,7 +236,7 @@ | |
1c8a025b ŁK |
4 | const char* __c_mode = fopen_mode(__mode); |
5 | if (__c_mode && !this->is_open()) | |
6 | { | |
7 | -#ifdef _GLIBCXX_USE_LFS | |
8 | +#if defined(_GLIBCXX_USE_LFS) || defined(__MINGW32__) | |
9 | if ((_M_cfile = fopen64(__name, __c_mode))) | |
10 | #else | |
11 | if ((_M_cfile = fopen(__name, __c_mode))) | |
0c9e92e0 | 12 | @@ -311,7 +311,7 @@ |
1c8a025b | 13 | streamoff |
0c9e92e0 | 14 | __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way) throw () |
1c8a025b ŁK |
15 | { |
16 | -#ifdef _GLIBCXX_USE_LFS | |
17 | +#if defined(_GLIBCXX_USE_LFS) || defined(__MINGW32__) | |
18 | return lseek64(this->fd(), __off, __way); | |
19 | #else | |
20 | if (__off > numeric_limits<off_t>::max() | |
0c9e92e0 JB |
21 | @@ -355,6 +355,15 @@ |
22 | if (!__err && _GLIBCXX_ISREG(__buffer.st_mode)) | |
23 | { | |
24 | const streamoff __off = __buffer.st_size - lseek64(this->fd(), 0, | |
25 | + ios_base::cur); | |
26 | + return std::min(__off, streamoff(numeric_limits<streamsize>::max())); | |
27 | + } | |
1c8a025b ŁK |
28 | +#elif defined(__MINGW32__) |
29 | + struct _stati64 __buffer; | |
30 | + const int __err = _fstati64(this->fd(), &__buffer); | |
31 | + if (!__err && _GLIBCXX_ISREG(__buffer.st_mode)) | |
32 | + { | |
33 | + const streamoff __off = __buffer.st_size - lseek64(this->fd(), 0, | |
0c9e92e0 JB |
34 | ios_base::cur); |
35 | return std::min(__off, streamoff(numeric_limits<streamsize>::max())); | |
36 | } | |
1c8a025b ŁK |
37 | diff -r faddb1a6e933 libstdc++-v3/include/ext/stdio_sync_filebuf.h |
38 | --- a/libstdc++-v3/include/ext/stdio_sync_filebuf.h Fri Jul 31 08:58:42 2009 -0600 | |
39 | +++ b/libstdc++-v3/include/ext/stdio_sync_filebuf.h Fri Jul 31 13:09:27 2009 -0600 | |
40 | @@ -163,7 +163,7 @@ | |
41 | __whence = SEEK_CUR; | |
42 | else | |
43 | __whence = SEEK_END; | |
44 | -#ifdef _GLIBCXX_USE_LFS | |
45 | +#if defined(_GLIBCXX_USE_LFS) || defined(__MINGW32__) | |
46 | if (!fseeko64(_M_file, __off, __whence)) | |
47 | __ret = std::streampos(ftello64(_M_file)); | |
48 | #else |