ObjFW  Check-in [9e9ce6aa1c]

Overview
Comment:Work around bugs in Apple GCC 4.0.1

Still miscompiles things.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9e9ce6aa1c571c4b6af9438d99344f5733c5ea56b6ea924e7fcacf5869ed03d4
User & Date: js on 2020-09-27 03:08:51
Other Links: manifest | tags
Context
2020-09-27
03:27
Fix tests with Apple GCC 4.0.1 check-in: 8911d7f031 user: js tags: trunk
03:08
Work around bugs in Apple GCC 4.0.1 check-in: 9e9ce6aa1c user: js tags: trunk
02:31
tests/terminal: Fix compiling with Apple GCC 4.2.1 check-in: 1535a3770b user: js tags: trunk
Changes

Modified PLATFORMS.md from [d2995207f3] to [0cc8861033].

85
86
87
88
89
90
91
92

93
94

95
96
97
98
99
100
101
85
86
87
88
89
90
91

92
93

94
95
96
97
98
99
100
101







-
+

-
+







  * Compilers: Clang 3.0-10.0, GCC 4.6-10.0
  * Runtimes: ObjFW


macOS
-----

  * OS Versions: 10.5, 10.7-10.14, Darling
  * OS Versions: 10.5, 10.7-10.15, Darling
  * Architectures: PowerPC, PowerPC64, x86, x86_64
  * Compilers: Clang 3.1-10.0, GCC 4.2.1
  * Compilers: Clang 3.1-10.0, Apple GCC 4.0.1 & 4.2.1
  * Runtimes: Apple, ObjFW


MorphOS
-------

  * OS Versions: 3.9-3.11

Modified src/OFHostAddressResolver.m from [8bdb78d119] to [1663ef2651].

205
206
207
208
209
210
211
212

213
214
215
216
217
218
219
205
206
207
208
209
210
211

212
213
214
215
216
217
218
219







-
+







		_searchDomainIndex++;
		[self sendQueries];
		return;
	}

	for (OF_KINDOF(OFDNSResourceRecord *) record in
	    [response.answerRecords objectForKey: query.domainName]) {
		const of_socket_address_t *address;
		const of_socket_address_t *address = NULL;
		OFDNSQuery *CNAMEQuery;

		if ([record DNSClass] != OF_DNS_CLASS_IN)
			continue;

		if (addressForRecord(record, &address, _addressFamily)) {
			[_addresses addItem: address];

Modified src/OFInflateStream.m from [3cf4fd3893] to [c1d8d6e047].

226
227
228
229
230
231
232
233

234
235
236
237
238
239
240
226
227
228
229
230
231
232

233
234
235
236
237
238
239
240







-
+







	[super dealloc];
}

- (size_t)lowlevelReadIntoBuffer: (void *)buffer_
			  length: (size_t)length
{
	unsigned char *buffer = buffer_;
	uint16_t bits, tmp, value;
	uint16_t bits = 0, tmp, value = 0;
	size_t bytesWritten = 0;
	unsigned char *slidingWindow;
	uint16_t slidingWindowIndex;

	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

Modified src/OFLHAArchive.h from [065c7afdab] to [73310bb7cf].

48
49
50
51
52
53
54
55
56


57
58

59
60
61
62
63
64
65
66
48
49
50
51
52
53
54


55
56
57

58

59
60
61
62
63
64
65







-
-
+
+

-
+
-







@property (nonatomic) of_string_encoding_t encoding;

/*!
 * @brief A stream for reading the current entry.
 *
 * @note This is only available in read mode.
 *
 * @note The returned stream only conforms to @ref OFReadyForReadingObserving if
 *	 the underlying stream does so, too.
 * @note The returned stream conforms to @ref OFReadyForReadingObserving if the
 *	 underlying stream does so, too.
 */
@property (readonly, nonatomic)
@property (readonly, nonatomic) OFStream *streamForReadingCurrentEntry;
    OFStream <OFReadyForReadingObserving> *streamForReadingCurrentEntry;

/*!
 * @brief Creates a new OFLHAArchive object with the specified stream.
 *
 * @param stream A stream from which the LHA archive will be read.
 *		 For read and append mode, this needs to be an OFSeekableStream.
 * @param mode The mode for the LHA file. Valid modes are "r" for reading,
137
138
139
140
141
142
143
144
145


146
147
148
149
150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
165
136
137
138
139
140
141
142


143
144
145
146
147
148
149
150
151
152
153
154


155
156
157
158
159
160
161
162
163







-
-
+
+










-
-
+








 * @brief Returns a stream for writing the specified entry.
 *
 * @note This is only available in write and append mode.
 *
 * @note The uncompressed size, compressed size and CRC16 of the specified
 *	 entry are ignored.
 *
 * @note The returned stream only conforms to @ref OFReadyForWritingObserving if
 *	 the underlying stream does so, too.
 * @note The returned stream conforms to @ref OFReadyForWritingObserving if the
 *	 underlying stream does so, too.
 *
 * @warning Calling @ref nextEntry will invalidate all streams returned by
 *	    @ref streamForReadingCurrentEntry or
 *	    @ref streamForWritingEntry:! Reading from or writing to an
 *	    invalidated stream will throw an @ref OFReadFailedException or
 *	    @ref OFWriteFailedException!
 *
 * @param entry The entry for which a stream for writing should be returned
 * @return A stream for writing the specified entry
 */
- (OFStream <OFReadyForWritingObserving> *)
    streamForWritingEntry: (OFLHAArchiveEntry *)entry;
- (OFStream *)streamForWritingEntry: (OFLHAArchiveEntry *)entry;

/*!
 * @brief Closes the OFLHAArchive.
 */
- (void)close;
@end

OF_ASSUME_NONNULL_END

Modified src/OFLHAArchive.m from [493061fab4] to [d4b33ee3bc].

201
202
203
204
205
206
207
208

209
210
211
212
213
214
215
216
217
218
219
220
221

222
223
224
225
226
227
228
201
202
203
204
205
206
207

208
209
210
211
212
213
214
215
216
217
218
219


220
221
222
223
224
225
226
227







-
+











-
-
+







	_lastReturnedStream = [[OFLHAArchiveFileReadStream alloc]
	    of_initWithStream: _stream
			entry: entry];

	return entry;
}

- (OFStream <OFReadyForReadingObserving> *)streamForReadingCurrentEntry
- (OFStream *)streamForReadingCurrentEntry
{
	if (_mode != OF_LHA_ARCHIVE_MODE_READ)
		@throw [OFInvalidArgumentException exception];

	if (_lastReturnedStream == nil)
		@throw [OFInvalidArgumentException exception];

	return [[(OFLHAArchiveFileReadStream *)_lastReturnedStream
	    retain] autorelease];
}

- (OFStream <OFReadyForWritingObserving> *)
    streamForWritingEntry: (OFLHAArchiveEntry *)entry
- (OFStream *)streamForWritingEntry: (OFLHAArchiveEntry *)entry
{
	OFString *compressionMethod;

	if (_mode != OF_LHA_ARCHIVE_MODE_WRITE &&
	    _mode != OF_LHA_ARCHIVE_MODE_APPEND)
		@throw [OFInvalidArgumentException exception];

Modified src/OFLHADecompressingStream.m from [aae6155a72] to [16b7cb0b85].

136
137
138
139
140
141
142
143

144
145
146
147
148
149
150
136
137
138
139
140
141
142

143
144
145
146
147
148
149
150







-
+







	[super dealloc];
}

- (size_t)lowlevelReadIntoBuffer: (void *)buffer_
			  length: (size_t)length
{
	unsigned char *buffer = buffer_;
	uint16_t bits, value;
	uint16_t bits = 0, value = 0;
	size_t bytesWritten = 0;

	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_stream.atEndOfStream && _bufferLength - _bufferIndex == 0 &&
	    _state == STATE_BLOCK_HEADER)

Modified src/OFTarArchive.h from [f899bf9135] to [53aa277ad0].

48
49
50
51
52
53
54
55
56


57
58

59
60
61
62
63
64
65
66
48
49
50
51
52
53
54


55
56
57

58

59
60
61
62
63
64
65







-
-
+
+

-
+
-







@property (nonatomic) of_string_encoding_t encoding;

/*!
 * @brief A stream for reading the current entry.
 *
 * @note This is only available in read mode.
 *
 * @note The returned stream only conforms to @ref OFReadyForReadingObserving if
 *	 the underlying stream does so, too.
 * @note The returned stream conforms to @ref OFReadyForReadingObserving if the
 *	 underlying stream does so, too.
 */
@property (readonly, nonatomic)
@property (readonly, nonatomic) OFStream *streamForReadingCurrentEntry;
    OFStream <OFReadyForReadingObserving> *streamForReadingCurrentEntry;

/*!
 * @brief Creates a new OFTarArchive object with the specified stream.
 *
 * @param stream A stream from which the tar archive will be read.
 *		 For append mode, this needs to be an OFSeekableStream.
 * @param mode The mode for the tar file. Valid modes are "r" for reading,
134
135
136
137
138
139
140
141
142


143
144
145
146
147
148
149
150
151
152
153
154

155
156
157
158
159
160
161
162
133
134
135
136
137
138
139


140
141
142
143
144
145
146
147
148
149
150
151


152
153
154
155
156
157
158
159
160







-
-
+
+










-
-
+








- (nullable OFTarArchiveEntry *)nextEntry;

/*!
 * @brief Returns a stream for writing the specified entry.
 *
 * @note This is only available in write and append mode.
 *
 * @note The returned stream only conforms to @ref OFReadyForWritingObserving if
 *	 the underlying stream does so, too.
 * @note The returned stream conforms to @ref OFReadyForWritingObserving if the
 *	 underlying stream does so, too.
 *
 * @warning Calling @ref nextEntry will invalidate all streams returned by
 *	    @ref streamForReadingCurrentEntry or
 *	    @ref streamForWritingEntry:! Reading from or writing to an
 *	    invalidated stream will throw an @ref OFReadFailedException or
 *	    @ref OFWriteFailedException!
 *
 * @param entry The entry for which a stream for writing should be returned
 * @return A stream for writing the specified entry
 */
- (OFStream <OFReadyForWritingObserving> *)
    streamForWritingEntry: (OFTarArchiveEntry *)entry;
- (OFStream *)streamForWritingEntry: (OFTarArchiveEntry *)entry;

/*!
 * @brief Closes the OFTarArchive.
 */
- (void)close;
@end

OF_ASSUME_NONNULL_END

Modified src/OFTarArchive.m from [22d3bc898d] to [6889b3aa0d].

210
211
212
213
214
215
216
217

218
219
220
221
222
223
224
225
226
227
228
229
230

231
232
233
234
235
236
237
210
211
212
213
214
215
216

217
218
219
220
221
222
223
224
225
226
227
228


229
230
231
232
233
234
235
236







-
+











-
-
+







	_lastReturnedStream = [[OFTarArchiveFileReadStream alloc]
	    of_initWithStream: _stream
			entry: entry];

	return entry;
}

- (OFStream <OFReadyForReadingObserving> *)streamForReadingCurrentEntry
- (OFStream *)streamForReadingCurrentEntry
{
	if (_mode != OF_TAR_ARCHIVE_MODE_READ)
		@throw [OFInvalidArgumentException exception];

	if (_lastReturnedStream == nil)
		@throw [OFInvalidArgumentException exception];

	return [[(OFTarArchiveFileReadStream *)_lastReturnedStream
	    retain] autorelease];
}

- (OFStream <OFReadyForWritingObserving> *)
    streamForWritingEntry: (OFTarArchiveEntry *)entry
- (OFStream *)streamForWritingEntry: (OFTarArchiveEntry *)entry
{
	void *pool;

	if (_mode != OF_TAR_ARCHIVE_MODE_WRITE &&
	    _mode != OF_TAR_ARCHIVE_MODE_APPEND)
		@throw [OFInvalidArgumentException exception];

Modified src/OFThread.m from [64242ae003] to [690c42ccaa].

332
333
334
335
336
337
338
339

340
341
342
343
344
345
346
332
333
334
335
336
337
338

339
340
341
342
343
344
345
346







-
+







{
	[OFThread currentThread].name = name;

	if (name != nil)
		of_thread_set_name(
		    [name cStringWithEncoding: [OFLocale encoding]]);
	else
		of_thread_set_name(class_getName(self.class));
		of_thread_set_name(class_getName([self class]));
}

+ (OFString *)name
{
	return [OFThread currentThread].name;
}

Modified src/OFZIPArchive.h from [3f137fd732] to [2ca7bfb5c8].

126
127
128
129
130
131
132



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148



149
150
151
152
153
154
155
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161







+
+
+
















+
+
+







			mode: (OFString *)mode;
#endif

/*!
 * @brief Returns a stream for reading the specified file from the archive.
 *
 * @note This method is only available in read mode.
 *
 * @note The returned stream conforms to @ref OFReadyForReadingObserving if the
 *	 underlying stream does so, too.
 *
 * @warning Calling @ref streamForReadingFile: will invalidate all streams
 *	    previously returned by @ref streamForReadingFile: or
 *	    @ref streamForWritingEntry:! Reading from or writing to an
 *	    invalidated stream will throw an @ref OFReadFailedException or
 *	    @ref OFWriteFailedException!
 *
 * @param path The path to the file inside the archive
 * @return A stream for reading the specified file form the archive
 */
- (OFStream *)streamForReadingFile: (OFString *)path;

/*!
 * @brief Returns a stream for writing the specified entry to the archive.
 *
 * @note This method is only available in write and append mode.
 *
 * @note The returned stream conforms to @ref OFReadyForWritingObserving if the
 *	 underlying stream does so, too.
 *
 * @warning Calling @ref streamForWritingEntry: will invalidate all streams
 *	    previously returned by @ref streamForReadingFile: or
 *	    @ref streamForWritingEntry:! Reading from or writing to an
 *	    invalidated stream will throw an @ref OFReadFailedException or
 *	    @ref OFWriteFailedException!
 *

Modified src/bridge/NSArray+OFObject.m from [a42c9f90ab] to [2163b64d79].

17
18
19
20
21
22
23
24

25
26
27
28
17
18
19
20
21
22
23

24
25
26
27
28







-
+





#import "NSArray+OFObject.h"
#import "OFNSArray.h"

int _NSArray_OFObject_reference;

@implementation NSArray (OFObject)
- (id)OFObject
- (OFArray *)OFObject
{
	return [[[OFNSArray alloc] initWithNSArray: self] autorelease];
}
@end

Modified src/bridge/NSDictionary+OFObject.m from [5bc6e4d906] to [61195e4046].

17
18
19
20
21
22
23
24

25
26
27
28
29
17
18
19
20
21
22
23

24
25
26
27
28
29







-
+






#import "NSDictionary+OFObject.h"
#import "OFNSDictionary.h"

int _NSDictionary_OFObject_reference;

@implementation NSDictionary (OFObject)
- (id)OFObject
- (OFDictionary *)OFObject
{
	return [[[OFNSDictionary alloc]
	    initWithNSDictionary: self] autorelease];
}
@end

Modified src/bridge/NSEnumerator+OFObject.m from [9c73fe8508] to [fc63efa4f6].

17
18
19
20
21
22
23
24

25
26
27
28
29
17
18
19
20
21
22
23

24
25
26
27
28
29







-
+






#import "NSEnumerator+OFObject.h"
#import "OFNSEnumerator.h"

int _NSEnumerator_OFObject_reference;

@implementation NSEnumerator (OFObject)
- (id)OFObject
- (OFEnumerator *)OFObject
{
	return [[[OFNSEnumerator alloc]
	    initWithNSEnumerator: self] autorelease];
}
@end

Modified src/bridge/NSNumber+OFObject.m from [bf44298fff] to [a79897d657].

19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33







-
+







#import "OFNumber.h"

#import "OFInvalidArgumentException.h"

int _NSNumber_OFObject_reference;

@implementation NSNumber (OFObject)
- (id)OFObject
- (OFNumber *)OFObject
{
	const char *type = self.objCType;

	if (strcmp(type, "c") == 0)
		return [OFNumber numberWithChar: self.charValue];
	else if (strcmp(type, "C") == 0)
		return [OFNumber numberWithUnsignedChar:

Modified src/bridge/NSSet+OFObject.m from [e43a9d0915] to [ce021d5ef0].

17
18
19
20
21
22
23
24

25
26
27
28
17
18
19
20
21
22
23

24
25
26
27
28







-
+





#import "NSSet+OFObject.h"
#import "OFNSSet.h"

int _NSSet_OFObject_reference;

@implementation NSSet (OFObject)
- (id)OFObject
- (OFSet *)OFObject
{
	return [[[OFNSSet alloc] initWithNSSet: self] autorelease];
}
@end

Modified src/bridge/NSString+OFObject.m from [da15184010] to [6eccedb527].

17
18
19
20
21
22
23
24

25
26
27
28
17
18
19
20
21
22
23

24
25
26
27
28







-
+





#import "NSString+OFObject.h"
#import "OFString.h"

int _NSString_OFObject_reference;

@implementation NSString (OFObject)
- (id)OFObject
- (OFString *)OFObject
{
	return [OFString stringWithUTF8String: self.UTF8String];
}
@end

Modified src/bridge/OFArray+NSObject.m from [45cade40bb] to [b153739fac].

18
19
20
21
22
23
24
25

26
27
28
29
18
19
20
21
22
23
24

25
26
27
28
29







-
+




#import "NSOFArray.h"

#import "OFArray+NSObject.h"

int _OFArray_NSObject_reference;

@implementation OFArray (NSObject)
- (id)NSObject
- (NSArray *)NSObject
{
	return [[[NSOFArray alloc] initWithOFArray: self] autorelease];
}
@end

Modified src/bridge/OFDictionary+NSObject.m from [67f14d80ee] to [d35c1e81fe].

18
19
20
21
22
23
24
25

26
27
28
29
30
18
19
20
21
22
23
24

25
26
27
28
29
30







-
+





#import "NSOFDictionary.h"

#import "OFDictionary+NSObject.h"

int _OFDictionary_NSObject_reference;

@implementation OFDictionary (NSObject)
- (id)NSObject
- (NSDictionary *)NSObject
{
	return [[[NSOFDictionary alloc]
	    initWithOFDictionary: self] autorelease];
}
@end

Modified src/bridge/OFEnumerator+NSObject.m from [e6f9572180] to [f173918960].

18
19
20
21
22
23
24
25

26
27
28
29
30
18
19
20
21
22
23
24

25
26
27
28
29
30







-
+





#import "NSOFEnumerator.h"

#import "OFEnumerator+NSObject.h"

int _OFEnumerator_NSObject_reference;

@implementation OFEnumerator (NSObject)
- (id)NSObject
- (NSEnumerator *)NSObject
{
	return [[[NSOFEnumerator alloc]
	    initWithOFEnumerator: self] autorelease];
}
@end

Modified src/bridge/OFNumber+NSObject.m from [efa414982c] to [444f15ed81].

20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34







-
+







#import "OFNumber+NSObject.h"

#import "OFInvalidArgumentException.h"

int _OFNumber_NSObject_reference;

@implementation OFNumber (NSObject)
- (id)NSObject
- (NSNumber *)NSObject
{
	const char *type = self.objCType;

	if (strcmp(type, "B") == 0)
		return [NSNumber numberWithBool: self.boolValue];
	else if (strcmp(type, "c") == 0)
		return [NSNumber numberWithChar: self.charValue];

Modified src/bridge/OFSet+NSObject.m from [7adc13fcff] to [32b967da40].

18
19
20
21
22
23
24
25

26
27
28
29
18
19
20
21
22
23
24

25
26
27
28
29







-
+




#import "NSOFSet.h"

#import "OFSet+NSObject.h"

int _OFSet_NSObject_reference;

@implementation OFSet (NSObject)
- (id)NSObject
- (NSSet *)NSObject
{
	return [[[NSOFSet alloc] initWithOFSet: self] autorelease];
}
@end

Modified src/bridge/OFString+NSObject.m from [69808ffd1b] to [fefeea73ea].

20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
36
37
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
37







-
+










#import "OFString+NSObject.h"

#import "OFInitializationFailedException.h"

int _OFString_NSObject_reference;

@implementation OFString (NSObject)
- (id)NSObject
- (NSString *)NSObject
{
	NSString *string = [NSString stringWithUTF8String: self.UTF8String];

	if (string == nil)
		@throw [OFInitializationFailedException
		    exceptionWithClass: [NSString class]];

	return string;
}
@end

Modified src/exceptions/OFLockFailedException.m from [63bcef0c89] to [194a416a76].

55
56
57
58
59
60
61
62

63
64
55
56
57
58
59
60
61

62
63
64







-
+


	[super dealloc];
}

- (OFString *)description
{
	return [OFString stringWithFormat:
	    @"A lock of type %@ could not be locked: %s",
	    _lock.class, strerror(_errNo)];
	    [_lock class], strerror(_errNo)];
}
@end

Modified src/exceptions/OFStillLockedException.m from [bb65a0cbbe] to [befdc7b2dc].

50
51
52
53
54
55
56
57

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

57
58
59
60
61
62







-
+





}

- (OFString *)description
{
	if (_lock != nil)
		return [OFString stringWithFormat:
		    @"Deallocation of a lock of type %@ even though it was "
		    @"still locked!", _lock.class];
		    @"still locked!", [_lock class]];
	else
		return @"Deallocation of a lock even though it was still "
		    @"locked!";
}
@end

Modified src/exceptions/OFUnlockFailedException.m from [458dec92ae] to [f8ba9a8de1].

55
56
57
58
59
60
61
62

63
64
55
56
57
58
59
60
61

62
63
64







-
+


	[super dealloc];
}

- (OFString *)description
{
	return [OFString stringWithFormat:
	    @"A lock of type %@ could not be unlocked: %s",
	    _lock.class, strerror(_errNo)];
	    [_lock class], strerror(_errNo)];
}
@end