ObjFW  Diff

Differences From Artifact [6d6b60fdc0]:

To Artifact [81cb0b1392]:


47
48
49
50
51
52
53


54
55
56
57


58
59
60
61
62
63
64
65
66



67
68
69
70
71
72
73
			@throw [OFInvalidFormatException exception];

		_types = [self allocMemoryWithSize: length + 1];
		memcpy(_types, types, length);

		_typesPointers = [[OFMutableData alloc]
		    initWithItemSize: sizeof(char *)];



		last = _types;
		for (size_t i = 0; i < length; i++) {
			if (isdigit(_types[i])) {


				if (last == _types + i)
					@throw [OFInvalidFormatException
					    exception];

				_types[i] = '\0';
				[_typesPointers addItem: &last];

				i++;
				for (; i < length && isdigit(_types[i]); i++);




				last = _types + i;
				i--;
			} else if (_types[i] == '{') {
				size_t depth = 0;

				for (; i < length; i++) {







>
>




>
>








|
>
>
>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
			@throw [OFInvalidFormatException exception];

		_types = [self allocMemoryWithSize: length + 1];
		memcpy(_types, types, length);

		_typesPointers = [[OFMutableData alloc]
		    initWithItemSize: sizeof(char *)];
		_offsets = [[OFMutableData alloc]
		    initWithItemSize: sizeof(size_t)];

		last = _types;
		for (size_t i = 0; i < length; i++) {
			if (isdigit(_types[i])) {
				size_t offset = _types[i] - '0';

				if (last == _types + i)
					@throw [OFInvalidFormatException
					    exception];

				_types[i] = '\0';
				[_typesPointers addItem: &last];

				i++;
				for (; i < length && isdigit(_types[i]); i++)
					offset = offset * 10 + _types[i] - '0';

				[_offsets addItem: &offset];

				last = _types + i;
				i--;
			} else if (_types[i] == '{') {
				size_t depth = 0;

				for (; i < length; i++) {
109
110
111
112
113
114
115

116
117
118
119
120
121
122
123
124
125
126
127
128





129
130
131
132
133





134

	return self;
}

- (void)dealloc
{
	[_typesPointers release];


	[super dealloc];
}

- (size_t)numberOfArguments
{
	return [_typesPointers count] - 1;
}

- (const char *)methodReturnType
{
	return *(const char **)[_typesPointers firstItem];
}






- (const char *)argumentTypeAtIndex: (size_t)index
{
	return *(const char **)[_typesPointers itemAtIndex: index + 1];
}





@end







>













>
>
>
>
>





>
>
>
>
>

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152

	return self;
}

- (void)dealloc
{
	[_typesPointers release];
	[_offsets release];

	[super dealloc];
}

- (size_t)numberOfArguments
{
	return [_typesPointers count] - 1;
}

- (const char *)methodReturnType
{
	return *(const char **)[_typesPointers firstItem];
}

- (size_t)frameLength
{
	return *(size_t *)[_offsets firstItem];
}

- (const char *)argumentTypeAtIndex: (size_t)index
{
	return *(const char **)[_typesPointers itemAtIndex: index + 1];
}

- (size_t)argumentOffsetAtIndex: (size_t)index
{
	return *(size_t *)[_offsets itemAtIndex: index + 1];
}
@end