277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
|
char *tmp = NULL;
int tmpLen = 0;
if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
return false;
switch (ctx->format[ctx->i]) {
case '@':;
OFAutoreleasePool *pool;
ctx->subformat[ctx->subformatLen - 1] = 's';
@try {
pool = [[OFAutoreleasePool alloc] init];
} @catch (id e) {
return false;
}
@try {
id object;
if ((object = va_arg(ctx->arguments, id)) != nil)
tmpLen = asprintf(&tmp, ctx->subformat,
[[object description] UTF8String]);
else
tmpLen = asprintf(&tmp, ctx->subformat,
"(nil)");
} @catch (id e) {
free(ctx->buffer);
@throw e;
} @finally {
[pool release];
}
break;
case 'd':
case 'i':
switch (ctx->lengthModifier) {
case LENGTH_MODIFIER_NONE:
|
|
<
<
<
<
<
<
<
<
|
>
>
>
>
|
<
<
|
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
char *tmp = NULL;
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) {
OFAutoreleasePool *pool;
pool = [[OFAutoreleasePool alloc] init];
tmpLen = asprintf(&tmp, ctx->subformat,
[[object description] UTF8String]);
[pool release];
} else
tmpLen = asprintf(&tmp, ctx->subformat,
"(nil)");
} @catch (id e) {
free(ctx->buffer);
@throw e;
}
break;
case 'd':
case 'i':
switch (ctx->lengthModifier) {
case LENGTH_MODIFIER_NONE:
|