ObjFW  Check-in [798d9e6320]

Overview
Comment:[pool release] can never throw by convention now.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 798d9e632033401797588dff7f559a912d0c0bd6186ea135c436e943b95b766d
User & Date: js on 2011-09-09 13:35:16
Other Links: manifest | tags
Context
2011-09-09
19:15
Fix a type mistmach (interface vs. implementation). check-in: e493aac469 user: js tags: trunk
13:35
[pool release] can never throw by convention now. check-in: 798d9e6320 user: js tags: trunk
10:50
Change documentation for abstract classes. check-in: eedcd6c7b2 user: js tags: trunk
Changes

Modified src/OFArray.m from [fec0c02685] to [6654434c69].

485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
	for (i = 0; i < count; i++) {
		[element addChild: [cArray[i] XMLElementBySerializing]];

		[pool2 releaseObjects];
	}

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}

- (void)makeObjectsPerformSelector: (SEL)selector
{
	id *cArray = [self cArray];







<
|
<
|
<







485
486
487
488
489
490
491

492

493

494
495
496
497
498
499
500
	for (i = 0; i < count; i++) {
		[element addChild: [cArray[i] XMLElementBySerializing]];

		[pool2 releaseObjects];
	}

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}

- (void)makeObjectsPerformSelector: (SEL)selector
{
	id *cArray = [self cArray];

Modified src/OFCountedSet.m from [931ec5d215] to [a967923f91].

203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
		[objectElement addChild: [object XMLElementBySerializing]];
		[element addChild: objectElement];

		[pool2 releaseObjects];
	}

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}

#ifdef OF_HAVE_BLOCKS
- (void)enumerateObjectsAndCountUsingBlock:
    (of_counted_set_enumeration_block_t)block







<
|
<
|
<







203
204
205
206
207
208
209

210

211

212
213
214
215
216
217
218
		[objectElement addChild: [object XMLElementBySerializing]];
		[element addChild: objectElement];

		[pool2 releaseObjects];
	}

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}

#ifdef OF_HAVE_BLOCKS
- (void)enumerateObjectsAndCountUsingBlock:
    (of_counted_set_enumeration_block_t)block

Modified src/OFDataArray.m from [5113b26e1a] to [62af6f1338].

459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
	pool = [[OFAutoreleasePool alloc] init];
	element = [OFXMLElement
	    elementWithName: [self className]
		  namespace: OF_SERIALIZATION_NS
		stringValue: of_base64_encode(data, count * itemSize)];

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}
@end

@implementation OFBigDataArray
- (void)addItem: (const void*)item







<
|
<
|
<







459
460
461
462
463
464
465

466

467

468
469
470
471
472
473
474
	pool = [[OFAutoreleasePool alloc] init];
	element = [OFXMLElement
	    elementWithName: [self className]
		  namespace: OF_SERIALIZATION_NS
		stringValue: of_base64_encode(data, count * itemSize)];

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}
@end

@implementation OFBigDataArray
- (void)addItem: (const void*)item

Modified src/OFDate.m from [6ee6276845] to [5432dcad54].

355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373

	[element addAttributeWithName: @"seconds"
			  stringValue: secondsString];
	[element addAttributeWithName: @"microseconds"
			  stringValue: microsecondsString];

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}

- (uint32_t)microsecond
{
	return microseconds;







<
|
<
|
<







355
356
357
358
359
360
361

362

363

364
365
366
367
368
369
370

	[element addAttributeWithName: @"seconds"
			  stringValue: secondsString];
	[element addAttributeWithName: @"microseconds"
			  stringValue: microsecondsString];

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}

- (uint32_t)microsecond
{
	return microseconds;

Modified src/OFDictionary.m from [98b4c2fae3] to [7066c6abb0].

529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
		[element addChild: keyElement];
		[element addChild: objectElement];

		[pool2 releaseObjects];
	}

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}
@end







<
|
<
|
<




529
530
531
532
533
534
535

536

537

538
539
540
541
		[element addChild: keyElement];
		[element addChild: objectElement];

		[pool2 releaseObjects];
	}

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}
@end

Modified src/OFList.m from [5cba33a83a] to [a2958826ad].

373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
	for (iter = firstListObject; iter != NULL; iter = iter->next) {
		[element addChild: [iter->object XMLElementBySerializing]];

		[pool2 releaseObjects];
	}

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}

- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (id*)objects
			     count: (int)count_







<
|
<
|
<







373
374
375
376
377
378
379

380

381

382
383
384
385
386
387
388
	for (iter = firstListObject; iter != NULL; iter = iter->next) {
		[element addChild: [iter->object XMLElementBySerializing]];

		[pool2 releaseObjects];
	}

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}

- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (id*)objects
			     count: (int)count_

Modified src/OFNull.m from [5534adc13a] to [d91bdef886].

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: [self className]
				      namespace: OF_SERIALIZATION_NS];

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}

- autorelease
{
	return self;







<
|
<
|
<







70
71
72
73
74
75
76

77

78

79
80
81
82
83
84
85
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: [self className]
				      namespace: OF_SERIALIZATION_NS];

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}

- autorelease
{
	return self;

Modified src/OFNumber.m from [a3610e7d0e] to [d6b1e87e08].

1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260

		break;
	default:
		@throw [OFInvalidFormatException newWithClass: isa];
	}

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}
@end







<
|
<
|
<




1245
1246
1247
1248
1249
1250
1251

1252

1253

1254
1255
1256
1257

		break;
	default:
		@throw [OFInvalidFormatException newWithClass: isa];
	}

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}
@end

Modified src/OFObject+Serialization.m from [dc7ca94ebf] to [914b1a9829].

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
		       stringValue: @"0"];
	[root addChild: element];

	ret = [@"<?xml version='1.0' encoding='UTF-8'?>\n"
	    stringByAppendingString: [root XMLStringWithIndentation: 2]];

	[ret retain];
	@try {
		[pool release];
	} @finally {
		[ret autorelease];
	}

	return ret;
}
@end







<
|
<
|
<




49
50
51
52
53
54
55

56

57

58
59
60
61
		       stringValue: @"0"];
	[root addChild: element];

	ret = [@"<?xml version='1.0' encoding='UTF-8'?>\n"
	    stringByAppendingString: [root XMLStringWithIndentation: 2]];

	[ret retain];

	[pool release];

	[ret autorelease];


	return ret;
}
@end

Modified src/OFSet.m from [61fa40e270] to [12cfe037e0].

352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
	while ((object = [enumerator nextObject]) != nil) {
		[element addChild: [object XMLElementBySerializing]];

		[pool2 releaseObjects];
	}

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}

#ifdef OF_HAVE_BLOCKS
- (void)enumerateObjectsUsingBlock: (of_set_enumeration_block_t)block
{







<
|
<
|
<







352
353
354
355
356
357
358

359

360

361
362
363
364
365
366
367
	while ((object = [enumerator nextObject]) != nil) {
		[element addChild: [object XMLElementBySerializing]];

		[pool2 releaseObjects];
	}

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}

#ifdef OF_HAVE_BLOCKS
- (void)enumerateObjectsUsingBlock: (of_set_enumeration_block_t)block
{

Modified src/OFString+Serialization.m from [a5b47627ae] to [fd771ca2dd].

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

	elements = [root elementsForNamespace: OF_SERIALIZATION_NS];

	if ([elements count] != 1)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	object = [[[elements firstObject] objectByDeserializing] retain];

	@try {
		[pool release];
	} @catch (id e) {
		[object release];
		@throw e;
	}

	return [object autorelease];
}
@end







|

|
|
<
|
<
|
|
<


51
52
53
54
55
56
57
58
59
60
61

62

63
64

65
66

	elements = [root elementsForNamespace: OF_SERIALIZATION_NS];

	if ([elements count] != 1)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	object = [[elements firstObject] objectByDeserializing];

	[object retain];
	[pool release];

	[object autorelease];


	return object;

}
@end

Modified src/OFString.m from [6c62052489] to [45f23dd776].

1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
		className = [self className];

	element = [OFXMLElement elementWithName: className
				      namespace: OF_SERIALIZATION_NS
				    stringValue: self];

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}

- (of_unichar_t)characterAtIndex: (size_t)index
{
	of_unichar_t character;







<
|
<
|
<







1307
1308
1309
1310
1311
1312
1313

1314

1315

1316
1317
1318
1319
1320
1321
1322
		className = [self className];

	element = [OFXMLElement elementWithName: className
				      namespace: OF_SERIALIZATION_NS
				    stringValue: self];

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}

- (of_unichar_t)characterAtIndex: (size_t)index
{
	of_unichar_t character;

Modified src/OFURL.m from [1998367c8d] to [5655588497].

548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: [self className]
				      namespace: OF_SERIALIZATION_NS
				    stringValue: [self string]];

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}
@end







<
|
<
|
<




548
549
550
551
552
553
554

555

556

557
558
559
560
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: [self className]
				      namespace: OF_SERIALIZATION_NS
				    stringValue: [self string]];

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}
@end

Modified src/OFXMLAttribute.m from [836db12fdb] to [72bfa63edb].

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
		[element addAttributeWithName: @"namespace"
				  stringValue: ns];

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

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}
@end







<
|
<
|
<




175
176
177
178
179
180
181

182

183

184
185
186
187
		[element addAttributeWithName: @"namespace"
				  stringValue: ns];

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

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}
@end

Modified src/OFXMLElement+Serialization.m from [8af8aee9f9] to [9723f4d0fb].

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
	if (![class conformsToProtocol: @protocol(OFSerialization)])
		@throw [OFNotImplementedException
		    newWithClass: class
			selector: @selector(initWithSerialization:)];

	object = [[class alloc] initWithSerialization: self];

	@try {
		[pool release];
	} @finally {
		[object autorelease];
	}

	return object;
}
@end







<
|
<
<
|
|
<


44
45
46
47
48
49
50

51


52
53

54
55
	if (![class conformsToProtocol: @protocol(OFSerialization)])
		@throw [OFNotImplementedException
		    newWithClass: class
			selector: @selector(initWithSerialization:)];

	object = [[class alloc] initWithSerialization: self];


	[pool release];



	return [object autorelease];

}
@end

Modified src/OFXMLElement.m from [213562d5f6] to [77eb90df4f].

842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
	if (comment != nil)
		[element addChild:
		    [OFXMLElement elementWithName: @"comment"
					namespace: OF_SERIALIZATION_NS
				      stringValue: comment]];

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}

- (void)addAttribute: (OFXMLAttribute*)attribute
{
	if (name == nil)







<
|
<
|
<







842
843
844
845
846
847
848

849

850

851
852
853
854
855
856
857
	if (comment != nil)
		[element addChild:
		    [OFXMLElement elementWithName: @"comment"
					namespace: OF_SERIALIZATION_NS
				      stringValue: comment]];

	[element retain];

	[pool release];

	[element autorelease];


	return element;
}

- (void)addAttribute: (OFXMLAttribute*)attribute
{
	if (name == nil)