comment and whitespace cleanup for Mac OS X filesystem code. no bug.

This commit is contained in:
Josh Aas 2008-11-28 13:37:40 -05:00
Родитель 66d73b21ec
Коммит 00ff40c300
2 изменённых файлов: 43 добавлений и 151 удалений

Просмотреть файл

@ -36,8 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsLocalFileMac_h__
#define nsLocalFileMac_h__
#ifndef nsLocalFileMac_h_
#define nsLocalFileMac_h_
#include "nsILocalFileMac.h"
#include "nsString.h"
@ -46,71 +46,66 @@
class nsDirEnumerator;
//*****************************************************************************
// nsLocalFile
//
// The native charset of this implementation is UTF-8. The Unicode used by the
// Mac OS file system is decomposed, so "Native" versions of these routines will
// always use decomposed Unicode (NFD). Their "non-Native" counterparts are
// intended to be simple wrappers which call the "Native" version and convert
// between UTF-8 and UTF-16. All the work is done on the "Native" side except
// for the conversion to NFC (composed Unicode) done in "non-Native" getters.
//*****************************************************************************
class NS_COM nsLocalFile : public nsILocalFileMac,
public nsIHashable
{
friend class nsDirEnumerator;
friend class nsDirEnumerator;
public:
NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
nsLocalFile();
NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
static NS_METHOD nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
nsLocalFile();
NS_DECL_ISUPPORTS
NS_DECL_NSIFILE
NS_DECL_NSILOCALFILE
NS_DECL_NSILOCALFILEMAC
NS_DECL_NSIHASHABLE
static NS_METHOD nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
NS_DECL_ISUPPORTS
NS_DECL_NSIFILE
NS_DECL_NSILOCALFILE
NS_DECL_NSILOCALFILEMAC
NS_DECL_NSIHASHABLE
public:
static void GlobalInit();
static void GlobalShutdown();
static void GlobalInit();
static void GlobalShutdown();
private:
~nsLocalFile();
~nsLocalFile();
protected:
nsLocalFile(const nsLocalFile& src);
nsresult SetBaseRef(CFURLRef aCFURLRef); // Does CFRetain on aCFURLRef
nsresult UpdateTargetRef();
nsresult GetFSRefInternal(FSRef& aFSSpec);
nsresult GetPathInternal(nsACString& path); // Returns path WRT mFollowLinks
nsresult EqualsInternal(nsISupports* inFile, PRBool *_retval);
nsLocalFile(const nsLocalFile& src);
nsresult CopyInternal(nsIFile* newParentDir,
const nsAString& newName,
PRBool followLinks);
nsresult SetBaseRef(CFURLRef aCFURLRef); // Does CFRetain on aCFURLRef
nsresult UpdateTargetRef();
static PRInt64 HFSPlustoNSPRTime(const UTCDateTime& utcTime);
static void NSPRtoHFSPlusTime(PRInt64 nsprTime, UTCDateTime& utcTime);
static nsresult CFStringReftoUTF8(CFStringRef aInStrRef, nsACString& aOutStr);
nsresult GetFSRefInternal(FSRef& aFSSpec);
nsresult GetPathInternal(nsACString& path); // Returns path WRT mFollowLinks
nsresult EqualsInternal(nsISupports* inFile, PRBool *_retval);
nsresult CopyInternal(nsIFile* newParentDir,
const nsAString& newName,
PRBool followLinks);
static PRInt64 HFSPlustoNSPRTime(const UTCDateTime& utcTime);
static void NSPRtoHFSPlusTime(PRInt64 nsprTime, UTCDateTime& utcTime);
static nsresult CFStringReftoUTF8(CFStringRef aInStrRef, nsACString& aOutStr);
protected:
CFURLRef mBaseRef; // The FS object we represent
CFURLRef mTargetRef; // If mBaseRef is an alias, its target
CFURLRef mBaseRef; // The FS object we represent
CFURLRef mTargetRef; // If mBaseRef is an alias, its target
PRPackedBool mFollowLinks;
PRPackedBool mFollowLinksDirty;
PRPackedBool mFollowLinks;
PRPackedBool mFollowLinksDirty;
static const char kPathSepChar;
static const PRUnichar kPathSepUnichar;
static const PRInt64 kJanuaryFirst1970Seconds;
static const char kPathSepChar;
static const PRUnichar kPathSepUnichar;
static const PRInt64 kJanuaryFirst1970Seconds;
};
#endif // nsLocalFileMac_h__
#endif // nsLocalFileMac_h_

Просмотреть файл

@ -60,11 +60,9 @@
#include "nsTArray.h"
#include "nsTraceRefcntImpl.h"
// Mac Includes
#include <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
// Unix Includes
#include <unistd.h>
#include <sys/stat.h>
#include <stdlib.h>
@ -81,18 +79,10 @@
return NS_ERROR_NOT_INITIALIZED; \
PR_END_MACRO
//*****************************************************************************
// Static Function Prototypes
//*****************************************************************************
static nsresult MacErrorMapper(OSErr inErr);
static OSErr FindRunningAppBySignature(OSType aAppSig, ProcessSerialNumber& outPsn);
static void CopyUTF8toUTF16NFC(const nsACString& aSrc, nsAString& aResult);
//*****************************************************************************
// Local Helper Classes
//*****************************************************************************
#pragma mark -
#pragma mark [FSRef operator==]
@ -238,7 +228,7 @@ class nsDirEnumerator : public nsISimpleEnumerator,
rv = HasMoreElements(&hasMore);
if (NS_FAILED(rv)) return rv;
*result = mNext; // might return nsnull
*result = mNext; // might return nsnull
NS_IF_ADDREF(*result);
mNext = nsnull;
@ -321,10 +311,6 @@ public:
#define FILENAME_BUFFER_SIZE 512
//*****************************************************************************
// nsLocalFile
//*****************************************************************************
const char nsLocalFile::kPathSepChar = '/';
const PRUnichar nsLocalFile::kPathSepUnichar = '/';
@ -373,10 +359,6 @@ nsLocalFile::~nsLocalFile()
NS_OBJC_END_TRY_ABORT_BLOCK;
}
//*****************************************************************************
// nsLocalFile::nsISupports
//*****************************************************************************
#pragma mark -
#pragma mark [nsISupports]
@ -404,20 +386,14 @@ NS_IMETHODIMP nsLocalFile::nsLocalFileConstructor(nsISupports* outer, const nsII
return NS_OK;
}
//*****************************************************************************
// nsLocalFile::nsIFile
//*****************************************************************************
#pragma mark -
#pragma mark [nsIFile]
/* void append (in AString node); */
NS_IMETHODIMP nsLocalFile::Append(const nsAString& aNode)
{
return AppendNative(NS_ConvertUTF16toUTF8(aNode));
}
/* [noscript] void appendNative (in ACString node); */
NS_IMETHODIMP nsLocalFile::AppendNative(const nsACString& aNode)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -449,7 +425,6 @@ NS_IMETHODIMP nsLocalFile::AppendNative(const nsACString& aNode)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void normalize (); */
NS_IMETHODIMP nsLocalFile::Normalize()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -500,7 +475,6 @@ NS_IMETHODIMP nsLocalFile::Normalize()
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void create (in unsigned long type, in unsigned long permissions); */
NS_IMETHODIMP nsLocalFile::Create(PRUint32 type, PRUint32 permissions)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -585,7 +559,6 @@ NS_IMETHODIMP nsLocalFile::Create(PRUint32 type, PRUint32 permissions)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* attribute AString leafName; */
NS_IMETHODIMP nsLocalFile::GetLeafName(nsAString& aLeafName)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -605,7 +578,6 @@ NS_IMETHODIMP nsLocalFile::SetLeafName(const nsAString& aLeafName)
return SetNativeLeafName(NS_ConvertUTF16toUTF8(aLeafName));
}
/* [noscript] attribute ACString nativeLeafName; */
NS_IMETHODIMP nsLocalFile::GetNativeLeafName(nsACString& aNativeLeafName)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -655,37 +627,31 @@ NS_IMETHODIMP nsLocalFile::SetNativeLeafName(const nsACString& aNativeLeafName)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void copyTo (in nsIFile newParentDir, in AString newName); */
NS_IMETHODIMP nsLocalFile::CopyTo(nsIFile *newParentDir, const nsAString& newName)
{
return CopyInternal(newParentDir, newName, PR_FALSE);
}
/* [noscrpit] void CopyToNative (in nsIFile newParentDir, in ACString newName); */
NS_IMETHODIMP nsLocalFile::CopyToNative(nsIFile *newParentDir, const nsACString& newName)
{
return CopyInternal(newParentDir, NS_ConvertUTF8toUTF16(newName), PR_FALSE);
}
/* void copyToFollowingLinks (in nsIFile newParentDir, in AString newName); */
NS_IMETHODIMP nsLocalFile::CopyToFollowingLinks(nsIFile *newParentDir, const nsAString& newName)
{
return CopyInternal(newParentDir, newName, PR_TRUE);
}
/* [noscript] void copyToFollowingLinksNative (in nsIFile newParentDir, in ACString newName); */
NS_IMETHODIMP nsLocalFile::CopyToFollowingLinksNative(nsIFile *newParentDir, const nsACString& newName)
{
return CopyInternal(newParentDir, NS_ConvertUTF8toUTF16(newName), PR_TRUE);
}
/* void moveTo (in nsIFile newParentDir, in AString newName); */
NS_IMETHODIMP nsLocalFile::MoveTo(nsIFile *newParentDir, const nsAString& newName)
{
return MoveToNative(newParentDir, NS_ConvertUTF16toUTF8(newName));
}
/* [noscript] void moveToNative (in nsIFile newParentDir, in ACString newName); */
NS_IMETHODIMP nsLocalFile::MoveToNative(nsIFile *newParentDir, const nsACString& newName)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -773,7 +739,6 @@ NS_IMETHODIMP nsLocalFile::MoveToNative(nsIFile *newParentDir, const nsACString&
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void remove (in boolean recursive); */
NS_IMETHODIMP nsLocalFile::Remove(PRBool recursive)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -821,7 +786,6 @@ NS_IMETHODIMP nsLocalFile::Remove(PRBool recursive)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* attribute unsigned long permissions; */
NS_IMETHODIMP nsLocalFile::GetPermissions(PRUint32 *aPermissions)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -867,7 +831,6 @@ NS_IMETHODIMP nsLocalFile::SetPermissions(PRUint32 aPermissions)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* attribute unsigned long permissionsOfLink; */
NS_IMETHODIMP nsLocalFile::GetPermissionsOfLink(PRUint32 *aPermissionsOfLink)
{
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
@ -880,7 +843,6 @@ NS_IMETHODIMP nsLocalFile::SetPermissionsOfLink(PRUint32 aPermissionsOfLink)
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute PRInt64 lastModifiedTime; */
NS_IMETHODIMP nsLocalFile::GetLastModifiedTime(PRInt64 *aLastModifiedTime)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -925,13 +887,13 @@ NS_IMETHODIMP nsLocalFile::SetLastModifiedTime(PRInt64 aLastModifiedTime)
FSRef parentRef;
PRBool notifyParent;
/* Get the node flags, the content modification date and time, and the parent ref */
// Get the node flags, the content modification date and time, and the parent ref
err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNodeFlags + kFSCatInfoContentMod,
&catalogInfo, NULL, NULL, &parentRef);
if (err != noErr)
return MacErrorMapper(err);
/* Notify the parent if this is a file */
// Notify the parent if this is a file
notifyParent = (0 == (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask));
NSPRtoHFSPlusTime(aLastModifiedTime, catalogInfo.contentModDate);
@ -939,7 +901,7 @@ NS_IMETHODIMP nsLocalFile::SetLastModifiedTime(PRInt64 aLastModifiedTime)
if (err != noErr)
return MacErrorMapper(err);
/* Send a notification for the parent of the file, or for the directory */
// Send a notification for the parent of the file, or for the directory
err = FNNotify(notifyParent ? &parentRef : &fsRef, kFNDirectoryModifiedMessage, kNilOptions);
if (err != noErr)
return MacErrorMapper(err);
@ -949,7 +911,6 @@ NS_IMETHODIMP nsLocalFile::SetLastModifiedTime(PRInt64 aLastModifiedTime)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* attribute PRInt64 lastModifiedTimeOfLink; */
NS_IMETHODIMP nsLocalFile::GetLastModifiedTimeOfLink(PRInt64 *aLastModifiedTimeOfLink)
{
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
@ -961,7 +922,6 @@ NS_IMETHODIMP nsLocalFile::SetLastModifiedTimeOfLink(PRInt64 aLastModifiedTimeOf
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute PRInt64 fileSize; */
NS_IMETHODIMP nsLocalFile::GetFileSize(PRInt64 *aFileSize)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1013,7 +973,6 @@ NS_IMETHODIMP nsLocalFile::SetFileSize(PRInt64 aFileSize)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* readonly attribute PRInt64 fileSizeOfLink; */
NS_IMETHODIMP nsLocalFile::GetFileSizeOfLink(PRInt64 *aFileSizeOfLink)
{
// Check we are correctly initialized.
@ -1025,7 +984,6 @@ NS_IMETHODIMP nsLocalFile::GetFileSizeOfLink(PRInt64 *aFileSizeOfLink)
return GetFileSize(aFileSizeOfLink);
}
/* readonly attribute AString target; */
NS_IMETHODIMP nsLocalFile::GetTarget(nsAString& aTarget)
{
nsCAutoString nativeString;
@ -1036,7 +994,6 @@ NS_IMETHODIMP nsLocalFile::GetTarget(nsAString& aTarget)
return NS_OK;
}
/* [noscript] readonly attribute ACString nativeTarget; */
NS_IMETHODIMP nsLocalFile::GetNativeTarget(nsACString& aNativeTarget)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1054,7 +1011,6 @@ NS_IMETHODIMP nsLocalFile::GetNativeTarget(nsACString& aNativeTarget)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* readonly attribute AString path; */
NS_IMETHODIMP nsLocalFile::GetPath(nsAString& aPath)
{
nsCAutoString nativeString;
@ -1065,7 +1021,6 @@ NS_IMETHODIMP nsLocalFile::GetPath(nsAString& aPath)
return NS_OK;
}
/* [noscript] readonly attribute ACString nativePath; */
NS_IMETHODIMP nsLocalFile::GetNativePath(nsACString& aNativePath)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1084,7 +1039,6 @@ NS_IMETHODIMP nsLocalFile::GetNativePath(nsACString& aNativePath)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* boolean exists (); */
NS_IMETHODIMP nsLocalFile::Exists(PRBool *_retval)
{
// Check we are correctly initialized.
@ -1101,7 +1055,6 @@ NS_IMETHODIMP nsLocalFile::Exists(PRBool *_retval)
return NS_OK;
}
/* boolean isWritable (); */
NS_IMETHODIMP nsLocalFile::IsWritable(PRBool *_retval)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1128,7 +1081,6 @@ NS_IMETHODIMP nsLocalFile::IsWritable(PRBool *_retval)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* boolean isReadable (); */
NS_IMETHODIMP nsLocalFile::IsReadable(PRBool *_retval)
{
// Check we are correctly initialized.
@ -1145,7 +1097,6 @@ NS_IMETHODIMP nsLocalFile::IsReadable(PRBool *_retval)
return NS_OK;
}
/* boolean isExecutable (); */
NS_IMETHODIMP nsLocalFile::IsExecutable(PRBool *_retval)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1172,7 +1123,6 @@ NS_IMETHODIMP nsLocalFile::IsExecutable(PRBool *_retval)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* boolean isHidden (); */
NS_IMETHODIMP nsLocalFile::IsHidden(PRBool *_retval)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1206,7 +1156,6 @@ NS_IMETHODIMP nsLocalFile::IsHidden(PRBool *_retval)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* boolean isDirectory (); */
NS_IMETHODIMP nsLocalFile::IsDirectory(PRBool *_retval)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1230,7 +1179,6 @@ NS_IMETHODIMP nsLocalFile::IsDirectory(PRBool *_retval)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* boolean isFile (); */
NS_IMETHODIMP nsLocalFile::IsFile(PRBool *_retval)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1254,7 +1202,6 @@ NS_IMETHODIMP nsLocalFile::IsFile(PRBool *_retval)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* boolean isSymlink (); */
NS_IMETHODIMP nsLocalFile::IsSymlink(PRBool *_retval)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1279,14 +1226,12 @@ NS_IMETHODIMP nsLocalFile::IsSymlink(PRBool *_retval)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* boolean isSpecial (); */
NS_IMETHODIMP nsLocalFile::IsSpecial(PRBool *_retval)
{
NS_ERROR("NS_ERROR_NOT_IMPLEMENTED");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIFile clone (); */
NS_IMETHODIMP nsLocalFile::Clone(nsIFile **_retval)
{
// Just copy-construct ourselves
@ -1299,7 +1244,6 @@ NS_IMETHODIMP nsLocalFile::Clone(nsIFile **_retval)
return NS_OK;
}
/* boolean equals (in nsIFile inFile); */
NS_IMETHODIMP nsLocalFile::Equals(nsIFile *inFile, PRBool *_retval)
{
return EqualsInternal(inFile, _retval);
@ -1341,7 +1285,6 @@ nsLocalFile::EqualsInternal(nsISupports* inFile, PRBool *_retval)
return NS_OK;
}
/* boolean contains (in nsIFile inFile, in boolean recur); */
NS_IMETHODIMP nsLocalFile::Contains(nsIFile *inFile, PRBool recur, PRBool *_retval)
{
// Check we are correctly initialized.
@ -1370,7 +1313,6 @@ NS_IMETHODIMP nsLocalFile::Contains(nsIFile *inFile, PRBool recur, PRBool *_retv
return NS_OK;
}
/* readonly attribute nsIFile parent; */
NS_IMETHODIMP nsLocalFile::GetParent(nsIFile * *aParent)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1413,7 +1355,6 @@ NS_IMETHODIMP nsLocalFile::GetParent(nsIFile * *aParent)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* readonly attribute nsISimpleEnumerator directoryEntries; */
NS_IMETHODIMP nsLocalFile::GetDirectoryEntries(nsISimpleEnumerator **aDirectoryEntries)
{
NS_ENSURE_ARG_POINTER(aDirectoryEntries);
@ -1441,20 +1382,14 @@ NS_IMETHODIMP nsLocalFile::GetDirectoryEntries(nsISimpleEnumerator **aDirectoryE
return NS_OK;
}
//*****************************************************************************
// nsLocalFile::nsILocalFile
//*****************************************************************************
#pragma mark -
#pragma mark [nsILocalFile]
/* void initWithPath (in AString filePath); */
NS_IMETHODIMP nsLocalFile::InitWithPath(const nsAString& filePath)
{
return InitWithNativePath(NS_ConvertUTF16toUTF8(filePath));
}
/* [noscript] void initWithNativePath (in ACString filePath); */
NS_IMETHODIMP nsLocalFile::InitWithNativePath(const nsACString& filePath)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1505,7 +1440,6 @@ NS_IMETHODIMP nsLocalFile::InitWithNativePath(const nsACString& filePath)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void initWithFile (in nsILocalFile aFile); */
NS_IMETHODIMP nsLocalFile::InitWithFile(nsILocalFile *aFile)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1526,7 +1460,6 @@ NS_IMETHODIMP nsLocalFile::InitWithFile(nsILocalFile *aFile)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* attribute PRBool followLinks; */
NS_IMETHODIMP nsLocalFile::GetFollowLinks(PRBool *aFollowLinks)
{
NS_ENSURE_ARG_POINTER(aFollowLinks);
@ -1544,7 +1477,6 @@ NS_IMETHODIMP nsLocalFile::SetFollowLinks(PRBool aFollowLinks)
return NS_OK;
}
/* [noscript] PRFileDescStar openNSPRFileDesc (in long flags, in long mode); */
NS_IMETHODIMP nsLocalFile::OpenNSPRFileDesc(PRInt32 flags, PRInt32 mode, PRFileDesc **_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
@ -1561,7 +1493,6 @@ NS_IMETHODIMP nsLocalFile::OpenNSPRFileDesc(PRInt32 flags, PRInt32 mode, PRFileD
return NS_OK;
}
/* [noscript] FILE openANSIFileDesc (in string mode); */
NS_IMETHODIMP nsLocalFile::OpenANSIFileDesc(const char *mode, FILE **_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
@ -1578,7 +1509,6 @@ NS_IMETHODIMP nsLocalFile::OpenANSIFileDesc(const char *mode, FILE **_retval)
return NS_OK;
}
/* [noscript] PRLibraryStar load (); */
NS_IMETHODIMP nsLocalFile::Load(PRLibrary **_retval)
{
// Check we are correctly initialized.
@ -1612,7 +1542,6 @@ NS_IMETHODIMP nsLocalFile::Load(PRLibrary **_retval)
return NS_OK;
}
/* readonly attribute PRInt64 diskSpaceAvailable; */
NS_IMETHODIMP nsLocalFile::GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1646,13 +1575,11 @@ NS_IMETHODIMP nsLocalFile::GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void appendRelativePath (in AString relativeFilePath); */
NS_IMETHODIMP nsLocalFile::AppendRelativePath(const nsAString& relativeFilePath)
{
return AppendRelativeNativePath(NS_ConvertUTF16toUTF8(relativeFilePath));
}
/* [noscript] void appendRelativeNativePath (in ACString relativeFilePath); */
NS_IMETHODIMP nsLocalFile::AppendRelativeNativePath(const nsACString& relativeFilePath)
{
if (relativeFilePath.IsEmpty())
@ -1679,7 +1606,6 @@ NS_IMETHODIMP nsLocalFile::AppendRelativeNativePath(const nsACString& relativeFi
return NS_OK;
}
/* attribute ACString persistentDescriptor; */
NS_IMETHODIMP nsLocalFile::GetPersistentDescriptor(nsACString& aPersistentDescriptor)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1763,7 +1689,6 @@ NS_IMETHODIMP nsLocalFile::SetPersistentDescriptor(const nsACString& aPersistent
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void reveal (); */
NS_IMETHODIMP nsLocalFile::Reveal()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1813,7 +1738,6 @@ NS_IMETHODIMP nsLocalFile::Reveal()
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void launch (); */
NS_IMETHODIMP nsLocalFile::Launch()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1829,14 +1753,9 @@ NS_IMETHODIMP nsLocalFile::Launch()
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
//*****************************************************************************
// nsLocalFile::nsILocalFileMac
//*****************************************************************************
#pragma mark -
#pragma mark [nsILocalFileMac]
/* void initWithCFURL (in CFURLRef aCFURL); */
NS_IMETHODIMP nsLocalFile::InitWithCFURL(CFURLRef aCFURL)
{
NS_ENSURE_ARG(aCFURL);
@ -1845,7 +1764,6 @@ NS_IMETHODIMP nsLocalFile::InitWithCFURL(CFURLRef aCFURL)
return NS_OK;
}
/* void initWithFSRef ([const] in FSRefPtr aFSRef); */
NS_IMETHODIMP nsLocalFile::InitWithFSRef(const FSRef *aFSRef)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1864,7 +1782,6 @@ NS_IMETHODIMP nsLocalFile::InitWithFSRef(const FSRef *aFSRef)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void initWithFSSpec ([const] in FSSpecPtr aFileSpec); */
NS_IMETHODIMP nsLocalFile::InitWithFSSpec(const FSSpec *aFileSpec)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1908,7 +1825,6 @@ NS_IMETHODIMP nsLocalFile::InitWithFSSpec(const FSSpec *aFileSpec)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void initToAppWithCreatorCode (in OSType aAppCreator); */
NS_IMETHODIMP nsLocalFile::InitToAppWithCreatorCode(OSType aAppCreator)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1922,7 +1838,6 @@ NS_IMETHODIMP nsLocalFile::InitToAppWithCreatorCode(OSType aAppCreator)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* CFURLRef getCFURL (); */
NS_IMETHODIMP nsLocalFile::GetCFURL(CFURLRef *_retval)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1937,14 +1852,12 @@ NS_IMETHODIMP nsLocalFile::GetCFURL(CFURLRef *_retval)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* FSRef getFSRef (); */
NS_IMETHODIMP nsLocalFile::GetFSRef(FSRef *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
return GetFSRefInternal(*_retval);
}
/* FSSpec getFSSpec (); */
NS_IMETHODIMP nsLocalFile::GetFSSpec(FSSpec *_retval)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1995,7 +1908,6 @@ NS_IMETHODIMP nsLocalFile::GetFSSpec(FSSpec *_retval)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* readonly attribute PRInt64 fileSizeWithResFork; */
NS_IMETHODIMP nsLocalFile::GetFileSizeWithResFork(PRInt64 *aFileSizeWithResFork)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -2019,7 +1931,6 @@ NS_IMETHODIMP nsLocalFile::GetFileSizeWithResFork(PRInt64 *aFileSizeWithResFork)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* attribute OSType fileType; */
NS_IMETHODIMP nsLocalFile::GetFileType(OSType *aFileType)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -2056,7 +1967,6 @@ NS_IMETHODIMP nsLocalFile::SetFileType(OSType aFileType)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* attribute OSType fileCreator; */
NS_IMETHODIMP nsLocalFile::GetFileCreator(OSType *aFileCreator)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -2093,7 +2003,6 @@ NS_IMETHODIMP nsLocalFile::SetFileCreator(OSType aFileCreator)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void setFileTypeAndCreatorFromMIMEType (in string aMIMEType); */
NS_IMETHODIMP nsLocalFile::SetFileTypeAndCreatorFromMIMEType(const char *aMIMEType)
{
// XXX - This should be cut from the API. Would create an evil dependency.
@ -2101,7 +2010,6 @@ NS_IMETHODIMP nsLocalFile::SetFileTypeAndCreatorFromMIMEType(const char *aMIMETy
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setFileTypeAndCreatorFromExtension (in string aExtension); */
NS_IMETHODIMP nsLocalFile::SetFileTypeAndCreatorFromExtension(const char *aExtension)
{
// XXX - This should be cut from the API. Would create an evil dependency.
@ -2109,7 +2017,6 @@ NS_IMETHODIMP nsLocalFile::SetFileTypeAndCreatorFromExtension(const char *aExten
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void launchWithDoc (in nsILocalFile aDocToLoad, in boolean aLaunchInBackground); */
NS_IMETHODIMP nsLocalFile::LaunchWithDoc(nsILocalFile *aDocToLoad, PRBool aLaunchInBackground)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -2156,7 +2063,6 @@ NS_IMETHODIMP nsLocalFile::LaunchWithDoc(nsILocalFile *aDocToLoad, PRBool aLaunc
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* void openDocWithApp (in nsILocalFile aAppToOpenWith, in boolean aLaunchInBackground); */
NS_IMETHODIMP nsLocalFile::OpenDocWithApp(nsILocalFile *aAppToOpenWith, PRBool aLaunchInBackground)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -2217,7 +2123,6 @@ NS_IMETHODIMP nsLocalFile::OpenDocWithApp(nsILocalFile *aAppToOpenWith, PRBool a
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
/* boolean isPackage (); */
NS_IMETHODIMP nsLocalFile::IsPackage(PRBool *_retval)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -2287,10 +2192,6 @@ nsLocalFile::GetBundleIdentifier(nsACString& outBundleIdentifier)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
//*****************************************************************************
// nsLocalFile Methods
//*****************************************************************************
#pragma mark -
#pragma mark [Protected Methods]
@ -2512,9 +2413,6 @@ nsLocalFile::GetHashCode(PRUint32 *aResult)
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
//*****************************************************************************
// Global Functions
//*****************************************************************************
#pragma mark -
#pragma mark [Global Functions]
@ -2587,9 +2485,8 @@ nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, PRBool aFollowLinks, nsIL
return NS_OK;
}
//*****************************************************************************
// Static Functions
//*****************************************************************************
#pragma mark -
#pragma mark [Static Functions]
static nsresult MacErrorMapper(OSErr inErr)
{