ObjFW  Diff

Differences From Artifact [c0e1b1f89f]:

To Artifact [bc01872668]:


178
179
180
181
182
183
184
185

186
187
188
189
190
191
192
193

194
195
196
197
198
199
200
178
179
180
181
182
183
184

185
186
187
188
189
190
191
192

193
194
195
196
197
198
199
200







-
+







-
+








	@try {
		const char *cString;
		size_t i;

		itemSize = 1;
		count = [string
		    lengthOfBytesUsingEncoding: OF_STRING_ENCODING_ASCII];
		    cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII];

		if (count & 1)
			@throw [OFInvalidFormatException
			    exceptionWithClass: [self class]];

		count >>= 1;
		cString = [string
		    cStringUsingEncoding: OF_STRING_ENCODING_ASCII];
		    cStringWithEncoding: OF_STRING_ENCODING_ASCII];
		items = [self allocMemoryWithSize: count];

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

231
232
233
234
235
236
237
238

239
240

241
242
243
244
245
246
247
231
232
233
234
235
236
237

238
239

240
241
242
243
244
245
246
247







-
+

-
+







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

	@try {
		itemSize = 1;

		if (!of_base64_decode(self, [string cStringUsingEncoding:
		if (!of_base64_decode(self, [string cStringWithEncoding:
		    OF_STRING_ENCODING_ASCII], [string
		    lengthOfBytesUsingEncoding: OF_STRING_ENCODING_ASCII])) {
		    cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII])) {
			Class c = [self class];
			[self release];
			@throw [OFInvalidFormatException exceptionWithClass: c];
		}
	} @catch (id e) {
		[self release];
		@throw e;
265
266
267
268
269
270
271
272
273


274
275
276
277
278
279
280
265
266
267
268
269
270
271


272
273
274
275
276
277
278
279
280







-
-
+
+







			@throw [OFInvalidArgumentException
			    exceptionWithClass: [self class]
				      selector: _cmd];

		stringValue = [element stringValue];

		if (!of_base64_decode(self, [stringValue
		    cStringUsingEncoding: OF_STRING_ENCODING_ASCII],
		    [stringValue lengthOfBytesUsingEncoding:
		    cStringWithEncoding: OF_STRING_ENCODING_ASCII],
		    [stringValue cStringLengthWithEncoding:
		    OF_STRING_ENCODING_ASCII]))
			@throw [OFInvalidFormatException
			    exceptionWithClass: [self class]];

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];