ObjFW  Check-in [d87df02e8b]

Overview
Comment:The if ((self = [super init])) construct isn't needed anymore.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d87df02e8be729152c23166716def65db645071e92c31647797b6ccb834056a8
User & Date: js on 2009-04-21 17:16:23
Other Links: manifest | tags
Context
2009-04-21
17:19
OFException should not override - class, rename it to - inClass. check-in: 770a3a4fe4 user: js tags: trunk
17:16
The if ((self = [super init])) construct isn't needed anymore. check-in: d87df02e8b user: js tags: trunk
16:47
Throw OFAllocFailedException instead of returning nil.
This exception is quite special, look at the documentation for details.
check-in: a1a5bfb3cd user: js tags: trunk
Changes

Modified src/OFArray.m from [3315367580] to [02c5a4d259].

32
33
34
35
36
37
38
39
40
41
42





43
44
45
46
47
48
49
50
32
33
34
35
36
37
38




39
40
41
42
43

44
45
46
47
48
49
50







-
-
-
-
+
+
+
+
+
-







+ bigArrayWithItemSize: (size_t)is
{
	return [[[OFBigArray alloc] initWithItemSize: is] autorelease];
}

- initWithItemSize: (size_t)is
{
	if ((self = [super init])) {
		data = NULL;
		itemsize = is;
		items = 0;
	self = [super init];

	data = NULL;
	itemsize = is;
	items = 0;
	}

	return self;
}

- (size_t)items
{
	return items;
179
180
181
182
183
184
185


186
187
188
189
190

191
192
193
194
195
196
197
179
180
181
182
183
184
185
186
187
188
189



190
191
192
193
194
195
196
197







+
+


-
-
-
+







	return hash;
}
@end

@implementation OFBigArray
- initWithItemSize: (size_t)is
{
	self = [super initWithItemSize: is];

	if (lastpagebyte == 0)
		lastpagebyte = getpagesize() - 1;

	if ((self = [super initWithItemSize: is]))
		size = 0;
	size = 0;

	return self;
}

- add: (void*)item
{
	size_t nsize;

Modified src/OFAutoreleasePool.m from [6c7114863d] to [f928f923c8].

82
83
84
85
86
87
88
89

90
91

92

93
94
95


96
97
98


99
100

101
102
103
104
105
106
107
108
82
83
84
85
86
87
88

89

90
91

92
93


94
95



96
97
98

99

100
101
102
103
104
105
106







-
+
-

+
-
+

-
-
+
+
-
-
-
+
+

-
+
-







	[[pool_list last]->object addToPool: obj];
}

- init
{
	OFList *pool_list;

	if ((self = [super init])) {
	self = [super init];
		objects = nil;

	objects = nil;
		pool_list = get_tls(pool_list_key);
	pool_list = get_tls(pool_list_key);

		if (pool_list == nil) {
			pool_list = [[OFList alloc]
	if (pool_list == nil) {
		pool_list = [[OFList alloc] initWithoutRetainAndRelease];
			    initWithoutRetainAndRelease];
			set_tls(pool_list_key, pool_list);
		}
		set_tls(pool_list_key, pool_list);
	}

		listobj = [pool_list append: self];
	listobj = [pool_list append: self];
	}

	return self;
}

- free
{
	[(OFList*)get_tls(pool_list_key) remove: listobj];

Modified src/OFDictionary.m from [ae861b76c6] to [570b1e1aa5].

25
26
27
28
29
30
31
32
33



34
35
36
37
38
39
40
41
42








43
44
45
46
47
48
49
50
51
52
53
54
55
56
57









58
59

60
61
62
63
64
65
66
67
68








69
70
71
72
73
74
75
76
25
26
27
28
29
30
31


32
33
34
35








36
37
38
39
40
41
42
43

44
45
46
47
48
49








50
51
52
53
54
55
56
57
58
59

60
61








62
63
64
65
66
67
68
69

70
71
72
73
74
75
76







-
-
+
+
+

-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-






-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
+

-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-







+ dictionaryWithHashSize: (int)hashsize
{
	return [[[OFDictionary alloc] initWithHashSize: hashsize] autorelease];
}

- init
{
	if ((self = [super init])) {
		size = 4096;
	self = [super init];

	size = 4096;

		@try {
			data = [self getMemForNItems: size
					      ofSize: sizeof(OFList*)];
		} @catch (OFException *e) {
			[self free];
			@throw e;
		}
		memset(data, 0, size);
	@try {
		data = [self getMemForNItems: size
				      ofSize: sizeof(OFList*)];
	} @catch (OFException *e) {
		[self free];
		@throw e;
	}
	memset(data, 0, size);
	}

	return self;
}

- initWithHashSize: (int)hashsize
{
	if ((self = [super init])) {
		if (hashsize < 8 || hashsize > 31) {
			Class c = isa;
			[self free];
			@throw [OFInvalidArgumentException
			    newWithClass: c
			     andSelector: _cmd];
		}
	self = [super init];

	if (hashsize < 8 || hashsize > 31) {
		Class c = isa;
		[self free];
		@throw [OFInvalidArgumentException
			newWithClass: c
			 andSelector: _cmd];
	}

		size = (size_t)1 << hashsize;
	size = (size_t)1 << hashsize;

		@try {
			data = [self getMemForNItems: size
					      ofSize: sizeof(OFList*)];
		} @catch (OFException *e) {
			[self free];
			@throw e;
		}
		memset(data, 0, size);
	@try {
		data = [self getMemForNItems: size
				      ofSize: sizeof(OFList*)];
	} @catch (OFException *e) {
		[self free];
		@throw e;
	}
	memset(data, 0, size);
	}

	return self;
}

- free
{
	size_t i;

Modified src/OFExceptions.m from [22a218a9f1] to [d5a6457c6c].

60
61
62
63
64
65
66
67
68
69




70
71
72
73
74
75
76
77
60
61
62
63
64
65
66



67
68
69
70

71
72
73
74
75
76
77







-
-
-
+
+
+
+
-







+ newWithClass: (Class)class_
{
	return [[self alloc] initWithClass: class_];
}

- initWithClass: (Class)class_
{
	if ((self = [super init])) {
		class = class_;
		string = NULL;
	self = [super init];

	class = class_;
	string = NULL;
	}

	return self;
}

- free
{
	if (string != NULL)
98
99
100
101
102
103
104
105
106



107
108
109
110
111
112
113
98
99
100
101
102
103
104


105
106
107
108
109
110
111
112
113
114







-
-
+
+
+







	return [[self alloc] initWithClass: class_
				   andSize: size];
}

- initWithClass: (Class)class_
	andSize: (size_t)size
{
	if ((self = [super initWithClass: class_]))
		req_size = size;
	self = [super initWithClass: class_];

	req_size = size;

	return self;
}

- (const char*)cString
{
	if (string != NULL)
132
133
134
135
136
137
138
139
140



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


140
141
142
143
144
145
146
147
148
149







-
-
+
+
+







	return [[self alloc] initWithClass: class_
				andPointer: ptr];
}

- initWithClass: (Class)class_
     andPointer: (void*)ptr
{
	if ((self = [super initWithClass: class_]))
		pointer = ptr;
	self = [super initWithClass: class_];

	pointer = ptr;

	return self;
}

- (const char*)cString
{
	if (string != NULL)
168
169
170
171
172
173
174
175
176



177
178
179
180
181
182
183
170
171
172
173
174
175
176


177
178
179
180
181
182
183
184
185
186







-
-
+
+
+







	return [[self alloc] initWithClass: class_
			       andSelector: selector_];
}

- initWithClass: (Class)class_
    andSelector: (SEL)selector_
{
	if ((self = [super initWithClass: class_]))
		selector = selector_;
	self = [super initWithClass: class_];

	selector = selector_;

	return self;
}

- (const char*)cString
{
	if (string != NULL)
209
210
211
212
213
214
215
216
217



218
219
220
221
222
223
224
212
213
214
215
216
217
218


219
220
221
222
223
224
225
226
227
228







-
-
+
+
+







	return [[self alloc] initWithClass: class_
			       andSelector: selector_];
}

- initWithClass: (Class)class_
    andSelector: (SEL)selector_
{
	if ((self = [super initWithClass: class_]))
		selector = selector_;
	self = [super initWithClass: class_];

	selector = selector_;

	return self;
}

- (const char*)cString
{
	if (string != NULL)
278
279
280
281
282
283
284
285
286
287
288





289
290
291
292
293
294
295
296
282
283
284
285
286
287
288




289
290
291
292
293

294
295
296
297
298
299
300







-
-
-
-
+
+
+
+
+
-







				   andMode: mode_];
}

- initWithClass: (Class)class_
	andPath: (const char*)path_
	andMode: (const char*)mode_
{
	if ((self = [super initWithClass: class_])) {
		path = (path_ != NULL ? strdup(path_) : NULL);
		mode = (mode_ != NULL ? strdup(mode_) : NULL);
		err = GET_ERR;
	self = [super initWithClass: class_];

	path = (path_ != NULL ? strdup(path_) : NULL);
	mode = (mode_ != NULL ? strdup(mode_) : NULL);
	err = GET_ERR;
	}

	return self;
}

- free
{
	if (path != NULL)
345
346
347
348
349
350
351
352
353
354
355
356






357
358
359
360
361
362
363
364
365
366
367
368
369






370
371
372
373
374
375
376
377
349
350
351
352
353
354
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







-
-
-
-
-
+
+
+
+
+
+
-







-
-
-
-
-
+
+
+
+
+
+
-







				   andSize: size];
}

- initWithClass: (Class)class_
	andSize: (size_t)size
      andNItems: (size_t)nitems
{
	if ((self = [super initWithClass: class_])) {
		req_size = size;
		req_items = nitems;
		has_items = YES;
		err = GET_ERR;
	self = [super initWithClass: class_];

	req_size = size;
	req_items = nitems;
	has_items = YES;
	err = GET_ERR;
	}

	return self;
}

- initWithClass: (Class)class_
	andSize: (size_t)size
{
	if ((self = [super initWithClass: class_])) {
		req_size = size;
		req_items = 0;
		has_items = NO;
		err = GET_ERR;
	self = [super initWithClass: class_];

	req_size = size;
	req_items = 0;
	has_items = NO;
	err = GET_ERR;
	}

	return self;
}

- (int)errNo
{
	return err;
492
493
494
495
496
497
498
499
500
501
502





503
504
505
506
507
508
509
510
496
497
498
499
500
501
502




503
504
505
506
507

508
509
510
511
512
513
514







-
-
-
-
+
+
+
+
+
-







		       andService: service_];
}

- initWithClass: (Class)class_
	andNode: (const char*)node_
     andService: (const char*)service_
{
	if ((self = [super initWithClass: class_])) {
		node = (node_ != NULL ? strdup(node_) : NULL);
		service = (service_ != NULL ? strdup(service_) : NULL);
		err = GET_SOCK_ERR;
	self = [super initWithClass: class_];

	node = (node_ != NULL ? strdup(node_) : NULL);
	service = (service_ != NULL ? strdup(service_) : NULL);
	err = GET_SOCK_ERR;
	}

	return self;
}

- free
{
	if (node != NULL)
556
557
558
559
560
561
562
563
564
565
566





567
568
569
570
571
572
573
574
560
561
562
563
564
565
566




567
568
569
570
571

572
573
574
575
576
577
578







-
-
-
-
+
+
+
+
+
-







			  andPort: port_];
}

- initWithClass: (Class)class_
	andHost: (const char*)host_
	andPort: (uint16_t)port_
{
	if ((self = [super initWithClass: class_])) {
		host = (host_ != NULL ? strdup(host_) : NULL);
		port = port_;
		err = GET_SOCK_ERR;
	self = [super initWithClass: class_];

	host = (host_ != NULL ? strdup(host_) : NULL);
	port = port_;
	err = GET_SOCK_ERR;
	}

	return self;
}

- free
{
	if (host != NULL)
617
618
619
620
621
622
623
624
625
626
627
628






629
630
631
632
633
634
635
636
621
622
623
624
625
626
627





628
629
630
631
632
633

634
635
636
637
638
639
640







-
-
-
-
-
+
+
+
+
+
+
-







}

- initWithClass: (Class)class_
	andHost: (const char*)host_
	andPort: (uint16_t)port_
      andFamily: (int)family_
{
	if ((self = [super initWithClass: class_])) {
		host = (host_ != NULL ? strdup(host_) : NULL);
		port = port_;
		family = family_;
		err = GET_SOCK_ERR;
	self = [super initWithClass: class_];

	host = (host_ != NULL ? strdup(host_) : NULL);
	port = port_;
	family = family_;
	err = GET_SOCK_ERR;
	}

	return self;
}

- free
{
	if (host != NULL)
678
679
680
681
682
683
684
685
686
687




688
689
690
691
692
693
694
695
682
683
684
685
686
687
688



689
690
691
692

693
694
695
696
697
698
699







-
-
-
+
+
+
+
-







	return [[self alloc] initWithClass: class_
				andBackLog: backlog_];
}

- initWithClass: (Class)class_
     andBackLog: (int)backlog_
{
	if ((self = [super initWithClass: class_])) {
		backlog = backlog_;
		err = GET_SOCK_ERR;
	self = [super initWithClass: class_];

	backlog = backlog_;
	err = GET_SOCK_ERR;
	}

	return self;
}

- (const char*)cString
{
	if (string != NULL)
711
712
713
714
715
716
717
718
719



720
721
722
723
724
725
726
715
716
717
718
719
720
721


722
723
724
725
726
727
728
729
730
731







-
-
+
+
+







	return backlog;
}
@end

@implementation OFAcceptFailedException
- initWithClass: (Class)class_
{
	if ((self = [super initWithClass: class_]))
		err = GET_SOCK_ERR;
	self = [super initWithClass: class_];

	err = GET_SOCK_ERR;

	return self;
}

- (const char*)cString
{
	if (string != NULL)

Modified src/OFFile.m from [de67b84ef2] to [164c881033].

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93










94
95
96
97
98
99
100
78
79
80
81
82
83
84









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







-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+







}

- initWithPath: (const char*)path
       andMode: (const char*)mode
{
	Class c;

	if ((self = [super init])) {
		if ((fp = fopen(path, mode)) == NULL) {
			c = isa;
			[super free];
			@throw [OFOpenFileFailedException newWithClass: c 
							       andPath: path
							       andMode: mode];
		}
	}
	self = [super init];

	if ((fp = fopen(path, mode)) == NULL) {
		c = isa;
		[super free];
		@throw [OFOpenFileFailedException newWithClass: c 
						       andPath: path
						       andMode: mode];
	}

	return self;
}

- free
{
	fclose(fp);

Modified src/OFHashes.m from [b4e6d30015] to [bfc8c7ca98].

118
119
120
121
122
123
124
125
126
127
128
129






130
131
132


133
134

135
136
137
138
139
140
141
142
118
119
120
121
122
123
124





125
126
127
128
129
130
131


132
133
134

135

136
137
138
139
140
141
142







-
-
-
-
-
+
+
+
+
+
+

-
-
+
+

-
+
-







+ md5Hash
{
	return [[[OFMD5Hash alloc] init] autorelease];
}

- init
{
	if ((self = [super init])) {
		buf[0] = 0x67452301;
		buf[1] = 0xEFCDAB89;
		buf[2] = 0x98BADCFE;
		buf[3] = 0x10325476;
	self = [super init];

	buf[0] = 0x67452301;
	buf[1] = 0xEFCDAB89;
	buf[2] = 0x98BADCFE;
	buf[3] = 0x10325476;

		bits[0] = 0;
		bits[1] = 0;
	bits[0] = 0;
	bits[1] = 0;

		calculated = NO;
	calculated = NO;
	}

	return self;
}

- updateWithBuffer: (const char*)buffer
	    ofSize: (size_t)size
{
361
362
363
364
365
366
367
368
369
370
371
372
373
374








375
376
377
378
379
380
381
382
361
362
363
364
365
366
367







368
369
370
371
372
373
374
375

376
377
378
379
380
381
382







-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-







+ sha1Hash
{
	return [[[OFSHA1Hash alloc] init] autorelease];
}

- init
{
	if ((self = [super init])) {
		count = 0;
		state[0] = 0x67452301;
		state[1] = 0xEFCDAB89;
		state[2] = 0x98BADCFE;
		state[3] = 0x10325476;
		state[4] = 0xC3D2E1F0;
	self = [super init];

	count = 0;
	state[0] = 0x67452301;
	state[1] = 0xEFCDAB89;
	state[2] = 0x98BADCFE;
	state[3] = 0x10325476;
	state[4] = 0xC3D2E1F0;
	}

	return self;
}

- updateWithBuffer: (const char*)buf
	    ofSize: (size_t)size
{

Modified src/OFList.m from [554cc90ca9] to [64103fca3f].

17
18
19
20
21
22
23
24
25
26
27





28
29
30
31
32
33
34
35
36
37
38





39
40
41
42
43
44
45
46
17
18
19
20
21
22
23




24
25
26
27
28

29
30
31
32
33
34




35
36
37
38
39

40
41
42
43
44
45
46







-
-
-
-
+
+
+
+
+
-






-
-
-
-
+
+
+
+
+
-







+ list
{
	return [[[OFList alloc] init] autorelease];
}

- init
{
	if ((self = [super init])) {
		first = NULL;
		last = NULL;
		retain_and_release = YES;
	self = [super init];

	first = NULL;
	last = NULL;
	retain_and_release = YES;
	}

	return self;
}

- initWithoutRetainAndRelease
{
	if ((self = [super init])) {
		first = NULL;
		last = NULL;
		retain_and_release = NO;
	self = [super init];

	first = NULL;
	last = NULL;
	retain_and_release = NO;
	}

	return self;
}

- free
{
	of_list_object_t *iter;

Modified src/OFNumber.m from [7eb8ab4a41] to [fe660d1678].

296
297
298
299
300
301
302
303
304
305




306
307
308
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
363
364
365




366
367
368
369
370
371
372
373
374
375




376
377
378
379
380
381
382
383
384
385




386
387
388
389
390
391
392
393
394
395




396
397
398
399
400
401
402
403
404
405




406
407
408
409
410
411
412
413
414
415




416
417
418
419
420
421
422
423
424
425




426
427
428
429
430
431
432
433
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
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
501
502
503
504
505




506
507
508
509
510
511
512
513
514
515




516
517
518
519
520
521
522
523
524
525




526
527
528
529
530
531
532
533
534
535




536
537
538
539
540
541
542
543
296
297
298
299
300
301
302



303
304
305
306

307
308
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



363
364
365
366

367
368
369
370
371
372



373
374
375
376

377
378
379
380
381
382



383
384
385
386

387
388
389
390
391
392



393
394
395
396

397
398
399
400
401
402



403
404
405
406

407
408
409
410
411
412



413
414
415
416

417
418
419
420
421
422



423
424
425
426

427
428
429
430
431
432



433
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
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
501
502



503
504
505
506

507
508
509
510
511
512



513
514
515
516

517
518
519
520
521
522



523
524
525
526

527
528
529
530
531
532



533
534
535
536

537
538
539
540
541
542
543







-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-






-
-
-
+
+
+
+
-







+ numberWithDouble: (double)double_
{
	return [[[OFNumber alloc] initWithDouble: double_] autorelease];
}

- initWithChar: (char)char_
{
	if ((self = [super init])) {
		value.char_ = char_;
		type = OF_NUMBER_CHAR;
	self = [super init];

	value.char_ = char_;
	type = OF_NUMBER_CHAR;
	}

	return self;
}

- initWithShort: (short)short_
{
	if ((self = [super init])) {
		value.short_ = short_;
		type = OF_NUMBER_SHORT;
	self = [super init];

	value.short_ = short_;
	type = OF_NUMBER_SHORT;
	}

	return self;
}

- initWithInt: (int)int_
{
	if ((self = [super init])) {
		value.int_ = int_;
		type = OF_NUMBER_INT;
	self = [super init];

	value.int_ = int_;
	type = OF_NUMBER_INT;
	}

	return self;
}

- initWithLong: (long)long_
{
	if ((self = [super init])) {
		value.long_ = long_;
		type = OF_NUMBER_LONG;
	self = [super init];

	value.long_ = long_;
	type = OF_NUMBER_LONG;
	}

	return self;
}

- initWithUChar: (unsigned char)uchar
{
	if ((self = [super init])) {
		value.uchar = uchar;
		type = OF_NUMBER_UCHAR;
	self = [super init];

	value.uchar = uchar;
	type = OF_NUMBER_UCHAR;
	}

	return self;
}

- initWithUShort: (unsigned short)ushort
{
	if ((self = [super init])) {
		value.ushort = ushort;
		type = OF_NUMBER_USHORT;
	self = [super init];

	value.ushort = ushort;
	type = OF_NUMBER_USHORT;
	}

	return self;
}

- initWithUInt: (unsigned int)uint
{
	if ((self = [super init])) {
		value.uint = uint;
		type = OF_NUMBER_UINT;
	self = [super init];

	value.uint = uint;
	type = OF_NUMBER_UINT;
	}

	return self;
}

- initWithULong: (unsigned long)ulong
{
	if ((self = [super init])) {
		value.ulong = ulong;
		type = OF_NUMBER_ULONG;
	self = [super init];

	value.ulong = ulong;
	type = OF_NUMBER_ULONG;
	}

	return self;
}

- initWithInt8: (int8_t)int8
{
	if ((self = [super init])) {
		value.int8 = int8;
		type = OF_NUMBER_INT8;
	self = [super init];

	value.int8 = int8;
	type = OF_NUMBER_INT8;
	}

	return self;
}

- initWithInt16: (int16_t)int16
{
	if ((self = [super init])) {
		value.int16 = int16;
		type = OF_NUMBER_INT16;
	self = [super init];

	value.int16 = int16;
	type = OF_NUMBER_INT16;
	}

	return self;
}

- initWithInt32: (int32_t)int32
{
	if ((self = [super init])) {
		value.int32 = int32;
		type = OF_NUMBER_INT32;
	self = [super init];

	value.int32 = int32;
	type = OF_NUMBER_INT32;
	}

	return self;
}

- initWithInt64: (int64_t)int64
{
	if ((self = [super init])) {
		value.int64 = int64;
		type = OF_NUMBER_INT64;
	self = [super init];

	value.int64 = int64;
	type = OF_NUMBER_INT64;
	}

	return self;
}

- initWithUInt8: (uint8_t)uint8
{
	if ((self = [super init])) {
		value.uint8 = uint8;
		type = OF_NUMBER_UINT8;
	self = [super init];

	value.uint8 = uint8;
	type = OF_NUMBER_UINT8;
	}

	return self;
}

- initWithUInt16: (uint16_t)uint16
{
	if ((self = [super init])) {
		value.uint16 = uint16;
		type = OF_NUMBER_UINT16;
	self = [super init];

	value.uint16 = uint16;
	type = OF_NUMBER_UINT16;
	}

	return self;
}

- initWithUInt32: (uint32_t)uint32
{
	if ((self = [super init])) {
		value.uint32 = uint32;
		type = OF_NUMBER_UINT32;
	self = [super init];

	value.uint32 = uint32;
	type = OF_NUMBER_UINT32;
	}

	return self;
}

- initWithUInt64: (uint64_t)uint64
{
	if ((self = [super init])) {
		value.uint64 = uint64;
		type = OF_NUMBER_UINT64;
	self = [super init];

	value.uint64 = uint64;
	type = OF_NUMBER_UINT64;
	}

	return self;
}

- initWithSize: (size_t)size
{
	if ((self = [super init])) {
		value.size = size;
		type = OF_NUMBER_SIZE;
	self = [super init];

	value.size = size;
	type = OF_NUMBER_SIZE;
	}

	return self;
}

- initWithSSize: (ssize_t)ssize
{
	if ((self = [super init])) {
		value.ssize = ssize;
		type = OF_NUMBER_SSIZE;
	self = [super init];

	value.ssize = ssize;
	type = OF_NUMBER_SSIZE;
	}

	return self;
}

- initWithIntMax: (intmax_t)intmax
{
	if ((self = [super init])) {
		value.intmax = intmax;
		type = OF_NUMBER_INTMAX;
	self = [super init];

	value.intmax = intmax;
	type = OF_NUMBER_INTMAX;
	}

	return self;
}

- initWithUIntMax: (uintmax_t)uintmax
{
	if ((self = [super init])) {
		value.uintmax = uintmax;
		type = OF_NUMBER_UINTMAX;
	self = [super init];

	value.uintmax = uintmax;
	type = OF_NUMBER_UINTMAX;
	}

	return self;
}

- initWithPtrDiff: (ptrdiff_t)ptrdiff
{
	if ((self = [super init])) {
		value.ptrdiff = ptrdiff;
		type = OF_NUMBER_PTRDIFF;
	self = [super init];

	value.ptrdiff = ptrdiff;
	type = OF_NUMBER_PTRDIFF;
	}

	return self;
}

- initWithIntPtr: (intptr_t)intptr
{
	if ((self = [super init])) {
		value.intptr = intptr;
		type = OF_NUMBER_INTPTR;
	self = [super init];

	value.intptr = intptr;
	type = OF_NUMBER_INTPTR;
	}

	return self;
}

- initWithFloat: (float)float_
{
	if ((self = [super init])) {
		value.float_ = float_;
		type = OF_NUMBER_FLOAT;
	self = [super init];

	value.float_ = float_;
	type = OF_NUMBER_FLOAT;
	}

	return self;
}

- initWithDouble: (double)double_
{
	if ((self = [super init])) {
		value.double_ = double_;
		type = OF_NUMBER_DOUBLE;
	self = [super init];

	value.double_ = double_;
	type = OF_NUMBER_DOUBLE;
	}

	return self;
}

- (enum of_number_type)type
{
	return type;

Modified src/OFObject.h from [84bfaf3d9b] to [706bb1644c].

31
32
33
34
35
36
37





38
39
40
41
42
43
44
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49







+
+
+
+
+







 * Derived classes can override this to execute their own code on
 * initialization.
 */
+ initialize;

/**
 * Allocates memory for an instance of the class.
 *
 * alloc will never return nil, instead, it will throw an 
 * OFAllocFailedException.
 *
 * \return The allocated object.
 */
+ alloc;

/**
 * Allocated memory for an instance of the class and initializes the instance.
 */
+ new;
62
63
64
65
66
67
68




69
70
71
72
73
74
75
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84







+
+
+
+







 */
+ (IMP)replaceMethod: (SEL)selector
 withMethodFromClass: (Class)class;

/**
 * Initialize the already allocated object.
 * Also sets up the memory pool for the object.
 *
 * Derived classes may override this, but need to do self = [super init] before
 * they do any initialization themselves. init may never return nil, instead
 * an exception (for example OFInitializationFailed) should be thrown.
 *
 * \return An initialized object
 */
- init;

/**
 * \return A pointer to the class of the instance

Modified src/OFPlugin.m from [b72d21c5c5] to [b318936bd6].

23
24
25
26
27
28
29
30
31
32


33
34
35
36
37
38
39
40
41








42
43
44
45



46
47
48


49
50
51
52
53




54
55

56
57
58


59
60
61
62
63
64
65
66
67
68
69
70
23
24
25
26
27
28
29



30
31
32








33
34
35
36
37
38
39
40
41



42
43
44



45
46
47




48
49
50
51


52
53


54
55



56
57
58
59
60
61
62
63
64







-
-
-
+
+

-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+

-
-
-
+
+
+
-
-
-
+
+

-
-
-
-
+
+
+
+
-
-
+

-
-
+
+
-
-
-









{
	char *file;
	size_t pathlen, suffixlen;
	void *handle;
	OFPlugin *(*init_plugin)();
	OFPlugin *plugin;

	if ((self = [super init])) {
		pathlen = strlen(path);
		suffixlen = strlen(PLUGIN_SUFFIX);
	pathlen = strlen(path);
	suffixlen = strlen(PLUGIN_SUFFIX);

		if ((file = malloc(pathlen + suffixlen + 1)) == NULL) {
			@throw [OFNoMemException newWithClass: self
						      andSize: pathlen +
							       suffixlen + 1];
		}
		memcpy(file, path, pathlen);
		memcpy(file + pathlen, PLUGIN_SUFFIX, suffixlen);
		file[pathlen + suffixlen] = 0;
	if ((file = malloc(pathlen + suffixlen + 1)) == NULL) {
		@throw [OFNoMemException newWithClass: self
					      andSize: pathlen +
					      suffixlen + 1];
	}
	memcpy(file, path, pathlen);
	memcpy(file + pathlen, PLUGIN_SUFFIX, suffixlen);
	file[pathlen + suffixlen] = 0;

		if ((handle = dlopen(file, RTLD_NOW)) == NULL) {
			free(file);
			@throw [OFInitializationFailedException
	if ((handle = dlopen(file, RTLD_NOW)) == NULL) {
		free(file);
		@throw [OFInitializationFailedException newWithClass: self];
			    newWithClass: self];
		}
		free(file);
	}
	free(file);

		if ((init_plugin = dlsym(handle, "init_plugin")) == NULL ||
		    (plugin = init_plugin()) == nil) {
			dlclose(handle);
			@throw [OFInitializationFailedException
	if ((init_plugin = dlsym(handle, "init_plugin")) == NULL ||
	    (plugin = init_plugin()) == nil) {
		dlclose(handle);
		@throw [OFInitializationFailedException newWithClass: self];
			    newWithClass: self];
		}
	}

		plugin->handle = handle;
		return plugin;
	plugin->handle = handle;
	return plugin;
	}

	return self;
}

- free
{
	dlclose(handle);

	return [super free];
}
@end

Modified src/OFString.m from [3c7d0ee24e] to [881fc1c877].

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
162
163
164
165


166
167
168
169
170
171
172
173







174
175
176
177
178
179
180
181
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
162
163
164


165
166
167







168
169
170
171
172
173
174

175
176
177
178
179
180
181







-
-
-
-
+
+
+
+
+
-








-
-
-
+
+
+
+

-
+







-
-
+
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+
-







{
	return [[[OFString alloc] initWithFormat: fmt
				andArguments: args] autorelease];
}

- init
{
	if ((self = [super init])) {
		length = 0;
		string = NULL;
		is_utf8 = NO;
	[super init];

	length = 0;
	string = NULL;
	is_utf8 = NO;
	}

	return self;
}

- initWithCString: (const char*)str
{
	Class c;

	if ((self = [super init])) {
		if (str != NULL) {
			length = strlen(str);
	self = [super init];

	if (str != NULL) {
		length = strlen(str);

			switch (check_utf8(str, length)) {
		switch (check_utf8(str, length)) {
			case 1:
				is_utf8 = YES;
				break;
			case -1:
				c = isa;
				[super free];
				@throw [OFInvalidEncodingException
				    newWithClass: c];
			}
					newWithClass: c];
		}

			@try {
				string = [self getMemWithSize: length + 1];
			} @catch (OFException *e) {
				[self free];
				@throw e;
			}
			memcpy(string, str, length + 1);
		@try {
			string = [self getMemWithSize: length + 1];
		} @catch (OFException *e) {
			[self free];
			@throw e;
		}
		memcpy(string, str, length + 1);
		}
	}

	return self;
}

- initWithFormat: (const char*)fmt, ...
{
192
193
194
195
196
197
198
199
200
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
229





230
231
232
233
234
235
236
237
192
193
194
195
196
197
198






199
200
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
229

230
231
232
233
234
235
236







-
-
-
-
-
-
+
+
+
+
+
+
+

-
-
-
-
+
+
+
+
-
-
-
+
+

-
+








-
+

-
-
-
-
-
+
+
+
+
+
-








- initWithFormat: (const char*)fmt
    andArguments: (va_list)args
{
	int t;
	Class c;

	if ((self = [super init])) {
		if (fmt == NULL) {
			c = isa;
			[super free];
			@throw [OFInvalidFormatException newWithClass: c];
		}
	self = [super init];

	if (fmt == NULL) {
		c = isa;
		[super free];
		@throw [OFInvalidFormatException newWithClass: c];
	}

		if ((t = vasprintf(&string, fmt, args)) == -1) {
			c = isa;
			[super free];
			@throw [OFInitializationFailedException
	if ((t = vasprintf(&string, fmt, args)) == -1) {
		c = isa;
		[super free];
		@throw [OFInitializationFailedException newWithClass: c];
			    newWithClass: c];
		}
		length = t;
	}
	length = t;

		switch (check_utf8(string, length)) {
	switch (check_utf8(string, length)) {
		case 1:
			is_utf8 = YES;
			break;
		case -1:
			free(string);
			c = isa;
			[super free];
			@throw [OFInvalidEncodingException newWithClass: c];
		}
	}

		@try {
			[self addToMemoryPool: string];
		} @catch (OFException *e) {
			free(string);
			@throw e;
	@try {
		[self addToMemoryPool: string];
	} @catch (OFException *e) {
		free(string);
		@throw e;
		}
	}

	return self;
}

- (const char*)cString
{

Modified src/OFTCPSocket.m from [9dddc5248f] to [a9b0b8f50a].

40
41
42
43
44
45
46
47
48
49
50





51
52
53
54
55
56
57
58
40
41
42
43
44
45
46




47
48
49
50
51

52
53
54
55
56
57
58







-
-
-
-
+
+
+
+
+
-








	return self;
}
#endif

- init
{
	if ((self = [super init])) {
		sock = INVALID_SOCKET;
		saddr = NULL;
		saddr_len = 0;
	self = [super init];

	sock = INVALID_SOCKET;
	saddr = NULL;
	saddr_len = 0;
	}

	return self;
}

- free
{
	if (sock != INVALID_SOCKET)