Fix for 86501 - bookmarks truncated when disk full

allow file streams to store and report on the status of the write operation.
r=darin, sr=brendan
This commit is contained in:
ben%netscape.com 2002-06-26 05:17:54 +00:00
Родитель c39ca4d30a
Коммит f47565520b
2 изменённых файлов: 12 добавлений и 2 удалений

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

@ -126,7 +126,7 @@ PRInt32 nsOutputStream::write(const void* s, PRInt32 n)
if (!mOutputStream)
return 0;
PRInt32 result = 0;
mOutputStream->Write((char*)s, n, (PRUint32*)&result);
mWriteStatus = mOutputStream->Write((char*)s, n, (PRUint32*)&result);
return result;
} // nsOutputStream::write
@ -137,6 +137,13 @@ nsresult nsOutputStream::flush()
return NS_OK;
}
//----------------------------------------------------------------------------------------
nsresult nsOutputStream::lastWriteStatus()
//----------------------------------------------------------------------------------------
{
return mWriteStatus;
}
//----------------------------------------------------------------------------------------
nsOutputStream& nsOutputStream::operator << (char c)
//----------------------------------------------------------------------------------------

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

@ -270,6 +270,7 @@ public:
void put(char c);
PRInt32 write(const void* s, PRInt32 n);
virtual nsresult flush();
nsresult lastWriteStatus();
// Output streamers. Add more as needed (but you have to add delegators to the derived
// classes, too, because these operators don't inherit).
@ -294,9 +295,11 @@ private:
nsOutputStream(const nsOutputStream& rhs);
nsOutputStream& operator=(const nsOutputStream& rhs);
nsresult mWriteStatus;
// DATA
protected:
nsCOMPtr<nsIOutputStream> mOutputStream;
nsCOMPtr<nsIOutputStream> mOutputStream;
}; // class nsOutputStream
typedef nsOutputStream nsBasicOutStream; // Historic support for this name