[phobos] phobos commit, revision 1877

Steve Schveighoffer schveiguy at yahoo.com
Mon Aug 16 14:53:54 PDT 2010


This is wrong on two counts.

First, david is right, changing from long to ulong is a mistake.  long is 
correct, this supports 2^63 bytes, which is plenty larger than the current 2GB 
limitation, and it allows negative seeking without issue.

Second, you cannot do a tell on the file handle, because you need to take into 
account the buffer.  I went through this exercise with Kris in Tango, seek and 
tell need to account for the buffer for any semblance of normalcy.  Tango used 
to have a buffer that was both a read and write buffer, depending how you used 
it.  The problem is, seek/tell didn't know how you were using it (the code is 
*very* different to account for the buffer on read vs. write) :)

In response to the "why UnbufferedFile" requirement, it's for this same reason.  
If you pass the FILE*, you may have consumed some data from the raw handle into 
the buffer, and then expect the child process to read from the start of your 
buffer, which of course it can't.  Using UnbufferedFile makes it clear that you 
need to ignore the buffer.  Lars put in some methods to convert easily from File 
to UnbufferedFile.  I think we discussed this on the ML a while back...

-Steve



----- Original Message ----
> From: Andrei Alexandrescu <andrei at erdani.com>
> To: Discuss the phobos library for D <phobos at puremagic.com>
> Sent: Mon, August 16, 2010 4:10:05 PM
> Subject: Re: [phobos] phobos commit, revision 1877
> 
> Works on win32wine and osx, could someone check on  Linuxen?
> 
> Andrei
> 
> dsource.org wrote:
> > phobos commit, revision  1877
> > 
> > 
> > user: andrei
> > 
> > msg:
> > Fixed  seek and tell for large files
> > 
> >  http://www.dsource.org/projects/phobos/changeset/1877
> > 
> >  _______________________________________________
> > phobos mailing  list
> > phobos at puremagic.com
> >  http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos  mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
> 


      


More information about the phobos mailing list