$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: eg (egoots_at_[hidden])
Date: 2007-07-03 12:48:56
Ulrich Eckhardt wrote:
> Too complicated still (obviously), and the not-checking/double-computation 
> of 'done' still applies. ;)
> 
> I'd suggest this version:
> 
>   while(true) {
>     // try to read a chunk of data
>     streamsize amt = iostreams::read(...);
>     if(amt==-1)
>       break;
>     // handle data
>     std::copy(...);
>     total += amt;
>   }
> 
> ...which also removes the unnecessary bool 'done'.
> 
Please note that there are two overloads of copy_impl() which contain 
the original while logic. The one reported has the bug, while the other 
one (line 102- line 122) does not.
If you are going to refactor this function, then the other one should be 
done the same way for consistency.