realbasic-plugins
[Top] [All Lists]

Re: CFStrings on Win32

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: CFStrings on Win32
From: Chris Little <cslittle at mac dot com>
Date: Thu, 26 Jan 2006 13:03:39 -0500
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
Thread-index: AcYijmHpoDrAMo6BEdqMlQAKldpEygAFHOsJ
Thread-topic: CFStrings on Win32
on 1/26/06 10:37 AM, Dave Addey at listmail1 at dsl dot pipex dot com wrote:

> Hi all,
> 
> I¹ve got my Win32 QuickTime-using plugin compiling now, pretty much.  But,
> one thing is causing me problems.  I need to convert a REALstring into a
> CFString ­ on Windows.  And I can¹t find a way to do so.
> 
> ³But surely there isn¹t such a thing as CFString on Windows?², you cry.
> Well, if you have the QuickTime Windows SDK installed, it contains a whole
> bunch of Win32 wrappers for common mac types such as all the CFObjects, and
> also lots of CoreAudio types.  It uses these wrappers to provide a common
> API on Mac and Windows.  So, it expects the (wrapper) CFStrings, CFURLs and
> so on on Win32 too.
> 
> I tried this (where inParameters->Location is a REALstring):
> 
>         const char *LocationCString = REALCString(inParameters->Location);
>         if (LocationCString == NULL)
>         {
>             return -1;
>         }
>  
>         CFStringRef LocationCFString = CFStringCreateWithCString(NULL,
> LocationCString, REALGetStringEncoding(inParameters->Location));
>         if (LocationCFString == NULL)
>         {
>             return -1;
>         }
> 
> This second call always returns NULL.
> 
> I tried passing the output from REALCString to the Windows debugging
> function OutputDebugString:
> 
>         OutputDebugString(LocationCString);
> 
> ...and I got a whole bunch of high-ASCII mixed characters, not what I was
> expecting at all.  On a MachO compile, the string is returned as expected
> and the CFString is created okay.
> 
> Any ideas?  Are CStrings different on Windows somehow?  Help much
> appreciated, as I¹m at a loose end without a way to get a CFString.
> 

It may be an encoding issue.  Have you tried simple string using
kCFStringEncodingWindowsLatin1 for the encoding?  What is the encoding of
the string?

Chris


_______________________________________________
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>


<Prev in Thread] Current Thread [Next in Thread>