ObjFW  Check-in [2ecede1f96]

Overview
Comment:Fix check in -[OFDictionary_hashtable isEqual:]

Instead of checking the passed dictionary, this checked self, which of
course would always be of type OFDictionary_hashtable.

While at it, use -[isKindOfClass:] instead for the check.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2ecede1f963e072d44f49b909cf6a37908518393729135ac4475726cb1fa6642
User & Date: js on 2014-07-16 17:02:30
Other Links: manifest | tags
Context
2014-07-18
09:55
README.md: Update Clang + ARM instructions check-in: 4494907e3f user: js tags: trunk
2014-07-16
17:02
Fix check in -[OFDictionary_hashtable isEqual:] check-in: 2ecede1f96 user: js tags: trunk
15:16
Coding style check-in: ff23684e9d user: js tags: trunk
Changes

Modified src/OFArray_adjacent.m from [babbf9f98a] to [f2533d462f].

286
287
288
289
290
291
292
293
294


295
296
297
298
299
300
301
302
286
287
288
289
290
291
292


293
294

295
296
297
298
299
300
301







-
-
+
+
-








- (bool)isEqual: (id)object
{
	OFArray *otherArray;
	id const *objects, *otherObjects;
	size_t i, count;

	if ([object class] != [OFArray_adjacent class] &&
	    [object class] != [OFMutableArray_adjacent class] &&
	if (![object isKindOfClass: [OFArray_adjacent class]] &&
	    ![object isKindOfClass: [OFMutableArray_adjacent class]])
	    [object class] != [OFArray_adjacentSubarray class])
		return [super isEqual: object];

	otherArray = object;

	count = [_array count];

	if (count != [otherArray count])

Modified src/OFArray_adjacentSubarray.m from [e44a0576ae] to [bfc5d5e2ae].

28
29
30
31
32
33
34
35
36


37
38
39
40
41
42
43
44
28
29
30
31
32
33
34


35
36

37
38
39
40
41
42
43







-
-
+
+
-








- (bool)isEqual: (id)object
{
	OFArray *otherArray;
	id const *objects, *otherObjects;
	size_t i;

	if ([object class] != [OFArray_adjacent class] &&
	    [object class] != [OFMutableArray_adjacent class] &&
	if (![object isKindOfClass: [OFArray_adjacent class]] &&
	    ![object isKindOfClass: [OFMutableArray_adjacent class]])
	    [object class] != [OFArray_adjacentSubarray class])
		return [super isEqual: object];

	otherArray = object;

	if (_range.length != [otherArray count])
		return false;

Modified src/OFDictionary_hashtable.m from [773b906c93] to [29f3ee3bba].

99
100
101
102
103
104
105
106
107


108
109
110
111
112
113
114
99
100
101
102
103
104
105


106
107
108
109
110
111
112
113
114







-
-
+
+







- initWithDictionary: (OFDictionary*)dictionary
{
	size_t count;

	if (dictionary == nil)
		return [self init];

	if ([dictionary class] == [OFDictionary_hashtable class] ||
	    [dictionary class] == [OFMutableDictionary_hashtable class]) {
	if ([dictionary isKindOfClass: [OFDictionary_hashtable class]] ||
	    [dictionary isKindOfClass: [OFMutableDictionary_hashtable class]]) {
		self = [super init];

		@try {
			OFDictionary_hashtable *dictionary_ =
			    (OFDictionary_hashtable*)dictionary;

			_mapTable = [dictionary_->_mapTable copy];
310
311
312
313
314
315
316
317
318


319
320
321
322
323
324
325
310
311
312
313
314
315
316


317
318
319
320
321
322
323
324
325







-
-
+
+







	return [_mapTable count];
}

- (bool)isEqual: (id)dictionary
{
	OFDictionary_hashtable *dictionary_;

	if ([self class] != [OFDictionary_hashtable class] &&
	    [self class] != [OFMutableDictionary_hashtable class])
	if (![dictionary isKindOfClass: [OFDictionary_hashtable class]] &&
	    ![dictionary isKindOfClass: [OFMutableDictionary_hashtable class]])
		return [super isEqual: dictionary];

	dictionary_ = (OFDictionary_hashtable*)dictionary;

	return [dictionary_->_mapTable isEqual: _mapTable];
}