ObjFW  Diff

Differences From Artifact [7648ed9d0c]:

To Artifact [dff98ec80e]:


149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173

174
175
176
177
178
179
180




181
182
183
184
185
186
187
		return NO;
	if (memcmp([obj cArray], data, count * itemsize))
		return NO;

	return YES;
}

- (int)compare: (id)obj
{
	int ret;

	if (![obj isKindOfClass: [OFDataArray class]])
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];
	if ([obj itemsize] != itemsize)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if ([obj count] == count)
		return memcmp(data, [obj cArray], count * itemsize);

	if (count > [obj count]) {
		if ((ret = memcmp(data, [obj cArray], [obj count] * itemsize)))
			return ret;


		return *(char*)[self itemAtIndex: [obj count]];
	} else {
		if ((ret = memcmp(data, [obj cArray], count * itemsize)))
			return ret;

		return *(char*)[obj itemAtIndex: count] * -1;
	}




}

- (uint32_t)hash
{
	uint32_t hash;
	size_t i;








|

|

|


|



|
|
<
<
<
|

>
|
|
<
|
|
<
|
>
>
>
>







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168



169
170
171
172
173

174
175

176
177
178
179
180
181
182
183
184
185
186
187
		return NO;
	if (memcmp([obj cArray], data, count * itemsize))
		return NO;

	return YES;
}

- (of_comparison_result_t)compare: (OFDataArray*)ary
{
	int cmp;

	if (![ary isKindOfClass: [OFDataArray class]])
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];
	if ([ary itemsize] != itemsize)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if ([ary count] == count) {
		if ((cmp = memcmp(data, [ary cArray], count * itemsize)) == 0)



			return OF_ORDERED_SAME;

		if (cmp > 0)
			return OF_ORDERED_DESCENDING;
		else

			return OF_ORDERED_ASCENDING;
	}


	if (count > [ary count])
		return OF_ORDERED_DESCENDING;
	else
		return OF_ORDERED_ASCENDING;
}

- (uint32_t)hash
{
	uint32_t hash;
	size_t i;