digitalmars.D.bugs - std.stream.Stream.copyFrom()
- derick_eddington nospam.dot.yahoo.dot.com (18/18) Mar 24 2005 std.stream.Stream.copyFrom(Stream):
- Ben Hinkle (7/25) Mar 24 2005 wow. Those are bad bugs - I guess you're one of the first people to try ...
- Ben Hinkle (4/33) Mar 24 2005 actually there's another change to std.stream that I want to send to Wal...
- derick_eddington nospam.dot.yahoo.dot.com (3/38) Mar 25 2005 Actually, I was just reading the source because I'm thinking of using St...
- Nick (6/14) Mar 27 2005 By the way, is it not a bit risky to assume the entire stream can fit in...
std.stream.Stream.copyFrom(Stream): void copyFrom(Stream s) { //BUG uint pos = position(); // not position of this uint pos = s.position(); // save position of s s.position(0); copyFrom(s, s.size()); s.position(pos); } std.stream.Stream.copyFrom(Stream, uint): void copyFrom(Stream s, uint count) { ubyte[] buf; //BUG buf.length = s.size(); // not size of s buf.length = count; // use specified size s.readExact(buf, buf.length); writeExact(buf, buf.length); }
Mar 24 2005
<derick_eddington nospam.dot.yahoo.dot.com> wrote in message news:d1vuka$1ed1$1 digitaldaemon.com...std.stream.Stream.copyFrom(Stream): void copyFrom(Stream s) { //BUG uint pos = position(); // not position of this uint pos = s.position(); // save position of s s.position(0); copyFrom(s, s.size()); s.position(pos); } std.stream.Stream.copyFrom(Stream, uint): void copyFrom(Stream s, uint count) { ubyte[] buf; //BUG buf.length = s.size(); // not size of s buf.length = count; // use specified size s.readExact(buf, buf.length); writeExact(buf, buf.length); }wow. Those are bad bugs - I guess you're one of the first people to try to use copyFrom. I wonder if it ever worked or if those bugs crept in by accident somehow. Have you sent the fix to Walter? Just email him the fixed file. I would add a unittest, too, if you have time since I notice it isn't tested anywhere.
Mar 24 2005
"Ben Hinkle" <ben.hinkle gmail.com> wrote in message news:d200sa$1gvm$1 digitaldaemon.com...<derick_eddington nospam.dot.yahoo.dot.com> wrote in message news:d1vuka$1ed1$1 digitaldaemon.com...actually there's another change to std.stream that I want to send to Walter so I'll just put your changes in with mine.std.stream.Stream.copyFrom(Stream): void copyFrom(Stream s) { //BUG uint pos = position(); // not position of this uint pos = s.position(); // save position of s s.position(0); copyFrom(s, s.size()); s.position(pos); } std.stream.Stream.copyFrom(Stream, uint): void copyFrom(Stream s, uint count) { ubyte[] buf; //BUG buf.length = s.size(); // not size of s buf.length = count; // use specified size s.readExact(buf, buf.length); writeExact(buf, buf.length); }wow. Those are bad bugs - I guess you're one of the first people to try to use copyFrom. I wonder if it ever worked or if those bugs crept in by accident somehow. Have you sent the fix to Walter? Just email him the fixed file. I would add a unittest, too, if you have time since I notice it isn't tested anywhere.
Mar 24 2005
Actually, I was just reading the source because I'm thinking of using Stream in the future and saw it. Thanks for sending the fix. In article <d2016e$1hdj$1 digitaldaemon.com>, Ben Hinkle says..."Ben Hinkle" <ben.hinkle gmail.com> wrote in message news:d200sa$1gvm$1 digitaldaemon.com...<derick_eddington nospam.dot.yahoo.dot.com> wrote in message news:d1vuka$1ed1$1 digitaldaemon.com...actually there's another change to std.stream that I want to send to Walter so I'll just put your changes in with mine.std.stream.Stream.copyFrom(Stream): void copyFrom(Stream s) { //BUG uint pos = position(); // not position of this uint pos = s.position(); // save position of s s.position(0); copyFrom(s, s.size()); s.position(pos); } std.stream.Stream.copyFrom(Stream, uint): void copyFrom(Stream s, uint count) { ubyte[] buf; //BUG buf.length = s.size(); // not size of s buf.length = count; // use specified size s.readExact(buf, buf.length); writeExact(buf, buf.length); }wow. Those are bad bugs - I guess you're one of the first people to try to use copyFrom. I wonder if it ever worked or if those bugs crept in by accident somehow. Have you sent the fix to Walter? Just email him the fixed file. I would add a unittest, too, if you have time since I notice it isn't tested anywhere.
Mar 25 2005
In article <d1vuka$1ed1$1 digitaldaemon.com>, derick_eddington nospam.dot.yahoo.dot.com says...void copyFrom(Stream s, uint count) { ubyte[] buf; //BUG buf.length = s.size(); // not size of s buf.length = count; // use specified size s.readExact(buf, buf.length); writeExact(buf, buf.length); }By the way, is it not a bit risky to assume the entire stream can fit in a memory buffer? And is it really appropriate to use uints for stream sizes? Why not use ulongs? Nick
Mar 27 2005