Boost logo

Boost Users :

From: eg (egoots_at_[hidden])
Date: 2006-12-11 22:55:55


eg wrote:

>
> I think the following change should work as well AND it mimics the
> copy_impl() function right below the one you changed... (i.e. the one
> that does a "Copy from an indirect Source to a indirect Sink...")
>
> It just moves the "if" statement up one line. So the while loop now
> looks like:
>
> while (!done) {
> streamsize amt;
> done = (amt = iostreams::read(src, buf.data(), buffer_size)) == -1;
> if (amt != -1) {
> std::copy(buf.data(), buf.data() + amt, p.first + total);
> total += amt;
> }
> }
>
> In any case, I have attached a patch file for this change if you want to
> pass it on.
>

I should read the patch guidelines before posting. The attached patch
should conform to the writeup (it applies the same change to "copy.orig"
to produce "copy.hpp")


--- C:\dev\boost_1_33_1\boost\iostreams\copy.orig Thu May 26 00:37:30 2005
+++ C:\dev\boost_1_33_1\boost\iostreams\copy.hpp Mon Dec 11 17:14:34 2006
@@ -92,9 +92,10 @@
     while (!done) {
         streamsize amt;
         done = (amt = iostreams::read(src, buf.data(), buffer_size)) == -1;
- std::copy(buf.data(), buf.data() + amt, p.first + total);
- if (amt != -1)
+ if (amt != -1) {
+ std::copy(buf.data(), buf.data() + amt, p.first + total);
             total += amt;
+ }
     }
     return total;
 }


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net