[futurebasic] Re: [FB] FBtoC : Iterate folder

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2008 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Sat, 19 Jan 2008 11:15:46 +1300
Steve wrote:

> At the end of the compile in FBtoC, it complains about the following  
> for the IterateFolder code for the xref dimensioned arrays.
> What would be the proper pointer type to pass ?
>
> xref catInfoArray(_maxInt) as FSCatalogInfo

> if catInfoArray then DisposePtr(catInfoArray)

> /Users/mactech/Desktop/newmacpos/build_temp/_8_filehanding.c:85:  
> warning: passing argument 1 of 'DisposePtr' from incompatible  
> pointer type

Three possible remedies:
[1] Ignore the warning as irritating but harmless.
[2] If your program is about to terminate, you don't need to dispose  
the array memory.
[3] Replace fn NewPtr() by fn malloc(), and DisposePtr() by fn free()

'----------------------
_myArrayNumElements = 100 // index 0-99

xref myRectArray1(_myArrayNumElements - 1) as Rect
myRectArray1 = fn NewPtr( _myArrayNumElements*sizeof( Rect ) )
//...do stuff with array...
DisposePtr( myRectArray1 ) // gcc warning: passing argument 1 of  
'DisposePtr' from incompatible pointer type

xref myRectArray2(_myArrayNumElements - 1) as Rect
myRectArray2 = fn malloc( _myArrayNumElements*sizeof( Rect ) )
//...do stuff with array...
fn free( myRectArray2 ) // no warning from gcc
'----------------------

Robert P.