writeBlock called from readBlock?

Lionello Lunesu lionello at lunesu.remove.com
Tue Jan 9 11:41:04 PST 2007


"Dan" <ddaglas at gmail.com> wrote in message 
news:env9tv$ouo$1 at 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. 





More information about the Digitalmars-d mailing list