|
From: <cre...@us...> - 2006-07-04 07:41:16
|
Revision: 1441 Author: creecode Date: 2006-07-04 00:41:12 -0700 (Tue, 04 Jul 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1441&view=rev Log Message: ----------- minor formatting tweaks 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-03 20:06:44 UTC (rev 1440) +++ Frontier/branches/FSRef_Migration/Common/source/langsystypes.c 2006-07-04 07:41:12 UTC (rev 1441) @@ -555,6 +555,7 @@ #endif + boolean filespectoalias (const ptrfilespec fs, boolean flminimal, AliasHandle *halias) { // @@ -613,123 +614,128 @@ #ifdef MACVERSION -static boolean filespecvaltoalias (tyvaluerecord *val) { + static boolean filespecvaltoalias (tyvaluerecord *val) { - // - // 2006-06-24 creedon: FSRef-ized - // - - register hdlfilespec hfs; - tyfilespec fs; - AliasHandle halias; - - if (!langcanusealiases ()) - return (false); - - hfs = (hdlfilespec) (*val).data.filespecvalue; - - fs = **hfs; - - if (!filespectoalias (&fs, false, &halias)) - return (false); - - if (!setheapvalue ((Handle) halias, aliasvaluetype, val)) - return (false); - - releaseheaptmp ((Handle) hfs); - - return (true); - } /*filespecvaltoalias*/ + // + // 2006-06-24 creedon: FSRef-ized + // + + register hdlfilespec hfs; + tyfilespec fs; + AliasHandle halias; + + if (!langcanusealiases ()) + return (false); + + hfs = (hdlfilespec) (*val).data.filespecvalue; + + fs = **hfs; + + if (!filespectoalias (&fs, false, &halias)) + return (false); + + if (!setheapvalue ((Handle) halias, aliasvaluetype, val)) + return (false); + + releaseheaptmp ((Handle) hfs); + + return (true); + + } // filespecvaltoalias #endif boolean aliastostring (Handle halias, bigstring bs) { -#ifdef MACVERSION - - // - // 2006-06-24 creedon: FSRef-ized - // - // 1996-04-26 dmb: restored FollowFinderAlias code; must use if we get fnfErr. - // - // 2.1b9 dmb: use FollowFinderAlias to avoid mounting volumes during alias resolution - // - // 1993-04-12 dmb: accept fnfErr result from ResolveAlias - // - // 1991-10-04 dmb: if alias can't be resolved, just say what volume it's on. - // - - register AliasHandle h = (AliasHandle) halias; - short flchanged; - tyfilespec fs; - bigstring bsinfo; - AliasInfoType ix = asiAliasName; - OSErr err; - - if (!langcanusealiases ()) - return (false); - - err = FSFollowFinderAlias (nil, h, false, &fs.fsref, (Boolean *) &flchanged); - - if ((err == noErr) /*|| (err == fnfErr)*/ ) { + #ifdef MACVERSION - if (flchanged) - FSUpdateAlias (nil, &fs.fsref, h, (Boolean *) &flchanged); + // + // 2006-06-24 creedon: FSRef-ized + // + // 1996-04-26 dmb: restored FollowFinderAlias code; must use if we get fnfErr. + // + // 2.1b9 dmb: use FollowFinderAlias to avoid mounting volumes during alias resolution + // + // 1993-04-12 dmb: accept fnfErr result from ResolveAlias + // + // 1991-10-04 dmb: if alias can't be resolved, just say what volume it's on. + // - return (filespectopath (&fs, bs)); - } - - langgettypestring (aliasvaluetype, bs); - - /* - if (GetAliasInfo (h, asiVolumeName, bsinfo) == noErr) { //add the volume name + register AliasHandle h = (AliasHandle) halias; + short flchanged; + tyfilespec fs; + bigstring bsinfo; + AliasInfoType ix = asiAliasName; + OSErr err; - bigstring bsaliasondisk; + if (!langcanusealiases ()) + return (false); - langgetstringlist (unresolvedaliasstring, bsaliasondisk); + err = FSFollowFinderAlias (nil, h, false, &fs.fsref, (Boolean *) &flchanged); - parsedialogstring (bsaliasondisk, bs, bsinfo, nil, nil, bsaliasondisk); + if ((err == noErr) /* || (err == fnfErr) */ ) { + + if (flchanged) + FSUpdateAlias (nil, &fs.fsref, h, (Boolean *) &flchanged); + + return (filespectopath (&fs, bs)); + } - copystring (bsaliasondisk, bs); - } - */ - - setemptystring (bs); - - // get each path element out of the alias - while (GetAliasInfo (h, ix, bsinfo) == noErr) { + langgettypestring (aliasvaluetype, bs); - if (isemptystring (bsinfo)) // reached top of path hierarchy - break; + /* + if (GetAliasInfo (h, asiVolumeName, bsinfo) == noErr) { //add the volume name + + bigstring bsaliasondisk; + + langgetstringlist (unresolvedaliasstring, bsaliasondisk); + + parsedialogstring (bsaliasondisk, bs, bsinfo, nil, nil, bsaliasondisk); + + copystring (bsaliasondisk, bs); + } + */ - if (ix > asiAliasName) - pushchar (':', bsinfo); + setemptystring (bs); - if (!insertstring (bsinfo, bs)) - break; + // get each path element out of the alias + while (GetAliasInfo (h, ix, bsinfo) == noErr) { + + if (isemptystring (bsinfo)) // reached top of path hierarchy + break; + + if (ix > asiAliasName) + pushchar (':', bsinfo); + + if (!insertstring (bsinfo, bs)) + break; + + ++ix; + } - ++ix; - } + // add the volume name + GetAliasInfo (h, asiVolumeName, bsinfo); + + pushchar (':', bsinfo); + + insertstring (bsinfo, bs); + + return (true); + + #endif + + #ifdef WIN95VERSION - // add the volume name - GetAliasInfo (h, asiVolumeName, bsinfo); + langparamerror (unimplementedverberror, bsfunctionname); + + return (false); + + #endif - pushchar (':', bsinfo); - - insertstring (bsinfo, bs); - - return (true); -#endif + } // aliastostring -#ifdef WIN95VERSION - langparamerror (unimplementedverberror, bsfunctionname); - return (false); -#endif - } /*aliastostring*/ - - boolean aliastofilespec ( AliasHandle halias, ptrfilespec fs ) { // @@ -1047,7 +1053,7 @@ disablelangerror (); - if (!filespectoalias (&fs, true, (AliasHandle *) &halias)) + if ( ! filespectoalias ( &fs, true, ( AliasHandle * ) &halias ) ) halias = nil; enablelangerror (); @@ -1100,13 +1106,14 @@ opdisposelist (hlist); return (fl); + } // langpackfileval boolean langunpackfileval (Handle hpacked, tyvaluerecord *vfile) { // - // 2006-06-24 creedon: for Mac, FSRef-zed + // 2006-07-01 creedon: clearbytes of fs first thing // // 5.0fc2 dmb: unpacking an alias on the pc, go straight for the path string // @@ -1117,7 +1124,7 @@ tyfilespec fs; boolean fl = false; - clearbytes ( &fs, sizeof ( tyfilespec ) ); + clearbytes ( &fs, sizeof ( fs ) ); if (!opunpacklist (hpacked, &hlist)) return (false); @@ -1167,30 +1174,40 @@ fl = opgetliststring (hlist, -1, filerecordpath, bspath); if (fl) { + // here we should check to see if the file path is from the correct platform??? + if (opgetliststring (hlist, -1, filerecordplatform, bsplat)) { + #ifdef MACVERSION + if (equalidentifiers (bsplat, bsplatformwin)) { - /* ERROR or Conversion HERE! */ + // ERROR or Conversion HERE! } + #endif #ifdef WIN95VERSION + if (equalidentifiers (bsplat, bsplatformmac)) { - /* ERROR or Conversion HERE! */ + // ERROR or Conversion HERE! } + #endif } fl = pathtofilespec (bspath, &fs); + } } if (fl) fl = newfilledhandle (&fs, filespecsize (fs), (Handle *) &(*vfile).data.filespecvalue); else { + // *** once we make tyfilespec the new record on both platforms, this will be ok // *** but for now, we need to make a string value + (*vfile).valuetype = stringvaluetype; fl = newtexthandle (bspath, &(*vfile).data.stringvalue); @@ -1199,14 +1216,17 @@ break; default: + assert (false); + break; } opdisposelist (hlist); return (fl); - } /*langunpackfileval*/ + + } // langunpackfileval #ifdef WIN95VERSION This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |