|
From: <cre...@us...> - 2006-07-30 17:45:24
|
Revision: 1475 Author: creecode Date: 2006-07-30 10:45:17 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1475&view=rev Log Message: ----------- minor formatting tweaks in aliastostring function, clearbytes of fs first thing in aliastofilespec function, fix crash,most of the function needed to be tweaked Modified Paths: -------------- Frontier/branches/FSRef_Migration/Common/source/langsystypes.c Modified: Frontier/branches/FSRef_Migration/Common/source/langsystypes.c =================================================================== --- Frontier/branches/FSRef_Migration/Common/source/langsystypes.c 2006-07-30 17:37:30 UTC (rev 1474) +++ Frontier/branches/FSRef_Migration/Common/source/langsystypes.c 2006-07-30 17:45:17 UTC (rev 1475) @@ -651,7 +651,7 @@ #ifdef MACVERSION // - // 2006-06-24 creedon: FSRef-ized + // 2006-07-26 creedon: FSRef-ized // // 1996-04-26 dmb: restored FollowFinderAlias code; must use if we get fnfErr. // @@ -669,6 +669,8 @@ AliasInfoType ix = asiAliasName; OSErr err; + clearbytes ( &fs, sizeof ( fs ) ); + if (!langcanusealiases ()) return (false); @@ -739,7 +741,7 @@ boolean aliastofilespec ( AliasHandle halias, ptrfilespec fs ) { // - // 2006-06-17 creedon: for Mac FSRef-ized + // 2006-07-29 creedon: for Mac FSRef-ized // // 7.0b34 PBS: Can't use ResolveAliasWithMountFlags on pre-Carbon Macs reliably, so fall back to FollowFinderAlias. // @@ -755,41 +757,56 @@ boolean flchanged; bigstring bs; OSErr err; + OSStatus status; - if (!langcanusealiases ()) - return (false); + if ( ! langcanusealiases ( ) ) + return ( false ); err = FSResolveAliasWithMountFlags ( NULL, halias, &( *fs ).fsref, &flchanged, kARMNoUI ); if ( ( err == noErr ) || ( err == fnfErr ) ) { - HFSUniStr255 name; - OSStatus status; - - status = FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNone, NULL, &name, NULL, &( *fs ).fsref ); + getfilespecparent ( fs ); + + return ( true ); - ( *fs ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length ); + } + + FSAliasInfoBitmap whichAliasInfo = kFSAliasInfoNone; + HFSUniStr255 targetName; + HFSUniStr255 volumeName; + + status = FSCopyAliasInfo ( halias, NULL, &volumeName, NULL, &whichAliasInfo, NULL ); + + if ( status == noErr ) { // try to get vol info + + HFSUniStr255ToStr255 ( &volumeName, bs ); - return ( true ); + fileparsevolname ( bs, fs ); } - if (GetAliasInfo (halias, asiVolumeName, bs) == noErr) // try to get vol info - fileparsevolname (bs, fs); + status = FSCopyAliasInfo ( halias, &targetName, NULL, NULL, &whichAliasInfo, NULL ); - getfsfile ( fs, bs ); + if ( status == noErr ) + HFSUniStr255ToStr255 ( &targetName, bs ); + else { - if (GetAliasInfo (halias, asiAliasName, bs ) != noErr) // try to set file name - langgetmiscstring (unknownstring, bs ); + langgetmiscstring ( unknownstring, bs ); + + } - if (langerrorenabled ()) { + ( *fs ).path = CFStringCreateWithPascalString ( kCFAllocatorDefault, bs, kCFStringEncodingMacRoman ); + + if ( langerrorenabled ( ) ) { - setfserrorparam ( fs ); + setoserrorparam ( bs ); - oserror (err); + oserror ( err ); + } - return (false); + return ( false ); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |