• 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: A problematic combination of malloc and getCharacters.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A problematic combination of malloc and getCharacters.


  • Subject: Re: A problematic combination of malloc and getCharacters.
  • From: "stephen joseph butler" <email@hidden>
  • Date: Wed, 24 Oct 2007 18:09:00 -0500

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: A problematic combination of malloc and getCharacters.
      • From: "stephen joseph butler" <email@hidden>
References: 
 >A problematic combination of malloc and getCharacters. (From: deepak gopal <email@hidden>)

  • Prev by Date: Re: Activating Quit Menu with a Modal Window
  • Next by Date: Re: XQuery string help
  • Previous by thread: A problematic combination of malloc and getCharacters.
  • Next by thread: Re: A problematic combination of malloc and getCharacters.
  • Index(es):
    • Date
    • Thread