ObjFW  Diff

Differences From Artifact [9afe18d8f2]:

To Artifact [84f1c9eaa1]:


175
176
177
178
179
180
181
182

183
184
185
186
187
188
189

190
191
192
193
194
195
196
	self = [super init];

	@try {
		const char *cString;
		size_t i;

		itemSize = 1;
		count = [string UTF8StringLength];


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

		count >>= 1;
		cString = [string UTF8String];

		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;








|
>






|
>







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
	self = [super init];

	@try {
		const char *cString;
		size_t i;

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

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

		count >>= 1;
		cString = [string
		    cStringUsingEncoding: 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;

227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
- initWithBase64EncodedString: (OFString*)string
{
	self = [super init];

	@try {
		itemSize = 1;

		if (!of_base64_decode(self, [string cStringWithEncoding:
		    OF_STRING_ENCODING_ASCII], [string
		    cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII])) {
			Class c = [self class];
			[self release];
			@throw [OFInvalidFormatException exceptionWithClass: c];
		}
	} @catch (id e) {
		[self release];
		@throw e;







|

|







229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
- initWithBase64EncodedString: (OFString*)string
{
	self = [super init];

	@try {
		itemSize = 1;

		if (!of_base64_decode(self, [string cStringUsingEncoding:
		    OF_STRING_ENCODING_ASCII], [string
		    lengthOfBytesUsingEncoding: OF_STRING_ENCODING_ASCII])) {
			Class c = [self class];
			[self release];
			@throw [OFInvalidFormatException exceptionWithClass: c];
		}
	} @catch (id e) {
		[self release];
		@throw e;
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
		    ![[element namespace] isEqual: OF_SERIALIZATION_NS])
			@throw [OFInvalidArgumentException
			    exceptionWithClass: [self class]
				      selector: _cmd];

		stringValue = [element stringValue];

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

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







|
|
|







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
		    ![[element namespace] isEqual: OF_SERIALIZATION_NS])
			@throw [OFInvalidArgumentException
			    exceptionWithClass: [self class]
				      selector: _cmd];

		stringValue = [element stringValue];

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

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