DefaultIOStream: Remove assert on empty count

fwrite() is valid to call with a 0 count, and will simply return 0.
See:
    https://en.cppreference.com/w/cpp/io/c/fwrite
    http://www.cplusplus.com/reference/cstdio/fwrite/

There are code paths where StreamWriter will call Tell(), which calls
Flush(), which calls Write(buffer.data(), 1, buffer.size()). This can
happen when nothing has yet been written to the buffer, so size is 0.
pull/3326/head
Ryan Styrczula 2020-07-14 10:39:18 -04:00
parent 67a710efad
commit 84e342acd7
1 changed files with 0 additions and 1 deletions

View File

@ -100,7 +100,6 @@ size_t DefaultIOStream::Write(const void *pvBuffer,
size_t pCount) { size_t pCount) {
ai_assert(nullptr != pvBuffer); ai_assert(nullptr != pvBuffer);
ai_assert(0 != pSize); ai_assert(0 != pSize);
ai_assert(0 != pCount);
return (mFile ? ::fwrite(pvBuffer, pSize, pCount, mFile) : 0); return (mFile ? ::fwrite(pvBuffer, pSize, pCount, mFile) : 0);
} }