forked from lix-project/lix
* Clean up exception handling.
This commit is contained in:
parent
5a1b9ed0aa
commit
78598d06f0
|
@ -41,8 +41,15 @@ void BufferedSink::operator () (const unsigned char * data, size_t len)
|
|||
void BufferedSink::flush()
|
||||
{
|
||||
if (bufPos == 0) return;
|
||||
write(buffer, bufPos);
|
||||
bufPos = 0;
|
||||
size_t n = bufPos;
|
||||
bufPos = 0; // don't trigger the assert() in ~BufferedSink()
|
||||
write(buffer, n);
|
||||
}
|
||||
|
||||
|
||||
FdSink::~FdSink()
|
||||
{
|
||||
try { flush(); } catch (...) { ignoreException(); }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ struct FdSink : BufferedSink
|
|||
|
||||
FdSink() : fd(-1) { }
|
||||
FdSink(int fd) : fd(fd) { }
|
||||
~FdSink() { flush(); }
|
||||
~FdSink();
|
||||
|
||||
void write(const unsigned char * data, size_t len);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue