• 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: NSMakeSize and correct type
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMakeSize and correct type


  • Subject: Re: NSMakeSize and correct type
  • From: Graham Cox <email@hidden>
  • Date: Thu, 12 Mar 2009 23:23:04 +1100


On 12/03/2009, at 11:08 PM, Kevin Walzer wrote:

-(int) makeIcon: (NSString *) filePath imagewidth: (float *) width imageheight: (float *)height outputfile:(NSString *)imagePath;


@end

@implementation MacIcon


-(int) makeIcon: (NSString *) filePath imagewidth: (float *) width imageheight: (float*)height outputfile:(NSString *)imagePath {


float* means "pointer to float", so width and height are pointers....

[resizeicon setSize:NSMakeSize(width, height)];

...and NSMakeSize() does not want pointers, it wants the real thing, <float>.


 [resizeicon  setPixelsWide:(int*) width];
 [resizeicon setPixelsHigh:(int*)height];

This is also wrong. You are casting a "pointer to float" (float*) to a "pointer to int" (int*). setPixelsWide: expects just an int.


You might be a bit confused about declaring pointer types in C, so review your favourite reference on the topic.


The correction would probably be to simply get rid of the '*' for the various float and int parameters.


--Graham


_______________________________________________

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


References: 
 >NSMakeSize and correct type (From: Kevin Walzer <email@hidden>)

  • Prev by Date: NSMakeSize and correct type
  • Next by Date: Re: NSMakeSize and correct type
  • Previous by thread: NSMakeSize and correct type
  • Next by thread: Re: NSMakeSize and correct type
  • Index(es):
    • Date
    • Thread