MSVC large file support (was Re: [Xapian-devel] Re: [Xapian-commits] 7603: trunk/xapian-core/ trunk/xapian-core/backends/flint/ trunk/xapian-core/backends/quartz/)

Charlie Hull charlie at juggler.net
Tue Feb 6 10:20:20 GMT 2007


Olly Betts wrote:
> On Mon, Jan 29, 2007 at 05:31:19PM +0000, Charlie Hull wrote:
>> I've produced patches for xapian-compact.cc, quartzcompact.cc and 
>> quartzcheck.cc (enclosed). Unfortunately I don't have any way of quickly 
>> testing them here but we should soon have some kind of Xapian test 
>> framework on Windows, complete with huge files, so I'll do it then.
> 
> I don't think this patch is quite correct - MSDN seems to say that
> _stat64() only increases the size of the *TIMESTAMP* fields to 64 bit
> - I think we actually want _stati64()!  That's consistent with needing
> to use _lseeki64() instead of lseek() I guess.
> 
> I think it's cleaner, and more robust to future changes, to put the
> magic in one place rather than fixing this in the files which use
> stat(), so I've done a bit of refactoring of this patch and some of the
> other MSVC specific bits and created a couple of new "safeXXX.h" headers
> which is how we've been encapsulating other platform specific oddities.
> 
> The patched version builds cleanly on Linux, so I've checked in the
> changes to SVN HEAD (revision 7605) to see if it builds on the tinderbox
> machines.  Could you see if it at least builds on MSVC even if you can't
> try it on 2GB+ files right now?
> 
> Cheers,
>     Olly
> 
That's much better Olly; keeping the platform specific stuff out is a 
much tidier approach. I've had to make a small change to stop the MS 
headers barfing (attached), but apart from that it builds fine.

Cheers

Charlie
-------------- next part --------------
Index: flint_io.cc
===================================================================
--- flint_io.cc	(revision 7606)
+++ flint_io.cc	(working copy)
@@ -20,13 +20,13 @@
 
 #include <config.h>
 
-#include "safeerrno.h"
-#include "safeunistd.h"
-
 #include <xapian/error.h>
 
 #include "flint_io.h"
 
+#include "safeerrno.h"
+#include "safeunistd.h"
+
 size_t flint_io_read(int fd, char * p, size_t n, size_t min)
 {
     size_t total = 0;


More information about the Xapian-devel mailing list