Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -449,13 +449,13 @@ #endif return (size_t)bytesWritten; } -- (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence +- (OFFileOffset)lowlevelSeekToOffset: (OFFileOffset)offset whence: (int)whence { - of_offset_t ret; + OFFileOffset ret; if (_handle == OF_INVALID_FILE_HANDLE) @throw [OFNotOpenException exceptionWithObject: self]; #ifndef OF_AMIGAOS Index: src/OFFileURLHandler.m ================================================================== --- src/OFFileURLHandler.m +++ src/OFFileURLHandler.m @@ -85,11 +85,11 @@ # endif #endif #if defined(OF_WINDOWS) || defined(OF_AMIGAOS) typedef struct { - of_offset_t st_size; + OFFileOffset st_size; unsigned int st_mode; OFTimeInterval st_atime, st_mtime, st_ctime; # ifdef OF_WINDOWS # define HAVE_STRUCT_STAT_ST_BIRTHTIME OFTimeInterval st_birthtime; Index: src/OFLHAArchive.m ================================================================== --- src/OFLHAArchive.m +++ src/OFLHAArchive.m @@ -55,11 +55,11 @@ @interface OFLHAArchiveFileWriteStream: OFStream { OFMutableLHAArchiveEntry *_entry; OFStringEncoding _encoding; OFSeekableStream *_stream; - of_offset_t _headerOffset; + OFFileOffset _headerOffset; uint32_t _bytesWritten; uint16_t _CRC16; } - (instancetype)of_initWithStream: (OFSeekableStream *)stream @@ -393,12 +393,12 @@ stream = _stream; } if ([stream isKindOfClass: [OFSeekableStream class]] && - (sizeof(of_offset_t) > 4 || toRead < INT32_MAX)) - [(OFSeekableStream *)stream seekToOffset: (of_offset_t)toRead + (sizeof(OFFileOffset) > 4 || toRead < INT32_MAX)) + [(OFSeekableStream *)stream seekToOffset: (OFFileOffset)toRead whence: SEEK_CUR]; else { while (toRead > 0) { char buffer[512]; size_t min = toRead; @@ -508,11 +508,11 @@ .fileDescriptorForWriting; } - (void)close { - of_offset_t offset; + OFFileOffset offset; if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; _entry.uncompressedSize = _bytesWritten; Index: src/OFSeekableStream.h ================================================================== --- src/OFSeekableStream.h +++ src/OFSeekableStream.h @@ -29,19 +29,19 @@ #import "OFStream.h" OF_ASSUME_NONNULL_BEGIN #if defined(OF_WINDOWS) -typedef __int64 of_offset_t; +typedef __int64 OFFileOffset; #elif defined(OF_ANDROID) -typedef long long of_offset_t; +typedef long long OFFileOffset; #elif defined(OF_MORPHOS) -typedef signed long long of_offset_t; +typedef signed long long OFFileOffset; #elif defined(OF_HAVE_OFF64_T) -typedef off64_t of_offset_t; +typedef off64_t OFFileOffset; #else -typedef off_t of_offset_t; +typedef off_t OFFileOffset; #endif /** * @class OFSeekableStream OFSeekableStream.h ObjFW/OFSeekableStream.h * @@ -69,11 +69,11 @@ * `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; +- (OFFileOffset)seekToOffset: (OFFileOffset)offset whence: (int)whence; /** * @brief Seek the stream on the lowlevel. * * @warning Do not call this directly! @@ -89,9 +89,9 @@ * `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; +- (OFFileOffset)lowlevelSeekToOffset: (OFFileOffset)offset whence: (int)whence; @end OF_ASSUME_NONNULL_END Index: src/OFSeekableStream.m ================================================================== --- src/OFSeekableStream.m +++ src/OFSeekableStream.m @@ -36,16 +36,16 @@ } return [super init]; } -- (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence +- (OFFileOffset)lowlevelSeekToOffset: (OFFileOffset)offset whence: (int)whence { OF_UNRECOGNIZED_SELECTOR } -- (of_offset_t)seekToOffset: (of_offset_t)offset whence: (int)whence +- (OFFileOffset)seekToOffset: (OFFileOffset)offset whence: (int)whence { if (whence == SEEK_CUR) offset -= _readBufferLength; offset = [self lowlevelSeekToOffset: offset whence: whence]; Index: src/OFTarArchive.m ================================================================== --- src/OFTarArchive.m +++ src/OFTarArchive.m @@ -357,14 +357,14 @@ { if (_stream == nil || _skipped) return; if ([_stream isKindOfClass: [OFSeekableStream class]] && - _toRead <= INT64_MAX && (of_offset_t)_toRead == (int64_t)_toRead) { + _toRead <= INT64_MAX && (OFFileOffset)_toRead == (int64_t)_toRead) { uint64_t size; - [(OFSeekableStream *)_stream seekToOffset: (of_offset_t)_toRead + [(OFSeekableStream *)_stream seekToOffset: (OFFileOffset)_toRead whence: SEEK_CUR]; _toRead = 0; size = _entry.size; Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -136,11 +136,11 @@ return field; } static void seekOrThrowInvalidFormat(OFSeekableStream *stream, - of_offset_t offset, int whence) + OFFileOffset offset, int whence) { @try { [stream seekToOffset: offset whence: whence]; } @catch (OFSeekFailedException *e) { if (e.errNo == EINVAL) @@ -198,11 +198,11 @@ } if (_mode == OF_ZIP_ARCHIVE_MODE_APPEND) { _offset = _centralDirectoryOffset; seekOrThrowInvalidFormat((OFSeekableStream *)_stream, - (of_offset_t)_offset, SEEK_SET); + (OFFileOffset)_offset, SEEK_SET); } } @catch (id e) { /* * If we are in write or append mode, we do not want -[close] * to write anything to it on error - after all, it might not @@ -254,11 +254,11 @@ - (void)of_readZIPInfo { void *pool = objc_autoreleasePoolPush(); uint16_t commentLength; - of_offset_t offset = -22; + OFFileOffset offset = -22; bool valid = false; do { seekOrThrowInvalidFormat((OFSeekableStream *)_stream, offset, SEEK_END); @@ -306,15 +306,15 @@ * central directory record. */ [_stream readLittleEndianInt32]; offset64 = [_stream readLittleEndianInt64]; - if (offset64 < 0 || (of_offset_t)offset64 != offset64) + if (offset64 < 0 || (OFFileOffset)offset64 != offset64) @throw [OFOutOfRangeException exception]; seekOrThrowInvalidFormat((OFSeekableStream *)_stream, - (of_offset_t)offset64, SEEK_SET); + (OFFileOffset)offset64, SEEK_SET); if ([_stream readLittleEndianInt32] != 0x06064B50) @throw [OFInvalidFormatException exception]; size = [_stream readLittleEndianInt64]; @@ -333,11 +333,11 @@ _centralDirectoryEntries = [_stream readLittleEndianInt64]; _centralDirectorySize = [_stream readLittleEndianInt64]; _centralDirectoryOffset = [_stream readLittleEndianInt64]; if (_centralDirectoryOffset < 0 || - (of_offset_t)_centralDirectoryOffset != + (OFFileOffset)_centralDirectoryOffset != _centralDirectoryOffset) @throw [OFOutOfRangeException exception]; } objc_autoreleasePoolPop(pool); @@ -346,15 +346,15 @@ - (void)of_readEntries { void *pool = objc_autoreleasePoolPush(); if (_centralDirectoryOffset < 0 || - (of_offset_t)_centralDirectoryOffset != _centralDirectoryOffset) + (OFFileOffset)_centralDirectoryOffset != _centralDirectoryOffset) @throw [OFOutOfRangeException exception]; seekOrThrowInvalidFormat((OFSeekableStream *)_stream, - (of_offset_t)_centralDirectoryOffset, SEEK_SET); + (OFFileOffset)_centralDirectoryOffset, SEEK_SET); for (size_t i = 0; i < _centralDirectoryEntries; i++) { OFZIPArchiveEntry *entry = [[[OFZIPArchiveEntry alloc] of_initWithStream: _stream] autorelease]; @@ -440,15 +440,15 @@ errNo: ENOENT]; [self of_closeLastReturnedStream]; offset64 = entry.of_localFileHeaderOffset; - if (offset64 < 0 || (of_offset_t)offset64 != offset64) + if (offset64 < 0 || (OFFileOffset)offset64 != offset64) @throw [OFOutOfRangeException exception]; seekOrThrowInvalidFormat((OFSeekableStream *)_stream, - (of_offset_t)offset64, SEEK_SET); + (OFFileOffset)offset64, SEEK_SET); localFileHeader = [[[OFZIPArchiveLocalFileHeader alloc] initWithStream: _stream] autorelease]; if (![localFileHeader matchesEntry: entry]) @throw [OFInvalidFormatException exception]; Index: src/exceptions/OFSeekFailedException.h ================================================================== --- src/exceptions/OFSeekFailedException.h +++ src/exceptions/OFSeekFailedException.h @@ -25,11 +25,11 @@ * @brief An exception indicating that seeking in a stream failed. */ @interface OFSeekFailedException: OFException { OFSeekableStream *_stream; - of_offset_t _offset; + OFFileOffset _offset; int _whence, _errNo; } /** * @brief The stream for which seeking failed. @@ -37,11 +37,11 @@ @property (readonly, nonatomic) OFSeekableStream *stream; /** * @brief The offset to which seeking failed. */ -@property (readonly, nonatomic) of_offset_t offset; +@property (readonly, nonatomic) OFFileOffset offset; /** * @brief To what the offset is relative. */ @property (readonly, nonatomic) int whence; @@ -61,11 +61,11 @@ * @param whence To what the offset is relative * @param errNo The errno of the error that occurred * @return A new, autoreleased seek failed exception */ + (instancetype)exceptionWithStream: (OFSeekableStream *)stream - offset: (of_offset_t)offset + offset: (OFFileOffset)offset whence: (int)whence errNo: (int)errNo; - (instancetype)init OF_UNAVAILABLE; @@ -77,11 +77,11 @@ * @param whence To what the offset is relative * @param errNo The errno of the error that occurred * @return An initialized seek failed exception */ - (instancetype)initWithStream: (OFSeekableStream *)stream - offset: (of_offset_t)offset + offset: (OFFileOffset)offset whence: (int)whence errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFSeekFailedException.m ================================================================== --- src/exceptions/OFSeekFailedException.m +++ src/exceptions/OFSeekFailedException.m @@ -27,11 +27,11 @@ { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithStream: (OFSeekableStream *)stream - offset: (of_offset_t)offset + offset: (OFFileOffset)offset whence: (int)whence errNo: (int)errNo { return [[[self alloc] initWithStream: stream offset: offset @@ -43,11 +43,11 @@ { OF_INVALID_INIT_METHOD } - (instancetype)initWithStream: (OFSeekableStream *)stream - offset: (of_offset_t)offset + offset: (OFFileOffset)offset whence: (int)whence errNo: (int)errNo { self = [super init];