ObjFW  Diff

Differences From Artifact [e60942ae0f]:

To Artifact [eb19be5b1d]:


255
256
257
258
259
260
261
262
263
264
265
266

267
268
269

270
271
272

273
274
275




276
277
278
279
280

281
282
283
284
285
286
287
255
256
257
258
259
260
261


262
263

264
265


266
267
268

269
270
271

272
273
274
275
276
277

278

279
280
281
282
283
284
285
286







-
-


-
+

-
-
+


-
+


-
+
+
+
+


-

-
+







	objc_autoreleasePoolPop(pool);

	return self;
}

- initWithStringRepresentation: (OFString*)string
{
	self = [super init];

	@try {
		const char *cString;
		size_t i;
		size_t i, count;

		_itemSize = 1;
		_count = [string
		count = [string
		    cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII];

		if (_count % 2 != 0)
		if (count % 2 != 0)
			@throw [OFInvalidFormatException exception];

		_count /= 2;
		count /= 2;

		self = [self initWithCapacity: count];

		cString = [string
		    cStringWithEncoding: OF_STRING_ENCODING_ASCII];
		_items = [self allocMemoryWithSize: _count];

		for (i = 0; i < _count; i++) {
		for (i = 0; i < count; i++) {
			uint8_t c1 = cString[2 * i];
			uint8_t c2 = cString[2 * i + 1];
			uint8_t byte;

			if (c1 >= '0' && c1 <= '9')
				byte = (c1 - '0') << 4;
			else if (c1 >= 'a' && c1 <= 'f')
296
297
298
299
300
301
302
303

304
305
306
307
308
309
310
295
296
297
298
299
300
301

302
303
304
305
306
307
308
309







-
+







			else if (c2 >= 'a' && c2 <= 'f')
				byte |= c2 - 'a' + 10;
			else if (c2 >= 'A' && c2 <= 'F')
				byte |= c2 - 'A' + 10;
			else
				@throw [OFInvalidFormatException exception];

			_items[i] = byte;
			[self addItem: &byte];
		}
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;