ObjFW  Check-in [0232e0c975]

Overview
Comment:of_asprintf: Don't accept length modifiers for %@.

Same for %C.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0232e0c9759c05f937c0dc1fe145a378344f319dae00c66a21220299057ef28e
User & Date: js on 2013-11-23 03:02:17
Other Links: manifest | tags
Context
2013-11-23
03:24
of_asprintf: Change %C to %k. check-in: 5eada9f7b0 user: js tags: trunk
03:02
of_asprintf: Don't accept length modifiers for %@. check-in: 0232e0c975 user: js tags: trunk
02:07
OFZIP: Fix type mismatch. check-in: 6e61a3dc0e user: js tags: trunk
Changes

Modified src/of_asprintf.m from [0f6776e0aa] to [7dd06b0a1f].

291
292
293
294
295
296
297



298
299
300
301
302
303
304
	int tmpLen = 0;

	if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
		return false;

	switch (ctx->format[ctx->i]) {
	case '@':



		ctx->subformat[ctx->subformatLen - 1] = 's';

		@try {
			id object;

			if ((object = va_arg(ctx->arguments, id)) != nil) {
				void *pool = objc_autoreleasePoolPush();







>
>
>







291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
	int tmpLen = 0;

	if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
		return false;

	switch (ctx->format[ctx->i]) {
	case '@':
		if (ctx->lengthModifier != LENGTH_MODIFIER_NONE)
			return false;

		ctx->subformat[ctx->subformatLen - 1] = 's';

		@try {
			id object;

			if ((object = va_arg(ctx->arguments, id)) != nil) {
				void *pool = objc_autoreleasePoolPush();
313
314
315
316
317
318
319



320
321
322
323
324
325
326
		} @catch (id e) {
			free(ctx->buffer);
			@throw e;
		}

		break;
	case 'C':



		ctx->subformat[ctx->subformatLen - 1] = 's';

		{
			char buffer[5];
			size_t len = of_string_utf8_encode(
			    va_arg(ctx->arguments, of_unichar_t), buffer);








>
>
>







316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
		} @catch (id e) {
			free(ctx->buffer);
			@throw e;
		}

		break;
	case 'C':
		if (ctx->lengthModifier != LENGTH_MODIFIER_NONE)
			return false;

		ctx->subformat[ctx->subformatLen - 1] = 's';

		{
			char buffer[5];
			size_t len = of_string_utf8_encode(
			    va_arg(ctx->arguments, of_unichar_t), buffer);