[Issue 3409] stdio.File.seek() doesn't work for files >2GB
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 17 09:00:29 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3409
Andrei Alexandrescu <andrei at metalanguage.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |andrei at metalanguage.com
AssignedTo|nobody at puremagic.com |andrei at metalanguage.com
--- Comment #3 from Andrei Alexandrescu <andrei at metalanguage.com> 2009-10-17 09:00:27 PDT ---
The bug is in druntime. It defines fseek and ftell in core.stdc.stdio like
this:
int fseek(FILE* stream, long offset, int whence);
c_long ftell(FILE* stream);
And it defines c_long in core.stdc.config like this:
version( Windows )
{
alias int c_long;
alias uint c_ulong;
}
else
{
static if( (void*).sizeof > int.sizeof )
{
alias long c_long;
alias ulong c_ulong;
}
else
{
alias int c_long;
alias uint c_ulong;
}
}
I don't know why under Windows c_long is actually 32 bit.
Then, in my code I had this note:
void seek(long offset, int origin = SEEK_SET)
{
enforce(p && p.handle,
"Attempting to seek() in an unopened file");
// @@@ Dubious: why is fseek in std.c.stdio taking an int???
errnoEnforce(core.stdc.stdio.fseek(
p.handle, to!int(offset), origin) == 0,
"Could not seek in file `"~p.name~"'");
}
So it seeme like there was something fishy going on.
I emailed Sean about the problem. He needs to fix druntime, then I will fix
stdio, and then we can close this.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list