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