Re: autorelease CGImageRef?

2008-08-08 Thread Thomas Engelmeier


Am 07.08.2008 um 17:24 schrieb Chris Hanson:

This appears correct, except for the fact that, for reasons known  
only to Apple, although CFMakeCollectable is available in 10.4, the  
trivial NSMakeCollectable macro is available only in 10.5.


If you build with the Mac OS X 10.5 SDK, you should be able to use  
NSMakeCollectable since it's declared as an inline function.


The earliest release of Mac OS X you're targeting is a function of  
the Mac OS X Deployment Target build setting, not the SDK.



In theory:
- The Xcode 2.4  10.4 SDK allows deployment on ANY 10.4 version,
- The Xcode 2.5 / 3.x  SDKs for  10.4 and 10.5 SDKs allow deployment  
on recently updated 10.4 versions:


 http://www.tom-e.org/2008/04/pimp-my-xcode-sdk/

These differences are AFAIK not covered in any release notes.

Regards,
Tom_E
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: autorelease CGImageRef?

2008-08-08 Thread Jean-Daniel Dupas


Le 8 août 08 à 16:17, Thomas Engelmeier a écrit :



Am 07.08.2008 um 17:24 schrieb Chris Hanson:

This appears correct, except for the fact that, for reasons known  
only to Apple, although CFMakeCollectable is available in 10.4,  
the trivial NSMakeCollectable macro is available only in 10.5.


If you build with the Mac OS X 10.5 SDK, you should be able to use  
NSMakeCollectable since it's declared as an inline function.


The earliest release of Mac OS X you're targeting is a function of  
the Mac OS X Deployment Target build setting, not the SDK.



In theory:
- The Xcode 2.4  10.4 SDK allows deployment on ANY 10.4 version,
- The Xcode 2.5 / 3.x  SDKs for  10.4 and 10.5 SDKs allow deployment  
on recently updated 10.4 versions:


 http://www.tom-e.org/2008/04/pimp-my-xcode-sdk/



Only as long as you set the deployment target to 10.4 of course.
An application compiled using 10.5 SDK and deployment target sets to  
10.5 will not run on 10.4.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: autorelease CGImageRef?

2008-08-08 Thread Thomas Engelmeier


Am 08.08.2008 um 16:23 schrieb Jean-Daniel Dupas:



In theory:
- The Xcode 2.4  10.4 SDK allows deployment on ANY 10.4 version,
- The Xcode 2.5 / 3.x  SDKs for  10.4 and 10.5 SDKs allow  
deployment on recently updated 10.4 versions:


 http://www.tom-e.org/2008/04/pimp-my-xcode-sdk/



Only as long as you set the deployment target to 10.4 of course.
An application compiled using 10.5 SDK and deployment target sets to  
10.5 will not run on 10.4.


Well, personally I'd expect an app linked against the 10.4 SDK  from  
Xcode 3 / 2.5 to run on any version of 10.4, otherwise I'd expect it's  
name to be like 10.3.9 SDK.


Regards,
Tom_E





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: autorelease CGImageRef?

2008-08-08 Thread Chris Hanson

On Aug 7, 2008, at 7:07 PM, Peter N Lewis wrote:


At 8:24 AM -0700 7/8/08, Chris Hanson wrote:
If you build with the Mac OS X 10.5 SDK, you should be able to use  
NSMakeCollectable since it's declared as an inline function.


The earliest release of Mac OS X you're targeting is a function of  
the Mac OS X Deployment Target build setting, not the SDK.


That's true, but its not safe to do so.

For example, that will allow kCGBlendModeCopy to be used, even  
though its not available in 10.4.


It is as safe as it ever was.  You just need to put in checks for what  
OS you're running on around places you use functionality from the  
newer release(s).


Where it gets complex is trying to message or (even more so) subclass  
new 10.5 classes in code that also needs to run on 10.4.


  -- Chris

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: autorelease CGImageRef?

2008-08-07 Thread Sean McBride
On 8/7/08 10:44 AM, Peter N Lewis said:

[NSMakeCollectable(aCGImageRef) autorelease];

This appears correct, except for the fact that, for reasons known
only to Apple, although CFMakeCollectable is available in 10.4, the
trivial NSMakeCollectable macro is available only in 10.5.

Yes, quite annoying.

So expanding the NSMakeCollectable macro gives:

return [(id)CFMakeCollectable(aCGImageRef) autorelease];

True, but that cast can cause warnings, and so having it in a system
header is nice.  If you can, use the NS version.  Consider:


#import Cocoa/Cocoa.h

int main (void)
{
CFStringRef foo = nil;

[NSMakeCollectable(foo) autorelease];
[(id)CFMakeCollectable(foo) autorelease]; //line 8

return 0;
}


$ gcc-4.2 -Wcast-qual /Users/sean/Desktop/test.m
/Users/sean/Desktop/test.m: In function 'main':
/Users/sean/Desktop/test.m:8: warning: cast discards qualifiers from
pointer target type

I suspect that's why the NS version was later added.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: autorelease CGImageRef?

2008-08-07 Thread Chris Hanson

On Aug 6, 2008, at 7:44 PM, Peter N Lewis wrote:

This email sent to [EMAIL PROTECTED] 2:26 PM +0200 6/8/08,  
Jean-Daniel Dupas wrote:

If I'm not wrong, it should be something like this:

[NSMakeCollectable(aCGImageRef) autorelease];


This appears correct, except for the fact that, for reasons known  
only to Apple, although CFMakeCollectable is available in 10.4, the  
trivial NSMakeCollectable macro is available only in 10.5.


If you build with the Mac OS X 10.5 SDK, you should be able to use  
NSMakeCollectable since it's declared as an inline function.


The earliest release of Mac OS X you're targeting is a function of the  
Mac OS X Deployment Target build setting, not the SDK.


 -- Chris

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: autorelease CGImageRef?

2008-08-07 Thread Peter N Lewis

At 8:24 AM -0700 7/8/08, Chris Hanson wrote:
If you build with the Mac OS X 10.5 SDK, you should be able to use 
NSMakeCollectable since it's declared as an inline function.


The earliest release of Mac OS X you're targeting is a function of 
the Mac OS X Deployment Target build setting, not the SDK.


That's true, but its not safe to do so.

For example, that will allow kCGBlendModeCopy to be used, even though 
its not available in 10.4.


Thanks,
   Peter.

--
  Keyboard Maestro 3 Now Available!
Now With Status Menu triggers!

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac
http://www.stairways.com/   http://download.stairways.com/
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: autorelease CGImageRef?

2008-08-06 Thread Mike Abdullah

Since CGImage is derived from CFType you can just do:

[(id)aCGImageRef autorelease]

The reason being that CFType knows how to handle a -release message,  
and autorelease is just a way of deferring that message.


On 6 Aug 2008, at 09:29, Peter N Lewis wrote:


Given a CGImageRef, how can I autorelease it?

Perhaps this is obvious, or perhaps its impossible, but googling  
hasn't found me the answer yet except for a tantalizing comment in  
the docs for NSBitmapImageRep:


- (CGImageRef)CGImage (added in 10.5)
Returns an autoreleased CGImage object (an opaque type) from the  
receiver's current bitmap data.


For CFStringRef, I know I can cast it to an NSString* and then  
autorelease it, but is there an equivalent for CGImageRef?


Thanks,
  Peter.

--
 Keyboard Maestro 3 Now Available!
   Now With Status Menu triggers!

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac
http://www.stairways.com/   http://download.stairways.com/
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: autorelease CGImageRef?

2008-08-06 Thread Jean-Daniel Dupas
Be carefull when you mix CFType memory management, and obj-c memory  
management.
It works well when you do not use GC, but may become problematic if  
you do not take special care with GC code.


If I'm not wrong, it should be something like this:

[NSMakeCollectable(aCGImageRef) autorelease];


Le 6 août 08 à 12:16, Mike Abdullah a écrit :


Since CGImage is derived from CFType you can just do:

[(id)aCGImageRef autorelease]

The reason being that CFType knows how to handle a -release message,  
and autorelease is just a way of deferring that message.


On 6 Aug 2008, at 09:29, Peter N Lewis wrote:


Given a CGImageRef, how can I autorelease it?

Perhaps this is obvious, or perhaps its impossible, but googling  
hasn't found me the answer yet except for a tantalizing comment in  
the docs for NSBitmapImageRep:


- (CGImageRef)CGImage (added in 10.5)
Returns an autoreleased CGImage object (an opaque type) from the  
receiver's current bitmap data.


For CFStringRef, I know I can cast it to an NSString* and then  
autorelease it, but is there an equivalent for CGImageRef?


Thanks,
 Peter.

--
Keyboard Maestro 3 Now Available!
  Now With Status Menu triggers!

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your  
Mac
http://www.stairways.com/   http:// 
download.stairways.com/

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: autorelease CGImageRef?

2008-08-06 Thread Shawn Erickson
On Wed, Aug 6, 2008 at 6:08 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote:

 Am Mi,06.08.2008 um 14:26 schrieb Jean-Daniel Dupas:

 Be carefull when you mix CFType memory management, and obj-c memory
 management.
 It works well when you do not use GC, but may become problematic if you do
 not take special care with GC code.

 IIRC, there are some rules:

Likely best to point folks at the documentation...

http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html

-Shawn
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]