Backing out previous change from the trunk, because it was supposed to have gone in on a branch.

This commit is contained in:
mcmullen%netscape.com 1999-02-18 00:45:07 +00:00
Родитель b941f5d5d8
Коммит 08350f58b5
4 изменённых файлов: 80 добавлений и 78 удалений

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

@ -41,13 +41,13 @@
// //
// Basic example: // Basic example:
// //
// nsFileSpec myPath("/Development/iotest.txt"); // nsFilePath myPath("/Development/iotest.txt");
// //
// nsOutputFileStream testStream(myPath); // nsOutputFileStream testStream(myPath);
// testStream << "Hello World" << nsEndl; // testStream << "Hello World" << nsEndl;
// //
// 4. Requires streams to be constructed using typesafe nsFileSpec specifier // 4. Requires streams to be constructed using typesafe nsFilePath specifier
// (not the notorious and bug prone const char*), namely nsFileSpec. See // (not the notorious and bug prone const char*), namely nsFilePath. See
// nsFileSpec.h for more details. // nsFileSpec.h for more details.
// //
// 5. Fixes a bug that have been there for a long time, and // 5. Fixes a bug that have been there for a long time, and
@ -140,7 +140,7 @@ public:
nsBasicFileStream(); nsBasicFileStream();
nsBasicFileStream(PRFileDesc* desc, int nsprMode); nsBasicFileStream(PRFileDesc* desc, int nsprMode);
nsBasicFileStream( nsBasicFileStream(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode, int nsprMode,
PRIntn accessMode); PRIntn accessMode);
virtual ~nsBasicFileStream(); virtual ~nsBasicFileStream();
@ -148,14 +148,14 @@ public:
inline PRBool is_open() const { return mFileDesc != 0; } inline PRBool is_open() const { return mFileDesc != 0; }
void open( void open(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode, int nsprMode,
PRIntn accessMode); PRIntn accessMode);
void close(); void close();
PRIntn tell() const; PRIntn tell() const;
void seek(PRInt32 offset) { seek(PR_SEEK_SET, offset); } void seek(PRInt32 offset) { seek(PR_SEEK_SET, offset); }
void seek(PRSeekWhence whence, PRInt32 offset); void seek(PRSeekWhence whence, PRInt32 offset);
PRBool eof() const { return mEOF; } PRBool eof() const { return mEOF; }
PRBool failed() const { return mFailed; } PRBool failed() const { return mFailed; }
// call PR_GetError() for details // call PR_GetError() for details
protected: protected:
@ -249,7 +249,7 @@ public:
enum { kDefaultMode = PR_RDONLY }; enum { kDefaultMode = PR_RDONLY };
nsInputFileStream(istream* stream = CONSOLE_IN); nsInputFileStream(istream* stream = CONSOLE_IN);
nsInputFileStream( nsInputFileStream(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
: nsBasicFileStream(inFile, nsprMode, accessMode) : nsBasicFileStream(inFile, nsprMode, accessMode)
@ -257,7 +257,7 @@ public:
{} {}
void open( void open(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
{ {
@ -280,7 +280,7 @@ public:
nsOutputFileStream(ostream* stream = CONSOLE_OUT); nsOutputFileStream(ostream* stream = CONSOLE_OUT);
nsOutputFileStream( nsOutputFileStream(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
: nsBasicFileStream(inFile, nsprMode, accessMode) : nsBasicFileStream(inFile, nsprMode, accessMode)
@ -288,7 +288,7 @@ public:
{} {}
inline void open( inline void open(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
{ {
@ -307,7 +307,7 @@ public:
enum { kDefaultMode = (PR_RDWR | PR_CREATE_FILE) }; enum { kDefaultMode = (PR_RDWR | PR_CREATE_FILE) };
nsIOFileStream( nsIOFileStream(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
: nsBasicFileStream(inFile, nsprMode, accessMode) : nsBasicFileStream(inFile, nsprMode, accessMode)
@ -316,7 +316,7 @@ public:
{} {}
inline void open( inline void open(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
{ {

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

@ -38,21 +38,21 @@ nsBasicFileStream::nsBasicFileStream()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
: mFileDesc(0) : mFileDesc(0)
, mNSPRMode(0) , mNSPRMode(0)
, mFailed(PR_FALSE) , mFailed(false)
, mEOF(PR_FALSE) , mEOF(false)
{ {
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
nsBasicFileStream::nsBasicFileStream( nsBasicFileStream::nsBasicFileStream(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode, int nsprMode,
PRIntn accessMode) PRIntn accessMode)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
: mFileDesc(0) : mFileDesc(0)
, mNSPRMode(0) , mNSPRMode(0)
, mFailed(PR_FALSE) , mFailed(false)
, mEOF(PR_FALSE) , mEOF(false)
{ {
open(inFile, nsprMode, accessMode); open(inFile, nsprMode, accessMode);
} }
@ -62,8 +62,8 @@ nsBasicFileStream::nsBasicFileStream(PRFileDesc* desc, int nsprMode)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
: mFileDesc(desc) : mFileDesc(desc)
, mNSPRMode(nsprMode) , mNSPRMode(nsprMode)
, mFailed(PR_FALSE) , mFailed(false)
, mEOF(PR_FALSE) , mEOF(false)
{ {
} }
@ -76,7 +76,7 @@ nsBasicFileStream::~nsBasicFileStream()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void nsBasicFileStream::open( void nsBasicFileStream::open(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode, int nsprMode,
PRIntn accessMode) PRIntn accessMode)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
@ -110,7 +110,7 @@ void nsBasicFileStream::open(
// several files on the Macintosh (you can have several volumes with the // several files on the Macintosh (you can have several volumes with the
// same name, see). // same name, see).
mFileDesc = 0; mFileDesc = 0;
if (inFile.Error() != noErr) if (inFile.GetNativeSpec().Error() != noErr)
return; return;
OSErr err = noErr; OSErr err = noErr;
#if DEBUG #if DEBUG
@ -118,9 +118,10 @@ void nsBasicFileStream::open(
#else #else
const OSType kCreator = 'MOSS'; const OSType kCreator = 'MOSS';
#endif #endif
const FSSpec& spec = inFile.operator const FSSpec&(); nsNativeFileSpec nativeSpec = inFile.GetNativeSpec();
FSSpec* spec = (FSSpec*)nativeSpec;
if (nsprMode & PR_CREATE_FILE) if (nsprMode & PR_CREATE_FILE)
err = FSpCreate(&spec, kCreator, 'TEXT', 0); err = FSpCreate(spec, kCreator, 'TEXT', 0);
if (err == dupFNErr) if (err == dupFNErr)
err = noErr; err = noErr;
if (err != noErr) if (err != noErr)
@ -135,7 +136,7 @@ void nsBasicFileStream::open(
perm = fsRdPerm; perm = fsRdPerm;
short refnum; short refnum;
err = FSpOpenDF(&spec, perm, &refnum); err = FSpOpenDF(spec, perm, &refnum);
if (err == noErr && (nsprMode & PR_TRUNCATE)) if (err == noErr && (nsprMode & PR_TRUNCATE))
err = SetEOF(refnum, 0); err = SetEOF(refnum, 0);
@ -150,7 +151,7 @@ void nsBasicFileStream::open(
// Platforms other than Macintosh... // Platforms other than Macintosh...
// Another bug in NSPR: Mac PR_Open assumes a unix style path, but Win PR_Open assumes // Another bug in NSPR: Mac PR_Open assumes a unix style path, but Win PR_Open assumes
// a windows path. // a windows path.
if ((mFileDesc = PR_Open((const char*)nsFileSpec(inFile), nsprMode, accessMode)) == 0) if ((mFileDesc = PR_Open((const char*)nsNativeFileSpec(inFile), nsprMode, accessMode)) == 0)
return; return;
#endif #endif
mNSPRMode = nsprMode; mNSPRMode = nsprMode;
@ -174,8 +175,8 @@ void nsBasicFileStream::seek(PRSeekWhence whence, PRInt32 offset)
{ {
if (mFileDesc==PR_STDIN || mFileDesc==PR_STDOUT || mFileDesc==PR_STDERR || mFileDesc == 0) if (mFileDesc==PR_STDIN || mFileDesc==PR_STDOUT || mFileDesc==PR_STDERR || mFileDesc == 0)
return; return;
mFailed = PR_FALSE; // reset on a seek. mFailed = false; // reset on a seek.
mEOF = PR_FALSE; // reset on a seek. mEOF = false; // reset on a seek.
PRInt32 position = PR_Seek(mFileDesc, 0, PR_SEEK_CUR); PRInt32 position = PR_Seek(mFileDesc, 0, PR_SEEK_CUR);
PRInt32 available = PR_Available(mFileDesc); PRInt32 available = PR_Available(mFileDesc);
PRInt32 fileSize = position + available; PRInt32 fileSize = position + available;
@ -189,15 +190,15 @@ void nsBasicFileStream::seek(PRSeekWhence whence, PRInt32 offset)
if (newPosition < 0) if (newPosition < 0)
{ {
newPosition = 0; newPosition = 0;
mFailed = PR_TRUE; mFailed = true;
} }
else if (newPosition >= fileSize) else if (newPosition >= fileSize)
{ {
newPosition = fileSize; newPosition = fileSize;
mEOF = PR_TRUE; mEOF = true;
} }
if (PR_Seek(mFileDesc, newPosition, PR_SEEK_SET) < 0) if (PR_Seek(mFileDesc, newPosition, PR_SEEK_SET) < 0)
mFailed = PR_TRUE; mFailed = true;
} // nsBasicFileStream::seek } // nsBasicFileStream::seek
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
@ -233,15 +234,15 @@ PRBool nsBasicInStream::readline(char* s, PRInt32 n)
// This will truncate if the buffer is too small. Result will always be null-terminated. // This will truncate if the buffer is too small. Result will always be null-terminated.
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
{ {
PRBool bufferLargeEnough = PR_TRUE; // result PRBool bufferLargeEnough = true; // result
if (!s || !n) if (!s || !n)
return PR_TRUE; return true;
PRIntn position = mBase.tell(); PRIntn position = mBase.tell();
if (position < 0) if (position < 0)
return PR_FALSE; return false;
PRInt32 bytesRead = read(s, n - 1); PRInt32 bytesRead = read(s, n - 1);
if (mBase.failed()) if (mBase.failed())
return PR_FALSE; return false;
s[bytesRead] = '\0'; // always terminate at the end of the buffer s[bytesRead] = '\0'; // always terminate at the end of the buffer
char* tp = strpbrk(s, "\n\r"); char* tp = strpbrk(s, "\n\r");
if (tp) if (tp)
@ -253,7 +254,7 @@ PRBool nsBasicInStream::readline(char* s, PRInt32 n)
bytesRead = (tp - s); bytesRead = (tp - s);
} }
else if (!mBase.eof()) else if (!mBase.eof())
bufferLargeEnough = PR_FALSE; bufferLargeEnough = false;
position += bytesRead; position += bytesRead;
mBase.seek(position); mBase.seek(position);
return bufferLargeEnough; return bufferLargeEnough;
@ -275,9 +276,9 @@ PRInt32 nsBasicInStream::read(void* s, PRInt32 n)
return -1; return -1;
PRInt32 bytesRead = PR_Read(mBase.GetFileDescriptor(), s, n); PRInt32 bytesRead = PR_Read(mBase.GetFileDescriptor(), s, n);
if (bytesRead < 0) if (bytesRead < 0)
mBase.mFailed = PR_TRUE; mBase.mFailed = true;
else if (bytesRead < n) else if (bytesRead < n)
mBase.mEOF = PR_TRUE; mBase.mEOF = true;
return bytesRead; return bytesRead;
} }
@ -341,7 +342,7 @@ PRInt32 nsBasicOutStream::write(const void* s, PRInt32 n)
return -1; return -1;
PRInt32 bytesWrit = PR_Write(mBase.mFileDesc, s, n); PRInt32 bytesWrit = PR_Write(mBase.mFileDesc, s, n);
if (bytesWrit != n) if (bytesWrit != n)
mBase.mFailed = PR_TRUE; mBase.mFailed = true;
return bytesWrit; return bytesWrit;
} }
@ -415,7 +416,7 @@ void nsBasicOutStream::flush()
#ifdef XP_MAC #ifdef XP_MAC
// On unix, it seems to fail always. // On unix, it seems to fail always.
if (itFailed) if (itFailed)
mBase.mFailed = PR_TRUE; mBase.mFailed = true;
#endif #endif
} // nsBasicOutStream::flush } // nsBasicOutStream::flush

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

@ -38,21 +38,21 @@ nsBasicFileStream::nsBasicFileStream()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
: mFileDesc(0) : mFileDesc(0)
, mNSPRMode(0) , mNSPRMode(0)
, mFailed(PR_FALSE) , mFailed(false)
, mEOF(PR_FALSE) , mEOF(false)
{ {
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
nsBasicFileStream::nsBasicFileStream( nsBasicFileStream::nsBasicFileStream(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode, int nsprMode,
PRIntn accessMode) PRIntn accessMode)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
: mFileDesc(0) : mFileDesc(0)
, mNSPRMode(0) , mNSPRMode(0)
, mFailed(PR_FALSE) , mFailed(false)
, mEOF(PR_FALSE) , mEOF(false)
{ {
open(inFile, nsprMode, accessMode); open(inFile, nsprMode, accessMode);
} }
@ -62,8 +62,8 @@ nsBasicFileStream::nsBasicFileStream(PRFileDesc* desc, int nsprMode)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
: mFileDesc(desc) : mFileDesc(desc)
, mNSPRMode(nsprMode) , mNSPRMode(nsprMode)
, mFailed(PR_FALSE) , mFailed(false)
, mEOF(PR_FALSE) , mEOF(false)
{ {
} }
@ -76,7 +76,7 @@ nsBasicFileStream::~nsBasicFileStream()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void nsBasicFileStream::open( void nsBasicFileStream::open(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode, int nsprMode,
PRIntn accessMode) PRIntn accessMode)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
@ -110,7 +110,7 @@ void nsBasicFileStream::open(
// several files on the Macintosh (you can have several volumes with the // several files on the Macintosh (you can have several volumes with the
// same name, see). // same name, see).
mFileDesc = 0; mFileDesc = 0;
if (inFile.Error() != noErr) if (inFile.GetNativeSpec().Error() != noErr)
return; return;
OSErr err = noErr; OSErr err = noErr;
#if DEBUG #if DEBUG
@ -118,9 +118,10 @@ void nsBasicFileStream::open(
#else #else
const OSType kCreator = 'MOSS'; const OSType kCreator = 'MOSS';
#endif #endif
const FSSpec& spec = inFile.operator const FSSpec&(); nsNativeFileSpec nativeSpec = inFile.GetNativeSpec();
FSSpec* spec = (FSSpec*)nativeSpec;
if (nsprMode & PR_CREATE_FILE) if (nsprMode & PR_CREATE_FILE)
err = FSpCreate(&spec, kCreator, 'TEXT', 0); err = FSpCreate(spec, kCreator, 'TEXT', 0);
if (err == dupFNErr) if (err == dupFNErr)
err = noErr; err = noErr;
if (err != noErr) if (err != noErr)
@ -135,7 +136,7 @@ void nsBasicFileStream::open(
perm = fsRdPerm; perm = fsRdPerm;
short refnum; short refnum;
err = FSpOpenDF(&spec, perm, &refnum); err = FSpOpenDF(spec, perm, &refnum);
if (err == noErr && (nsprMode & PR_TRUNCATE)) if (err == noErr && (nsprMode & PR_TRUNCATE))
err = SetEOF(refnum, 0); err = SetEOF(refnum, 0);
@ -150,7 +151,7 @@ void nsBasicFileStream::open(
// Platforms other than Macintosh... // Platforms other than Macintosh...
// Another bug in NSPR: Mac PR_Open assumes a unix style path, but Win PR_Open assumes // Another bug in NSPR: Mac PR_Open assumes a unix style path, but Win PR_Open assumes
// a windows path. // a windows path.
if ((mFileDesc = PR_Open((const char*)nsFileSpec(inFile), nsprMode, accessMode)) == 0) if ((mFileDesc = PR_Open((const char*)nsNativeFileSpec(inFile), nsprMode, accessMode)) == 0)
return; return;
#endif #endif
mNSPRMode = nsprMode; mNSPRMode = nsprMode;
@ -174,8 +175,8 @@ void nsBasicFileStream::seek(PRSeekWhence whence, PRInt32 offset)
{ {
if (mFileDesc==PR_STDIN || mFileDesc==PR_STDOUT || mFileDesc==PR_STDERR || mFileDesc == 0) if (mFileDesc==PR_STDIN || mFileDesc==PR_STDOUT || mFileDesc==PR_STDERR || mFileDesc == 0)
return; return;
mFailed = PR_FALSE; // reset on a seek. mFailed = false; // reset on a seek.
mEOF = PR_FALSE; // reset on a seek. mEOF = false; // reset on a seek.
PRInt32 position = PR_Seek(mFileDesc, 0, PR_SEEK_CUR); PRInt32 position = PR_Seek(mFileDesc, 0, PR_SEEK_CUR);
PRInt32 available = PR_Available(mFileDesc); PRInt32 available = PR_Available(mFileDesc);
PRInt32 fileSize = position + available; PRInt32 fileSize = position + available;
@ -189,15 +190,15 @@ void nsBasicFileStream::seek(PRSeekWhence whence, PRInt32 offset)
if (newPosition < 0) if (newPosition < 0)
{ {
newPosition = 0; newPosition = 0;
mFailed = PR_TRUE; mFailed = true;
} }
else if (newPosition >= fileSize) else if (newPosition >= fileSize)
{ {
newPosition = fileSize; newPosition = fileSize;
mEOF = PR_TRUE; mEOF = true;
} }
if (PR_Seek(mFileDesc, newPosition, PR_SEEK_SET) < 0) if (PR_Seek(mFileDesc, newPosition, PR_SEEK_SET) < 0)
mFailed = PR_TRUE; mFailed = true;
} // nsBasicFileStream::seek } // nsBasicFileStream::seek
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
@ -233,15 +234,15 @@ PRBool nsBasicInStream::readline(char* s, PRInt32 n)
// This will truncate if the buffer is too small. Result will always be null-terminated. // This will truncate if the buffer is too small. Result will always be null-terminated.
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
{ {
PRBool bufferLargeEnough = PR_TRUE; // result PRBool bufferLargeEnough = true; // result
if (!s || !n) if (!s || !n)
return PR_TRUE; return true;
PRIntn position = mBase.tell(); PRIntn position = mBase.tell();
if (position < 0) if (position < 0)
return PR_FALSE; return false;
PRInt32 bytesRead = read(s, n - 1); PRInt32 bytesRead = read(s, n - 1);
if (mBase.failed()) if (mBase.failed())
return PR_FALSE; return false;
s[bytesRead] = '\0'; // always terminate at the end of the buffer s[bytesRead] = '\0'; // always terminate at the end of the buffer
char* tp = strpbrk(s, "\n\r"); char* tp = strpbrk(s, "\n\r");
if (tp) if (tp)
@ -253,7 +254,7 @@ PRBool nsBasicInStream::readline(char* s, PRInt32 n)
bytesRead = (tp - s); bytesRead = (tp - s);
} }
else if (!mBase.eof()) else if (!mBase.eof())
bufferLargeEnough = PR_FALSE; bufferLargeEnough = false;
position += bytesRead; position += bytesRead;
mBase.seek(position); mBase.seek(position);
return bufferLargeEnough; return bufferLargeEnough;
@ -275,9 +276,9 @@ PRInt32 nsBasicInStream::read(void* s, PRInt32 n)
return -1; return -1;
PRInt32 bytesRead = PR_Read(mBase.GetFileDescriptor(), s, n); PRInt32 bytesRead = PR_Read(mBase.GetFileDescriptor(), s, n);
if (bytesRead < 0) if (bytesRead < 0)
mBase.mFailed = PR_TRUE; mBase.mFailed = true;
else if (bytesRead < n) else if (bytesRead < n)
mBase.mEOF = PR_TRUE; mBase.mEOF = true;
return bytesRead; return bytesRead;
} }
@ -341,7 +342,7 @@ PRInt32 nsBasicOutStream::write(const void* s, PRInt32 n)
return -1; return -1;
PRInt32 bytesWrit = PR_Write(mBase.mFileDesc, s, n); PRInt32 bytesWrit = PR_Write(mBase.mFileDesc, s, n);
if (bytesWrit != n) if (bytesWrit != n)
mBase.mFailed = PR_TRUE; mBase.mFailed = true;
return bytesWrit; return bytesWrit;
} }
@ -415,7 +416,7 @@ void nsBasicOutStream::flush()
#ifdef XP_MAC #ifdef XP_MAC
// On unix, it seems to fail always. // On unix, it seems to fail always.
if (itFailed) if (itFailed)
mBase.mFailed = PR_TRUE; mBase.mFailed = true;
#endif #endif
} // nsBasicOutStream::flush } // nsBasicOutStream::flush

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

@ -41,13 +41,13 @@
// //
// Basic example: // Basic example:
// //
// nsFileSpec myPath("/Development/iotest.txt"); // nsFilePath myPath("/Development/iotest.txt");
// //
// nsOutputFileStream testStream(myPath); // nsOutputFileStream testStream(myPath);
// testStream << "Hello World" << nsEndl; // testStream << "Hello World" << nsEndl;
// //
// 4. Requires streams to be constructed using typesafe nsFileSpec specifier // 4. Requires streams to be constructed using typesafe nsFilePath specifier
// (not the notorious and bug prone const char*), namely nsFileSpec. See // (not the notorious and bug prone const char*), namely nsFilePath. See
// nsFileSpec.h for more details. // nsFileSpec.h for more details.
// //
// 5. Fixes a bug that have been there for a long time, and // 5. Fixes a bug that have been there for a long time, and
@ -140,7 +140,7 @@ public:
nsBasicFileStream(); nsBasicFileStream();
nsBasicFileStream(PRFileDesc* desc, int nsprMode); nsBasicFileStream(PRFileDesc* desc, int nsprMode);
nsBasicFileStream( nsBasicFileStream(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode, int nsprMode,
PRIntn accessMode); PRIntn accessMode);
virtual ~nsBasicFileStream(); virtual ~nsBasicFileStream();
@ -148,14 +148,14 @@ public:
inline PRBool is_open() const { return mFileDesc != 0; } inline PRBool is_open() const { return mFileDesc != 0; }
void open( void open(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode, int nsprMode,
PRIntn accessMode); PRIntn accessMode);
void close(); void close();
PRIntn tell() const; PRIntn tell() const;
void seek(PRInt32 offset) { seek(PR_SEEK_SET, offset); } void seek(PRInt32 offset) { seek(PR_SEEK_SET, offset); }
void seek(PRSeekWhence whence, PRInt32 offset); void seek(PRSeekWhence whence, PRInt32 offset);
PRBool eof() const { return mEOF; } PRBool eof() const { return mEOF; }
PRBool failed() const { return mFailed; } PRBool failed() const { return mFailed; }
// call PR_GetError() for details // call PR_GetError() for details
protected: protected:
@ -249,7 +249,7 @@ public:
enum { kDefaultMode = PR_RDONLY }; enum { kDefaultMode = PR_RDONLY };
nsInputFileStream(istream* stream = CONSOLE_IN); nsInputFileStream(istream* stream = CONSOLE_IN);
nsInputFileStream( nsInputFileStream(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
: nsBasicFileStream(inFile, nsprMode, accessMode) : nsBasicFileStream(inFile, nsprMode, accessMode)
@ -257,7 +257,7 @@ public:
{} {}
void open( void open(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
{ {
@ -280,7 +280,7 @@ public:
nsOutputFileStream(ostream* stream = CONSOLE_OUT); nsOutputFileStream(ostream* stream = CONSOLE_OUT);
nsOutputFileStream( nsOutputFileStream(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
: nsBasicFileStream(inFile, nsprMode, accessMode) : nsBasicFileStream(inFile, nsprMode, accessMode)
@ -288,7 +288,7 @@ public:
{} {}
inline void open( inline void open(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
{ {
@ -307,7 +307,7 @@ public:
enum { kDefaultMode = (PR_RDWR | PR_CREATE_FILE) }; enum { kDefaultMode = (PR_RDWR | PR_CREATE_FILE) };
nsIOFileStream( nsIOFileStream(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
: nsBasicFileStream(inFile, nsprMode, accessMode) : nsBasicFileStream(inFile, nsprMode, accessMode)
@ -316,7 +316,7 @@ public:
{} {}
inline void open( inline void open(
const nsFileSpec& inFile, const nsFilePath& inFile,
int nsprMode = kDefaultMode, int nsprMode = kDefaultMode,
PRIntn accessMode = 00700) // <- OCTAL PRIntn accessMode = 00700) // <- OCTAL
{ {