• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: va_list and unanticipated format specifiers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: va_list and unanticipated format specifiers


  • Subject: Re: va_list and unanticipated format specifiers
  • From: "email@hidden" <email@hidden>
  • Date: Thu, 3 Jun 2010 14:46:48 +0100

On 3 Jun 2010, at 14:20, Ken Thomases wrote:

>
>> With the va_list we don't know the number of items.
>> With the format spec we don't know which of the format specifiers are unanticipated.
>
> Again, what constitutes "unanticipated" for a format specifier?  If there's something like "%@" in the string and it's _not_ intended by the caller to be a format specifier, then the caller should have escaped the percent sign by doubling it.
>

I think this answers the question.
Once you have a format specifier string and a va_list you are pretty much fully committed.

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 %%.

Thanks and regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com

_______________________________________________

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

  • Follow-Ups:
    • Re: va_list and unanticipated format specifiers
      • From: David Duncan <email@hidden>
    • Re: va_list and unanticipated format specifiers
      • From: Ken Thomases <email@hidden>
References: 
 >va_list and unanticipated format specifiers (From: "email@hidden" <email@hidden>)
 >Re: va_list and unanticipated format specifiers (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: va_list and unanticipated format specifiers
  • Next by Date: Re: Monster memory leak and I can't figure out why
  • Previous by thread: Re: va_list and unanticipated format specifiers
  • Next by thread: Re: va_list and unanticipated format specifiers
  • Index(es):
    • Date
    • Thread