www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [patch] SliceStream fix

reply Nick <Nick_member pathlink.com> writes:
Since the phobos stream.d bug
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/4360
seems to have been overlooked for two revisions now, here is a repost as a
patch.

Nick

--- stream.d    2005-08-06 21:57:06.000000000 +0200
+++ streamfixed.d       2005-08-07 08:26:42.733724680 +0200
   -2522,8 +2522,8   
override size_t readBlock (void *buffer, size_t size) {
assertReadable();
if (bounded) {
-      if (size > high - low + pos)
-       size = high - low + pos;
+      if (size > high - low - pos)
+       size = high - low - pos;
}

ulong bp = base.position;
   -2540,8 +2540,8   
override size_t writeBlock (void *buffer, size_t size) {
assertWriteable();
if (bounded) {
-      if (size > high - low + pos)
-       size = high - low + pos;
+      if (size > high - low - pos)
+       size = high - low - pos;
}

ulong bp = base.position;
Aug 06 2005
parent reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Nick" <Nick_member pathlink.com> wrote in message 
news:dd4a95$2qgv$1 digitaldaemon.com...
 Since the phobos stream.d bug
 http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/4360
 seems to have been overlooked for two revisions now, here is a repost as a
 patch.
I'll incorporate it in my next stream update (the one with FilterStream I mentioned on the main page). Sorry for the delay - your original post was made while I was on vacation and I must have missed it or forgot to include it in the latest round. Thanks for reposting! -Ben
Aug 07 2005
parent Nick <Nick_member pathlink.com> writes:
In article <dd4s38$5ha$1 digitaldaemon.com>, Ben Hinkle says...
I'll incorporate it in my next stream update (the one with FilterStream I 
mentioned on the main page).
Thanks.
Sorry for the delay - your original post was made while I was on vacation
and I must have missed it or forgot to include it in the latest round.
Hey no problem :) I found a workaround for it, I'll just have to remember to remove it when it's fixed. Nick
Aug 08 2005