D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7822 - lseek cast(int)offset should be lseek cast(off_t)offset
Summary: lseek cast(int)offset should be lseek cast(off_t)offset
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-04 14:18 UTC by Jay Norwood
Modified: 2014-05-28 06:35 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jay Norwood 2012-04-04 14:18:53 UTC
cast(int)offset is found in lseek parameter in several places in the phobos library code.

phobos\mmfile.d(137):            lseek(fd, cast(int)(size - 1), SEEK_SET);
phobos\mmfile.d(362):                    .lseek(fd, cast(int)(size - 1), SEEK_SET);
phobos\stream.d(1992):      auto result = lseek(hFile, cast(int)offset, rel);
phobos\std\mmfile.d(130):            lseek(fd, cast(int)(size - 1), SEEK_SET);

\phobos\std\stream.d(1987):      auto result = lseek(hFile, cast(int)offset, rel);

 I'd guess these int casts are contrary to the intent of the use of off_t redefinition to support 64 bit operations on linux and so the casts of the offset parameter should be changed to cast(off_t) in each of these cases.
Comment 1 github-bugzilla 2014-05-28 06:35:00 UTC
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/b462d98887a2f50e2a916bde745e209a35e24e3f
fix Issue 7822 - lseek cast(int)offset should be lseek cast(off_t)offset

https://github.com/D-Programming-Language/phobos/commit/643b4640034f25ac87d4adca3ed5a9c062e4c63c
Merge pull request #2209 from SerialVelocity/master

Fix Issue 7822 - lseek cast(int)offset should be lseek cast(off_t)offset