ObjFW  Diff

Differences From Artifact [5a9553cf23]:

To Artifact [6f0115135e]:


25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41



42
43
44
45
46
47
48
    size_t *size)
{
	size_t fill = count * 4 / *size;
	size_t newsize;
	struct of_dictionary_bucket *newdata;
	uint32_t i;

	if (fill > 3) {
		if (*size > SIZE_MAX / 8)
			@throw [OFOutOfRangeException newWithClass: isa];


		newsize = *size << 1;
	} else if (fill < 1)
		newsize = *size >> 1;
	else
		return;




	newdata = [self allocMemoryForNItems: newsize
				    withSize: BUCKET_SIZE];
	memset(newdata, 0, newsize * BUCKET_SIZE);

	for (i = 0; i < *size; i++) {
		if ((*data)[i].key != nil && (*data)[i].key != DELETED) {
			uint32_t j, last;







<
|
|

>

|




>
>
>







25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    size_t *size)
{
	size_t fill = count * 4 / *size;
	size_t newsize;
	struct of_dictionary_bucket *newdata;
	uint32_t i;


	if (count > SIZE_MAX / 4)
		@throw [OFOutOfRangeException newWithClass: isa];

	if (fill > 3)
		newsize = *size << 1;
	else if (fill < 1)
		newsize = *size >> 1;
	else
		return;

	if (newsize == 0)
		@throw [OFOutOfRangeException newWithClass: isa];

	newdata = [self allocMemoryForNItems: newsize
				    withSize: BUCKET_SIZE];
	memset(newdata, 0, newsize * BUCKET_SIZE);

	for (i = 0; i < *size; i++) {
		if ((*data)[i].key != nil && (*data)[i].key != DELETED) {
			uint32_t j, last;