ObjFW  Check-in [c81086beeb]

Overview
Comment:Rename all struct of_*
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | new-naming-convention
Files: files | file ages | folders
SHA3-256: c81086beeb6c90c9e65546e1fd0aade2c2fccc82941050615725339755092d2a
User & Date: js on 2021-04-19 21:07:40
Other Links: branch diff | manifest | tags
Context
2021-04-19
21:54
Rename a few more constants check-in: 458420998c user: js tags: new-naming-convention
21:07
Rename all struct of_* check-in: c81086beeb user: js tags: new-naming-convention
20:50
Fix a few forgotten of_forward check-in: b886536090 user: js tags: new-naming-convention
Changes

Modified src/OFMD5Hash.h from [308882c688] to [339183e371].

24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38







-
+







 *
 * @brief A class which provides methods to create an MD5 hash.
 */
OF_SUBCLASSING_RESTRICTED
@interface OFMD5Hash: OFObject <OFCryptographicHash>
{
	OFSecureData *_iVarsData;
	struct of_md5_hash_ivars {
	struct {
		uint32_t state[4];
		uint64_t bits;
		union of_md5_hash_buffer {
			unsigned char bytes[64];
			uint32_t words[16];
		} buffer;
		size_t bufferLength;

Modified src/OFMapTable.h from [14b8d30277] to [0dfbcfb542].

69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
69
70
71
72
73
74
75

76
77
78
79
80
81
82
83







-
+







 * @brief A class similar to OFDictionary, but providing more options how keys
 *	  and objects should be retained, released, compared and hashed.
 */
OF_SUBCLASSING_RESTRICTED
@interface OFMapTable: OFObject <OFCopying, OFFastEnumeration>
{
	OFMapTableFunctions _keyFunctions, _objectFunctions;
	struct of_map_table_bucket *_Nonnull *_Nullable _buckets;
	struct OFMapTableBucket *_Nonnull *_Nullable _buckets;
	unsigned long _count, _capacity;
	unsigned char _rotate;
	unsigned long _mutations;
}

/**
 * @brief The key functions used by the map table.
231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
231
232
233
234
235
236
237

238
239
240
241
242
243
244
245







-
+







 *
 * @brief A class which provides methods to enumerate through an OFMapTable's
 *	  keys or objects.
 */
@interface OFMapTableEnumerator: OFObject
{
	OFMapTable *_mapTable;
	struct of_map_table_bucket *_Nonnull *_Nullable _buckets;
	struct OFMapTableBucket *_Nonnull *_Nullable _buckets;
	unsigned long _capacity, _mutations, *_Nullable _mutationsPtr;
	unsigned long _position;
}

- (instancetype)init OF_UNAVAILABLE;

/**

Modified src/OFMapTable.m from [8cb89e6a68] to [963c916eb5].

26
27
28
29
30
31
32
33

34
35
36
37

38
39
40
41
42
43
44
26
27
28
29
30
31
32

33
34
35
36

37
38
39
40
41
42
43
44







-
+



-
+








#import "OFEnumerationMutationException.h"
#import "OFInvalidArgumentException.h"
#import "OFOutOfRangeException.h"

#define MIN_CAPACITY 16

struct of_map_table_bucket {
struct OFMapTableBucket {
	void *key, *object;
	unsigned long hash;
};
static struct of_map_table_bucket deleted = { 0 };
static struct OFMapTableBucket deleted = { 0 };

static void *
defaultRetain(void *object)
{
	return object;
}

58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
58
59
60
61
62
63
64

65
66
67
68
69
70
71
72







-
+







{
	return (object1 == object2);
}

OF_DIRECT_MEMBERS
@interface OFMapTableEnumerator ()
- (instancetype)of_initWithMapTable: (OFMapTable *)mapTable
			    buckets: (struct of_map_table_bucket **)buckets
			    buckets: (struct OFMapTableBucket **)buckets
			   capacity: (unsigned long)capacity
		   mutationsPointer: (unsigned long *)mutationsPtr
    OF_METHOD_FAMILY(init);
@end

@interface OFMapTableKeyEnumerator: OFMapTableEnumerator
@end
180
181
182
183
184
185
186
187

188
189
190
191
192
193
194
180
181
182
183
184
185
186

187
188
189
190
191
192
193
194







-
+







	[super dealloc];
}

static void
resizeForCount(OFMapTable *self, unsigned long count)
{
	unsigned long fullness, capacity;
	struct of_map_table_bucket **buckets;
	struct OFMapTableBucket **buckets;

	if (count > ULONG_MAX / sizeof(*self->_buckets) ||
	    count > ULONG_MAX / 8)
		@throw [OFOutOfRangeException exception];

	fullness = count * 8 / self->_capacity;

278
279
280
281
282
283
284
285

286
287
288
289
290
291
292
278
279
280
281
282
283
284

285
286
287
288
289
290
291
292







-
+







		}
	}

	/* Key not in map table */
	if (i >= last || self->_buckets[i] == NULL ||
	    self->_buckets[i] == &deleted ||
	    !self->_keyFunctions.equal(self->_buckets[i]->key, key)) {
		struct of_map_table_bucket *bucket;
		struct OFMapTableBucket *bucket;

		resizeForCount(self, self->_count + 1);

		self->_mutations++;
		last = self->_capacity;

		for (i = hash & (self->_capacity - 1); i < last &&
645
646
647
648
649
650
651
652

653
654
655
656
657
658
659
645
646
647
648
649
650
651

652
653
654
655
656
657
658
659







-
+







@implementation OFMapTableEnumerator
- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}

- (instancetype)of_initWithMapTable: (OFMapTable *)mapTable
			    buckets: (struct of_map_table_bucket **)buckets
			    buckets: (struct OFMapTableBucket **)buckets
			   capacity: (unsigned long)capacity
		   mutationsPointer: (unsigned long *)mutationsPtr
{
	self = [super init];

	_mapTable = [mapTable retain];
	_buckets = buckets;

Modified src/OFRIPEMD160Hash.h from [222f93a653] to [0b19515ab4].

24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38







-
+







 *
 * @brief A class which provides methods to create a RIPEMD-160 hash.
 */
OF_SUBCLASSING_RESTRICTED
@interface OFRIPEMD160Hash: OFObject <OFCryptographicHash>
{
	OFSecureData *_iVarsData;
	struct of_ripemd160_hash_ivars {
	struct {
		uint32_t state[5];
		uint64_t bits;
		union of_ripemd160_hash_buffer {
			unsigned char bytes[64];
			uint32_t words[16];
		} buffer;
		size_t bufferLength;

Modified src/OFSHA1Hash.h from [e3b92b0480] to [af6053ff2d].

24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38







-
+







 *
 * @brief A class which provides methods to create an SHA-1 hash.
 */
OF_SUBCLASSING_RESTRICTED
@interface OFSHA1Hash: OFObject <OFCryptographicHash>
{
	OFSecureData *_iVarsData;
	struct of_sha1_hash_ivars {
	struct {
		uint32_t state[5];
		uint64_t bits;
		union of_sha1_hash_buffer {
			unsigned char bytes[64];
			uint32_t words[80];
		} buffer;
		size_t bufferLength;

Modified src/OFSHA224Or256Hash.h from [f40021c439] to [bbb35d6ed5].

25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
25
26
27
28
29
30
31

32
33
34
35
36
37
38
39







-
+







 * @brief A base class for SHA-224 and SHA-256.
 */
@interface OFSHA224Or256Hash: OFObject <OFCryptographicHash>
{
@private
	OFSecureData *_iVarsData;
@protected
	struct of_sha224_or_256_hash_ivars {
	struct {
		uint32_t state[8];
		uint64_t bits;
		union of_sha224_or_256_hash_buffer {
			unsigned char bytes[64];
			uint32_t words[64];
		} buffer;
		size_t bufferLength;

Modified src/OFSHA384Or512Hash.h from [a9ade386ad] to [825cb3a856].

25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
25
26
27
28
29
30
31

32
33
34
35
36
37
38
39







-
+







 * @brief A base class for SHA-384 and SHA-512.
 */
@interface OFSHA384Or512Hash: OFObject <OFCryptographicHash>
{
@private
	OFSecureData *_iVarsData;
@protected
	struct of_sha384_or_512_hash_ivars {
	struct {
		uint64_t state[8];
		uint64_t bits[2];
		union of_sha384_or_512_hash_buffer {
			unsigned char bytes[128];
			uint64_t words[80];
		} buffer;
		size_t bufferLength;