ObjFW  Diff

Differences From Artifact [2ec4537eb9]:

To Artifact [5217ffcc95]:


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
- initWithDictionary: (OFDictionary*)dictionary
{
	self = [super init];

	@try {
		OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
		OFEnumerator *enumerator;
		id <OFCopying> key;
		uint32_t i, newSize;

		count = [dictionary count];

		if (count > UINT32_MAX)
			@throw [OFOutOfRangeException newWithClass: isa];








|







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
- initWithDictionary: (OFDictionary*)dictionary
{
	self = [super init];

	@try {
		OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
		OFEnumerator *enumerator;
		id key;
		uint32_t i, newSize;

		count = [dictionary count];

		if (count > UINT32_MAX)
			@throw [OFOutOfRangeException newWithClass: isa];

199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
		@throw e;
	}

	return self;
}

- initWithObject: (id)object
	  forKey: (id <OFCopying>)key
{
	self = [super init];

	@try {
		uint32_t i;
		struct of_dictionary_hashtable_bucket *bucket;








|







199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
		@throw e;
	}

	return self;
}

- initWithObject: (id)object
	  forKey: (id)key
{
	self = [super init];

	@try {
		uint32_t i;
		struct of_dictionary_hashtable_bucket *bucket;

297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
						break;
			}

			/* Key not in dictionary */
			if (j >= last || data[j] == NULL ||
			    ![data[j]->key isEqual: keysCArray[i]]) {
				struct of_dictionary_hashtable_bucket *bucket;
				id <OFCopying> key;

				last = size;

				j = hash & (size - 1);
				for (; j < last && data[j] != NULL; j++);

				/* In case the last bucket is already used */







|







297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
						break;
			}

			/* Key not in dictionary */
			if (j >= last || data[j] == NULL ||
			    ![data[j]->key isEqual: keysCArray[i]]) {
				struct of_dictionary_hashtable_bucket *bucket;
				id key;

				last = size;

				j = hash & (size - 1);
				for (; j < last && data[j] != NULL; j++);

				/* In case the last bucket is already used */
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
		[self release];
		@throw e;
	}

	return self;
}

- initWithKey: (id <OFCopying>)firstKey
    arguments: (va_list)arguments
{
	self = [super init];

	@try {
		id key, object;
		uint32_t i, j, hash, newSize;







|







361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
		[self release];
		@throw e;
	}

	return self;
}

- initWithKey: (id)firstKey
    arguments: (va_list)arguments
{
	self = [super init];

	@try {
		id key, object;
		uint32_t i, j, hash, newSize;
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
		bucket->hash = hash;

		data[j] = bucket;

		for (i = 1; i < count; i++) {
			uint32_t last;

			key = va_arg(arguments, id <OFCopying>);
			object = va_arg(arguments, id);

			if (key == nil || object == nil)
				@throw [OFInvalidArgumentException
				    newWithClass: isa
					selector: _cmd];








|







427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
		bucket->hash = hash;

		data[j] = bucket;

		for (i = 1; i < count; i++) {
			uint32_t last;

			key = va_arg(arguments, id);
			object = va_arg(arguments, id);

			if (key == nil || object == nil)
				@throw [OFInvalidArgumentException
				    newWithClass: isa
					selector: _cmd];

578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
		[self release];
		@throw e;
	}

	return self;
}

- (id)objectForKey: (id <OFCopying>)key
{
	uint32_t i, hash, last;

	if (key == nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];








|







578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
		[self release];
		@throw e;
	}

	return self;
}

- (id)objectForKey: (id)key
{
	uint32_t i, hash, last;

	if (key == nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];