Re: va_list and unanticipated format specifiers
Re: va_list and unanticipated format specifiers
- Subject: Re: va_list and unanticipated format specifiers
- From: David Duncan <email@hidden>
- Date: Thu, 3 Jun 2010 17:00:54 -0700
On Jun 3, 2010, at 6:46 AM, email@hidden wrote:
> My app runs user supplied scripts.
>
> These scripts may contain RubyCocoa statements such as:
> OSX::NSLog("task parameters are %@ and %@", a, b)
>
> These scripts may contain errors and the generated error reports may contain the likes of:
> syntax error, unexpected tIDENTIFIER, expecting $end OSX::NSLog("task parameters are %@ and %@", a, b)
>
> When the error is logged the extra format specifiers trip the code.
>
> Unanticipated transpires to mean unanticipated by me!
>
> All I need to do is sanitise those logging statements that derive from script errors and escape % as %%.
If your client expects only C format specifies, then I would recommend you use a C formatter (such as vasprintf) to do the formatting, then use NSLog to log the produced string. Any other format string errors are the client's to deal with.
Yes, this would preclude the client logging objects, but from the sounds of your specification, any escaping you did would have the same effect.
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden