ObjFW  Diff

Differences From Artifact [086a701808]:

To Artifact [d6db94dbe6]:


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	void *p, *q;
	size_t i;

	puts("Trying to add too much to an array...");
	a = [OFArray newWithItemSize: 4096];
	CATCH_EXCEPTION([a addNItems: SIZE_MAX
			  fromCArray: NULL],
	    OFOverflowException)

	puts("Trying to add something after that error...");
	p = [a getMemWithSize: 4096];
	memset(p, 255, 4096);
	[a add: p];
	if (!memcmp([a last], p, 4096))
		puts("[a last] matches with p!");







|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
	void *p, *q;
	size_t i;

	puts("Trying to add too much to an array...");
	a = [OFArray newWithItemSize: 4096];
	CATCH_EXCEPTION([a addNItems: SIZE_MAX
			  fromCArray: NULL],
	    OFOutOfRangeException)

	puts("Trying to add something after that error...");
	p = [a getMemWithSize: 4096];
	memset(p, 255, 4096);
	[a add: p];
	if (!memcmp([a last], p, 4096))
		puts("[a last] matches with p!");
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
	[a removeNItems: 2];
	if ([a items] + 2 != i) {
		puts("[a items] + 2 != i!");
		abort();
	}

	puts("Trying to remove more data than we added...");
	CATCH_EXCEPTION([a removeNItems: [a items] + 1], OFOverflowException);

	puts("Trying to access an index that does not exist...");
	CATCH_EXCEPTION([a item: [a items]], OFOverflowException);

	[a free];

	puts("Creating new array and using it to build a string...");
	a = [OFArray newWithItemSize: 1];

	for (i = 0; i < strlen(str); i++)







|


|







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
	[a removeNItems: 2];
	if ([a items] + 2 != i) {
		puts("[a items] + 2 != i!");
		abort();
	}

	puts("Trying to remove more data than we added...");
	CATCH_EXCEPTION([a removeNItems: [a items] + 1], OFOutOfRangeException);

	puts("Trying to access an index that does not exist...");
	CATCH_EXCEPTION([a item: [a items]], OFOutOfRangeException);

	[a free];

	puts("Creating new array and using it to build a string...");
	a = [OFArray newWithItemSize: 1];

	for (i = 0; i < strlen(str); i++)