Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -17,14 +17,14 @@ #import "OFKernelEventObserver.h" #ifndef OF_AMIGAOS # define OF_FILE_HANDLE_IS_FD # define OF_INVALID_FILE_HANDLE (-1) -typedef int of_file_handle_t; +typedef int OFFileHandle; #else # define OF_INVALID_FILE_HANDLE NULL -typedef struct of_file_handle *of_file_handle_t; +typedef struct OFFileHandle *OFFileHandle; #endif OF_ASSUME_NONNULL_BEGIN @class OFURL; @@ -38,11 +38,11 @@ @interface OFFile: OFSeekableStream #ifdef OF_FILE_HANDLE_IS_FD #endif { - of_file_handle_t _handle; + OFFileHandle _handle; bool _atEndOfStream; } /** * @brief Creates a new OFFile with the specified path and mode. @@ -91,11 +91,11 @@ * @param handle A native file handle. If OF_FILE_HANDLE_IS_FD is defined, this * is a file descriptor. The handle is closed when the OFFile * object is deallocated! * @return A new autoreleased OFFile */ -+ (instancetype)fileWithHandle: (of_file_handle_t)handle; ++ (instancetype)fileWithHandle: (OFFileHandle)handle; - (instancetype)init OF_UNAVAILABLE; /** * @brief Initializes an already allocated OFFile. @@ -151,10 +151,9 @@ * @param handle A native file handle. If OF_FILE_HANDLE_IS_FD is defined, this * is a file descriptor. The handle is closed when the OFFile * object is deallocated! * @return An initialized OFFile */ -- (instancetype)initWithHandle: (of_file_handle_t)handle - OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithHandle: (OFFileHandle)handle OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -77,18 +77,18 @@ #endif #ifndef OF_AMIGAOS # define closeHandle(h) close(h) #else -static struct of_file_handle { - of_file_handle_t previous, next; +static struct OFFileHandle + OFFileHandle previous, next; BPTR handle; bool append; } *firstHandle = NULL; static void -closeHandle(of_file_handle_t handle) +closeHandle(OFFileHandle handle) { Close(handle->handle); if (handle->previous != NULL) handle->previous->next = handle->next; @@ -101,11 +101,11 @@ free(handle); } OF_DESTRUCTOR() { - for (of_file_handle_t iter = firstHandle; iter != NULL; + for (OFFileHandle iter = firstHandle; iter != NULL; iter = iter->next) Close(iter->handle); } #endif @@ -190,11 +190,11 @@ + (instancetype)fileWithURL: (OFURL *)URL mode: (OFString *)mode { return [[[self alloc] initWithURL: URL mode: mode] autorelease]; } -+ (instancetype)fileWithHandle: (of_file_handle_t)handle ++ (instancetype)fileWithHandle: (OFFileHandle)handle { return [[[self alloc] initWithHandle: handle] autorelease]; } - (instancetype)init @@ -202,11 +202,11 @@ OF_INVALID_INIT_METHOD } - (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode { - of_file_handle_t handle; + OFFileHandle handle; @try { void *pool = objc_autoreleasePoolPush(); int flags; @@ -338,11 +338,11 @@ objc_autoreleasePoolPop(pool); return self; } -- (instancetype)initWithHandle: (of_file_handle_t)handle +- (instancetype)initWithHandle: (OFFileHandle)handle { self = [super init]; _handle = handle;