ObjFW  Check-in [2aca549d60]

Overview
Comment:Clean up class extensions

Now that we can require GCC >= 4.6, we no longer need to fall back to
using a category on old compilers.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2aca549d603756ea27c4879ed5a6d32ce78dddf5c7a1e344bd1b046656d5be94
User & Date: js on 2015-11-29 14:23:09
Other Links: manifest | tags
Context
2015-11-29
14:26
Remove defines we no longer need check-in: be8db49635 user: js tags: trunk
14:23
Clean up class extensions check-in: 2aca549d60 user: js tags: trunk
14:20
Clean up optional protocols check-in: ba62f00fac user: js tags: trunk
Changes

Modified src/OFApplication.m from [faff25c759] to [22742689c9].

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

#ifdef OF_NINTENDO_DS
# define asm __asm__
# include <nds.h>
# undef asm
#endif

@interface OFApplication (OF_PRIVATE_CATEGORY)
- (void)OF_setArgumentCount: (int*)argc
	  andArgumentValues: (char**[])argv;
#ifdef OF_WINDOWS
- (void)OF_setArgumentCount: (int)argc
      andWideArgumentValues: (wchar_t*[])argv;
#endif
- (void)OF_run;







|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

#ifdef OF_NINTENDO_DS
# define asm __asm__
# include <nds.h>
# undef asm
#endif

@interface OFApplication ()
- (void)OF_setArgumentCount: (int*)argc
	  andArgumentValues: (char**[])argv;
#ifdef OF_WINDOWS
- (void)OF_setArgumentCount: (int)argc
      andWideArgumentValues: (wchar_t*[])argv;
#endif
- (void)OF_run;

Modified src/OFArray.m from [2be2e1c20f] to [1d6d7edd47].

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#import "OFInvalidArgumentException.h"
#import "OFOutOfRangeException.h"

static struct {
	Class isa;
} placeholder;

@interface OFArray (OF_PRIVATE_CATEGORY)
- (OFString*)OF_JSONRepresentationWithOptions: (int)options
					depth: (size_t)depth;
@end

@interface OFArray_placeholder: OFArray
@end








|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#import "OFInvalidArgumentException.h"
#import "OFOutOfRangeException.h"

static struct {
	Class isa;
} placeholder;

@interface OFArray ()
- (OFString*)OF_JSONRepresentationWithOptions: (int)options
					depth: (size_t)depth;
@end

@interface OFArray_placeholder: OFArray
@end

Modified src/OFAutoreleasePool+Private.h from [15b3ef0a51] to [888b2bcf2d].

14
15
16
17
18
19
20
21
22
23
24
25
26
 * file.
 */

#import "OFAutoreleasePool.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFAutoreleasePool (OF_PRIVATE_CATEGORY)
+ (void)OF_handleThreadTermination;
- (void)OF_super_dealloc;
@end

OF_ASSUME_NONNULL_END







|





14
15
16
17
18
19
20
21
22
23
24
25
26
 * file.
 */

#import "OFAutoreleasePool.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFAutoreleasePool ()
+ (void)OF_handleThreadTermination;
- (void)OF_super_dealloc;
@end

OF_ASSUME_NONNULL_END

Modified src/OFDictionary.m from [f9d2ed8c00] to [4d31711ac3].

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#import "OFInvalidArgumentException.h"
#import "OFOutOfRangeException.h"

static struct {
	Class isa;
} placeholder;

@interface OFDictionary (OF_PRIVATE_CATEGORY)
- (OFString*)OF_JSONRepresentationWithOptions: (int)options
					depth: (size_t)depth;
@end

@interface OFDictionary_placeholder: OFDictionary
@end








|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#import "OFInvalidArgumentException.h"
#import "OFOutOfRangeException.h"

static struct {
	Class isa;
} placeholder;

@interface OFDictionary ()
- (OFString*)OF_JSONRepresentationWithOptions: (int)options
					depth: (size_t)depth;
@end

@interface OFDictionary_placeholder: OFDictionary
@end

Modified src/OFHTTPServer.m from [c7dbee91dc] to [3f7a396278].

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#define BUFFER_SIZE 1024

/*
 * FIXME: Key normalization replaces headers like "DNT" with "Dnt".
 * FIXME: Errors are not reported to the user.
 */

@interface OFHTTPServer (OF_PRIVATE_CATEGORY)
- (bool)OF_socket: (OFTCPSocket*)socket
  didAcceptSocket: (OFTCPSocket*)clientSocket
	exception: (OFException*)exception;
@end

static const char*
statusCodeToString(short code)







|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#define BUFFER_SIZE 1024

/*
 * FIXME: Key normalization replaces headers like "DNT" with "Dnt".
 * FIXME: Errors are not reported to the user.
 */

@interface OFHTTPServer ()
- (bool)OF_socket: (OFTCPSocket*)socket
  didAcceptSocket: (OFTCPSocket*)clientSocket
	exception: (OFException*)exception;
@end

static const char*
statusCodeToString(short code)

Modified src/OFINICategory+Private.h from [57eb45a3d8] to [3b162a836d].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#import "OFINICategory.h"
#import "OFString.h"

OF_ASSUME_NONNULL_BEGIN

@class OFStream;

@interface OFINICategory (OF_PRIVATE_CATEGORY)
- (instancetype)OF_init;
- (void)OF_parseLine: (OFString*)line;
- (bool)OF_writeToStream: (OFStream*)stream
		encoding: (of_string_encoding_t)encoding
		   first: (bool)first;
@end

OF_ASSUME_NONNULL_END







|








17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#import "OFINICategory.h"
#import "OFString.h"

OF_ASSUME_NONNULL_BEGIN

@class OFStream;

@interface OFINICategory ()
- (instancetype)OF_init;
- (void)OF_parseLine: (OFString*)line;
- (bool)OF_writeToStream: (OFStream*)stream
		encoding: (of_string_encoding_t)encoding
		   first: (bool)first;
@end

OF_ASSUME_NONNULL_END

Modified src/OFINIFile.m from [754d91375c] to [9c088e62fb].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#import "OFFile.h"
#import "OFINICategory.h"
#import "OFINICategory+Private.h"

#import "OFInvalidFormatException.h"
#import "OFOpenItemFailedException.h"

@interface OFINIFile (OF_PRIVATE_CATEGORY)
- (void)OF_parseFile: (OFString*)path
	    encoding: (of_string_encoding_t)encoding;
@end

static bool
isWhitespaceLine(OFString *line)
{







|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#import "OFFile.h"
#import "OFINICategory.h"
#import "OFINICategory+Private.h"

#import "OFInvalidFormatException.h"
#import "OFOpenItemFailedException.h"

@interface OFINIFile ()
- (void)OF_parseFile: (OFString*)path
	    encoding: (of_string_encoding_t)encoding;
@end

static bool
isWhitespaceLine(OFString *line)
{

Modified src/OFKernelEventObserver+Private.h from [e624333841] to [2c8d4ea4a1].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 * file.
 */

#import "OFKernelEventObserver.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFKernelEventObserver (OF_PRIVATE_CATEGORY)
- (void)OF_addObjectForReading: (id)object;
- (void)OF_addObjectForWriting: (id)object;
- (void)OF_removeObjectForReading: (id)object;
- (void)OF_removeObjectForWriting: (id)object;
- (void)OF_processQueueAndStoreRemovedIn: (nullable OFMutableArray*)removed;
- (void)OF_processReadBuffers;
@end

OF_ASSUME_NONNULL_END







|









14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 * file.
 */

#import "OFKernelEventObserver.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFKernelEventObserver ()
- (void)OF_addObjectForReading: (id)object;
- (void)OF_addObjectForWriting: (id)object;
- (void)OF_removeObjectForReading: (id)object;
- (void)OF_removeObjectForWriting: (id)object;
- (void)OF_processQueueAndStoreRemovedIn: (nullable OFMutableArray*)removed;
- (void)OF_processReadBuffers;
@end

OF_ASSUME_NONNULL_END

Modified src/OFMapTable.m from [1fa0a57947] to [a593ea3dae].

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

static bool
defaultEqual(void *value1, void *value2)
{
	return (value1 == value2);
}

@interface OFMapTable (OF_PRIVATE_CATEGORY)
- (void)OF_setValue: (void*)value
	     forKey: (void*)key
	       hash: (uint32_t)hash;
@end

@interface OFMapTableEnumerator (OF_PRIVATE_CATEGORY)
- (instancetype)OF_initWithMapTable: (OFMapTable*)mapTable
			    buckets: (struct of_map_table_bucket**)buckets
			   capacity: (uint32_t)capacity
		   mutationsPointer: (unsigned long*)mutationsPtr;
@end

@interface OFMapTableKeyEnumerator: OFMapTableEnumerator







|





|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

static bool
defaultEqual(void *value1, void *value2)
{
	return (value1 == value2);
}

@interface OFMapTable ()
- (void)OF_setValue: (void*)value
	     forKey: (void*)key
	       hash: (uint32_t)hash;
@end

@interface OFMapTableEnumerator ()
- (instancetype)OF_initWithMapTable: (OFMapTable*)mapTable
			    buckets: (struct of_map_table_bucket**)buckets
			   capacity: (uint32_t)capacity
		   mutationsPointer: (unsigned long*)mutationsPtr;
@end

@interface OFMapTableKeyEnumerator: OFMapTableEnumerator

Modified src/OFNull.m from [eb742fd093] to [1ad0ed2b53].

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#import "OFNull.h"
#import "OFString.h"
#import "OFXMLElement.h"
#import "OFDataArray.h"

#import "OFInvalidArgumentException.h"

@interface OFNull (OF_PRIVATE_CATEGORY)
- (OFString*)OF_JSONRepresentationWithOptions: (int)options
					depth: (size_t)depth;
@end

static OFNull *null = nil;

@implementation OFNull







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#import "OFNull.h"
#import "OFString.h"
#import "OFXMLElement.h"
#import "OFDataArray.h"

#import "OFInvalidArgumentException.h"

@interface OFNull ()
- (OFString*)OF_JSONRepresentationWithOptions: (int)options
					depth: (size_t)depth;
@end

static OFNull *null = nil;

@implementation OFNull

Modified src/OFNumber.m from [6960976b0a] to [a41a16b8f6].

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
		return (t)_value.float_;				\
	case OF_NUMBER_TYPE_DOUBLE:					\
		return (t)_value.double_;				\
	default:							\
		@throw [OFInvalidFormatException exception];		\
	}

@interface OFNumber (OF_PRIVATE_CATEGORY)
- (OFString*)OF_JSONRepresentationWithOptions: (int)options
					depth: (size_t)depth;
@end

@implementation OFNumber
@synthesize type = _type;








|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
		return (t)_value.float_;				\
	case OF_NUMBER_TYPE_DOUBLE:					\
		return (t)_value.double_;				\
	default:							\
		@throw [OFInvalidFormatException exception];		\
	}

@interface OFNumber ()
- (OFString*)OF_JSONRepresentationWithOptions: (int)options
					depth: (size_t)depth;
@end

@implementation OFNumber
@synthesize type = _type;

Modified src/OFProcess.m from [3256a71833] to [b05e103aab].

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# include <windows.h>
#endif

#if !defined(OF_WINDOWS) && !defined(HAVE_POSIX_SPAWNP)
extern char **environ;
#endif

@interface OFProcess (OF_PRIVATE_CATEGORY)
#ifndef OF_WINDOWS
- (void)OF_getArgV: (char***)argv
    forProgramName: (OFString*)programName
      andArguments: (OFArray*)arguments;
- (char**)OF_environmentForDictionary: (OFDictionary*)dictionary;
#else
- (of_char16_t*)OF_environmentForDictionary: (OFDictionary*)dictionary;







|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# include <windows.h>
#endif

#if !defined(OF_WINDOWS) && !defined(HAVE_POSIX_SPAWNP)
extern char **environ;
#endif

@interface OFProcess ()
#ifndef OF_WINDOWS
- (void)OF_getArgV: (char***)argv
    forProgramName: (OFString*)programName
      andArguments: (OFArray*)arguments;
- (char**)OF_environmentForDictionary: (OFDictionary*)dictionary;
#else
- (of_char16_t*)OF_environmentForDictionary: (OFDictionary*)dictionary;

Modified src/OFRunLoop+Private.h from [c9ae02043f] to [c425b64ab7].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#import "OFStream.h"
#ifdef OF_HAVE_SOCKETS
# import "OFUDPSocket.h"
#endif

OF_ASSUME_NONNULL_BEGIN

@interface OFRunLoop (OF_PRIVATE_CATEGORY)
+ (void)OF_setMainRunLoop: (OFRunLoop*)runLoop;
#ifdef OF_HAVE_SOCKETS
+ (void)OF_addAsyncReadForStream: (OFStream*)stream
			  buffer: (void*)buffer
			  length: (size_t)length
			  target: (id)target
			selector: (SEL)selector;







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#import "OFStream.h"
#ifdef OF_HAVE_SOCKETS
# import "OFUDPSocket.h"
#endif

OF_ASSUME_NONNULL_BEGIN

@interface OFRunLoop ()
+ (void)OF_setMainRunLoop: (OFRunLoop*)runLoop;
#ifdef OF_HAVE_SOCKETS
+ (void)OF_addAsyncReadForStream: (OFStream*)stream
			  buffer: (void*)buffer
			  length: (size_t)length
			  target: (id)target
			selector: (SEL)selector;

Modified src/OFStdIOStream.m from [18f864f44a] to [b89433fb35].

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"

OFStdIOStream *of_stdin = nil;
OFStdIOStream *of_stdout = nil;
OFStdIOStream *of_stderr = nil;

@interface OFStdIOStream (OF_PRIVATE_CATEGORY)
- (instancetype)OF_initWithFileDescriptor: (int)fd;
@end

void
of_log(OFConstantString *format, ...)
{
	void *pool = objc_autoreleasePoolPush();







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"

OFStdIOStream *of_stdin = nil;
OFStdIOStream *of_stdout = nil;
OFStdIOStream *of_stderr = nil;

@interface OFStdIOStream ()
- (instancetype)OF_initWithFileDescriptor: (int)fd;
@end

void
of_log(OFConstantString *format, ...)
{
	void *pool = objc_autoreleasePoolPush();

Modified src/OFStream+Private.h from [cd0edecb76] to [5f033357f4].

14
15
16
17
18
19
20
21
22
23
24
25
 * file.
 */

#import "OFStream.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFStream (OF_PRIVATE_CATEGORY)
@property (readonly) bool OF_isWaitingForDelimiter;
@end

OF_ASSUME_NONNULL_END







|




14
15
16
17
18
19
20
21
22
23
24
25
 * file.
 */

#import "OFStream.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFStream ()
@property (readonly) bool OF_isWaitingForDelimiter;
@end

OF_ASSUME_NONNULL_END

Modified src/OFString.m from [01f9bb127a] to [f76a1b5752].

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 * It seems strtod is buggy on Win32.
 * However, the MinGW version __strtod seems to be ok.
 */
#ifdef __MINGW32__
# define strtod __strtod
#endif

@interface OFString (OF_PRIVATE_CATEGORY)
- (size_t)OF_getCString: (char*)cString
	      maxLength: (size_t)maxLength
	       encoding: (of_string_encoding_t)encoding
		  lossy: (bool)lossy;
- (const char*)OF_cStringWithEncoding: (of_string_encoding_t)encoding
				lossy: (bool)lossy;
- (OFString*)OF_JSONRepresentationWithOptions: (int)options







|







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 * It seems strtod is buggy on Win32.
 * However, the MinGW version __strtod seems to be ok.
 */
#ifdef __MINGW32__
# define strtod __strtod
#endif

@interface OFString ()
- (size_t)OF_getCString: (char*)cString
	      maxLength: (size_t)maxLength
	       encoding: (of_string_encoding_t)encoding
		  lossy: (bool)lossy;
- (const char*)OF_cStringWithEncoding: (of_string_encoding_t)encoding
				lossy: (bool)lossy;
- (OFString*)OF_JSONRepresentationWithOptions: (int)options

Modified src/OFString_UTF8+Private.h from [ce04431695] to [475e4177ca].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * file.
 */

#import "OFString_UTF8.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFString_UTF8 (OF_PRIVATE_CATEGORY)
- (instancetype)OF_initWithUTF8String: (const char*)UTF8String
			       length: (size_t)UTF8StringLength
			      storage: (char*)storage;
@end

OF_ASSUME_NONNULL_END







|






14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * file.
 */

#import "OFString_UTF8.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFString_UTF8 ()
- (instancetype)OF_initWithUTF8String: (const char*)UTF8String
			       length: (size_t)UTF8StringLength
			      storage: (char*)storage;
@end

OF_ASSUME_NONNULL_END

Modified src/OFThread+Private.h from [0c17908055] to [d3b39888a7].

15
16
17
18
19
20
21
22
23
24
25
26
27
 */

#import "OFThread.h"

OF_ASSUME_NONNULL_BEGIN

#ifdef OF_HAVE_THREADS
@interface OFThread (OF_PRIVATE_CATEGORY)
+ (void)OF_createMainThread;
@end
#endif

OF_ASSUME_NONNULL_END







|





15
16
17
18
19
20
21
22
23
24
25
26
27
 */

#import "OFThread.h"

OF_ASSUME_NONNULL_BEGIN

#ifdef OF_HAVE_THREADS
@interface OFThread ()
+ (void)OF_createMainThread;
@end
#endif

OF_ASSUME_NONNULL_END

Modified src/OFTimer+Private.h from [a5998b0d21] to [5d9f0e719d].

14
15
16
17
18
19
20
21
22
23
24
25
26
 * file.
 */

#import "OFTimer.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFTimer (OF_PRIVATE_CATEGORY)
@property OF_NULLABLE_PROPERTY (retain, setter=OF_setInRunLoop:)
    OFRunLoop *OF_inRunLoop;
@end

OF_ASSUME_NONNULL_END







|





14
15
16
17
18
19
20
21
22
23
24
25
26
 * file.
 */

#import "OFTimer.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFTimer ()
@property OF_NULLABLE_PROPERTY (retain, setter=OF_setInRunLoop:)
    OFRunLoop *OF_inRunLoop;
@end

OF_ASSUME_NONNULL_END

Modified src/OFZIPArchive.m from [e3768699d3] to [217e433e7c].

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 * FIXME: Current limitations:
 *  - Split archives are not supported.
 *  - Write support is missing.
 *  - The ZIP has to be a file on the local file system.
 *  - Encrypted files cannot be read.
 */

@interface OFZIPArchive (OF_PRIVATE_CATEGORY)
- (void)OF_readZIPInfo;
- (void)OF_readEntries;
@end

@interface OFZIPArchive_LocalFileHeader: OFObject
{
@public







|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 * FIXME: Current limitations:
 *  - Split archives are not supported.
 *  - Write support is missing.
 *  - The ZIP has to be a file on the local file system.
 *  - Encrypted files cannot be read.
 */

@interface OFZIPArchive ()
- (void)OF_readZIPInfo;
- (void)OF_readEntries;
@end

@interface OFZIPArchive_LocalFileHeader: OFObject
{
@public

Modified src/OFZIPArchiveEntry+Private.h from [bc7d037fee] to [90b610f3ba].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 * file.
 */

#import "OFZIPArchive.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFZIPArchiveEntry (OF_PRIVATE_CATEGORY)
@property (readonly) uint16_t OF_generalPurposeBitFlag, OF_lastModifiedFileTime;
@property (readonly) uint16_t OF_lastModifiedFileDate;
@property (readonly) uint64_t OF_localFileHeaderOffset;

- (instancetype)OF_initWithStream: (OFStream*)stream;
@end

OF_ASSUME_NONNULL_END







|








14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 * file.
 */

#import "OFZIPArchive.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFZIPArchiveEntry ()
@property (readonly) uint16_t OF_generalPurposeBitFlag, OF_lastModifiedFileTime;
@property (readonly) uint16_t OF_lastModifiedFileDate;
@property (readonly) uint64_t OF_localFileHeaderOffset;

- (instancetype)OF_initWithStream: (OFStream*)stream;
@end

OF_ASSUME_NONNULL_END