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: Dave Addey <listmail1 at dsl dot pipex dot com>
Date: Fri, 27 Jan 2006 14:41:24 +0000
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
Thread-index: AcYjT774/Vkgk49CEdqp0QAKldpEyg==
Thread-topic: CFStrings on Win32
Hi Theo,

That's a thought... How would that affect my Cstring on Windows?

Dave.

> From: "Theodore H. Smith" <delete at elfdata dot com>
> Reply-To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot 
> com>
> Date: Fri, 27 Jan 2006 14:38:48 +0000
> To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
> Subject: Re: CFStrings on Win32
> 
> 
> Did you consider endian issues?
> 
> On 27 Jan 2006, at 13:48, Dave Addey wrote:
> 
>> Hi all,
>> 
>> Thanks for all of the help with this.  Unfortunately, I still can't
>> get it
>> to work.  All of this approach works for creating a CFString, but
>> Cstring()
>> is still returning weird characters on Windows.  It's specifically the
>> CString from the REALstring which is causing problems, rather than the
>> CFString creation.  For some reason, the CString just isn't coming
>> back out
>> correctly on Windows from within the plugin code.  (It's fine when
>> set and
>> retrieved in RB).
>> 
>> I've spent ages pulling my hair out over this one, so I think I'm
>> going to
>> try a different approach - perhaps using declares for this bit, and
>> then
>> passing in CFObject references to the plugin instead.
>> 
>> Dave.
>> 
>>> From: Eric Baumgartner <eric at inquirium dot net>
>>> Reply-To: REALbasic Plugins <realbasic-
>>> plugins at lists dot realsoftware dot com>
>>> Date: Thu, 26 Jan 2006 18:37:02 -0800
>>> To: <realbasic-plugins at lists dot realsoftware dot com>
>>> Subject: Re: CFStrings on Win32
>>> 
>>>> 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>
>> 
>> 
>> _______________________________________________
>> 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>
>> 
>> 
> 
> 
> --
> http://elfdata.com/plugin/
> 
> What does our work achieve, if it's not making the world a happier
> place?
> http://www.whatnextjournal.co.uk/Pages/Next/Happiness.html
> When's the last time you thought deeply about how to improve our lives?
> 
> 
> _______________________________________________
> 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>


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