]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_transform/lib/c++utils.cpp
5 std::string
StringFromCFString(CFStringRef theString
)
7 CFIndex maxLength
= CFStringGetMaximumSizeForEncoding(CFStringGetLength(theString
), 0);
9 if (maxLength
<= 0) // roll over? just plain bad?
14 // leave room for NULL termination
17 char* buffer
= new char[maxLength
];
19 if (buffer
== NULL
) // out of memory? Naughty, naughty...
24 CFStringGetCString(theString
, buffer
, maxLength
, 0);
26 string
result(buffer
);
33 CFStringRef
CFStringFromString(std::string theString
)
35 return CFStringCreateWithCString(NULL
, theString
.c_str(), 0);
40 CFTypeRefHolder::~CFTypeRefHolder()
50 void CFTypeRefHolder::Set(CFTypeRef typeRef
)