cfstring

Code segfaults unless esp incremented

♀尐吖头ヾ 提交于 2019-11-29 16:30:06
I have the following code all it is suppose to do is print Hello World using CoreFoundation functions. However whenever I seemingly have a proper aligned stack it doesn't work, seg faulting. But then when I finally got it working the stack isn't aligned?!?!?! global _main align 4, db 0x90 extern _CFStringCreateWithCString extern _CFShow section .data hw: db 'Hello World!' ,0xA,0 section .text _main: ; entering a new function stack must be balanced right? push ebp ; saving ebp (esp + 4) mov ebp, esp ; moving registers around ; align stack as calling pushed a 4 byte address on to the stack sub

How to get an array of sentences using CFStringTokenizer?

∥☆過路亽.° 提交于 2019-11-28 23:52:47
I've created an string tokenizer like this: stringTokenizer = CFStringTokenizerCreate( NULL , (CFStringRef)str , CFRangeMake(0, [str length]) , kCFStringTokenizerUnitSentence , userLocale); But how do I obtain those sentences now from the tokenizer? The CF String Programming Guide doesn't mention CFStringTokenizer or tokens (did a full-text search in the PDF). sbooth Here is an example of CFStringTokenizer usage: CFStringRef string; // Get string from somewhere CFLocaleRef locale = CFLocaleCopyCurrent(); CFStringTokenizerRef tokenizer = CFStringTokenizerCreate( kCFAllocatorDefault , string ,

Code segfaults unless esp incremented

人走茶凉 提交于 2019-11-28 11:16:10
问题 I have the following code all it is suppose to do is print Hello World using CoreFoundation functions. However whenever I seemingly have a proper aligned stack it doesn't work, seg faulting. But then when I finally got it working the stack isn't aligned?!?!?! global _main align 4, db 0x90 extern _CFStringCreateWithCString extern _CFShow section .data hw: db 'Hello World!' ,0xA,0 section .text _main: ; entering a new function stack must be balanced right? push ebp ; saving ebp (esp + 4) mov

How to convert CFStringRef to NSString?

北城余情 提交于 2019-11-28 02:45:50
NSString *aNSString; CFStringRef aCFString; aCFString = CFStringCreateWithCString(NULL, [aNSString UTF8String], NSUTF8StringEncoding); aCFString = CFXMLCreateStringByUnescapingEntities(NULL, aCFString, NULL); How can I get a new NSString from aCFString ? NilObject NSString and CFStringRef are "Toll free bridged", meaning that you can simply typecast between them. For example: CFStringRef aCFString = (CFStringRef)aNSString; works perfectly and transparently. Likewise: NSString *aNSString = (NSString *)aCFString; The previous syntax was for MRC. If you're using ARC, the new casting syntax is as