ObjFW  Check-in [e47c219327]

Overview
Comment:Disable -Wnullable-to-nonnull-conversion again

It does not work well enough yet: While creating a lot of noise, it
fails to even find many of the obvious cases. Depending on the static
analyzer seems to be the better approach for now.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e47c219327d2243def2806d34888f33a6f8aaf43870c0419fa735f693200a7a4
User & Date: js on 2017-10-01 14:05:29
Other Links: manifest | tags
Context
2017-10-01
18:09
OFTarArchive: Support for star numbers check-in: 6b6856298d user: js tags: trunk
14:05
Disable -Wnullable-to-nonnull-conversion again check-in: e47c219327 user: js tags: trunk
13:43
More nullability and style fixes check-in: 66c29a31f2 user: js tags: trunk
Changes

Modified configure.ac from [94abb5e481] to [8d9285e4df].

185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
185
186
187
188
189
190
191


192
193
194
195
196
197
198







-
-







	[OBJCFLAGS="$OBJCFLAGS -Wsemicolon-before-method-body"])
AX_CHECK_COMPILER_FLAGS([-Wobjc-missing-property-synthesis -Werror],
	[OBJCFLAGS="$OBJCFLAGS -Wobjc-missing-property-synthesis"])
AX_CHECK_COMPILER_FLAGS([-Watomic-properties -Werror], [
	OBJCFLAGS="$OBJCFLAGS -Watomic-properties"
	TESTS_OBJCFLAGS="$TESTS_OBJCFLAGS -Wno-atomic-properties"
])
AX_CHECK_COMPILER_FLAGS([-Wnullable-to-nonnull-conversion -Werror],
	[OBJCFLAGS="$OBJCFLAGS -Wnullable-to-nonnull-conversion"])

AC_MSG_CHECKING(whether Objective C compiler supports properties)
AC_TRY_COMPILE([
	#ifdef __has_attribute
	# if __has_attribute(objc_root_class)
	__attribute__((__objc_root_class__))
	# endif

Modified src/OFApplication.m from [031d2d2246] to [f12746971d].

95
96
97
98
99
100
101
102

103
104
105
106
107
108
109
110
95
96
97
98
99
100
101

102

103
104
105
106
107
108
109







-
+
-







	[delegate release];
}

#define SIGNAL_HANDLER(sig)					\
	static void						\
	handle##sig(int signal)					\
	{							\
		app->_##sig##Handler(				\
		app->_##sig##Handler(app->_delegate,		\
		    (id <OFApplicationDelegate>)app->_delegate,	\
		    @selector(applicationDidReceive##sig));	\
	}
SIGNAL_HANDLER(SIGINT)
#ifdef SIGHUP
SIGNAL_HANDLER(SIGHUP)
#endif
#ifdef SIGUSR1

Modified src/OFDate.m from [fde4276673] to [618922b043].

640
641
642
643
644
645
646
647
648


649
650
651
652
653
654
655
656
657
658
659


660
661
662
663
664
665
666
640
641
642
643
644
645
646


647
648
649
650
651
652
653
654
655
656
657


658
659
660
661
662
663
664
665
666







-
-
+
+









-
-
+
+







}

- (OFDate *)earlierDate: (OFDate *)otherDate
{
	if (otherDate == nil)
		return self;

	if ([self compare: (OFDate *)otherDate] == OF_ORDERED_DESCENDING)
		return (OFDate *)otherDate;
	if ([self compare: otherDate] == OF_ORDERED_DESCENDING)
		return otherDate;

	return self;
}

- (OFDate *)laterDate: (OFDate *)otherDate
{
	if (otherDate == nil)
		return self;

	if ([self compare: (OFDate *)otherDate] == OF_ORDERED_ASCENDING)
		return (OFDate *)otherDate;
	if ([self compare: otherDate] == OF_ORDERED_ASCENDING)
		return otherDate;

	return self;
}

- (of_time_interval_t)timeIntervalSince1970
{
	return _seconds;

Modified src/OFDictionary.m from [20c3611bfd] to [bd2dcff559].

466
467
468
469
470
471
472
473

474
475
476
477
478
479
480
466
467
468
469
470
471
472

473
474
475
476
477
478
479
480







-
+







#ifdef OF_HAVE_BLOCKS
- (void)enumerateKeysAndObjectsUsingBlock:
    (of_dictionary_enumeration_block_t)block
{
	bool stop = false;

	for (id key in self) {
		block(key, (id)[self objectForKey: key], &stop);
		block(key, [self objectForKey: key], &stop);

		if (stop)
			break;
	}
}

- (OFDictionary *)mappedDictionaryUsingBlock: (of_dictionary_map_block_t)block

Modified src/OFHMAC.m from [fa6e2e00eb] to [298535fc6e].

123
124
125
126
127
128
129
130

131
132

133
134
135
136

137
138
139
140
141
142
143
123
124
125
126
127
128
129

130
131

132
133
134
135

136
137
138
139
140
141
142
143







-
+

-
+



-
+








- (const unsigned char *)digest
{
	if (_outerHash == nil || _innerHash == nil)
		@throw [OFInvalidArgumentException exception];

	if (_calculated)
		return (const unsigned char *)[_outerHash digest];
		return [_outerHash digest];

	[_outerHash updateWithBuffer: (const unsigned char *)[_innerHash digest]
	[_outerHash updateWithBuffer: [_innerHash digest]
			      length: [_hashClass digestSize]];
	_calculated = true;

	return (const unsigned char *)[_outerHash digest];
	return [_outerHash digest];
}

- (size_t)digestSize
{
	return [_hashClass digestSize];
}

Modified src/OFHTTPClient.m from [f0ee0fc898] to [6841c42cc1].

93
94
95
96
97
98
99
100

101
102
103
104
105
106
107
93
94
95
96
97
98
99

100
101
102
103
104
105
106
107







-
+







		path = @"/";

	requestString = [OFMutableString stringWithFormat:
	    @"%s %@", of_http_request_method_to_string(method), path];

	if ([URL query] != nil) {
		[requestString appendString: @"?"];
		[requestString appendString: (OFString *)[URL query]];
		[requestString appendString: [URL query]];
	}

	[requestString appendString: @" HTTP/"];
	[requestString appendString: [request protocolVersionString]];
	[requestString appendString: @"\r\n"];

	headers = [[[request headers] mutableCopy] autorelease];

Modified src/OFHTTPCookie.m from [dc41fbd99f] to [13073ad757].

401
402
403
404
405
406
407
408
409
410



411
412
413
414
415
416
417
401
402
403
404
405
406
407



408
409
410
411
412
413
414
415
416
417







-
-
-
+
+
+







	OFMutableString *ret = [OFMutableString
	    stringWithFormat: @"%@=%@", _name, _value];
	void *pool = objc_autoreleasePoolPush();

	[ret appendFormat: @"; Domain=%@; Path=%@", _domain, _path];

	if (_expires != nil)
		[ret appendString: [(OFDate *)_expires
		    dateStringWithFormat: @"; Expires=%a, %d %b %Y "
					  @"%H:%M:%S +0000"]];
		[ret appendString:
		    [_expires dateStringWithFormat: @"; Expires=%a, %d %b %Y "
						    @"%H:%M:%S +0000"]];

	if (_secure)
		[ret appendString: @"; Secure"];

	if (_HTTPOnly)
		[ret appendString: @"; HTTPOnly"];

Modified src/OFHTTPServer.m from [f5a4b0ce8e] to [1e27dfeb94].

721
722
723
724
725
726
727
728

729
730
731
732
733
734
735
721
722
723
724
725
726
727

728
729
730
731
732
733
734
735







-
+







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

	if (_listeningSocket != nil)
		@throw [OFAlreadyConnectedException exception];

	_listeningSocket = [[OFTCPSocket alloc] init];
	_port = [_listeningSocket bindToHost: (OFString *)_host
	_port = [_listeningSocket bindToHost: _host
					port: _port];
	[_listeningSocket listen];

	[_listeningSocket asyncAcceptWithTarget: self
				       selector: @selector(of_socket:
						     didAcceptSocket:context:
						     exception:)

Modified src/OFIntrospection.m from [b331601cc7] to [cd2923612d].

146
147
148
149
150
151
152
153
154


155
156
157


158
159
160
161
162
163
164
146
147
148
149
150
151
152


153
154
155


156
157
158
159
160
161
162
163
164







-
-
+
+

-
-
+
+








	@try {
		_name = [[OFString alloc] initWithUTF8String: property->name];
		_attributes =
		    property->attributes | (property->extended_attributes << 8);

		if (property->getter.name != NULL)
			_getter = [[OFString alloc] initWithUTF8String:
			    (const char *)property->getter.name];
			_getter = [[OFString alloc]
			    initWithUTF8String: property->getter.name];
		if (property->setter.name != NULL)
			_setter = [[OFString alloc] initWithUTF8String:
			    (const char *)property->setter.name];
			_setter = [[OFString alloc]
			    initWithUTF8String: property->setter.name];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
387
388
389
390
391
392
393
394

395
396
397
398
399
400
401
387
388
389
390
391
392
393

394
395
396
397
398
399
400
401







-
+







	self = [super init];

	@try {
		const char *name = ivar_getName(ivar);

		if (name != NULL)
			_name = [[OFString alloc] initWithUTF8String:
			    (const char *)ivar_getName(ivar)];
			    ivar_getName(ivar)];
		_typeEncoding = ivar_getTypeEncoding(ivar);
		_offset = ivar_getOffset(ivar);
	} @catch (id e) {
		[self release];
		@throw e;
	}

Modified src/OFMutableString_UTF8.m from [fc29ab31f7] to [4a3385c744].

209
210
211
212
213
214
215
216
217
218



219
220
221
222
223
224
225
209
210
211
212
213
214
215



216
217
218
219
220
221
222
223
224
225







-
-
-
+
+
+







		@throw [OFInvalidEncodingException exception];

	_s->hashed = false;

	if (lenNew == (size_t)lenOld)
		memcpy(_s->cString + index, buffer, lenNew);
	else if (lenNew > (size_t)lenOld) {
		_s->cString = (void *)[self resizeMemory: _s->cString
						    size: _s->cStringLength -
							  lenOld + lenNew + 1];
		_s->cString = [self resizeMemory: _s->cString
					    size: _s->cStringLength -
						  lenOld + lenNew + 1];

		memmove(_s->cString + index + lenNew,
		    _s->cString + index + lenOld,
		    _s->cStringLength - index - lenOld);
		memcpy(_s->cString + index, buffer, lenNew);

		_s->cStringLength -= lenOld;
238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
238
239
240
241
242
243
244

245
246
247
248
249
250
251
252







-
+







		_s->cStringLength += lenNew;
		_s->cString[_s->cStringLength] = '\0';

		if (character >= 0x80)
			_s->isUTF8 = true;

		@try {
			_s->cString = (void *)[self
			_s->cString = [self
			    resizeMemory: _s->cString
				    size: _s->cStringLength + 1];
		} @catch (OFOutOfMemoryException *e) {
			/* We don't really care, as we only made it smaller */
		}
	}
}
267
268
269
270
271
272
273
274
275
276



277
278
279
280
281
282
283
267
268
269
270
271
272
273



274
275
276
277
278
279
280
281
282
283







-
-
-
+
+
+







		_s->isUTF8 = true;
		break;
	case -1:
		@throw [OFInvalidEncodingException exception];
	}

	_s->hashed = false;
	_s->cString = (void *)[self resizeMemory: _s->cString
					    size: _s->cStringLength +
						  UTF8StringLength + 1];
	_s->cString = [self resizeMemory: _s->cString
				    size: _s->cStringLength +
					  UTF8StringLength + 1];
	memcpy(_s->cString + _s->cStringLength, UTF8String,
	    UTF8StringLength + 1);

	_s->cStringLength += UTF8StringLength;
	_s->length += length;
}

297
298
299
300
301
302
303
304
305
306



307
308
309
310
311
312
313
297
298
299
300
301
302
303



304
305
306
307
308
309
310
311
312
313







-
-
-
+
+
+







		_s->isUTF8 = true;
		break;
	case -1:
		@throw [OFInvalidEncodingException exception];
	}

	_s->hashed = false;
	_s->cString = (void *)[self resizeMemory: _s->cString
					    size: _s->cStringLength +
						  UTF8StringLength + 1];
	_s->cString = [self resizeMemory: _s->cString
				    size: _s->cStringLength +
					  UTF8StringLength + 1];
	memcpy(_s->cString + _s->cStringLength, UTF8String, UTF8StringLength);

	_s->cStringLength += UTF8StringLength;
	_s->length += length;

	_s->cString[_s->cStringLength] = 0;
}
345
346
347
348
349
350
351
352
353
354



355
356
357
358
359
360
361
345
346
347
348
349
350
351



352
353
354
355
356
357
358
359
360
361







-
-
-
+
+
+








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

	UTF8StringLength = [string UTF8StringLength];

	_s->hashed = false;
	_s->cString = (void *)[self resizeMemory: _s->cString
					    size: _s->cStringLength +
						  UTF8StringLength + 1];
	_s->cString = [self resizeMemory: _s->cString
				    size: _s->cStringLength +
					  UTF8StringLength + 1];
	memcpy(_s->cString + _s->cStringLength, [string UTF8String],
	    UTF8StringLength);

	_s->cStringLength += UTF8StringLength;
	_s->length += [string length];

	_s->cString[_s->cStringLength] = 0;
390
391
392
393
394
395
396
397
398
399


400
401
402
403
404
405
406
390
391
392
393
394
395
396



397
398
399
400
401
402
403
404
405







-
-
-
+
+








			j += len;
		}

		tmp[j] = '\0';

		_s->hashed = false;
		_s->cString = (void *)[self
		    resizeMemory: _s->cString
			    size: _s->cStringLength + j + 1];
		_s->cString = [self resizeMemory: _s->cString
					    size: _s->cStringLength + j + 1];
		memcpy(_s->cString + _s->cStringLength, tmp, j + 1);

		_s->cStringLength += j;
		_s->length += length;

		if (isUTF8)
			_s->isUTF8 = true;
520
521
522
523
524
525
526
527
528


529
530
531
532
533
534
535
519
520
521
522
523
524
525


526
527
528
529
530
531
532
533
534







-
-
+
+








	if (_s->isUTF8)
		index = of_string_utf8_get_position(_s->cString, index,
		    _s->cStringLength);

	newCStringLength = _s->cStringLength + [string UTF8StringLength];
	_s->hashed = false;
	_s->cString = (void *)[self resizeMemory: _s->cString
					    size: newCStringLength + 1];
	_s->cString = [self resizeMemory: _s->cString
				    size: newCStringLength + 1];

	memmove(_s->cString + index + [string UTF8StringLength],
	    _s->cString + index, _s->cStringLength - index);
	memcpy(_s->cString + index, [string UTF8String],
	    [string UTF8StringLength]);
	_s->cString[newCStringLength] = '\0';

563
564
565
566
567
568
569
570
571
572


573
574
575
576
577
578
579
562
563
564
565
566
567
568



569
570
571
572
573
574
575
576
577







-
-
-
+
+







	    _s->cStringLength - end);
	_s->hashed = false;
	_s->length -= range.length;
	_s->cStringLength -= end - start;
	_s->cString[_s->cStringLength] = 0;

	@try {
		_s->cString = (void *)[self
		    resizeMemory: _s->cString
			    size: _s->cStringLength + 1];
		_s->cString = [self resizeMemory: _s->cString
					    size: _s->cStringLength + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
	}
}

- (void)replaceCharactersInRange: (of_range_t)range
		      withString: (OFString *)replacement
606
607
608
609
610
611
612
613
614


615
616
617
618
619
620
621
622
623
624
625
626
627
628


629
630
631
632
633
634
635
604
605
606
607
608
609
610


611
612
613
614
615
616
617
618
619
620
621
622
623
624


625
626
627
628
629
630
631
632
633







-
-
+
+












-
-
+
+







	 * memmove() the rest of the string to the end.
	 *
	 * We must not resize the string if the new string is smaller, because
	 * then we can't memmove() the rest of the string forward as the rest is
	 * lost due to the resize!
	 */
	if (newCStringLength > _s->cStringLength)
		_s->cString = (void *)[self resizeMemory: _s->cString
						    size: newCStringLength + 1];
		_s->cString = [self resizeMemory: _s->cString
					    size: newCStringLength + 1];

	memmove(_s->cString + start + [replacement UTF8StringLength],
	    _s->cString + end, _s->cStringLength - end);
	memcpy(_s->cString + start, [replacement UTF8String],
	    [replacement UTF8StringLength]);
	_s->cString[newCStringLength] = '\0';

	/*
	 * If the new string is smaller, we can safely resize it now as we're
	 * done with memmove().
	 */
	if (newCStringLength < _s->cStringLength)
		_s->cString = (void *)[self resizeMemory: _s->cString
						    size: newCStringLength + 1];
		_s->cString = [self resizeMemory: _s->cString
					    size: newCStringLength + 1];

	_s->cStringLength = newCStringLength;
	_s->length = newLength;

	if ([replacement isKindOfClass: [OFString_UTF8 class]] ||
	    [replacement isKindOfClass: [OFMutableString_UTF8 class]]) {
		if (((OFString_UTF8 *)replacement)->_s->isUTF8)
737
738
739
740
741
742
743
744
745
746


747
748
749
750
751
752
753
735
736
737
738
739
740
741



742
743
744
745
746
747
748
749
750







-
-
-
+
+







	_s->cStringLength -= i;
	_s->length -= i;

	memmove(_s->cString, _s->cString + i, _s->cStringLength);
	_s->cString[_s->cStringLength] = '\0';

	@try {
		_s->cString = (void *)[self
		    resizeMemory: _s->cString
			    size: _s->cStringLength + 1];
		_s->cString = [self resizeMemory: _s->cString
					    size: _s->cStringLength + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
	}
}

- (void)deleteTrailingWhitespaces
{
765
766
767
768
769
770
771
772
773
774


775
776
777
778
779
780
781
762
763
764
765
766
767
768



769
770
771
772
773
774
775
776
777







-
-
-
+
+







		d++;
	}

	_s->cStringLength -= d;
	_s->length -= d;

	@try {
		_s->cString = (void *)[self
		    resizeMemory: _s->cString
			    size: _s->cStringLength + 1];
		_s->cString = [self resizeMemory: _s->cString
					    size: _s->cStringLength + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
	}
}

- (void)deleteEnclosingWhitespaces
{
803
804
805
806
807
808
809
810
811
812


813
814
815
816
817
818
819
820
821
822
799
800
801
802
803
804
805



806
807
808
809
810
811
812
813
814
815
816
817







-
-
-
+
+










	_s->cStringLength -= i;
	_s->length -= i;

	memmove(_s->cString, _s->cString + i, _s->cStringLength);
	_s->cString[_s->cStringLength] = '\0';

	@try {
		_s->cString = (void *)[self
		    resizeMemory: _s->cString
			    size: _s->cStringLength + 1];
		_s->cString = [self resizeMemory: _s->cString
					    size: _s->cStringLength + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
	}
}

- (void)makeImmutable
{
	object_setClass(self, [OFString_UTF8 class]);
}
@end

Modified src/OFObject.m from [b2d94e1a72] to [d94672b28e].

293
294
295
296
297
298
299
300

301
302

303
304
305
306
307
308
309
293
294
295
296
297
298
299

300


301
302
303
304
305
306
307
308







-
+
-
-
+







+ (Class)class
{
	return self;
}

+ (OFString *)className
{
	return [OFString
	return [OFString stringWithCString: class_getName(self)
	    stringWithCString: (const char *)class_getName(self)
		     encoding: OF_STRING_ENCODING_ASCII];
				  encoding: OF_STRING_ENCODING_ASCII];
}

+ (bool)isSubclassOfClass: (Class)class
{
	for (Class iter = self; iter != Nil; iter = class_getSuperclass(iter))
		if (iter == class)
			return true;
356
357
358
359
360
361
362
363
364


365
366
367
368
369
370
371
372
373
374
375
376

377
378
379
380
381
382
383
355
356
357
358
359
360
361


362
363

364
365
366
367
368
369
370
371
372
373

374
375
376
377
378
379
380
381







-
-
+
+
-










-
+







      withMethodFromClass: (Class)class
{
	IMP method = [class methodForSelector: selector];

	if (method == NULL)
		@throw [OFInvalidArgumentException exception];

	return class_replaceMethod((Class)object_getClass(self), selector,
	    (IMP)method, typeEncodingForSelector(object_getClass(class),
	return class_replaceMethod(object_getClass(self), selector, method,
	    typeEncodingForSelector(object_getClass(class), selector));
	    selector));
}

+ (IMP)replaceInstanceMethod: (SEL)selector
	 withMethodFromClass: (Class)class
{
	IMP method = [class instanceMethodForSelector: selector];

	if (method == NULL)
		@throw [OFInvalidArgumentException exception];

	return class_replaceMethod(self, selector, (IMP)method,
	return class_replaceMethod(self, selector, method,
	    typeEncodingForSelector(class, selector));
}

+ (void)inheritMethodsFromClass: (Class)class
{
	Class superclass = [self superclass];

482
483
484
485
486
487
488
489

490
491
492
493
494
495
496
497
498
499

500
501

502
503
504
505
506
507
508
480
481
482
483
484
485
486

487
488
489
490
491
492
493
494
495
496

497


498
499
500
501
502
503
504
505







-
+









-
+
-
-
+







- init
{
	return self;
}

- (Class)class
{
	return (Class)object_getClass(self);
	return object_getClass(self);
}

- (Class)superclass
{
	return class_getSuperclass(object_getClass(self));
}

- (OFString *)className
{
	return [OFString
	return [OFString stringWithCString: object_getClassName(self)
	    stringWithCString: (const char *)object_getClassName(self)
		     encoding: OF_STRING_ENCODING_ASCII];
				  encoding: OF_STRING_ENCODING_ASCII];
}

- (bool)isKindOfClass: (Class)class
{
	for (Class iter = object_getClass(self); iter != Nil;
	    iter = class_getSuperclass(iter))
		if (iter == class)

Modified src/OFOptionsParser.m from [77a19bfe68] to [f1e270d342].

103
104
105
106
107
108
109
110

111
112
113
114
115
116
117
118
119

120
121
122
123
124
125
126
103
104
105
106
107
108
109

110

111
112
113
114
115
116


117
118
119
120
121
122
123
124







-
+
-






-
-
+








			if (iter->longOption != nil) {
				@try {
					iter2->longOption =
					    [iter->longOption copy];

					if ([_longOptions objectForKey:
					    (OFString *)iter2->longOption] !=
					    iter2->longOption] != NULL)
					    NULL)
						@throw
						    [OFInvalidArgumentException
						    exception];

					[_longOptions
					    setObject: iter2
					       forKey: (OFString *)
							   iter2->longOption];
					       forKey: iter2->longOption];
				} @catch (id e) {
					/*
					 * Make sure we are in a consistent
					 * state where dealloc works.
					 */
					[iter2->longOption release];

207
208
209
210
211
212
213
214

215
216
217
218
219
220
221
222
205
206
207
208
209
210
211

212

213
214
215
216
217
218
219







-
+
-







				pos = [argument length];

			_lastLongOption = [[argument substringWithRange:
			    of_range(2, pos - 2)] copy];

			objc_autoreleasePoolPop(pool);

			option = [_longOptions objectForKey:
			option = [_longOptions objectForKey: _lastLongOption];
			    (OFString *)_lastLongOption];
			if (option == NULL)
				return '?';

			if (option->hasArgument == 1 && _argument == nil)
				return ':';
			if (option->hasArgument == 0 && _argument != nil)
				return '=';

Modified src/OFSet.h from [968a9faa33] to [28701b2ea5].

202
203
204
205
206
207
208
209

210
211
212
213
214
215
216
202
203
204
205
206
207
208

209
210
211
212
213
214
215
216







-
+







- (OFArray OF_GENERIC(ObjectType) *)allObjects;

/*!
 * @brief Returns an arbitrary object in the set.
 *
 * @return An arbitrary object in the set
 */
- (ObjectType)anyObject;
- (nullable ObjectType)anyObject;

/*!
 * @brief Checks whether the set contains an object equal to the specified
 *	  object.
 *
 * @param object The object which is checked for being in the set
 * @return A boolean whether the set contains the specified object

Modified src/OFStream.m from [9e8fe0a5ac] to [815f2dd728].

657
658
659
660
661
662
663
664

665
666
667


668
669
670
671
672
673
674
657
658
659
660
661
662
663

664



665
666
667
668
669
670
671
672
673







-
+
-
-
-
+
+







			if OF_UNLIKELY (_readBuffer[i] == '\n' ||
			    _readBuffer[i] == '\0') {
				retLength = i;

				if (i > 0 && _readBuffer[i - 1] == '\r')
					retLength--;

				ret = [OFString
				ret = [OFString stringWithCString: _readBuffer
				    stringWithCString: (char *)_readBuffer
					     encoding: encoding
					       length: retLength];
							 encoding: encoding
							   length: retLength];

				_readBuffer += i + 1;
				_readBufferLength -= i + 1;

				_waitingForDelimiter = false;
				return ret;
			}
687
688
689
690
691
692
693
694

695
696
697
698
699
700
701
686
687
688
689
690
691
692

693
694
695
696
697
698
699
700







-
+







			}

			retLength = _readBufferLength;

			if (retLength > 0 && _readBuffer[retLength - 1] == '\r')
				retLength--;

			ret = [OFString stringWithCString: (char *)_readBuffer
			ret = [OFString stringWithCString: _readBuffer
						 encoding: encoding
						   length: retLength];

			[self freeMemory: _readBufferMemory];
			_readBuffer = _readBufferMemory = NULL;
			_readBufferLength = 0;

882
883
884
885
886
887
888
889

890
891
892
893
894
895
896
881
882
883
884
885
886
887

888
889
890
891
892
893
894
895







-
+







				j = 0;

			if (j == delimiterLength || _readBuffer[i] == '\0') {
				if (_readBuffer[i] == '\0')
					delimiterLength = 1;

				ret = [OFString
				    stringWithCString: (char *)_readBuffer
				    stringWithCString: _readBuffer
					     encoding: encoding
					      length: i + 1 - delimiterLength];

				_readBuffer += i + 1;
				_readBufferLength -= i + 1;

				_waitingForDelimiter = false;
906
907
908
909
910
911
912
913

914
915
916
917
918
919
920
905
906
907
908
909
910
911

912
913
914
915
916
917
918
919







-
+







	@try {
		if ([self lowlevelIsAtEndOfStream]) {
			if (_readBuffer == NULL) {
				_waitingForDelimiter = false;
				return nil;
			}

			ret = [OFString stringWithCString: (char *)_readBuffer
			ret = [OFString stringWithCString: _readBuffer
						 encoding: encoding
						   length: _readBufferLength];

			[self freeMemory: _readBufferMemory];
			_readBuffer = _readBufferMemory = NULL;
			_readBufferLength = 0;

1036
1037
1038
1039
1040
1041
1042
1043

1044
1045
1046
1047
1048
1049
1050
1035
1036
1037
1038
1039
1040
1041

1042
1043
1044
1045
1046
1047
1048
1049







-
+







}

- (void)flushWriteBuffer
{
	if (_writeBuffer == NULL)
		return;

	[self lowlevelWriteBuffer: (char *)_writeBuffer
	[self lowlevelWriteBuffer: _writeBuffer
			   length: _writeBufferLength];

	[self freeMemory: _writeBuffer];
	_writeBuffer = NULL;
	_writeBufferLength = 0;
}

Modified src/OFString_UTF8.m from [c4bb148231] to [62af83b584].

175
176
177
178
179
180
181
182

183
184
185
186
187
188
189
175
176
177
178
179
180
181

182
183
184
185
186
187
188
189







-
+







- init
{
	self = [super init];

	@try {
		_s = &_storage;

		_s->cString = (void *)[self allocMemoryWithSize: 1];
		_s->cString = [self allocMemoryWithSize: 1];
		_s->cString[0] = '\0';
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
241
242
243
244
245
246
247
248
249

250
251
252
253
254
255
256
241
242
243
244
245
246
247


248
249
250
251
252
253
254
255







-
-
+







		    memcmp(cString, "\xEF\xBB\xBF", 3) == 0) {
			cString += 3;
			cStringLength -= 3;
		}

		_s = &_storage;

		_s->cString = (void *)[self
		    allocMemoryWithSize: cStringLength + 1];
		_s->cString = [self allocMemoryWithSize: cStringLength + 1];
		_s->cStringLength = cStringLength;

		if (encoding == OF_STRING_ENCODING_UTF_8 ||
		    encoding == OF_STRING_ENCODING_ASCII) {
			switch (of_string_utf8_check(cString, cStringLength,
			    &_s->length)) {
			case 1:
289
290
291
292
293
294
295
296

297
298
299
300
301
302
303
288
289
290
291
292
293
294

295
296
297
298
299
300
301
302







-
+







				    (uint8_t)cString[i], buffer);

				if (bytes == 0)
					@throw [OFInvalidEncodingException
					    exception];

				_s->cStringLength += bytes - 1;
				_s->cString = (void *)[self
				_s->cString = [self
				    resizeMemory: _s->cString
					    size: _s->cStringLength + 1];

				memcpy(_s->cString + j, buffer, bytes);
				j += bytes;
			}

370
371
372
373
374
375
376
377

378
379
380
381
382
383
384
369
370
371
372
373
374
375

376
377
378
379
380
381
382
383







-
+







			_s->isUTF8 = true;
			byteLength = of_string_utf8_encode(unichar, buffer);

			if (byteLength == 0)
				@throw [OFInvalidEncodingException exception];

			_s->cStringLength += byteLength - 1;
			_s->cString = (void *)[self
			_s->cString = [self
			    resizeMemory: _s->cString
				    size: _s->cStringLength + 1];

			memcpy(_s->cString + j, buffer, byteLength);
			j += byteLength;
		}

442
443
444
445
446
447
448
449
450

451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471

472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493


494
495
496
497
498
499
500
441
442
443
444
445
446
447


448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467


468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488


489
490
491
492
493
494
495
496
497







-
-
+



















-
-
+




















-
-
+
+







		    [string isKindOfClass: [OFMutableString_UTF8 class]])
			_s->isUTF8 = ((OFString_UTF8 *)string)->_s->isUTF8;
		else
			_s->isUTF8 = true;

		_s->length = [string length];

		_s->cString = (void *)[self
		    allocMemoryWithSize: _s->cStringLength + 1];
		_s->cString = [self allocMemoryWithSize: _s->cStringLength + 1];
		memcpy(_s->cString, [string UTF8String], _s->cStringLength + 1);
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- initWithCharacters: (const of_unichar_t *)characters
	      length: (size_t)length
{
	self = [super init];

	@try {
		size_t j;

		_s = &_storage;

		_s->cString = (void *)[self
		    allocMemoryWithSize: (length * 4) + 1];
		_s->cString = [self allocMemoryWithSize: (length * 4) + 1];
		_s->length = length;

		j = 0;
		for (size_t i = 0; i < length; i++) {
			size_t len = of_string_utf8_encode(characters[i],
			    _s->cString + j);

			if (len == 0)
				@throw [OFInvalidEncodingException exception];

			if (len > 1)
				_s->isUTF8 = true;

			j += len;
		}

		_s->cString[j] = '\0';
		_s->cStringLength = j;

		@try {
			_s->cString = (void *)[self resizeMemory: _s->cString
							    size: j + 1];
			_s->cString = [self resizeMemory: _s->cString
						    size: j + 1];
		} @catch (OFOutOfMemoryException *e) {
			/* We don't care, as we only tried to make it smaller */
		}
	} @catch (id e) {
		[self release];
		@throw e;
	}
520
521
522
523
524
525
526
527
528

529
530
531
532
533
534
535
517
518
519
520
521
522
523


524
525
526
527
528
529
530
531







-
-
+







			string++;
			length--;
		} else if (byteOrder != OF_BYTE_ORDER_NATIVE)
			swap = true;

		_s = &_storage;

		_s->cString = (void *)[self
		    allocMemoryWithSize: (length * 4) + 1];
		_s->cString = [self allocMemoryWithSize: (length * 4) + 1];
		_s->length = length;

		j = 0;
		for (size_t i = 0; i < length; i++) {
			of_unichar_t character =
			    (swap ? OF_BSWAP16(string[i]) : string[i]);
			size_t len;
571
572
573
574
575
576
577
578
579


580
581
582
583
584
585
586
567
568
569
570
571
572
573


574
575
576
577
578
579
580
581
582







-
-
+
+







			j += len;
		}

		_s->cString[j] = '\0';
		_s->cStringLength = j;

		@try {
			_s->cString = (void *)[self resizeMemory: _s->cString
							    size: j + 1];
			_s->cString = [self resizeMemory: _s->cString
						    size: j + 1];
		} @catch (OFOutOfMemoryException *e) {
			/* We don't care, as we only tried to make it smaller */
		}
	} @catch (id e) {
		[self release];
		@throw e;
	}
606
607
608
609
610
611
612
613
614

615
616
617
618
619
620
621
602
603
604
605
606
607
608


609
610
611
612
613
614
615
616







-
-
+







			characters++;
			length--;
		} else if (byteOrder != OF_BYTE_ORDER_NATIVE)
			swap = true;

		_s = &_storage;

		_s->cString = (void *)[self
		    allocMemoryWithSize: (length * 4) + 1];
		_s->cString = [self allocMemoryWithSize: (length * 4) + 1];
		_s->length = length;

		j = 0;
		for (size_t i = 0; i < length; i++) {
			char buffer[4];
			size_t len = of_string_utf8_encode(
			    (swap ? OF_BSWAP32(characters[i]) : characters[i]),
639
640
641
642
643
644
645
646
647


648
649
650
651
652
653
654
634
635
636
637
638
639
640


641
642
643
644
645
646
647
648
649







-
-
+
+







			}
		}

		_s->cString[j] = '\0';
		_s->cStringLength = j;

		@try {
			_s->cString = (void *)[self resizeMemory: _s->cString
							    size: j + 1];
			_s->cString = [self resizeMemory: _s->cString
						    size: j + 1];
		} @catch (OFOutOfMemoryException *e) {
			/* We don't care, as we only tried to make it smaller */
		}
	} @catch (id e) {
		[self release];
		@throw e;
	}
682
683
684
685
686
687
688
689

690
691
692
693
694
695
696
677
678
679
680
681
682
683

684
685
686
687
688
689
690
691







-
+







			case 1:
				_s->isUTF8 = true;
				break;
			case -1:
				@throw [OFInvalidEncodingException exception];
			}

			_s->cString = (void *)[self
			_s->cString = [self
			    allocMemoryWithSize: cStringLength + 1];
			memcpy(_s->cString, tmp, cStringLength + 1);
		} @finally {
			free(tmp);
		}
	} @catch (id e) {
		[self release];

Modified src/OFTCPSocket.m from [736afef818] to [bfcab86676].

261
262
263
264
265
266
267
268

269
270
271
272
273
274
275
261
262
263
264
265
266
267

268
269
270
271
272
273
274
275







-
+







	int errNo = 0;

	if (_socket != INVALID_SOCKET)
		@throw [OFAlreadyConnectedException exceptionWithSocket: self];

	if (_SOCKS5Host != nil) {
		/* Connect to the SOCKS5 proxy instead */
		host = (OFString *)_SOCKS5Host;
		host = _SOCKS5Host;
		port = _SOCKS5Port;
	}

	results = of_resolve_host(host, port, SOCK_STREAM);

	for (iter = results; *iter != NULL; iter++) {
		of_resolver_result_t *result = *iter;
603
604
605
606
607
608
609
610

611
612
613
614
615
616
617
618
603
604
605
606
607
608
609

610

611
612
613
614
615
616
617







-
+
-








	if (_socket == INVALID_SOCKET)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_address == NULL)
		@throw [OFInvalidArgumentException exception];

	of_address_to_string_and_port((struct sockaddr *)_address,
	of_address_to_string_and_port(_address, _addressLength, &ret, NULL);
	    _addressLength, &ret, NULL);

	return ret;
}

- (bool)isListening
{
	return _listening;

Modified src/OFTarArchive.m from [0808282283] to [5865d323f0].

207
208
209
210
211
212
213
214

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

214
215
216
217
218
219
220
221







-
+







{
	if (_mode != OF_TAR_ARCHIVE_MODE_READ)
		@throw [OFInvalidArgumentException exception];

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

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

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

	if (_mode != OF_TAR_ARCHIVE_MODE_WRITE &&
232
233
234
235
236
237
238
239

240
241
242
243
244
245
246
232
233
234
235
236
237
238

239
240
241
242
243
244
245
246







-
+








	_lastReturnedStream = [[OFTarArchive_FileWriteStream alloc]
	    initWithStream: _stream
		     entry: entry];

	objc_autoreleasePoolPop(pool);

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

- (void)close
{
	if (_stream == nil)
		return;

Modified src/OFThread.m from [488341d5ad] to [c1e478224c].

383
384
385
386
387
388
389
390

391
392
393
394
395
396
397
383
384
385
386
387
388
389

390
391
392
393
394
395
396
397







-
+







# else
	@synchronized (self) {
		if (_runLoop == nil)
			_runLoop = [[OFRunLoop alloc] init];
	}
# endif

	return (OFRunLoop *)_runLoop;
	return _runLoop;
}

- (OFString *)name
{
	return [[_name copy] autorelease];
}

Modified src/OFXMLAttribute.m from [292617ba84] to [464c2003f8].

161
162
163
164
165
166
167
168

169
170
171
172
173
174
175
161
162
163
164
165
166
167

168
169
170
171
172
173
174
175







-
+







				      namespace: OF_SERIALIZATION_NS];

	[element addAttributeWithName: @"name"
			  stringValue: _name];

	if (_namespace != nil)
		[element addAttributeWithName: @"namespace"
				  stringValue: (OFString *)_namespace];
				  stringValue: _namespace];

	[element addAttributeWithName: @"stringValue"
			  stringValue: _stringValue];

	[element retain];

	objc_autoreleasePoolPop(pool);

Modified src/OFXMLElement.m from [8c36bd33b3] to [28440d417d].

172
173
174
175
176
177
178
179

180
181
182
183
184
185
186
172
173
174
175
176
177
178

179
180
181
182
183
184
185
186







-
+








		_namespaces = [[OFMutableDictionary alloc]
		    initWithKeysAndObjects:
		    @"http://www.w3.org/XML/1998/namespace", @"xml",
		    @"http://www.w3.org/2000/xmlns/", @"xmlns", nil];

		if (stringValue != nil)
			[self setStringValue: (OFString *)stringValue];
			[self setStringValue: stringValue];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
434
435
436
437
438
439
440
441

442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462

463
464
465
466
467
468
469
434
435
436
437
438
439
440

441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461

462
463
464
465
466
467
468
469







-
+




















-
+







	OFString *ret;
	OFString *defaultNS;

	pool = objc_autoreleasePoolPush();

	parentPrefix = [allNamespaces objectForKey:
	    (parent != nil && parent->_namespace != nil
	    ? (OFString *)parent->_namespace : (OFString *)@"")];
	    ? parent->_namespace : (OFString *)@"")];

	/* Add the namespaces of the current element */
	if (allNamespaces != nil) {
		OFEnumerator *keyEnumerator = [_namespaces keyEnumerator];
		OFEnumerator *objectEnumerator = [_namespaces objectEnumerator];
		OFMutableDictionary *tmp;
		id key, object;

		tmp = [[allNamespaces mutableCopy] autorelease];

		while ((key = [keyEnumerator nextObject]) != nil &&
		    (object = [objectEnumerator nextObject]) != nil)
			[tmp setObject: object
				forKey: key];

		allNamespaces = tmp;
	} else
		allNamespaces = _namespaces;

	prefix = [allNamespaces objectForKey:
	    (_namespace != nil ? (OFString *)_namespace : (OFString *)@"")];
	    (_namespace != nil ? _namespace : (OFString *)@"")];

	if (parent != nil && parent->_namespace != nil && parentPrefix == nil)
		defaultNS = parent->_namespace;
	else if (parent != nil && parent->_defaultNamespace != nil)
		defaultNS = parent->_defaultNamespace;
	else
		defaultNS = _defaultNamespace;
523
524
525
526
527
528
529
530

531
532

533
534
535
536
537
538
539
540
523
524
525
526
527
528
529

530
531

532

533
534
535
536
537
538
539







-
+

-
+
-







		void *pool2 = objc_autoreleasePoolPush();
		OFString *attributeName = [attribute name];
		OFString *attributePrefix = nil;
		OFString *tmp = [[attribute stringValue] stringByXMLEscaping];

		if ([attribute namespace] != nil &&
		    (attributePrefix = [allNamespaces objectForKey:
		    (OFString *)[attribute namespace]]) == nil)
		    [attribute namespace]]) == nil)
			@throw [OFUnboundNamespaceException
			    exceptionWithNamespace: (OFString *)
			    exceptionWithNamespace: [attribute namespace]
							[attribute namespace]
					   element: self];

		length += [attributeName UTF8StringLength] +
		    (attributePrefix != nil ?
		    [attributePrefix UTF8StringLength] + 1 : 0) +
		    [tmp UTF8StringLength] + 4;

700
701
702
703
704
705
706
707

708
709
710
711

712
713
714
715
716
717
718
719
720

721
722
723
724
725
726
727
699
700
701
702
703
704
705

706
707
708
709

710
711
712
713
714
715
716
717
718

719
720
721
722
723
724
725
726







-
+



-
+








-
+








	if (_name != nil)
		[element addAttributeWithName: @"name"
				  stringValue: _name];

	if (_namespace != nil)
		[element addAttributeWithName: @"namespace"
				  stringValue: (OFString *)_namespace];
				  stringValue: _namespace];

	if (_defaultNamespace != nil)
		[element addAttributeWithName: @"defaultNamespace"
				  stringValue: (OFString *)_defaultNamespace];
				  stringValue: _defaultNamespace];

	if (_attributes != nil) {
		OFXMLElement *attributesElement;

		attributesElement =
		    [OFXMLElement elementWithName: @"attributes"
					namespace: OF_SERIALIZATION_NS];
		[attributesElement addChild:
		    [(OFArray *)_attributes XMLElementBySerializing]];
		    [_attributes XMLElementBySerializing]];
		[element addChild: attributesElement];
	}

	if (_namespaces != nil) {
		OFXMLElement *namespacesElement;
		OFMutableDictionary *namespacesCopy =
		    [[_namespaces mutableCopy] autorelease];
743
744
745
746
747
748
749
750

751
752
753
754
755
756
757
758
742
743
744
745
746
747
748

749

750
751
752
753
754
755
756







-
+
-








	if (_children != nil) {
		OFXMLElement *childrenElement;

		childrenElement =
		    [OFXMLElement elementWithName: @"children"
					namespace: OF_SERIALIZATION_NS];
		[childrenElement addChild:
		[childrenElement addChild: [_children XMLElementBySerializing]];
		    [(OFArray *)_children XMLElementBySerializing]];
		[element addChild: childrenElement];
	}

	[element retain];

	objc_autoreleasePoolPop(pool);

Modified src/OFXMLElementBuilder.m from [112bbd4243] to [8f1f7d2342].

113
114
115
116
117
118
119
120
121

122
123
124
125
126
127
128
113
114
115
116
117
118
119


120
121
122
123
124
125
126
127







-
-
+







					namespace: namespace];
		else
			@throw [OFMalformedXMLException exception];

		return;
	case 1:
		[_delegate elementBuilder: self
			  didBuildElement: (OFXMLElement *)
					       [_stack firstObject]];
			  didBuildElement: [_stack firstObject]];
		break;
	}

	[_stack removeLastObject];
}

-    (void)parser: (OFXMLParser *)parser

Modified src/OFXMLParser.m from [8522ee412a] to [913f851c54].

543
544
545
546
547
548
549
550

551
552
553
554
555
556

557
558
559
560
561
562
563
564
565

566
567
568
569
570
571
572
543
544
545
546
547
548
549

550
551
552
553
554
555

556
557
558
559
560
561
562
563
564

565
566
567
568
569
570
571
572







-
+





-
+








-
+







	if (_data[_i] == '>' || _data[_i] == '/') {
		OFString *namespace;

		namespace = namespaceForPrefix(_prefix, _namespaces);

		if (_prefix != nil && namespace == nil)
			@throw [OFUnboundPrefixException
			    exceptionWithPrefix: (OFString *)_prefix
			    exceptionWithPrefix: _prefix
					 parser: self];

		if ([_delegate respondsToSelector: @selector(parser:
		    didStartElement:prefix:namespace:attributes:)])
			[_delegate parser: self
			  didStartElement: (OFString *)_name
			  didStartElement: _name
				   prefix: _prefix
				namespace: namespace
			       attributes: nil];

		if (_data[_i] == '/') {
			if ([_delegate respondsToSelector:
			    @selector(parser:didEndElement:prefix:namespace:)])
				[_delegate parser: self
				    didEndElement: (OFString *)_name
				    didEndElement: _name
					   prefix: _prefix
					namespace: namespace];

			if ([_previous count] == 0)
				_finishedParsing = true;
		} else
			[_previous addObject: bufferString];
630
631
632
633
634
635
636
637

638
639

640
641
642
643
644

645
646
647
648
649
650
651
630
631
632
633
634
635
636

637


638
639
640
641
642

643
644
645
646
647
648
649
650







-
+
-
-
+




-
+








	[_previous removeLastObject];

	[_buffer removeAllItems];

	namespace = namespaceForPrefix(_prefix, _namespaces);
	if (_prefix != nil && namespace == nil)
		@throw [OFUnboundPrefixException
		@throw [OFUnboundPrefixException exceptionWithPrefix: _prefix
		    exceptionWithPrefix: (OFString *)_prefix
				 parser: self];
							      parser: self];

	if ([_delegate respondsToSelector:
	    @selector(parser:didEndElement:prefix:namespace:)])
		[_delegate parser: self
		    didEndElement: (OFString *)_name
		    didEndElement: _name
			   prefix: _prefix
			namespace: namespace];

	objc_autoreleasePoolPop(pool);

	[_namespaces removeLastObject];
	[_name release];
682
683
684
685
686
687
688
689

690
691

692
693
694
695
696
697
698
699
700
701
702

703
704
705
706
707
708
709
710
711

712
713
714
715
716
717
718
719
720
721
722
723
724

725
726
727
728
729
730
731
681
682
683
684
685
686
687

688


689
690
691
692
693
694
695
696
697
698
699

700
701
702
703
704
705
706
707
708

709
710
711
712
713
714
715
716
717
718
719
720
721

722
723
724
725
726
727
728
729







-
+
-
-
+










-
+








-
+












-
+








	attributesObjects = [_attributes objects];
	attributesCount = [_attributes count];

	namespace = namespaceForPrefix(_prefix, _namespaces);

	if (_prefix != nil && namespace == nil)
		@throw [OFUnboundPrefixException
		@throw [OFUnboundPrefixException exceptionWithPrefix: _prefix
		    exceptionWithPrefix: (OFString *)_prefix
				 parser: self];
							      parser: self];

	for (size_t j = 0; j < attributesCount; j++)
		resolveAttributeNamespace(attributesObjects[j], _namespaces,
		    self);

	pool = objc_autoreleasePoolPush();

	if ([_delegate respondsToSelector:
	    @selector(parser:didStartElement:prefix:namespace:attributes:)])
		[_delegate parser: self
		  didStartElement: (OFString *)_name
		  didStartElement: _name
			   prefix: _prefix
			namespace: namespace
		       attributes: _attributes];

	if (_data[_i] == '/') {
		if ([_delegate respondsToSelector:
		    @selector(parser:didEndElement:prefix:namespace:)])
			[_delegate parser: self
			    didEndElement: (OFString *)_name
			    didEndElement: _name
				   prefix: _prefix
				namespace: namespace];

		if ([_previous count] == 0)
			_finishedParsing = true;

		[_namespaces removeLastObject];
	} else if (_prefix != nil) {
		OFString *str = [OFString stringWithFormat: @"%@:%@",
							    _prefix, _name];
		[_previous addObject: str];
	} else
		[_previous addObject: (OFString *)_name];
		[_previous addObject: _name];

	objc_autoreleasePoolPop(pool);

	[_name release];
	[_prefix release];
	[_attributes removeAllObjects];
	_name = _prefix = nil;
828
829
830
831
832
833
834
835

836
837

838
839
840

841
842
843
844
845
846
847
826
827
828
829
830
831
832

833


834
835
836

837
838
839
840
841
842
843
844







-
+
-
-
+


-
+







	pool = objc_autoreleasePoolPush();
	attributeValue = transformString(self, _buffer, 0, true);

	if (_attributePrefix == nil && [_attributeName isEqual: @"xmlns"])
		[[_namespaces lastObject] setObject: attributeValue
					     forKey: @""];
	if ([_attributePrefix isEqual: @"xmlns"])
		[[_namespaces lastObject]
		[[_namespaces lastObject] setObject: attributeValue
		    setObject: attributeValue
		       forKey: (OFString *)_attributeName];
					     forKey: _attributeName];

	[_attributes addObject:
	    [OFXMLAttribute attributeWithName: (OFString *)_attributeName
	    [OFXMLAttribute attributeWithName: _attributeName
				    namespace: _attributePrefix
				  stringValue: attributeValue]];

	objc_autoreleasePoolPop(pool);

	[_buffer removeAllItems];
	[_attributeName release];

Modified src/OFZIPArchive.m from [0736b3b069] to [700f57a4db].

463
464
465
466
467
468
469
470

471
472
473
474
475
476
477
463
464
465
466
467
468
469

470
471
472
473
474
475
476
477







-
+








	_lastReturnedStream = [[OFZIPArchive_FileReadStream alloc]
	     initWithStream: _stream
		      entry: entry];

	objc_autoreleasePoolPop(pool);

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

- (OFStream *)streamForWritingEntry: (OFZIPArchiveEntry *)entry_
{
	/* TODO: Avoid data descriptor when _stream is an OFSeekableStream */
	int64_t offsetAdd = 0;
	void *pool;
554
555
556
557
558
559
560
561

562
563
564
565
566
567
568
554
555
556
557
558
559
560

561
562
563
564
565
566
567
568







-
+








	_lastReturnedStream = [[OFZIPArchive_FileWriteStream alloc]
	     initWithStream: _stream
		      entry: entry];

	objc_autoreleasePoolPop(pool);

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

- (void)of_writeCentralDirectory
{
	void *pool = objc_autoreleasePoolPush();

	_centralDirectoryEntries = 0;
601
602
603
604
605
606
607
608

609
610
611
612
613
614
615
601
602
603
604
605
606
607

608
609
610
611
612
613
614
615







-
+







	[_stream writeLittleEndianInt16: 0xFFFF];	/* CD disk */
	[_stream writeLittleEndianInt16: 0xFFFF];	/* CD entries in disk */
	[_stream writeLittleEndianInt16: 0xFFFF];	/* CD entries */
	[_stream writeLittleEndianInt32: 0xFFFFFFFF];	/* CD size */
	[_stream writeLittleEndianInt32: 0xFFFFFFFF];	/* CD offset */
	[_stream writeLittleEndianInt16: [_archiveComment UTF8StringLength]];
	if (_archiveComment != nil)
		[_stream writeString: (OFString *)_archiveComment];
		[_stream writeString: _archiveComment];

	objc_autoreleasePoolPop(pool);
}

- (void)close
{
	if (_stream == nil)

Modified src/OFZIPArchiveEntry.m from [f6ad079c58] to [c8f541f60e].

461
462
463
464
465
466
467
468

469
470
471
472

473
474
475
476
477
478
479
461
462
463
464
465
466
467

468
469
470
471

472
473
474
475
476
477
478
479







-
+



-
+







	[stream writeLittleEndianInt64: _uncompressedSize];
	[stream writeLittleEndianInt64: _compressedSize];
	[stream writeLittleEndianInt64: _localFileHeaderOffset];
	[stream writeLittleEndianInt32: _startDiskNumber];
	size += (2 * 2) + (3 * 8) + 4;

	if (_extraField != nil)
		[stream writeData: (OFData *)_extraField];
		[stream writeData: _extraField];
	size += (uint64_t)[_extraField count];

	if (_fileComment != nil)
		[stream writeString: (OFString *)_fileComment];
		[stream writeString: _fileComment];
	size += (uint64_t)[_fileComment UTF8StringLength];

	objc_autoreleasePoolPop(pool);

	return size;
}
@end

Modified src/bridge/NSString+OFObject.m from [0a0d7245e4] to [02a295e9aa].

16
17
18
19
20
21
22
23

24
25
16
17
18
19
20
21
22

23
24
25







-
+



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

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

Modified src/instance.m from [ba0e2c91f2] to [163d513c31].

53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
53
54
55
56
57
58
59

60
61
62
63
64
65
66
67







-
+







objc_constructInstance(Class cls, void *bytes)
{
	id obj = (id)bytes;

	if (cls == Nil || bytes == NULL)
		return nil;

	object_setClass(obj, (Class)cls);
	object_setClass(obj, cls);

	if (!callConstructors(cls, obj))
		return nil;

	return obj;
}

Modified src/runtime/class.m from [671f7fc3c1] to [d9200138d3].

865
866
867
868
869
870
871
872

873
874
875
876
877
878
879
865
866
867
868
869
870
871

872
873
874
875
876
877
878
879







-
+







	rcls->info &= ~OBJC_CLASS_INFO_SETUP;
}

void
objc_unregister_class(Class cls)
{
	while (cls->subclass_list != NULL && cls->subclass_list[0] != Nil)
		objc_unregister_class((Class)cls->subclass_list[0]);
		objc_unregister_class(cls->subclass_list[0]);

	if (cls->info & OBJC_CLASS_INFO_LOADED)
		call_method(cls, "unload");

	objc_hashtable_delete(classes, cls->name);

	if (strcmp(class_getName(cls), "Protocol") != 0)

Modified src/runtime/protocol.m from [4d79da63d1] to [74d4f4e6fc].

63
64
65
66
67
68
69
70

71
72
73
74
75
76
77
63
64
65
66
67
68
69

70
71
72
73
74
75
76
77







-
+







	    pl != NULL; pl = pl->next)
		for (long i = 0; i < pl->count; i++)
			if (protocol_conformsToProtocol(pl->list[i], p))
				return true;

	objc_global_mutex_lock();

	if ((cats = objc_categories_for_class((Class)cls)) == NULL) {
	if ((cats = objc_categories_for_class(cls)) == NULL) {
		objc_global_mutex_unlock();
		return false;
	}

	for (long i = 0; cats[i] != NULL; i++) {
		for (struct objc_protocol_list *pl = cats[i]->protocols;
		    pl != NULL; pl = pl->next) {

Modified src/runtime/selector.m from [b4ebf0ad92] to [1deeb73a3c].

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
68
69
70
71
72
73
74

75
76
77
78
79
80
81
82
83
84
85
86

87
88
89

90
91
92
93
94
95
96







-












-
+


-







}

SEL
sel_registerName(const char *name)
{
	const struct objc_abi_selector *rsel;
	struct objc_abi_selector *sel;
	char *name_copy;

	objc_global_mutex_lock();

	if (selectors != NULL &&
	    (rsel = objc_hashtable_get(selectors, name)) != NULL) {
		objc_global_mutex_unlock();
		return (SEL)rsel;
	}

	if ((sel = malloc(sizeof(struct objc_abi_selector))) == NULL)
		OBJC_ERROR("Not enough memory to allocate selector!");

	if ((name_copy = of_strdup(name)) == NULL)
	if ((sel->name = of_strdup(name)) == NULL)
		OBJC_ERROR("Not enough memory to allocate selector!");

	sel->name = name_copy;
	sel->types = NULL;

	if ((free_list = realloc(free_list,
	    sizeof(void *) * (free_list_cnt + 2))) == NULL)
		OBJC_ERROR("Not enough memory to allocate selector!");

	free_list[free_list_cnt++] = sel;

Modified tests/ForwardingTests.m from [89ccb0a706] to [64bebc8dde].

69
70
71
72
73
74
75
76
77


78
79
80
81
82
83
84
69
70
71
72
73
74
75


76
77
78
79
80
81
82
83
84







-
-
+
+








@implementation ForwardingTest
+ (BOOL)resolveClassMethod: (SEL)selector
{
	forwardings++;

	if (sel_isEqual(selector, @selector(test))) {
		class_replaceMethod((Class)object_getClass(self),
		    @selector(test), (IMP)test, "v#:");
		class_replaceMethod(object_getClass(self), @selector(test),
		    (IMP)test, "v#:");
		return YES;
	}

	return NO;
}

+ (BOOL)resolveInstanceMethod: (SEL)selector

Modified tests/OFDictionaryTests.m from [513f38a1a5] to [76bc88ef2a].

234
235
236
237
238
239
240
241

242
243
244
245
246
247
248
234
235
236
237
238
239
240

241
242
243
244
245
246
247
248







-
+








	for (OFString *key in mutDict) {
		if (i > 1 || ![key isEqual: keys[i]]) {
			ok = false;
			break;
		}

		[mutDict setObject: (OFString *)[mutDict objectForKey: key]
		[mutDict setObject: [mutDict objectForKey: key]
			    forKey: key];
		i++;
	}

	TEST(@"Fast Enumeration", ok)

	ok = false;
275
276
277
278
279
280
281
282

283
284

285
286
287
288
289
290
291
275
276
277
278
279
280
281

282


283
284
285
286
287
288
289
290







-
+
-
-
+







		    ^ (id key, id obj, bool *stop) {
			if (i > 1 || ![key isEqual: keys[i]]) {
				ok = false;
				*stop = true;
				return;
			}

			[mutDict
			[mutDict setObject: [mutDict objectForKey: key]
			    setObject: (OFString *)[mutDict objectForKey: key]
			       forKey: key];
				    forKey: key];
			i++;
		}];

		TEST(@"Enumeration using blocks", ok)

		ok = false;
		@try {

Modified tests/OFInvocationTests.m from [852b660a9a] to [1bbbdf67b6].

251
252
253
254
255
256
257
258

259
260
261
262
263
264
265
266
251
252
253
254
255
256
257

258

259
260
261
262
263
264
265







-
+
-







}
#endif

- (void)invocationTests
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	SEL selector = @selector(invocationTestMethod1::::);
	OFMethodSignature *sig =
	OFMethodSignature *sig = [self methodSignatureForSelector: selector];
	    (OFMethodSignature *)[self methodSignatureForSelector: selector];
	OFInvocation *invocation;
	struct test_struct st, st2, *stp = &st, *stp2;
	unsigned const char c = 0xAA;
	unsigned char c2;
	const unsigned int i = 0x55555555;
	unsigned int i2;

310
311
312
313
314
315
316
317

318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335

336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356

357
358
359
360
361
362
363
309
310
311
312
313
314
315

316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333

334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354

355
356
357
358
359
360
361
362







-
+

















-
+




















-
+







							      atIndex: 5]) &&
	    memcmp(&st, &st2, sizeof(st)) == 0)

#ifdef OF_INVOCATION_CAN_INVOKE
	/* -[invoke] #1 */
	selector = @selector(invocationTestMethod2::::::::::::::::);
	invocation = [OFInvocation invocationWithMethodSignature:
	    (OFMethodSignature *)[self methodSignatureForSelector: selector]];
	    [self methodSignatureForSelector: selector]];

	[invocation setArgument: &self
			atIndex: 0];
	[invocation setArgument: &selector
			atIndex: 1];

	for (int i = 1; i <= 16; i++)
		[invocation setArgument: &i
				atIndex: i + 1];

	int intResult;
	TEST(@"-[invoke] #1", R([invocation invoke]) &&
	    R([invocation getReturnValue: &intResult]) && intResult == 8)

	/* -[invoke] #2 */
	selector = @selector(invocationTestMethod3::::::::::::::::);
	invocation = [OFInvocation invocationWithMethodSignature:
	    (OFMethodSignature *)[self methodSignatureForSelector: selector]];
	    [self methodSignatureForSelector: selector]];

	[invocation setArgument: &self
			atIndex: 0];
	[invocation setArgument: &selector
			atIndex: 1];

	for (int i = 1; i <= 16; i++) {
		double d = i;
		[invocation setArgument: &d
				atIndex: i + 1];
	}

	double doubleResult;
	TEST(@"-[invoke] #2", R([invocation invoke]) &&
	    R([invocation getReturnValue: &doubleResult]) &&
	    doubleResult == 8.5)

	/* -[invoke] #3 */
	selector = @selector(invocationTestMethod4::::::::::::::::);
	invocation = [OFInvocation invocationWithMethodSignature:
	    (OFMethodSignature *)[self methodSignatureForSelector: selector]];
	    [self methodSignatureForSelector: selector]];

	[invocation setArgument: &self
			atIndex: 0];
	[invocation setArgument: &selector
			atIndex: 1];

	for (int i = 1; i <= 16; i++) {
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
376
377
378
379
380
381
382

383
384
385
386
387
388
389







-







	    R([invocation getReturnValue: &floatResult]) && floatResult == 8.5)

	/* Only when encoding long doubles is supported */
	if (strcmp(@encode(double), @encode(long double)) != 0) {
		/* -[invoke] #4 */
		selector = @selector(invocationTestMethod5::::::::::::::::);
		invocation = [OFInvocation invocationWithMethodSignature:
		    (OFMethodSignature *)
		    [self methodSignatureForSelector: selector]];

		[invocation setArgument: &self
				atIndex: 0];
		[invocation setArgument: &selector
				atIndex: 1];

401
402
403
404
405
406
407
408

409
410
411
412
413
414
415
399
400
401
402
403
404
405

406
407
408
409
410
411
412
413







-
+







		    longDoubleResult == 8.5)
	}

# ifndef __STDC_NO_COMPLEX__
	/* -[invoke] #5 */
	selector = @selector(invocationTestMethod6::::::::::::::::);
	invocation = [OFInvocation invocationWithMethodSignature:
	    (OFMethodSignature *)[self methodSignatureForSelector: selector]];
	    [self methodSignatureForSelector: selector]];

	[invocation setArgument: &self
			atIndex: 0];
	[invocation setArgument: &selector
			atIndex: 1];

	for (int i = 1; i <= 16; i++) {
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
429
430
431
432
433
434
435

436
437
438
439
440
441
442







-








	/* Only when encoding complex long doubles is supported */
	if (strcmp(@encode(complex double),
	    @encode(complex long double)) != 0) {
		/* -[invoke] #6 */
		selector = @selector(invocationTestMethod7::::::::::::::::);
		invocation = [OFInvocation invocationWithMethodSignature:
		    (OFMethodSignature *)
		    [self methodSignatureForSelector: selector]];

		[invocation setArgument: &self
				atIndex: 0];
		[invocation setArgument: &selector
				atIndex: 1];

471
472
473
474
475
476
477
478

479
480
481
482
483
484
485
468
469
470
471
472
473
474

475
476
477
478
479
480
481
482







-
+







	}
# endif

# ifdef __SIZEOF_INT128__
	/* -[invoke] #7 */
	selector = @selector(invocationTestMethod8::::::::::::::::);
	invocation = [OFInvocation invocationWithMethodSignature:
	    (OFMethodSignature *)[self methodSignatureForSelector: selector]];
	    [self methodSignatureForSelector: selector]];

	[invocation setArgument: &self
			atIndex: 0];
	[invocation setArgument: &selector
			atIndex: 1];

	for (int i = 1; i <= 16; i++) {

Modified tests/OFListTests.m from [8387465471] to [3c7e2e133b].

56
57
58
59
60
61
62
63

64
65
66

67
68
69
70
71
72
73

74
75
76
77
78
79

80
81
82
83
84
85
86
56
57
58
59
60
61
62

63

64

65

66
67
68
69
70

71
72
73
74
75


76
77
78
79
80
81
82
83







-
+
-

-
+
-





-
+




-
-
+







	TEST(@"-[lastListObject]",
	    [[list lastListObject]->object isEqual: strings[2]])

	TEST(@"-[lastListObject]->previous",
	    [[list lastListObject]->previous->object isEqual: strings[1]])

	TEST(@"-[removeListObject:]",
	    R([list removeListObject:
	    R([list removeListObject: [list lastListObject]]) &&
	    (of_list_object_t *)[list lastListObject]]) &&
	    [[list lastListObject]->object isEqual: strings[1]] &&
	    R([list removeListObject:
	    R([list removeListObject: [list firstListObject]]) &&
	    (of_list_object_t *)[list firstListObject]]) &&
	    [[list firstListObject]->object isEqual:
	    [list lastListObject]->object])

	TEST(@"-[insertObject:beforeListObject:]",
	    [list insertObject: strings[0]
	      beforeListObject: (of_list_object_t *)[list lastListObject]] &&
	      beforeListObject: [list lastListObject]] &&
	    [[list lastListObject]->previous->object isEqual: strings[0]])

	TEST(@"-[insertObject:afterListObject:]",
	    [list insertObject: strings[2]
	       afterListObject: (of_list_object_t *)
				    [list firstListObject]->next] &&
	       afterListObject: [list firstListObject]->next] &&
	    [[list lastListObject]->object isEqual: strings[2]])

	TEST(@"-[count]", [list count] == 3)

	TEST(@"-[containsObject:]",
	    [list containsObject: strings[1]] &&
	    ![list containsObject: @"nonexistant"])
115
116
117
118
119
120
121
122

123
124
125
126
127
128
129
112
113
114
115
116
117
118

119
120
121
122
123
124
125
126







-
+








	if ([list count] != i)
		ok = false;

	TEST(@"OFEnumerator's -[nextObject]", ok);

	[enumerator reset];
	[list removeListObject: (of_list_object_t *)[list firstListObject]];
	[list removeListObject: [list firstListObject]];

	EXPECT_EXCEPTION(@"Detection of mutation during enumeration",
	    OFEnumerationMutationException, [enumerator nextObject])

	[list prependObject: strings[0]];

	loe = [list firstListObject];
144
145
146
147
148
149
150
151

152
153
154
155
156
157
158
159
160
161
162
141
142
143
144
145
146
147

148

149
150
151
152
153
154
155
156
157
158







-
+
-










	TEST(@"Fast Enumeration", ok)

	ok = false;
	@try {
		for (OFString *obj in list) {
			(void)obj;

			[list removeListObject:
			[list removeListObject: [list lastListObject]];
			    (of_list_object_t *)[list lastListObject]];
		}
	} @catch (OFEnumerationMutationException *e) {
		ok = true;
	}

	TEST(@"Detection of mutation during Fast Enumeration", ok)

	[pool drain];
}
@end