nsLocalFileOSX.cpp revision ed0d4ccac4cbe85936511b94a907111e824fc588
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001, 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Conrad Carlen <ccarlen@netscape.com>
* Jungshik Shin <jshin@mailaps.org>
* Asaf Romano <mozilla.mano@sent.com>
* Mark Mentovai <mark@moxienet.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsLocalFile.h"
#include "nsDirectoryServiceDefs.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIDirectoryEnumerator.h"
#include "nsISimpleEnumerator.h"
#include "nsITimelineService.h"
#include "nsVoidArray.h"
#include "plbase64.h"
#include "prmem.h"
#include "nsCRT.h"
#include "nsHashKeys.h"
#include "MoreFilesX.h"
#include "FSCopyObject.h"
#include "nsAutoBuffer.h"
#include "nsTraceRefcntImpl.h"
// Mac Includes
// Unix Includes
#include <unistd.h>
#include <stdlib.h>
#else
#endif
#define CHECK_mBaseRef() \
if (!mBaseRef) \
return NS_ERROR_NOT_INITIALIZED; \
//*****************************************************************************
// Static Function Prototypes
//*****************************************************************************
//*****************************************************************************
// Local Helper Classes
//*****************************************************************************
#pragma mark -
{
}
#pragma mark -
#pragma mark [StFollowLinksState]
class StFollowLinksState
{
public:
{
}
{
}
{
}
private:
};
#pragma mark -
#pragma mark [nsDirEnumerator]
class nsDirEnumerator : public nsISimpleEnumerator,
public nsIDirectoryEnumerator
{
public:
nsDirEnumerator() :
mArrayCnt(0), mArrayIndex(0)
{
}
{
return rv;
if (!mFSRefsArray)
return NS_ERROR_OUT_OF_MEMORY;
return MacErrorMapper(err);
return NS_OK;
}
{
if (mArrayIndex >= mArrayCnt) {
nsnull);
mArrayIndex = 0;
}
}
if (mArrayIndex < mArrayCnt) {
if (!newFile)
return NS_ERROR_OUT_OF_MEMORY;
return NS_ERROR_FAILURE;
mArrayIndex++;
}
}
if (!*result)
Close();
return NS_OK;
}
{
return NS_OK;
}
{
return rv;
return NS_OK;
}
{
if (mIterator) {
}
if (mFSRefsArray) {
}
return NS_OK;
}
private:
{
Close();
}
protected:
// According to Apple doc, request the number of objects
// per call that will fit in 4 VM pages.
enum {
};
};
#pragma mark -
{
public:
StAEDesc()
{
dataHandle = nil;
}
~StAEDesc()
{
::AEDisposeDesc(this);
}
};
#define FILENAME_BUFFER_SIZE 512
//*****************************************************************************
// nsLocalFile
//*****************************************************************************
// The HFS+ epoch is Jan. 1, 1904 GMT - differs from HFS in which times were local
// The NSPR epoch is Jan. 1, 1970 GMT
// 2082844800 is the difference in seconds between those dates
#pragma mark -
nsLocalFile::nsLocalFile() :
{
}
{
// A CFURLRef is immutable so no need to copy, just retain.
if (mBaseRef)
if (mTargetRef)
::CFRetain(mTargetRef);
}
{
if (mBaseRef)
if (mTargetRef)
::CFRelease(mTargetRef);
}
//*****************************************************************************
// nsLocalFile::nsISupports
//*****************************************************************************
#pragma mark -
#pragma mark [nsISupports]
NS_METHOD nsLocalFile::nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
{
return NS_ERROR_OUT_OF_MEMORY;
{
delete inst;
return rv;
}
return NS_OK;
}
//*****************************************************************************
// nsLocalFile::nsIFile
//*****************************************************************************
#pragma mark -
/* void append (in AString node); */
{
}
/* [noscript] void appendNative (in ACString node); */
{
// Check we are correctly initialized.
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
if (nodeStrRef) {
::CFRelease(nodeStrRef);
if (newRef) {
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}
/* void normalize (); */
{
// Check we are correctly initialized.
// CFURL doesn't doesn't seem to resolve paths containing relative
// components, so we'll nick the stdlib code from nsLocalFileUnix
if (!success)
return NS_ERROR_FAILURE;
char *resolved_path_ptr = nsnull;
// if there is an error, the return is null.
if (!resolved_path_ptr)
return NSRESULT_FOR_ERRNO();
// Need to know whether we're a directory to create a new CFURLRef
if (pathStrRef) {
if (newURLRef) {
}
::CFRelease(pathStrRef);
}
return rv;
}
/* void create (in unsigned long type, in unsigned long permissions); */
{
return NS_ERROR_FILE_UNKNOWN_TYPE;
// Check we are correctly initialized.
// Work backwards through the path to find the last node which
// exists. Place the nodes which don't exist in an array and we'll
// create those below.
if (!leafStrRef)
break;
break;
::CFRelease(leafStrRef);
leafStrRef = nsnull;
// Get the parent of the leaf for the next go round
if (!parent)
break;
if (pathURLRef != mBaseRef)
::CFRelease(pathURLRef);
pathURLRef = parent;
}
if (pathURLRef != mBaseRef)
::CFRelease(pathURLRef);
if (leafStrRef != nsnull)
::CFRelease(leafStrRef);
if (!success)
return NS_ERROR_FAILURE;
if (nodesToCreate == 0)
return NS_ERROR_FILE_ALREADY_EXISTS;
return MacErrorMapper(err);
}
if (type == NORMAL_FILE_TYPE) {
}
else {
}
return MacErrorMapper(err);
}
/* attribute AString leafName; */
{
return rv;
return NS_OK;
}
{
}
/* [noscript] attribute ACString nativeLeafName; */
{
// Check we are correctly initialized.
if (leafStrRef) {
::CFRelease(leafStrRef);
}
return rv;
}
{
// Check we are correctly initialized.
if (parentURLRef) {
if (nodeStrRef) {
if (newURLRef) {
}
::CFRelease(nodeStrRef);
}
}
return rv;
}
/* void copyTo (in nsIFile newParentDir, in AString newName); */
{
}
/* [noscrpit] void CopyToNative (in nsIFile newParentDir, in ACString newName); */
{
}
/* void copyToFollowingLinks (in nsIFile newParentDir, in AString newName); */
{
}
/* [noscript] void copyToFollowingLinksNative (in nsIFile newParentDir, in ACString newName); */
NS_IMETHODIMP nsLocalFile::CopyToFollowingLinksNative(nsIFile *newParentDir, const nsACString& newName)
{
}
/* void moveTo (in nsIFile newParentDir, in AString newName); */
{
}
/* [noscript] void moveToNative (in nsIFile newParentDir, in ACString newName); */
{
// Check we are correctly initialized.
return rv;
// Get the source path.
return rv;
// Build the destination path.
if (!parentDir) {
return NS_ERROR_INVALID_ARG;
return rv;
}
else {
return rv;
if (!exists) {
return rv;
}
}
return rv;
else {
return rv;
}
// Perform the move.
// Can't move across volume (device) boundaries. Copy and remove.
if (NS_SUCCEEDED(rv)) {
// Permit removal failure.
}
}
else
rv = NSRESULT_FOR_ERRNO();
return rv;
}
// Update |this| to refer to the moved file.
if (!newBaseRef)
return NS_ERROR_FAILURE;
::CFRelease(newBaseRef);
return rv;
}
/* void remove (in boolean recursive); */
{
// Check we are correctly initialized.
// XXX If we're an alias, never remove target
return rv;
if (recursive && isDirectory) {
return rv;
// Call MoreFilesX to do a recursive removal.
}
else {
return rv;
int status;
if (isDirectory)
else
if (status != 0)
rv = NSRESULT_FOR_ERRNO();
}
return rv;
}
/* attribute unsigned long permissions; */
{
return rv;
return MacErrorMapper(err);
return NS_OK;
}
{
return rv;
return MacErrorMapper(err);
return MacErrorMapper(err);
}
/* attribute unsigned long permissionsOfLink; */
{
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
return NS_ERROR_NOT_IMPLEMENTED;
}
{
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute PRInt64 lastModifiedTime; */
{
// Check we are correctly initialized.
return rv;
return MacErrorMapper(err);
return NS_OK;
}
{
// Check we are correctly initialized.
return rv;
/* Get the node flags, the content modification date and time, and the parent ref */
return MacErrorMapper(err);
/* Notify the parent if this is a file */
return MacErrorMapper(err);
/* Send a notification for the parent of the file, or for the directory */
return MacErrorMapper(err);
return NS_OK;
}
/* attribute PRInt64 lastModifiedTimeOfLink; */
{
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
return NS_ERROR_NOT_IMPLEMENTED;
}
{
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute PRInt64 fileSize; */
{
*aFileSize = 0;
return rv;
return MacErrorMapper(err);
// FSGetCatalogInfo can return a bogus size for directories sometimes, so only
// rely on the answer for files
return NS_OK;
}
{
// Check we are correctly initialized.
return rv;
return MacErrorMapper(err);
::FSCloseFork(refNum);
return MacErrorMapper(err);
}
/* readonly attribute PRInt64 fileSizeOfLink; */
{
// Check we are correctly initialized.
return GetFileSize(aFileSizeOfLink);
}
/* readonly attribute AString target; */
{
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* [noscript] readonly attribute ACString nativeTarget; */
{
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute AString path; */
{
return rv;
return NS_OK;
}
/* [noscript] readonly attribute ACString nativePath; */
{
// Check we are correctly initialized.
if (pathStrRef) {
::CFRelease(pathStrRef);
}
return rv;
}
/* boolean exists (); */
{
// Check we are correctly initialized.
}
return NS_OK;
}
/* boolean isWritable (); */
{
// Check we are correctly initialized.
return rv;
return rv;
}
return NS_OK;
}
/* boolean isReadable (); */
{
// Check we are correctly initialized.
return rv;
return NS_OK;
}
/* boolean isExecutable (); */
{
// Check we are correctly initialized.
return rv;
}
return NS_OK;
}
/* boolean isHidden (); */
{
return rv;
return MacErrorMapper(err);
FileInfo *fInfoPtr = (FileInfo *)(catalogInfo.finderInfo); // Finder flags are in the same place whether we use FileInfo or FolderInfo
}
else {
// If the leaf name begins with a '.', consider it invisible
}
return NS_OK;
}
/* boolean isDirectory (); */
{
return rv;
return MacErrorMapper(err);
return NS_OK;
}
/* boolean isFile (); */
{
return rv;
return MacErrorMapper(err);
return NS_OK;
}
/* boolean isSymlink (); */
{
// Check we are correctly initialized.
// Check we are correctly initialized.
}
return NS_OK;
}
/* boolean isSpecial (); */
{
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIFile clone (); */
{
// Just copy-construct ourselves
*_retval = new nsLocalFile(*this);
if (!*_retval)
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
/* boolean equals (in nsIFile inFile); */
{
}
{
if (!inFile)
return NS_OK;
nsLocalFile* inLF =
// If both exist, compare FSRefs
return NS_OK;
}
// If one exists and the other doesn't, not equal
return NS_OK;
// Arg, we have to get their paths and compare
return NS_ERROR_FAILURE;
return NS_ERROR_FAILURE;
return NS_OK;
}
/* boolean contains (in nsIFile inFile, in boolean recur); */
{
// Check we are correctly initialized.
return rv;
if (!isDir)
return NS_OK; // must be a dir to contain someone
return NS_ERROR_FAILURE;
if ((inPath.Length() > thisPathLen + 1) && (strncasecmp(thisPath.get(), inPath.get(), thisPathLen) == 0)) {
// Now make sure that the |inFile|'s path has a separator at thisPathLen,
// and there's at least one more character after that.
}
return NS_OK;
}
/* readonly attribute nsIFile parent; */
{
// Check we are correctly initialized.
// If it can be determined without error that a file does not
// have a parent, return nsnull for the parent and NS_OK as the result.
// See bug 133617.
if (parentURLRef) {
newFile = new nsLocalFile;
if (newFile) {
if (NS_SUCCEEDED(rv)) {
}
}
}
return rv;
}
/* readonly attribute nsISimpleEnumerator directoryEntries; */
{
return rv;
if (!isDir)
return NS_ERROR_FILE_NOT_DIRECTORY;
return NS_ERROR_OUT_OF_MEMORY;
return rv;
}
return NS_OK;
}
//*****************************************************************************
// nsLocalFile::nsILocalFile
//*****************************************************************************
#pragma mark -
#pragma mark [nsILocalFile]
/* void initWithPath (in AString filePath); */
{
}
/* [noscript] void initWithNativePath (in ACString filePath); */
{
}
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
else
// A path with consecutive '/'s which are not between
// nodes crashes CFURLGetFSRef(). Consecutive '/'s which
// are between actual nodes are OK. So, convert consecutive
// '/'s to a single one.
// On 10.2, huge paths also crash CFURLGetFSRef()
return NS_ERROR_FILE_NAME_TOO_LONG;
if (!pathAsCFString)
return NS_ERROR_FAILURE;
pathAsCFURL = ::CFURLCreateWithFileSystemPath(nsnull, pathAsCFString, kCFURLPOSIXPathStyle, PR_FALSE);
if (!pathAsCFURL) {
return NS_ERROR_FAILURE;
}
::CFRelease(pathAsCFURL);
return NS_OK;
}
/* void initWithFile (in nsILocalFile aFile); */
{
if (!aFileMac)
return NS_ERROR_UNEXPECTED;
return rv;
return rv;
}
/* attribute PRBool followLinks; */
{
return NS_OK;
}
{
if (aFollowLinks != mFollowLinks) {
}
return NS_OK;
}
/* [noscript] PRFileDescStar openNSPRFileDesc (in long flags, in long mode); */
{
return rv;
if (! *_retval)
return NS_ErrorAccordingToNSPR();
return NS_OK;
}
/* [noscript] FILE openANSIFileDesc (in string mode); */
{
return rv;
if (! *_retval)
return NS_ERROR_FAILURE;
return NS_OK;
}
/* [noscript] PRLibraryStar load (); */
{
// Check we are correctly initialized.
NS_TIMELINE_START_TIMER("PR_LoadLibrary");
return rv;
#ifdef NS_BUILD_REFCNT_LOGGING
#endif
#ifdef NS_BUILD_REFCNT_LOGGING
#endif
NS_TIMELINE_STOP_TIMER("PR_LoadLibrary");
if (!*_retval)
return NS_ERROR_FAILURE;
return NS_OK;
}
/* readonly attribute PRInt64 diskSpaceAvailable; */
{
// Check we are correctly initialized.
return rv;
return MacErrorMapper(err);
return MacErrorMapper(err);
return NS_OK;
}
/* void appendRelativePath (in AString relativeFilePath); */
{
}
/* [noscript] void appendRelativeNativePath (in ACString relativeFilePath); */
{
if (relativeFilePath.IsEmpty())
return NS_OK;
// No leading '/'
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
// Parse the nodes and call Append() for each
return rv;
++nodeEnd;
}
return NS_OK;
}
/* attribute ACString persistentDescriptor; */
{
return rv;
return MacErrorMapper(err);
// Passing nsnull for dest makes NULL-term string
return NS_OK;
}
{
if (aPersistentDescriptor.IsEmpty())
return NS_ERROR_INVALID_ARG;
// Support pathnames as user-supplied descriptors if they begin with '/'
// or '~'. These characters do not collide with the base64 set used for
// encoding alias records.
return InitWithNativePath(aPersistentDescriptor);
char* decodedData = PL_Base64Decode(PromiseFlatCString(aPersistentDescriptor).get(), dataSize, nsnull);
if (!decodedData) {
NS_ERROR("SetPersistentDescriptor was given bad data");
return NS_ERROR_FAILURE;
}
// Cast to an alias record and resolve.
return NS_ERROR_FAILURE;
}
// Move the now-decoded data into the Handle.
// The size of the decoded data is 3/4 the size of the encoded data. See plbase64.h
return rv;
return rv;
return InitWithFSRef(&resolvedFSRef);
}
/* void reveal (); */
{
return rv;
// Create the FinderEvent
// Create the file list
::SetFrontProcess(&process);
}
}
}
}
}
}
}
return NS_OK;
}
/* void launch (); */
{
return rv;
return MacErrorMapper(err);
}
//*****************************************************************************
// nsLocalFile::nsILocalFileMac
//*****************************************************************************
#pragma mark -
#pragma mark [nsILocalFileMac]
/* void initWithCFURL (in CFURLRef aCFURL); */
{
return NS_OK;
}
/* void initWithFSRef ([const] in FSRefPtr aFSRef); */
{
if (newURLRef) {
}
return rv;
}
/* void initWithFSSpec ([const] in FSSpecPtr aFileSpec); */
{
return InitWithFSRef(&fsRef);
parentDirSpec.name[0] = 0;
return MacErrorMapper(err);
return MacErrorMapper(err);
return MacErrorMapper(err);
return rv;
}
return MacErrorMapper(err);
}
/* void initToAppWithCreatorCode (in OSType aAppCreator); */
{
return MacErrorMapper(err);
return InitWithFSRef(&fsRef);
}
/* CFURLRef getCFURL (); */
{
if (whichURLRef)
::CFRetain(whichURLRef);
*_retval = whichURLRef;
}
/* FSRef getFSRef (); */
{
return GetFSRefInternal(*_retval);
}
/* FSSpec getFSSpec (); */
{
// Check we are correctly initialized.
if (NS_SUCCEEDED(rv)) {
// If the leaf node exists, things are simple.
return MacErrorMapper(err);
}
else if (rv == NS_ERROR_FILE_NOT_FOUND) {
// If the parent of the leaf exists, make an FSSpec from that.
if (!parentURLRef)
return NS_ERROR_FAILURE;
}
}
}
}
return rv;
}
/* readonly attribute PRInt64 fileSizeWithResFork; */
{
return rv;
return MacErrorMapper(err);
return NS_OK;
}
/* attribute OSType fileType; */
{
return rv;
return MacErrorMapper(err);
return NS_OK;
}
{
return rv;
return MacErrorMapper(err);
}
/* attribute OSType fileCreator; */
{
return rv;
return MacErrorMapper(err);
return NS_OK;
}
{
return rv;
return MacErrorMapper(err);
}
/* void setFileTypeAndCreatorFromMIMEType (in string aMIMEType); */
{
// XXX - This should be cut from the API. Would create an evil dependency.
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setFileTypeAndCreatorFromExtension (in string aExtension); */
{
// XXX - This should be cut from the API. Would create an evil dependency.
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void launchWithDoc (in nsILocalFile aDocToLoad, in boolean aLaunchInBackground); */
{
return rv;
if (!isExecutable)
return NS_ERROR_FILE_EXECUTION_FAILED;
return rv;
if (aDocToLoad) {
return rv;
}
if (aLaunchInBackground)
if (aDocToLoad) {
}
return MacErrorMapper(err);
return NS_OK;
}
/* void openDocWithApp (in nsILocalFile aAppToOpenWith, in boolean aLaunchInBackground); */
{
return rv;
if (aAppToOpenWith) {
if (!appFileMac)
return rv;
return rv;
if (!isExecutable)
return NS_ERROR_FILE_EXECUTION_FAILED;
return rv;
}
else {
return rv;
return MacErrorMapper(err);
}
if (aLaunchInBackground)
return MacErrorMapper(err);
return NS_OK;
}
/* boolean isPackage (); */
{
return rv;
return MacErrorMapper(err);
}
else {
// Folders ending with ".app" are also considered to
// be packages, even if the top-level folder doesn't have bundle set
if (extPtr) {
}
}
}
}
return NS_OK;
}
{
return NS_ERROR_FAILURE;
return rv;
// 4 characters in ".app"
}
else
return NS_OK;
}
{
if (bundle) {
if (bundleIdentifier)
}
}
return rv;
}
//*****************************************************************************
// nsLocalFile Methods
//*****************************************************************************
#pragma mark -
{
if (mBaseRef)
return NS_OK;
}
{
// Check we are correctly initialized.
if (mFollowLinksDirty) {
if (mTargetRef) {
::CFRelease(mTargetRef);
mTargetRef = nsnull;
}
if (mFollowLinks) {
::CFRetain(mTargetRef);
::CFRelease(mTargetRef);
if (!mTargetRef)
return NS_ERROR_FAILURE;
}
}
}
}
return NS_OK;
}
{
if (bForceUpdateCache || !mCachedFSRefValid) {
}
if (mCachedFSRefValid) {
return NS_OK;
}
// CFURLGetFSRef only returns a Boolean for success,
// so we have to assume what the error was. This is
// the only probable cause.
return NS_ERROR_FILE_NOT_FOUND;
}
{
if (pathStrRef) {
::CFRelease(pathStrRef);
}
return rv;
}
{
// Check we are correctly initialized.
return rv;
if (!newParentDir) {
return NS_ERROR_INVALID_ARG;
return rv;
}
// If newParentDir does not exist, create it
return rv;
if (!exists) {
return rv;
}
if (!newParentDirMac)
return NS_ERROR_NO_INTERFACE;
return rv;
err =
return MacErrorMapper(err);
}
{
// Start with seconds since Jan. 1, 1904 GMT
// Subtract to convert to NSPR epoch of 1970
// Convert to millisecs
// Convert the fraction to millisecs and add it
return result;
}
{
}
{
if (charsConverted == inStrLen) {
#if 0 /* bird: too new? */
return NS_ERROR_OUT_OF_MEMORY;
#else
}
#endif
}
return rv;
}
// nsIHashable
{
}
{
return NS_OK;
}
//*****************************************************************************
// Global Functions
//*****************************************************************************
#pragma mark -
void nsLocalFile::GlobalInit()
{
}
void nsLocalFile::GlobalShutdown()
{
}
{
return NS_ERROR_OUT_OF_MEMORY;
return rv;
}
}
return NS_OK;
}
{
}
nsresult NS_NewLocalFileWithFSSpec(const FSSpec* inSpec, PRBool followLinks, nsILocalFileMac **result)
{
return NS_ERROR_OUT_OF_MEMORY;
return rv;
}
return NS_OK;
}
nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, PRBool aFollowLinks, nsILocalFileMac** result)
{
return NS_ERROR_OUT_OF_MEMORY;
return rv;
}
return NS_OK;
}
//*****************************************************************************
// Static Functions
//*****************************************************************************
{
switch (inErr)
{
case noErr:
break;
case fnfErr:
break;
case dupFNErr:
break;
case dskFulErr:
break;
case fLckdErr:
break;
// Can't find good map for some
case bdNamErr:
break;
default:
break;
}
return outErr;
}
{
outPsn.highLongOfPSN = 0;
while (PR_TRUE)
{
if (err == procNotFound)
break;
return err;
return err;
return noErr;
}
return procNotFound;
}
// Convert a UTF-8 string to a UTF-16 string while normalizing to
// Normalization Form C (composed Unicode). We need this because
// Mac OS X file system uses NFD (Normalization Form D : decomposed Unicode)
// while most other OS', server-side programs usually expect NFC.
{
// CFStringNormalize was not introduced until Mac OS 10.2
if (!sChecked) {
if (carbonBundle)
CFSTR("CFStringNormalize"));
}
if (!sUnicodeNormalizer) { // OS X 10.2 or earlier
return;
}
// The number of 16bit code units in a UTF-16 string will never be
// larger than the number of bytes in the corresponding UTF-8 string.
if (!inStr) {
return;
}
if (chars)
else {
else {
}
}
}