[futurebasic] Re: [FB] FBtoC problemo

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

From: Robert Purves <listrp@...>
Date: Sat, 24 Dec 2011 20:15:47 +1300
Robert Covington wrote:

>>> I am wondering also though, if one is sending over an str255 to a Fn CFSTR which expects a str255 param, why the translator demands a string literal..."  " type, not name$ for instance.
>> The warning is to discourage programmers from abusing fn CFSTR by creating thousands of entries in its look-up table, leading to a 'performance bug'.

> Here's an example of one where I have to basically recreate the old Folder statement to create a folder in the app directory, something I do a lot for Colors, Brushes, Selections, Enhance, Actions, Plugins, and other subdirectories in the app folder. Getting a warning here is kind of annoying, I am sure you can agree. 

> Local Fn AppFolderNestedFolder(name$, outFS as ^FSSpec)
> dim as FSSpec appSpec, mySpec
> dim as OSErr err
> err = Fn GetApplicationSpec(@appSpec)
> err = fn FD_CreateDirectoryWithFSSpec( Fn CFStr(name$), appSpec, mySpec )  // Gives warning
> blockmove @mySpec, outFS, sizeof(FSSpec)
> end fn = err
> 
> The above function reflects my current lack of fluency with pointers, and how it works with GCC probably, so maybe the blockmove can be avoided..
> ?
> err = fn FD_CreateDirectoryWithFSSpec( Fn CFStr(name$), appSpec, outFS )// Instead?



err = fn FD_CreateDirectoryWithFSSpec( fn CFStr( "" + name$ ), appSpec, #outFS )

Robert P.