Bug 7822 – lseek cast(int)offset should be lseek cast(off_t)offset

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2012-04-04T14:18:00Z
Last change time
2014-05-28T06:35:01Z
Assigned to
nobody
Creator
jayn

Comments

Comment #0 by jayn — 2012-04-04T14:18:53Z
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 by github-bugzilla — 2014-05-28T06:35:00Z
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