[futurebasic] continued - Problem converting Pascal strings to C strings - inside CFStringRef

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2011 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Sun, 2 Oct 2011 02:24:14 -0400
Brian explained:

> The caller(s) of GetCStringFromCFString is responsible for freeing the allocated ( malloc ) storage.


Brian, thanks for the confirmation. As is evident, I've been having trouble 
with retain and release memory issues.  :-)

Also note in the code I posted, I had a legacy error from an earlier test. This
is correct:


appearance window 1,"Thomas Peters:CFDictionary", @r, _kDocumentWindowClass, wa
text _sysFont, 12
window 1


Also in the code I posted in fn ShowValueListCCode, Thomas' results can be reproduced
in FB without going to C code with these lines:


for i = 0 to ( valuesCount -1 )
cfStr = fn CFArrayGetValueAtIndex( valuesArrayRef, i )
buffer = fn GetCStringFromCFString( cfStr )
SetRect( r, 20, 10 + ((i + 1) * 32), 510, 26 + ((i + 1) * 32) )
Edit Field i+1, [@buffer], @r
free( buffer )
next i


> The last passed var of FBEditField() is a zero which tells the runtime the type being passed is a pascal string ( which it isn’t ).


Is there a variable that tells the runtime to expect a C string buffer?

Ken