ObjFW  Check-in [2de15db195]

Overview
Comment:Rethrow some exceptions to fix class.

This way, the error message will show the called class instead of the
class used internally.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2de15db195de3cda6b16147c75754874f5dd638861bc30da82945878cc847f5c
User & Date: js on 2013-03-01 21:19:02
Other Links: manifest | tags
Context
2013-03-04
17:20
Replace BOOL with bool. check-in: c5ef582958 user: js tags: trunk
2013-03-01
21:19
Rethrow some exceptions to fix class. check-in: 2de15db195 user: js tags: trunk
2013-02-28
09:57
Make @true and @false work. check-in: de24e36b29 user: js tags: trunk
Changes

Modified src/OFArray_adjacent.m from [1c69665b63] to [2158b59870].

213
214
215
216
217
218
219

220




221
222
223
224

225




226
227
228
229
230
231
232
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
238
239
240







+
-
+
+
+
+




+
-
+
+
+
+







- (id*)objects
{
	return [_array items];
}

- (id)objectAtIndex: (size_t)index
{
	@try {
	return *((id*)[_array itemAtIndex: index]);
		return *((id*)[_array itemAtIndex: index]);
	} @catch (OFOutOfRangeException *e) {
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];
	}
}

- (id)objectAtIndexedSubscript: (size_t)index
{
	@try {
	return *((id*)[_array itemAtIndex: index]);
		return *((id*)[_array itemAtIndex: index]);
	} @catch (OFOutOfRangeException *e) {
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];
	}
}

- (void)getObjects: (id*)buffer
	   inRange: (of_range_t)range
{
	id *objects = [_array items];
	size_t i, count = [_array count];

Modified src/OFDictionary_hashtable.m from [6f8779fe47] to [c66bc3b5e1].

303
304
305
306
307
308
309

310






311
312
313
314
315
316
317
303
304
305
306
307
308
309
310

311
312
313
314
315
316
317
318
319
320
321
322
323







+
-
+
+
+
+
+
+







	[_mapTable dealloc];

	[super dealloc];
}

- (id)objectForKey: (id)key
{
	@try {
	return [_mapTable valueForKey: key];
		return [_mapTable valueForKey: key];
	} @catch (OFInvalidArgumentException *e) {
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [self class]
			      selector: _cmd];
	}
}

- (size_t)count
{
	return [_mapTable count];
}

Modified src/OFMutableArray_adjacent.m from [95d0045e21] to [a8ef885aa6].

63
64
65
66
67
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
63
64
65
66
67
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
99
100







+
-
-
+
+
+
+
+











+
-
-
-
+
+
+
+
+
+







- (void)insertObject: (id)object
	     atIndex: (size_t)index
{
	if (object == nil)
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [self class]];

	@try {
	[_array insertItem: &object
		   atIndex: index];
		[_array insertItem: &object
			   atIndex: index];
	} @catch (OFOutOfRangeException *e) {
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];
	}
	[object retain];

	_mutations++;
}

- (void)insertObjectsFromArray: (OFArray*)array
		       atIndex: (size_t)index
{
	id *objects = [array objects];
	size_t i, count = [array count];

	@try {
	[_array insertItems: objects
		    atIndex: index
		      count: count];
		[_array insertItems: objects
			    atIndex: index
			      count: count];
	} @catch (OFOutOfRangeException *e) {
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];
	}

	for (i = 0; i < count; i++)
		[objects[i] retain];

	_mutations++;
}

Modified src/OFMutableDictionary_hashtable.m from [808b6f21ab] to [62c70227b5].

34
35
36
37
38
39
40

41
42







43
44
45
46

47






48
49
50
51
52
53
54
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







+
-
-
+
+
+
+
+
+
+




+
-
+
+
+
+
+
+







	if (self == [OFMutableDictionary_hashtable class])
		[self inheritMethodsFromClass: [OFDictionary_hashtable class]];
}

- (void)setObject: (id)object
	   forKey: (id)key
{
	@try {
	[_mapTable setValue: object
		     forKey: key];
		[_mapTable setValue: object
			     forKey: key];
	} @catch (OFInvalidArgumentException *e) {
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [self class]
			      selector: _cmd];
	}
}

- (void)removeObjectForKey: (id)key
{
	@try {
	[_mapTable removeValueForKey: key];
		[_mapTable removeValueForKey: key];
	} @catch (OFInvalidArgumentException *e) {
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [self class]
			      selector: _cmd];
	}
}

#ifdef OF_HAVE_BLOCKS
- (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block
{
	@try {
		[_mapTable replaceValuesUsingBlock: