www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - writeBlock called from readBlock?

reply Dan <ddaglas gmail.com> writes:
BufferStream's writeBlock calls readBlock.  Is it supposed to, or is it a bug?
Jan 08 2007
next sibling parent Dan <ddaglas gmail.com> writes:
== Quote from Dan (ddaglas gmail.com)'s article
 BufferStream's writeBlock calls readBlock.  Is it supposed to, or is it a bug?

Sorry, rephrased subject line to reflect the content of the message. --Dan
Jan 08 2007
prev sibling parent "Lionello Lunesu" <lionello lunesu.remove.com> writes:
"Dan" <ddaglas gmail.com> wrote in message 
news:env9tv$ouo$1 digitaldaemon.com...
 BufferStream's writeBlock calls readBlock.  Is it supposed to, or is it a 
 bug?

Strange, I really don't know why it's doing this: from std.stream.BufferedStream: # override size_t writeBlock(void* result, size_t len) { # assertWriteable(); # # ubyte* buf = cast(ubyte*)result; # size_t writesize = 0; # # if (bufferLen == 0) { # // buffer is empty so fill it if possible # if ((len < buffer.length) && (readable)) { # // read in data if the buffer is currently empty # bufferLen = s.readBlock(buffer.ptr, buffer.length); # bufferSourcePos = bufferLen; # streamPos += bufferLen; Why "buffer is empty so fill it if possible" ??? L.
Jan 09 2007