crashing in CFStringInitInlineBuffer
crashing in CFStringInitInlineBuffer
- Subject: crashing in CFStringInitInlineBuffer
- From: "Jim Winetke" <email@hidden>
- Date: Wed, 29 May 2002 09:41:40 -0700
I'm pretty new to both C and Cocoa, and I think I'm good and stuck on a
crashing problem with CFStringInlineBuffer. Here's my sample method:
- (IBAction)testBuffer:(id)sender
{
CFStringRef myCFString = CFSTR("string me up");
CFStringInlineBuffer *buff;
CFRange myRange;
UniChar littleCharacter;
CFIndex idx;
myRange = CFRangeMake(0, 2); //just a test
CFStringInitInlineBuffer(myCFString, buff, myRange);
// other stuff here if I can get past the initializer
}
It's crashing in the buffer initializer (from CFString.h):
CF_INLINE void CFStringInitInlineBuffer(CFStringRef str,
CFStringInlineBuffer *buf,
CFRange range) {
buf->theString = str;
buf->rangeToBuffer = range;
buf->directBuffer = CFStringGetCharactersPtr(str);
buf->bufferedRangeStart = buf->bufferedRangeEnd = 0;
}
In the first line, "theString = str", with EXC_BAD_ACCESS. I can't figure
it out. At first I think I was casting improperly from an NSString to a
CFStringRef, but now I'm just using the CFSTR macro. CFShowStr gives me
good info on myCFString, so I presume it's a valid CFString object.
Any help would be appreciated. I'd also love to hear if there's any sample
code out there for CFStringInlineBuffer -- I couldn't find any at Apple's
site.
Jim
PS: what's up with "CFRangeMake"? It's documented as "CFMakeRange", which
I presumed off the bat as an analogue to NSMakeRange, and I burned up a
bunch of time trying to figure out the "implicit declaration" build errors.
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.