From: Dave Addey <listmail1 at dsl dot pipex dot com>
Date: Thu, 26 Jan 2006 15:37:15 +0000
I tried this (where inParameters->Location is a REALstring):
const char *LocationCString =3D REALCString(inParameters->Location);
if (LocationCString =3D=3D NULL)
{
return -1;
}
=20
CFStringRef LocationCFString =3D CFStringCreateWithCString(NULL,
LocationCString, REALGetStringEncoding(inParameters->Location));
if (LocationCFString =3D=3D NULL)
{
return -1;
}
This second call always returns NULL.
Probably because you aren't specifying an allocator. (At least,
that's the obvious difference I see.) Here's what I use.
/* Utility function to convert string format.
REAL provides an API for this but it only works on Mac.
Caller is reponsible for releasing the CFString reference.
*/
CFStringRef ConvertREALstringToCFString(REALstring str) {
const char *cstr;
CFStringRef theCFString;
// We're assuming that REALCString returns a pointer to
data, and doesn't create
// something we need to dispose of.
cstr = REALCString(str);
theCFString = CFStringCreateWithCString(kCFAllocatorDefault,
cstr, REALGetStringEncoding(str));
return theCFString;
}
Eric Baumgartner
Inquirium
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|