@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2022 Jonathan Schleifer + * Copyright (c) 2008-2024 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -13,13 +13,14 @@ * file. */ #include "config.h" -#define _LARGEFILE64_SOURCE +#ifndef _LARGEFILE64_SOURCE +# define _LARGEFILE64_SOURCE +#endif -#include #include #ifdef HAVE_FCNTL_H # include #endif @@ -31,11 +32,10 @@ #import "OFFile.h" #import "OFLocale.h" #import "OFString.h" #import "OFSystemInfo.h" -#import "OFURI.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFNotOpenException.h" #import "OFOpenItemFailedException.h" @@ -48,12 +48,14 @@ #ifdef OF_WINDOWS # include #endif #ifdef OF_AMIGAOS +# define Class IntuitionClass # include # include +# undef Class #endif #ifdef OF_WII # include #endif @@ -337,10 +339,11 @@ - (instancetype)initWithHandle: (OFFileHandle)handle { self = [super init]; _handle = handle; + _initialized = true; return self; } - (instancetype)init @@ -552,11 +555,11 @@ [super close]; } - (void)dealloc { - if (_handle != OFInvalidFileHandle) + if (_initialized && _handle != OFInvalidFileHandle) [self close]; [super dealloc]; } @end