ObjFW  Check-in [10f221ad30]

Overview
Comment:Clean up a few -[hash] methods.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 10f221ad303086acf45d93a0c2b54988a8d10ff7e1d671d3506b66a4c5fee4c2
User & Date: js on 2012-12-06 00:51:09
Other Links: manifest | tags
Context
2012-12-06
01:08
runtime.h: Remove functions which are elsewhere. check-in: 5c5ae52ccd user: js tags: trunk
00:51
Clean up a few -[hash] methods. check-in: 10f221ad30 user: js tags: trunk
00:14
Improve -[hash] of OFNumber and OFObject. check-in: ac51f5f0cf user: js tags: trunk
Changes

Modified src/OFArray.m from [4f7e60625c] to [a77077bbb2].

450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
{
	id *objects = [self objects];
	size_t i, count = [self count];
	uint32_t hash;

	OF_HASH_INIT(hash);

	for (i = 0; i < count; i++) {
		uint32_t h = [objects[i] hash];

		OF_HASH_ADD(hash, h >> 24);
		OF_HASH_ADD(hash, (h >> 16) & 0xFF);
		OF_HASH_ADD(hash, (h >> 8) & 0xFF);
		OF_HASH_ADD(hash, h & 0xFF);
	}

	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description







|
|
<
<
<
<
<
<







450
451
452
453
454
455
456
457
458






459
460
461
462
463
464
465
{
	id *objects = [self objects];
	size_t i, count = [self count];
	uint32_t hash;

	OF_HASH_INIT(hash);

	for (i = 0; i < count; i++)
		OF_HASH_ADD_HASH(hash, [objects[i] hash]);







	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description

Modified src/OFArray_adjacent.m from [7116965323] to [78c03c8d5c].

321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
{
	id *objects = [array cArray];
	size_t i, count = [array count];
	uint32_t hash;

	OF_HASH_INIT(hash);

	for (i = 0; i < count; i++) {
		uint32_t h = [objects[i] hash];

		OF_HASH_ADD(hash, h >> 24);
		OF_HASH_ADD(hash, (h >> 16) & 0xFF);
		OF_HASH_ADD(hash, (h >> 8) & 0xFF);
		OF_HASH_ADD(hash, h & 0xFF);
	}

	OF_HASH_FINALIZE(hash);

	return hash;
}

#ifdef OF_HAVE_BLOCKS







|
|
<
<
<
<
<
<







321
322
323
324
325
326
327
328
329






330
331
332
333
334
335
336
{
	id *objects = [array cArray];
	size_t i, count = [array count];
	uint32_t hash;

	OF_HASH_INIT(hash);

	for (i = 0; i < count; i++)
		OF_HASH_ADD_HASH(hash, [objects[i] hash]);







	OF_HASH_FINALIZE(hash);

	return hash;
}

#ifdef OF_HAVE_BLOCKS

Modified src/OFDataArray.m from [dfe3b68b31] to [0d3563afe7].

483
484
485
486
487
488
489

490
491

492
493
494
495
496
497
498

- (uint32_t)hash
{
	uint32_t hash;
	size_t i;

	OF_HASH_INIT(hash);

	for (i = 0; i < count * itemSize; i++)
		OF_HASH_ADD(hash, ((char*)data)[i]);

	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description
{







>


>







483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500

- (uint32_t)hash
{
	uint32_t hash;
	size_t i;

	OF_HASH_INIT(hash);

	for (i = 0; i < count * itemSize; i++)
		OF_HASH_ADD(hash, ((char*)data)[i]);

	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description
{

Modified src/OFList.m from [ccac864af8] to [872a6d7ce4].

323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
- (uint32_t)hash
{
	of_list_object_t *iter;
	uint32_t hash;

	OF_HASH_INIT(hash);

	for (iter = firstListObject; iter != NULL; iter = iter->next) {
		uint32_t h = [iter->object hash];

		OF_HASH_ADD(hash, h >> 24);
		OF_HASH_ADD(hash, (h >> 16) & 0xFF);
		OF_HASH_ADD(hash, (h >> 8) & 0xFF);
		OF_HASH_ADD(hash, h & 0xFF);
	}

	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description







|
|
<
<
<
<
<
<







323
324
325
326
327
328
329
330
331






332
333
334
335
336
337
338
- (uint32_t)hash
{
	of_list_object_t *iter;
	uint32_t hash;

	OF_HASH_INIT(hash);

	for (iter = firstListObject; iter != NULL; iter = iter->next)
		OF_HASH_ADD_HASH(hash, [iter->object hash]);







	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description