#
f0a016dc |
|
21-Sep-2023 |
Augustin Cavalier <waddlesplash@gmail.com> |
BBufferedDataIO: Fix Write(). I looked at this code as a reference when writing similar code in another project, and realized then that this was broken to the point where I don't think anyone could have actually used it: 1. Writes larger than the buffer should only return the amount written by this Write() call, not the amount flushed beforehand. 2. fDirty was only set if there were bytes remaining after the first write to the buffer. So, if you wrote small amounts of data, they would be silently discarded most of the time! 3. When filling the buffer, we might as well flush simultaneously. This allows the logic to be consolidated into a loop and remove the duplicate memcpy. In case of failure, just return the bytes-written as the write could be retried later. 4. Flush() should always return an error or 0, not bytes written. While at it, add some basic tests for this class. Change-Id: I2de01d0b31e3fe22863cef21dd7b0b62ed47121b
|
#
a6b84a0c |
|
24-Apr-2013 |
Axel Dörfler <axeld@pinc-software.de> |
BBufferedDataIO: the underlying stream might return an error. * In this case, fSize would have been set incorrectly, ignoring the error completely, but open the possibility to read from uninitialized or even unmapped memory.
|
#
b6e4d1a9 |
|
29-Dec-2011 |
Philippe Saint-Pierre <stpere@gmail.com> |
BufferedDataIO::Flush(), use ssize_t rather than size_t Write() was returing an ssize_t and Flush() was expecting a ssize_t, but a size_t was instead used. CID 11052.
|
#
29e07dd0 |
|
21-Nov-2011 |
Axel Dörfler <axeld@pinc-software.de> |
Added a buffered DataIO subclass. * Only the read path is tested so far.
|
#
a6b84a0c57bcbdc9ce22bbd789d56ab4a0d41929 |
|
24-Apr-2013 |
Axel Dörfler <axeld@pinc-software.de> |
BBufferedDataIO: the underlying stream might return an error. * In this case, fSize would have been set incorrectly, ignoring the error completely, but open the possibility to read from uninitialized or even unmapped memory.
|
#
b6e4d1a9dc2ec8dd6e5fd5a89fff62bb7409cdf9 |
|
29-Dec-2011 |
Philippe Saint-Pierre <stpere@gmail.com> |
BufferedDataIO::Flush(), use ssize_t rather than size_t Write() was returing an ssize_t and Flush() was expecting a ssize_t, but a size_t was instead used. CID 11052.
|
#
29e07dd0eba33d964827fe3d6726b63c27335286 |
|
21-Nov-2011 |
Axel Dörfler <axeld@pinc-software.de> |
Added a buffered DataIO subclass. * Only the read path is tested so far.
|