ObjFW  Diff

Differences From Artifact [f51e0ac16e]:

To Artifact [6669fbc50f]:


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	/*
	 * Worst case: 3 times longer than before.
	 * Oh, and we can't use [self allocWithSize:] here as self might be a
	 * @"" literal.
	 */
	if ((ret_c = malloc((length * 3) + 1)) == NULL)
		@throw [OFOutOfMemoryException newWithClass: isa
						    andSize: (length * 3) + 1];

	for (i = 0; *s != '\0'; s++) {
		if (isalnum(*s) || *s == '-' || *s == '_' || *s == '.' ||
		    *s == '~')
			ret_c[i++] = *s;
		else {
			uint8_t high, low;







|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
	/*
	 * Worst case: 3 times longer than before.
	 * Oh, and we can't use [self allocWithSize:] here as self might be a
	 * @"" literal.
	 */
	if ((ret_c = malloc((length * 3) + 1)) == NULL)
		@throw [OFOutOfMemoryException newWithClass: isa
						       size: (length * 3) + 1];

	for (i = 0; *s != '\0'; s++) {
		if (isalnum(*s) || *s == '-' || *s == '_' || *s == '.' ||
		    *s == '~')
			ret_c[i++] = *s;
		else {
			uint8_t high, low;
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
	int st;
	OFString *ret;

	s = string;

	if ((ret_c = malloc(length + 1)) == NULL)
		@throw [OFOutOfMemoryException newWithClass: isa
						    andSize: length + 1];

	for (st = 0, i = 0, c = 0; *s; s++) {
		switch (st) {
		case 0:
			if (*s == '%')
				st = 1;
			else if (*s == '+')







|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
	int st;
	OFString *ret;

	s = string;

	if ((ret_c = malloc(length + 1)) == NULL)
		@throw [OFOutOfMemoryException newWithClass: isa
						       size: length + 1];

	for (st = 0, i = 0, c = 0; *s; s++) {
		switch (st) {
		case 0:
			if (*s == '%')
				st = 1;
			else if (*s == '+')