--- xerces-c-src_2_8_0/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp	2007-08-28 13:44:07.000000000 -0500
+++ xerces-c-src_2_8_0.new/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp	2009-09-01 12:27:46.000000000 -0500
@@ -55,11 +55,14 @@
 #include <xercesc/util/XMLUni.hpp>
 #include <xercesc/util/XMLString.hpp>
 #include <xercesc/util/Platforms/MacOS/MacOSPlatformUtils.hpp>
-#include <xercesc/util/Platforms/MacOS/MacCarbonFile.hpp>
 #include <xercesc/util/Platforms/MacOS/MacPosixFile.hpp>
 #include <xercesc/util/PanicHandler.hpp>
 #include <xercesc/util/OutOfMemoryException.hpp>
 
+#include <time.h>
+#include <sys/time.h>
+#include <libkern/OSAtomic.h>
+
 #if (defined(XML_USE_INMEMORY_MSGLOADER) || defined(XML_USE_INMEM_MESSAGELOADER))
    #include <xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp>
 #endif
@@ -94,15 +97,6 @@
 XMLCh*	ConvertSlashToColon(XMLCh* p, std::size_t charCount);
 char*	ConvertSlashToColon(char* p, std::size_t charCount);
 
-XMLCh*	XMLCreateFullPathFromFSRef_X(const FSRef& startingRef, MemoryManager* const manager);
-XMLCh*	XMLCreateFullPathFromFSRef_Classic(const FSRef& startingRef, MemoryManager* const manager);
-XMLCh*	XMLCreateFullPathFromFSSpec_Classic(const FSSpec& startingSpec,
-                                            MemoryManager* const manager);
-bool	XMLParsePathToFSRef_X(const XMLCh* const pathName, FSRef& ref, MemoryManager* const manager);
-bool	XMLParsePathToFSRef_Classic(const XMLCh* const pathName, FSRef& ref, MemoryManager* const manager);
-bool	XMLParsePathToFSSpec_Classic(const XMLCh* const pathName, FSSpec& spec, MemoryManager* const manager);
-
-
 //----------------------------------------------------------------------------
 //  Local Data
 //
@@ -152,7 +146,7 @@
 bool gHasFSPathAPIs			= false;
 bool gPathAPIsUsePosixPaths	= false;
 bool gHasMPAPIs				= false;
-bool gUsePosixFiles			= false;
+bool gUsePosixFiles			= true;
 bool gUseGETCWD				= false;
 
 
@@ -294,26 +288,22 @@
 XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
                               MemoryManager* const manager)
 {
-    XMLCh* path = NULL;
+    //
+    //  NOTE: The path provided has always already been opened successfully,
+    //  so we know that its not some pathological freaky path. It comes in
+    //  in native format, and goes out as Unicode always
+    //
+    char* newSrc = XMLString::transcode(srcPath, manager);
+    ArrayJanitor<char> janText(newSrc, manager);
 
-    if (gHasHFSPlusAPIs)
-    {
-        FSRef ref;
-        if (   !XMLParsePathToFSRef(srcPath, ref, manager)
-			|| (path = XMLCreateFullPathFromFSRef(ref, manager)) == NULL
-		   )
-            path = XMLString::replicate(srcPath, manager);
-    }
-    else
-    {
-        FSSpec spec;
-        if (   !XMLParsePathToFSSpec(srcPath, spec, manager)
-		    || (path = XMLCreateFullPathFromFSSpec(spec, manager)) == NULL
-		   )
-            path = XMLString::replicate(srcPath, manager);
-    }
+    // Use a local buffer that is big enough for the largest legal path
+    char absPath[PATH_MAX + 1];
+    
+    // get the absolute path
+    if (!realpath(newSrc, absPath))
+   		ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName, manager);
 
-    return path;
+    return XMLString::transcode(absPath, manager);
 }
 
 
@@ -321,29 +311,27 @@
 XMLPlatformUtils::isRelative(const XMLCh* const toCheck
                              , MemoryManager* const manager)
 {
-    return (toCheck[0] != L'/');
+    // Check for pathological case of empty path
+    if (!toCheck || !toCheck[0])
+        return false;
+
+    //
+    //  If it starts with a slash, then it cannot be relative.
+    //
+    return toCheck[0] != XMLCh('/');
 }
 
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-	//	Get a newly allocated path to the current directory
-	FSSpec spec;
+    char dirBuf[PATH_MAX + 2];
+    char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
+
+    if (!curDir)
+        ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+                 XMLExcepts::File_CouldNotGetBasePathName, manager);
 
-	//  Parse to path to determine current directory: this allows the
-	//  path parsing routines to determine best way to find the current
-	//  directory.
-	XMLCh curDirPath[] = { '.', 0 };
-	XMLCh* path =
-		(XMLParsePathToFSSpec(curDirPath, spec, manager))
-			? XMLCreateFullPathFromFSSpec(spec, manager)
-			: NULL;
-			
-    if (!path)
-		 ThrowXMLwithMemMgr(XMLPlatformUtilsException,
-	           XMLExcepts::File_CouldNotGetBasePathName, manager);
-	           
-	return path;
+    return XMLString::transcode(curDir, manager);
 }
 
 
@@ -360,15 +348,13 @@
 unsigned long
 XMLPlatformUtils::getCurrentMillis()
 {
-	if ((void*)kUnresolvedCFragSymbolAddress != UpTime)
-	{
-		// Use Driver services routines, now in Carbon,
-		// to get the elapsed milliseconds.
-		AbsoluteTime time = UpTime();
-		return AbsoluteToDuration(time);
-	}
-	else
-		return TickCount() * 100 / 6;
+	unsigned long ms = 0;
+
+   struct timeval aTime;
+   gettimeofday(&aTime, NULL);
+   ms = (unsigned long) (aTime.tv_sec * 1000 + aTime.tv_usec / 1000);
+
+	return ms;
 }
 
 
@@ -462,10 +448,10 @@
     // Replace *toFill with newValue iff *toFill == toCompare,
     // returning previous value of *toFill
 
-    Boolean success = CompareAndSwap(
-        reinterpret_cast<UInt32>(toCompare),
-        reinterpret_cast<UInt32>(newValue),
-        reinterpret_cast<UInt32*>(toFill));
+    Boolean success = OSAtomicCompareAndSwapPtrBarrier(
+                                 const_cast<void*>(toCompare),
+                                 const_cast<void*>(newValue),
+                                 toFill);
 
     return (success) ? const_cast<void*>(toCompare) : *toFill;
 }
@@ -482,14 +468,14 @@
 int
 XMLPlatformUtils::atomicIncrement(int &location)
 {
-    return IncrementAtomic(reinterpret_cast<long*>(&location)) + 1;
+    return OSAtomicIncrement32(reinterpret_cast<int32_t*>(&location)) + 1;
 }
 
 
 int
 XMLPlatformUtils::atomicDecrement(int &location)
 {
-    return DecrementAtomic(reinterpret_cast<long*>(&location)) - 1;
+    return OSAtomicDecrement32(reinterpret_cast<int32_t*>(&location)) - 1;
 }
 
 
@@ -503,7 +489,7 @@
 void
 XMLPlatformUtils::platformInit()
 {
-	long value = 0;
+	int32_t value = 0;
 
 	//	Detect available functions
 	
@@ -519,28 +505,12 @@
         gHasFS2TBAPIs		= (value & (1 << gestaltFSSupports2TBVols)) != 0;
         gHasHFSPlusAPIs		= (value & (1 << gestaltHasHFSPlusAPIs)) != 0;
 
-        #if TARGET_API_MAC_CARBON
-        gHasFSPathAPIs		= ((void*)kUnresolvedCFragSymbolAddress != FSPathMakeRef);
-        #else
-        gHasFSPathAPIs		= false;
-        #endif
-
-        gPathAPIsUsePosixPaths = gHasFSPathAPIs
-								 && (value & (1 << gestaltFSUsesPOSIXPathsForConversion));
+        gPathAPIsUsePosixPaths = true;
     }
 
 	//	We require FSSpecs at a minimum
     gFileSystemCompatible	= gHasFSSpecAPIs;
 
-	//	Determine which file system to use (posix or carbon file access)
-	//	If we're using Metrowerks MSL, we surely don't want posix paths,
-	//	as MSL doesn't use them.
-	#if __MSL__ && (__MSL__ < 0x08000 || _MSL_CARBON_FILE_APIS)
-	gUsePosixFiles			= false;
-	#else
-	gUsePosixFiles			= gMacOSXOrBetter;
-	#endif
-	
 	//  Determine whether to use getcwd or not. We use it only if we're not using MSL,
 	//  and we're on a Mac OS X system.
 	#if __MSL__
@@ -754,712 +724,12 @@
 {
 	XMLMacAbstractFile* result = NULL;
 	
-	if (gUsePosixFiles)
 		result = new (manager) XMLMacPosixFile;
-	else
-		result = new (manager) XMLMacCarbonFile;
-		
-	return result;
-}
-
-
-bool
-XMLParsePathToFSRef(const XMLCh* const pathName, FSRef& ref, MemoryManager* const manager)
-{
-	bool result;
-	
-	//	If FSPathMakeRef is available, we use it to parse the
-	//	path: this gives us "standard" path support under MacOS X.
-	//	Without this, our paths in that environment would always
-	//	have a volume name at their root...which would look
-	//	"normal" to Mac users, but not normal to unix users. Since
-	//	we're making "unix" paths, we'll stick with the unix
-	//	style paths. This also allows us to easilly take paths
-	//	off the command line.
-	//
-	//	FSPathMakeRef is available on Mac OS X and in CarbonLib 1.1
-	//	and greater. But on classic under CarbonLib, it expects paths
-	//	to contain ':' separators, for which we're not prepared. Since
-	//	this isn't a case where we need to use it, we drop back to the
-	//	classic case for this.
-		
-	if (TARGET_API_MAC_CARBON && gHasFSPathAPIs && gPathAPIsUsePosixPaths)
-		result = XMLParsePathToFSRef_X(pathName, ref, manager);
-	else
-		result = XMLParsePathToFSRef_Classic(pathName, ref, manager);
-		
-	return result;
-}
-
-
-bool
-XMLParsePathToFSRef_X(const XMLCh* const pathName, FSRef& ref, MemoryManager* const manager)
-{
-	//	Parse Path to FSRef using FSPathMakeRef as available under
-	//	Mac OS X and CarbonLib 1.1 and greater.
-	
-	OSStatus err = noErr;	
-	std::size_t pathLen = XMLString::stringLen(pathName);
-
-    //	Transcode XMLCh into UniChar
-	UniChar uniBuf[kMaxMacStaticPathChars];
-	CopyXMLChsToUniChars(pathName, uniBuf, pathLen, kMaxMacStaticPathChars);
-	
-	//	Transcode Unicode to UTF-8
-	char utf8Buf[kMaxMacStaticPathChars];
-	pathLen = TranscodeUniCharsToUTF8(uniBuf, utf8Buf, pathLen, kMaxMacStaticPathChars-1);
-	
-	//	Terminate the path
-	char* p = utf8Buf;
-	p[pathLen++] = '\0';
-	
-	//	If it's a relative path, pre-pend the current directory to the path.
-	//	FSPathMakeRef doesn't deal with relativity on the front of the path
-	if (*p != '/' && kMaxMacStaticPathChars > pathLen)
-	{
-		//	Right justify the user path to make room for the pre-pended path
-		std::memmove(p + kMaxMacStaticPathChars - pathLen, p, pathLen);
-		*p = '\0';
-				
-		//	Get the current directory
-		if (gUseGETCWD)
-		{
-			//	Get current directory path, leaving room for one '/' after
-			if (err == noErr)
-				getcwd(p, kMaxMacStaticPathChars - pathLen - 1);
-		}
-		else
-		{
-			//	Get current directory path, leaving room for one '/' after
-
-			//	We quiz the carbon file manager for the current directory.
-			//	Note that carbon defaults its concept of the current directory
-			//  to the location of the executable.
-	        FSSpec spec;
-			if (err == noErr)
-				err = FSMakeFSSpec(0, 0, NULL, &spec);
-	        if (err == noErr)
-	            err = FSpMakeFSRef(&spec, &ref);
-			
-			//	Get current directory path, leaving room for one '/' after
-			if (err == noErr)
-				err = FSRefMakePath(&ref, reinterpret_cast<UInt8*>(p), kMaxMacStaticPathChars - pathLen - 1);
-		}
-					
-		//	Now munge the two paths back together
-		std::size_t prefixLen = std::strlen(p);
-		p[prefixLen++] = '/';
-		std::memmove(p + prefixLen, p + kMaxMacStaticPathChars - pathLen, pathLen);
-		
-		//	We now have a path from an absolute starting point
-	}
-	
-	//	Let the OS discover the location
-	Boolean isDirectory = false;
-	if (err == noErr)
-		err = FSPathMakeRef(reinterpret_cast<UInt8*>(p), &ref, &isDirectory);
-		
-	//	Return true on success
-	return (err == noErr);
-}
-
-
-bool
-XMLParsePathToFSRef_Classic(const XMLCh* const pathName, FSRef& ref, MemoryManager* const manager)
-{
-	//	Parse Path to FSRef by stepping manually through path components.
-	
-	//	Path's parsed in this way must always begin with a volume name.
-	//	This assumption would fail for standard unix paths under Mac OS X,
-	//	so for those cases we use the routine XMLParsePathToFSRef_Carbon
-	//	above.
-	
-    const XMLCh* p = pathName;
-    const XMLCh* pEnd;
-    std::size_t segLen;
-	
-	const std::size_t kXMLBufCount = 256;
-	XMLCh xmlBuf[kXMLBufCount];
-
-    OSErr err = noErr;
-
-    if (*p == L'/')
-    {
-        // Absolute name: grab the first component as volume name
-
-        // Find the end of the path segment
-        for (pEnd = ++p; *pEnd && *pEnd != L'/'; ++pEnd) ;
-        segLen = pEnd - p;
-
-        // Try to find a volume that matches this name
-        for (ItemCount volIndex = 1; err == noErr; ++volIndex)
-        {
-            HFSUniStr255 hfsStr;
-            hfsStr.length = 0;
-
-            // Get the volume name
-            err = FSGetVolumeInfo(
-                0,
-                volIndex,
-                static_cast<FSVolumeRefNum*>(NULL),
-                0,
-                static_cast<FSVolumeInfo*>(NULL),
-                &hfsStr,
-                &ref
-                );
-
-            // Compare against our path segment
-            if (err == noErr && segLen == hfsStr.length)
-            {
-            	//	Case-insensitive compare
-            	if (XMLString::compareNIString(
-									ConvertSlashToColon(
-										CopyUniCharsToXMLChs(hfsStr.unicode, xmlBuf, segLen, kXMLBufCount),
-										segLen),
-									p, segLen) == 0)
-                    break;  // we found our volume
-            }
-        }
-
-        p = pEnd;
-    }
-    else
-    {
-        // Relative name, so get the default directory as parent ref
-        FSSpec spec;
-        err = FSMakeFSSpec(0, 0, NULL, &spec);
-        if (err == noErr)
-            err = FSpMakeFSRef(&spec, &ref);
-    }
-
-    // ref now refers to the parent directory: parse the rest of the path
-    while (err == noErr && *p)
-    {
-        switch (*p)
-        {
-        case L'/':   // Just skip any number of path separators
-            ++p;
-            break;
-
-        case L'.':   // Potentially "current directory" or "parent directory"
-            if (p[1] == L'/' || p[1] == 0)       // "current directory"
-            {
-                ++p;
-                break;
-            }
-            else if (p[1] == L'.' && (p[2] == L'/' || p[2] == 0)) // "parent directory"
-            {
-                p += 2;  // Get the parent of our parent
-
-                FSCatalogInfo catalogInfo;
-                err = FSGetCatalogInfo(
-                    &ref,
-                    kFSCatInfoParentDirID,
-                    &catalogInfo,
-                    static_cast<HFSUniStr255*>(NULL),
-                    static_cast<FSSpec*>(NULL),
-                    &ref
-                    );
-
-                // Check that we didn't go too far
-                if (err != noErr || catalogInfo.parentDirID == fsRtParID)
-                    return false;
-
-                break;
-            }
-            else // some other sequence of periods...fall through and treat as segment
-                ;
-
-        default:
-            // Find the end of the path segment
-            for (pEnd = p; *pEnd && *pEnd != L'/'; ++pEnd) ;
-            segLen = pEnd - p;
-			
-            // pEnd now points either to '/' or NUL
-            // Create a new ref using this path segment
-            err = FSMakeFSRefUnicode(
-                &ref,
-                segLen,
-                ConvertColonToSlash(
-                	CopyXMLChsToUniChars(p, reinterpret_cast<UniChar*>(xmlBuf), segLen, kXMLBufCount),
-                	segLen),
-                kTextEncodingUnknown,
-                &ref
-                );
-
-            p = pEnd;
-            break;
-        }
-    }
-
-    return err == noErr;
-}
-
-
-bool
-XMLParsePathToFSSpec(const XMLCh* const pathName, FSSpec& spec,
-                            MemoryManager* const manager)
-{
-	//	Parse Path to an FSSpec
-
-	//	If we've got HFS+ APIs, do this in terms of refs so that
-	//	we can grandfather in the use of FSPathMakeRef under Mac OS X
-	//	and CarbonLib 1.1. Otherwise, do it the hard way.
-	
-	bool result = false;
-	
-	if (gHasHFSPlusAPIs)
-	{
-		//	Parse to a ref
-		FSRef ref;
-		result = XMLParsePathToFSRef(pathName, ref, manager);
 		
-		//	Down convert to a spec
-		if (result)
-			result = (noErr == FSGetCatalogInfo(&ref,
-								kFSCatInfoNone,
-								static_cast<FSCatalogInfo*>(NULL),	// catalogInfo
-								static_cast<HFSUniStr255*>(NULL),	// outName
-								&spec,
-								static_cast<FSRef*>(NULL)			// parentRef
-								));
-	}
-	else
-		result = XMLParsePathToFSSpec_Classic(pathName, spec, manager);
-		
-	//	Return true on success
 	return result;
 }
 
 
-bool
-XMLParsePathToFSSpec_Classic(const XMLCh* const pathName, FSSpec& spec,
-                            MemoryManager* const manager)
-{
-	//	Manually parse the path using FSSpec APIs.
-	
-    //	Transcode the path into ascii
-    const char* p = XMLString::transcode(pathName, manager);
-    ArrayJanitor<const char> janPath(p, manager);
-    const char* pEnd;
-    std::size_t segLen;
-
-    OSStatus err = noErr;
-    Str255 name;  // Must be long enough for a partial pathname consisting of two segments (64 bytes)
-
-    if (*p == '/')
-    {
-        // Absolute name: grab the first component as volume name
-
-        // Find the end of the path segment
-        for (pEnd = ++p; *pEnd && *pEnd != '/'; ++pEnd) ;
-        segLen = pEnd - p;
-
-        // Try to find a volume that matches this name
-        for (ItemCount volIndex = 1; err == noErr; ++volIndex)
-        {
-            FSVolumeRefNum volRefNum;
-
-            if (gHasFS2TBAPIs)
-            {
-                XVolumeParam xVolParam;
-                name[0] = 0;
-                xVolParam.ioNamePtr  = name;
-                xVolParam.ioVRefNum  = 0;
-                xVolParam.ioXVersion = 0;
-                xVolParam.ioVolIndex = volIndex;
-                err = PBXGetVolInfoSync(&xVolParam);
-                volRefNum = xVolParam.ioVRefNum;
-            }
-            else
-            {
-#if !TARGET_API_MAC_CARBON
-                HParamBlockRec hfsParams;
-                name[0] = 0;
-                hfsParams.volumeParam.ioNamePtr  = name;
-                hfsParams.volumeParam.ioVRefNum  = 0;
-                hfsParams.volumeParam.ioVolIndex = volIndex;
-                err = PBHGetVInfoSync(&hfsParams);
-                volRefNum = hfsParams.volumeParam.ioVRefNum;
-#else
-                err = nsvErr;
-#endif
-            }
-
-            // Compare against our path segment
-            if (err == noErr && segLen == StrLength(name))
-            {
-            	//	Case-insensitive compare
-            	if (XMLString::compareNIString(
-	            		ConvertSlashToColon(reinterpret_cast<char*>(&name[1]), segLen),
-	            		p, segLen) == 0)
-                {
-                    // we found our volume: fill in the spec
-                    err = FSMakeFSSpec(volRefNum, fsRtDirID, NULL, &spec);
-                    break;
-                }
-            }
-        }
-
-        p = pEnd;
-    }
-    else
-    {
-        // Relative name, so get the default directory as parent spec
-        err = FSMakeFSSpec(0, 0, NULL, &spec);
-    }
-
-    // We now have a parent directory in the spec.
-    while (err == noErr && *p)
-    {
-        switch (*p)
-        {
-        case '/': 	// Just skip any number of path separators
-            ++p;
-            break;
-
-        case L'.': 	// Potentially "current directory" or "parent directory"
-            if (p[1] == '/' || p[1] == 0)      // "current directory"
-            {
-                ++p;
-                break;
-            }
-            else if (p[1] == '.' && (p[2] == '/' || p[2] == 0)) // "parent directory"
-            {
-                p += 2;  // Get the parent of our parent
-
-                CInfoPBRec catInfo;
-                catInfo.dirInfo.ioNamePtr = NULL;
-                catInfo.dirInfo.ioVRefNum = spec.vRefNum;
-                catInfo.dirInfo.ioFDirIndex = -1;
-                catInfo.dirInfo.ioDrDirID = spec.parID;
-                err = PBGetCatInfoSync(&catInfo);
-
-                // Check that we didn't go too far
-                if (err != noErr || catInfo.dirInfo.ioDrParID == fsRtParID)
-                    return false;
-
-                // Update our spec
-                if (err == noErr)
-                    err = FSMakeFSSpec(spec.vRefNum, catInfo.dirInfo.ioDrDirID, NULL, &spec);
-
-                break;
-            }
-            else // some other sequence of periods...fall through and treat as segment
-                ;
-
-        default:
-            {
-                // Find the end of the path segment
-                for (pEnd = p; *pEnd && *pEnd != '/'; ++pEnd) ;
-                segLen = pEnd - p;
-
-                // Check for name length overflow
-                if (segLen > 31)
-                    return false;
-
-                // Make a partial pathname from our current spec to the new object
-                unsigned char* partial = &name[1];
-
-                *partial++ = ':';       // Partial leads with :
-                const unsigned char* specName = spec.name; // Copy in spec name
-                for (int specCnt = *specName++; specCnt > 0; --specCnt)
-                    *partial++ = *specName++;
-
-                *partial++ = ':';       // Separator
-                while (p != pEnd)       // Copy in new element
-               	{
-                	if (*p == ':')				// Convert : to /
-                	{
-                		*partial++ = '/';
-                		p++;
-                	}
-                	else
-                		*partial++ = *p++;
-				}
-				
-                name[0] = partial - &name[1];   // Set the name length
-
-                // Update the spec
-                err = FSMakeFSSpec(spec.vRefNum, spec.parID, name, &spec);
-            }
-            break;
-        }
-    }
-
-    return err == noErr;
-}
-
-
-XMLCh*
-XMLCreateFullPathFromFSRef(const FSRef& startingRef,
-                            MemoryManager* const manager)
-{
-	XMLCh* result = NULL;
-	
-	//	If FSRefMakePath is available, we use it to create the
-	//	path: this gives us "standard" path support under MacOS X.
-	//	Without this, our paths in that environment would always
-	//	have a volume name at their root...which would look
-	//	"normal" to Mac users, but not normal to unix users. Since
-	//	we're making "unix" paths, we'll stick with the unix
-	//	style paths. This also allows us to easilly take paths
-	//	off the command line.
-	//
-	//	FSRefMakePath is available on Mac OS X and in CarbonLib 1.1
-	//	and greater. But we use it only on X since on Classic it
-	//	makes paths with ':' separators, which really confuses us!
-	
-	if (TARGET_API_MAC_CARBON && gHasFSPathAPIs && gPathAPIsUsePosixPaths)
-		result = XMLCreateFullPathFromFSRef_X(startingRef, manager);
-	else
-		result = XMLCreateFullPathFromFSRef_Classic(startingRef, manager);
-		
-	return result;
-}
-
-
-XMLCh*
-XMLCreateFullPathFromFSRef_X(const FSRef& startingRef,
-                            MemoryManager* const manager)
-{
-	//	Create the path using FSRefMakePath as available on Mac OS X
-	//	and under CarbonLib 1.1 and greater.
-	OSStatus err = noErr;
-	
-	//	Make the path in utf8 form
-	char utf8Buf[kMaxMacStaticPathChars];
-	utf8Buf[0] = '\0';
-	
-	if (err == noErr)
-		err = FSRefMakePath(&startingRef, reinterpret_cast<UInt8*>(utf8Buf), kMaxMacStaticPathChars);
-		
-	//	Bail if path conversion failed
-	if (err != noErr)
-		return NULL;
-	
-	//	Transcode into UniChars
-	UniChar uniBuf[kMaxMacStaticPathChars];
-	std::size_t pathLen = TranscodeUTF8ToUniChars(utf8Buf, uniBuf, kMaxMacStaticPathChars-1);
-	uniBuf[pathLen++] = 0;
-	
-	//	Transcode into a dynamically allocated buffer of XMLChs
-	ArrayJanitor<XMLCh> result((XMLCh*) manager->allocate(pathLen * sizeof(XMLCh))/*new XMLCh[pathLen]*/,
-			manager);
-	if (result.get() != NULL)
-		CopyUniCharsToXMLChs(uniBuf, result.get(), pathLen, pathLen);
-		
-	return result.release();
-}
-
-
-XMLCh*
-XMLCreateFullPathFromFSRef_Classic(const FSRef& startingRef,
-                            MemoryManager* const manager)
-{
-	//	Manually create the path using FSRef APIs.
-    OSStatus err = noErr;
-    FSCatalogInfo catalogInfo;
-    HFSUniStr255 name;
-    FSRef ref = startingRef;
-
-    XMLCh buf[kMaxMacStaticPathChars];
-    std::size_t bufPos   = kMaxMacStaticPathChars;
-    std::size_t bufCnt   = 0;
-
-    ArrayJanitor<XMLCh> result(NULL);
-    std::size_t resultLen = 0;
-
-    buf[--bufPos] = L'\0';
-    ++bufCnt;
-
-	do
-	{
-		err = FSGetCatalogInfo(
-			&ref,
-			kFSCatInfoParentDirID,
-			&catalogInfo,
-			&name,
-			static_cast<FSSpec*>(NULL),
-			&ref
-			);
-		
-		if (err == noErr)
-		{
-			// If there's not room in our static buffer for the new
-			// name plus separator, dump it to the dynamic result buffer.
-			if (bufPos < (std::size_t)name.length + 1)
-			{
-				ArrayJanitor<XMLCh> temp
-                (
-                    (XMLCh*) manager->allocate((bufCnt + resultLen) * sizeof(XMLCh)) //new XMLCh[bufCnt + resultLen]
-                    , manager
-                );
-				
-				// Copy in the static buffer
-				std::memcpy(temp.get(), &buf[bufPos], bufCnt * sizeof(XMLCh));
-				
-				// Copy in the old buffer
-				if (resultLen > 0)
-					std::memcpy(temp.get() + bufCnt, result.get(), resultLen * sizeof(XMLCh));
-				
-				result.reset(temp.release());
-				resultLen += bufCnt;
-				
-				bufPos = kMaxMacStaticPathChars;
-				bufCnt = 0;
-			}
-			
-			// Prepend our new name and a '/'
-			bufPos -= name.length;
-			ConvertSlashToColon(
-				CopyUniCharsToXMLChs(name.unicode, &buf[bufPos], name.length, name.length),
-				name.length);
-			buf[--bufPos] = L'/';
-			bufCnt += (name.length + 1);
-		}
-	}
-	while (err == noErr && catalogInfo.parentDirID != fsRtParID);
-	
-	// Composite existing buffer + any previous result buffer
-	ArrayJanitor<XMLCh> final
-    (
-        (XMLCh*) manager->allocate((bufCnt + resultLen) * sizeof(XMLCh))//new XMLCh[bufCnt + resultLen]
-        , manager
-    );
-	
-	// Copy in the static buffer
-	std::memcpy(final.get(), &buf[bufPos], bufCnt * sizeof(XMLCh));
-	
-	// Copy in the old buffer
-	if (resultLen > 0)
-		std::memcpy(final.get() + bufCnt, result.get(), resultLen * sizeof(XMLCh));
-	
-    return final.release();
-}
-
-
-XMLCh*
-XMLCreateFullPathFromFSSpec(const FSSpec& startingSpec,
-                            MemoryManager* const manager)
-{
-	XMLCh* result = NULL;
-	
-	//	If FSRefs are available, do this operation in terms of refs...this
-	//	allows us to grandfather in the use of FSPathMakeRef and FSRefMakePath
-	//	if possible.
-	if (gHasHFSPlusAPIs)
-	{
-		OSStatus err = noErr;
-		FSRef ref;
-		
-		//	Up convert to FSRef
-		if (err == noErr)
-			err = FSpMakeFSRef(&startingSpec, &ref);
-			
-		//	Create the path
-		if (err == noErr)
-			result = XMLCreateFullPathFromFSRef(ref, manager);
-	}
-	else
-	{
-		//	Create using FSSpecs only
-		result = XMLCreateFullPathFromFSSpec_Classic(startingSpec, manager);
-	}
-		
-	return result;
-}
-
-
-XMLCh*
-XMLCreateFullPathFromFSSpec_Classic(const FSSpec& startingSpec,
-                                    MemoryManager* const manager)
-{
-	//	Manually create the path using FSSpec APIs.
-    OSStatus err = noErr;
-    FSSpec spec = startingSpec;
-
-    char buf[kMaxMacStaticPathChars];
-    std::size_t bufPos   = kMaxMacStaticPathChars;
-    std::size_t bufCnt   = 0;
-
-    ArrayJanitor<char> result(NULL);
-    std::size_t resultLen = 0;
-
-    buf[--bufPos] = '\0';
-    ++bufCnt;
-
-	short index = 0;
-	do
-	{
-		CInfoPBRec catInfo;
-		catInfo.dirInfo.ioNamePtr = spec.name;
-		catInfo.dirInfo.ioVRefNum = spec.vRefNum;
-		catInfo.dirInfo.ioFDirIndex = index;
-		catInfo.dirInfo.ioDrDirID = spec.parID;
-		err = PBGetCatInfoSync(&catInfo);
-		
-		if (err == noErr)
-		{
-			std::size_t nameLen = StrLength(spec.name);
-			
-			// If there's not room in our static buffer for the new
-			// name plus separator, dump it to the dynamic result buffer.
-			if (bufPos < nameLen + 1)
-			{
-				ArrayJanitor<char> temp
-                (
-                    (char*) manager->allocate((bufCnt + resultLen) * sizeof(char))//new char[bufCnt + resultLen]
-                    , manager
-                );
-				
-				// Copy in the static buffer
-				std::memcpy(temp.get(), &buf[bufPos], bufCnt);
-				
-				// Copy in the old buffer
-				if (resultLen > 0)
-					std::memcpy(temp.get() + bufCnt, result.get(), resultLen);
-				
-				result.reset(temp.release());
-				resultLen += bufCnt;
-				
-				bufPos = kMaxMacStaticPathChars;
-				bufCnt = 0;
-			}
-			
-			// Prepend our new name and a '/'
-			bufPos -= nameLen;
-			ConvertSlashToColon((char*)std::memcpy(&buf[bufPos], &spec.name[1], nameLen), nameLen);
-			buf[--bufPos] = '/';
-			bufCnt += (nameLen + 1);
-			
-			// From here on out, ignore the input file name
-			index = -1;
-			
-			// Move up to the parent
-			spec.parID = catInfo.dirInfo.ioDrParID;
-		}
-	}
-	while (err == noErr && spec.parID != fsRtParID);
-	
-	// Composite existing buffer with any previous result buffer
-	ArrayJanitor<char> final
-    (
-        (char*) manager->allocate((bufCnt + resultLen) * sizeof(char))//new char[bufCnt + resultLen]
-        , manager
-    );
-	
-	// Copy in the static buffer
-	std::memcpy(final.get(), &buf[bufPos], bufCnt);
-	
-	// Copy in the old buffer
-	if (resultLen > 0)
-		std::memcpy(final.get() + bufCnt, result.get(), resultLen);
-
-    // Cleanup and transcode to unicode
-    return XMLString::transcode(final.get(), manager);
-}
-
 
 std::size_t
 TranscodeUniCharsToUTF8(const UniChar* src, char* dst, std::size_t srcCnt, std::size_t maxChars)

