69862. r=bienvenu sr=scc@mozilla.org. Check and close the file stream in the destructor

This commit is contained in:
naving%netscape.com 2001-02-26 18:50:25 +00:00
Родитель a91023590b
Коммит f67645d1d2
2 изменённых файлов: 17 добавлений и 0 удалений

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

@ -310,6 +310,14 @@ nsInputFileStream::nsInputFileStream(nsIFileSpec* inSpec)
NS_RELEASE(stream);
} // nsInputFileStream::nsInputFileStream
//----------------------------------------------------------------------------------------
nsInputFileStream::~nsInputFileStream()
//----------------------------------------------------------------------------------------
{
if (is_open())
close();
}
//----------------------------------------------------------------------------------------
void nsInputFileStream::AssignFrom(nsISupports* stream)
//----------------------------------------------------------------------------------------
@ -337,6 +345,13 @@ nsOutputFileStream::nsOutputFileStream(nsIFileSpec* inSpec)
NS_RELEASE(stream);
}
//----------------------------------------------------------------------------------------
nsOutputFileStream::~nsOutputFileStream()
//----------------------------------------------------------------------------------------
{
if (is_open())
close();
}
//----------------------------------------------------------------------------------------
void nsOutputFileStream::AssignFrom(nsISupports* stream)
//----------------------------------------------------------------------------------------

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

@ -481,6 +481,7 @@ public:
int nsprMode = kDefaultMode,
PRIntn accessMode = 00666);
nsInputFileStream(nsIFileSpec* inFile);
virtual ~nsInputFileStream();
void Open(
const nsFileSpec& inFile,
@ -606,6 +607,7 @@ public:
NS_RELEASE(stream);
}
nsOutputFileStream(nsIFileSpec* inFile);
virtual ~nsOutputFileStream();
virtual void flush();
virtual void abort();