Re: Using MAPM with Cocoa/ObjectiveC
Re: Using MAPM with Cocoa/ObjectiveC
- Subject: Re: Using MAPM with Cocoa/ObjectiveC
- From: "Stephen J. Butler" <email@hidden>
- Date: Thu, 2 Dec 2010 22:47:09 -0600
Not at all familiar with this library but...
On Thu, Dec 2, 2010 at 10:36 PM, Martin Stanley
<email@hidden> wrote:
> int digits3 = m_apm_significant_digits(mapm3);
> char out3[digits3 + 2]; // add 1 for the sign and 1 for the decimal point
What about space for the '\0' terminator?
> m_apm_to_string(out3, DECIMAL_PLACES, mapm3);
>
> NSString *str = [NSString stringWithFormat:@"%s", out3];
You'd be better here using +[NSString stringWithUTF8String:]. Or
+[NSString stringWithCString:encoding:]. Or -[NSString
initWithBytes:length:encoding:] and then you don't need the '\0' at
the end.
_______________________________________________
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