Differences From Artifact [22230c5b39]:
- File src/OFSeekableStream.h — part of check-in [246cfe0807] at 2014-02-18 18:50:30 on branch trunk — Documentation: Show correct imports (user: js, size: 2437) [annotate] [blame] [check-ins using]
To Artifact [0d5fe8bc05]:
- File
src/OFSeekableStream.h
— part of check-in
[46b89b1c8e]
at
2015-01-03 20:42:30
on branch trunk
— Introduce and use of_offset_t instead of off_t
The reason for this is that some systems, for example Android, use
32 bits for off_t while having size related fields like st_size as
long long. (user: js, size: 2550) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # define __STDC_CONSTANT_MACROS #endif #include <sys/types.h> #import "OFStream.h" /*! * @class OFSeekableStream OFSeekableStream.h ObjFW/OFSeekableStream.h * * @brief A stream that supports seeking. * * @note If you want to subclass this, override * @ref lowlevelSeekToOffset:whence:. OFSeekableStream uses this method | > > > > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # define __STDC_CONSTANT_MACROS #endif #include <sys/types.h> #import "OFStream.h" #ifdef __ANDROID__ typedef long long of_offset_t; #else typedef off_t of_offset_t; #endif /*! * @class OFSeekableStream OFSeekableStream.h ObjFW/OFSeekableStream.h * * @brief A stream that supports seeking. * * @note If you want to subclass this, override * @ref lowlevelSeekToOffset:whence:. OFSeekableStream uses this method |
︙ | ︙ | |||
46 47 48 49 50 51 52 | * Value | Description * -----------|--------------------------------------- * `SEEK_SET` | Seek to the specified byte * `SEEK_CUR` | Seek to the current location + offset * `SEEK_END` | Seek to the end of the stream + offset * @return The new offset form the start of the file */ | | | | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | * Value | Description * -----------|--------------------------------------- * `SEEK_SET` | Seek to the specified byte * `SEEK_CUR` | Seek to the current location + offset * `SEEK_END` | Seek to the end of the stream + offset * @return The new offset form the start of the file */ - (of_offset_t)seekToOffset: (of_offset_t)offset whence: (int)whence; /*! * @brief Seek the stream on the lowlevel. * * @warning Do not call this directly! * * Override this with this method with your actual seek implementation when * subclassing! * * @param offset The offset to seek to * @param whence From where to seek.@n * Possible values are: * Value | Description * -----------|--------------------------------------- * `SEEK_SET` | Seek to the specified byte * `SEEK_CUR` | Seek to the current location + offset * `SEEK_END` | Seek to the end of the stream + offset * @return The new offset from the start of the file */ - (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence; @end |