home *** CD-ROM | disk | FTP | other *** search
- /*
- * Project: SimpleApp
- *
- * Filename: Utilities.c
- *
- * Author: Marco Piovanelli
- *
- * Revision History:
- *
- * 1996.05.24 MP created this file
- *
- */
-
- #include "Utilities.h"
-
- void Assert ( Boolean inAssertion )
- {
- if ( ! inAssertion )
- {
- DebugStr ( "\pAssertion Failed" ) ;
- }
- }
-
- void BlockClear ( void * ioBlockPtr, Size inBlockSize )
- {
- register char * p = ( char * ) ioBlockPtr ;
-
- while ( -- inBlockSize >= 0 )
- {
- * p ++ = 0 ;
- }
- }
-
- void InitDesc ( AEDesc * ioDesc )
- {
- ioDesc -> descriptorType = typeNull ;
- ioDesc -> dataHandle = nil ;
- }
-
- void ForgetDesc ( AEDesc * ioDesc )
- {
- if ( ( ioDesc -> descriptorType != typeNull ) || ( ioDesc -> dataHandle != nil ) )
- {
- AEDisposeDesc ( ioDesc ) ;
- }
- }
-
- OSErr FindParentSpec ( FSSpec * ioFileSpec )
- {
- CInfoPBRec pb ;
- OSErr err ;
-
- BlockClear ( & pb, sizeof ( pb ) ) ;
- pb . dirInfo . ioVRefNum = ioFileSpec -> vRefNum ;
- pb . dirInfo . ioDrDirID = ioFileSpec -> parID ;
- pb . dirInfo . ioFDirIndex = -1 ;
- pb . dirInfo . ioNamePtr = ioFileSpec -> name ;
-
- err = PBGetCatInfoSync ( & pb ) ;
-
- ioFileSpec -> parID = pb . dirInfo . ioDrParID ;
-
- return err ;
- }
-