diff --git a/xpcom/io/nsFileStream.cpp b/xpcom/io/nsFileStream.cpp index ad2d8dee7181..56f345830c45 100644 --- a/xpcom/io/nsFileStream.cpp +++ b/xpcom/io/nsFileStream.cpp @@ -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) //---------------------------------------------------------------------------------------- diff --git a/xpcom/io/nsFileStream.h b/xpcom/io/nsFileStream.h index 8cc9250b226c..e8345b90d0a4 100644 --- a/xpcom/io/nsFileStream.h +++ b/xpcom/io/nsFileStream.h @@ -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 mOutputStream; + nsCOMPtr mOutputStream; }; // class nsOutputStream typedef nsOutputStream nsBasicOutStream; // Historic support for this name