This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, libfortran] PR 40812 Large file support on MinGW


On Fri, Dec 4, 2009 at 5:56 AM, Janne Blomqvist
<blomqvist.janne@gmail.com> wrote:
> On Thu, Dec 3, 2009 at 12:41, Kai Tietz <ktietz70@googlemail.com> wrote:
>> Interesting was that my last patch just worked as the restoration seek
>> use SEEK_CUR, which puzzled me a bit. Finally I found the real issue
>> here in the patch.
>> First I cleaned up this this temporary variable for comparison with
>> INVALID_HANDLE_VALUE. This define is a pointer already, and so no
>> scalar cast is necessary here.
>> Secondly for the seek to position to be truncated, FILE_CUR was used,
>> but of course it has to be seeked from beginning of file by
>> FILE_BEGIN.
>
> Yes, I misread the description for SetFilePointerEx on MSDN, or rather
> I didn't read it and just assumed it would work like POSIX lseek().
> Attached is a further revised version of the patch that uses lseek
> (which is as of this patch redefined as _lseeki64 on MinGW). Also, it
> tries to seek back to the original position in case something went
> wrong in order to make it behave more like ftruncate().
>

With one correction, this patch fixes the PR testcases and create no
new regressions.
Thanks.

The correction:  mingw.org's sys/types.h header does not define
_off64_t, only off64_t.
Thus this was modification was necessary for me to compile the lib:

Index: libgfortran.h
===================================================================
--- libgfortran.h       (revision 154864)
+++ libgfortran.h       (working copy)
@@ -56,7 +56,12 @@
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
+
+#ifdef __MINGW32__
+typedef off64_t gfc_offset;
+#else
 typedef off_t gfc_offset;
+#endif

 #ifndef NULL
 #define NULL (void *) 0

Kai, do we need a __MINGW64__ conditional as well?

Danny


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]