Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9.
Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9.
- Subject: Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9.
- From: David Duncan <email@hidden>
- Date: Mon, 18 Dec 2006 14:52:26 -0800
On Dec 18, 2006, at 2:28 PM, Matt Fox-Wilson wrote:
gCString sResult = L"";
UniChar* sSource = (UniChar*)(uint16*)sRef;
This may not actually be a problem, but it is relying on the internal
layout of your class to function properly (I'm assuming sRef is
another instance of a gCString?). Unless the UniChar buffer is inline
at the start of this class and there are no virtual functions, this
shouldn't work. All of that may even be true, but I wouldn't rely on
it and it would probably be very useful to add a UniCharPtr()
accessor to your class that just returns a UniChar* to your characters.
if (sRef.Length() < 1) return sResult;
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString * nsSrc = [NSString stringWithCharacters:sSource
length:sRef.Length()];
NSString* nsExt = [nsSrc lastPathComponent];
sResult.CopyString((CFStringRef)nsExt);
return sResult;
--
David Duncan
Apple DTS Quartz and Printing
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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