Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A problematic combination of malloc and getCharacters.



On 10/24/07, deepak gopal <email@hidden> wrote:
> 1 - (BOOL)performChange  {
> 2  char **plistArgs = (char **) malloc(3 *sizeof(char*));
> 3  NSString *shell = @"/bin/sh";
>
> 4  char *plistScript = (char *) malloc([copyPlistScript_ length]*sizeof(unichar));
> 5  [copyPlistScript_ getCharacters:(unichar *) plistScript];
>
> 6  char *garage = (char *) malloc([garage_ lengthOfBytesUsingEncoding:NSUnicodeStringEncoding]);
> 7  [garage_ getCharacters:(unichar *) garage];

a) sizeof(unichar) != sizeof(char)

b) a unichar string is very different from a char string.

c) posix functions don't accept unichar's.

d) <http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/Articles/ManipulatingPaths.html#//apple_ref/doc/uid/20000152>
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >A problematic combination of malloc and getCharacters. (From: deepak gopal <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.