зеркало из https://github.com/mozilla/pjs.git
oops, back out this change, wasn't supposed to land
This commit is contained in:
Родитель
300c7177e1
Коммит
be588199b7
|
@ -42,6 +42,7 @@ EXPORTS = \
|
|||
nsLinebreakConverter.h \
|
||||
nsScriptableInputStream.h \
|
||||
nsSpecialSystemDirectory.h \
|
||||
nsStorageStream.h \
|
||||
nsStringIO.h \
|
||||
$(NULL)
|
||||
|
||||
|
@ -102,6 +103,7 @@ CPP_OBJS = \
|
|||
.\$(OBJDIR)\nsScriptableInputStream.obj \
|
||||
.\$(OBJDIR)\nsSegmentedBuffer.obj \
|
||||
.\$(OBJDIR)\nsSpecialSystemDirectory.obj \
|
||||
.\$(OBJDIR)\nsStorageStream.obj \
|
||||
.\$(OBJDIR)\nsUnicharInputStream.obj \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -935,15 +935,14 @@ void nsFileSpec::operator = (const nsPersistentFileDescriptor& inDescriptor)
|
|||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
nsSimpleCharString data;
|
||||
PRInt32 dataSize;
|
||||
inDescriptor.GetData(data, dataSize);
|
||||
nsCAutoString data;
|
||||
inDescriptor.GetData(data);
|
||||
|
||||
#if defined(XP_MAC)
|
||||
char* decodedData = PL_Base64Decode((const char*)data, (int)dataSize, nsnull);
|
||||
char* decodedData = PL_Base64Decode(data.get(), data.Length(), nsnull);
|
||||
// Cast to an alias record and resolve.
|
||||
AliasHandle aliasH = nsnull;
|
||||
mError = NS_FILE_RESULT(PtrToHand(decodedData, &(Handle)aliasH, (dataSize * 3) / 4));
|
||||
mError = NS_FILE_RESULT(PtrToHand(decodedData, &(Handle)aliasH, (data.Length() * 3) / 4));
|
||||
PR_Free(decodedData);
|
||||
if (NS_FAILED(mError))
|
||||
return; // not enough memory?
|
||||
|
@ -953,7 +952,7 @@ void nsFileSpec::operator = (const nsPersistentFileDescriptor& inDescriptor)
|
|||
DisposeHandle((Handle) aliasH);
|
||||
mPath.SetToEmpty();
|
||||
#else
|
||||
mPath = data;
|
||||
mPath = data.get();
|
||||
mError = NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
@ -1214,32 +1213,17 @@ nsPersistentFileDescriptor::~nsPersistentFileDescriptor()
|
|||
} // nsPersistentFileDescriptor::~nsPersistentFileDescriptor
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsPersistentFileDescriptor::GetData(nsSimpleCharString& outData) const
|
||||
void nsPersistentFileDescriptor::GetData(nsAFlatCString& outData) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
outData = mDescriptorString;
|
||||
outData.Assign(mDescriptorString, mDescriptorString.Length());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsPersistentFileDescriptor::SetData(const nsSimpleCharString& inData)
|
||||
void nsPersistentFileDescriptor::SetData(const nsAFlatCString& inData)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
SetData(inData, inData.Length());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsPersistentFileDescriptor::GetData(nsSimpleCharString& outData, PRInt32& outSize) const
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
outSize = mDescriptorString.Length();
|
||||
outData = mDescriptorString;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void nsPersistentFileDescriptor::SetData(const nsSimpleCharString& inData, PRInt32 inSize)
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
mDescriptorString.CopyFrom((const char*)inData, inSize);
|
||||
mDescriptorString.CopyFrom(inData.get(), inData.Length());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
|
|
@ -242,7 +242,7 @@ nsresult ns_file_convert_result(PRInt32 nativeErr);
|
|||
#define NS_FILE_FAILURE NS_FILE_RESULT(-1)
|
||||
|
||||
//========================================================================================
|
||||
class NS_COM nsSimpleCharString
|
||||
class nsSimpleCharString
|
||||
// An envelope for char*: reference counted. Used internally by all the nsFileSpec
|
||||
// classes below.
|
||||
//========================================================================================
|
||||
|
@ -330,7 +330,6 @@ class NS_COM nsFileSpec
|
|||
|
||||
NS_EXPLICIT nsFileSpec(const nsFilePath& inPath);
|
||||
NS_EXPLICIT nsFileSpec(const nsFileURL& inURL);
|
||||
NS_EXPLICIT nsFileSpec(const nsPersistentFileDescriptor& inURL);
|
||||
nsFileSpec(const nsFileSpec& inPath);
|
||||
virtual ~nsFileSpec();
|
||||
|
||||
|
@ -518,6 +517,9 @@ class NS_COM nsFileSpec
|
|||
nsSimpleCharString mPath;
|
||||
nsresult mError;
|
||||
|
||||
private:
|
||||
NS_EXPLICIT nsFileSpec(const nsPersistentFileDescriptor& inURL);
|
||||
|
||||
}; // class nsFileSpec
|
||||
|
||||
// FOR HISTORICAL REASONS:
|
||||
|
@ -634,7 +636,7 @@ class NS_COM nsFilePath
|
|||
}; // class nsFilePath
|
||||
|
||||
//========================================================================================
|
||||
class NS_COM nsPersistentFileDescriptor
|
||||
class nsPersistentFileDescriptor
|
||||
// To save information about a file's location in another file, initialize
|
||||
// one of these from your nsFileSpec, and then write this out to your output stream.
|
||||
// To retrieve the info, create one of these, read its value from an input stream.
|
||||
|
@ -664,10 +666,8 @@ class NS_COM nsPersistentFileDescriptor
|
|||
// writes the data to a file
|
||||
friend class nsFileSpec;
|
||||
|
||||
void GetData(nsSimpleCharString& outData) const;
|
||||
void SetData(const nsSimpleCharString& inData);
|
||||
void GetData(nsSimpleCharString& outData, PRInt32& outSize) const;
|
||||
void SetData(const nsSimpleCharString& inData, PRInt32 inSize);
|
||||
void GetData(nsAFlatCString& outData) const;
|
||||
void SetData(const nsAFlatCString& inData);
|
||||
void SetData(const char* inData, PRInt32 inSize);
|
||||
|
||||
//--------------------------------------------------
|
||||
|
|
|
@ -172,9 +172,9 @@ NS_IMETHODIMP nsFileSpecImpl::GetPersistentDescriptorString(char * *aPersistentD
|
|||
if (mFileSpec.Failed())
|
||||
return mFileSpec.Error();
|
||||
nsPersistentFileDescriptor desc(mFileSpec);
|
||||
nsSimpleCharString data;
|
||||
nsCAutoString data;
|
||||
desc.GetData(data);
|
||||
*aPersistentDescriptorString = nsCRT::strdup((const char*) data);
|
||||
*aPersistentDescriptorString = ToNewCString(data);
|
||||
if (!*aPersistentDescriptorString)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
|
@ -185,7 +185,7 @@ NS_IMETHODIMP nsFileSpecImpl::SetPersistentDescriptorString(const char * aPersis
|
|||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
nsPersistentFileDescriptor desc(mFileSpec);
|
||||
desc.SetData(aPersistentDescriptorString);
|
||||
desc.SetData(nsDependentCString(aPersistentDescriptorString));
|
||||
mFileSpec = desc;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче