Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1070: [iostreams]boost\iostreams\copy.hpp line80 copy_impl
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-07-06 08:01:48
#1070: [iostreams]boost\iostreams\copy.hpp line80 copy_impl
---------------------------------+------------------------------------------
Reporter: qbowater_at_[hidden] | Owner:
Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
Version: release 1.34.0 | Severity: Showstopper
Resolution: | Keywords:
---------------------------------+------------------------------------------
Comment (by qbowater_at_[hidden]):
{{{
#!diff
--- copy.hpp 2005-05-26 01:37:30.000000000 +0800
+++ copy1.hpp 2007-07-06 15:55:17.859375000 +0800
@@ -88,13 +88,12 @@
detail::basic_buffer<char_type> buf(buffer_size);
pair_type p = snk.output_sequence();
streamsize total = 0;
- bool done = false;
- while (!done) {
- streamsize amt;
- done = (amt = iostreams::read(src, buf.data(), buffer_size)) ==
-1;
+ while (true) {
+ streamsize amt = iostreams::read(src, buf.data(), buffer_size);
+ if(amt == -1)
+ break;
std::copy(buf.data(), buf.data() + amt, p.first + total);
- if (amt != -1)
- total += amt;
+ total += amt;
}
return total;
}
@@ -109,14 +108,12 @@
detail::basic_buffer<char_type> buf(buffer_size);
non_blocking_adapter<Sink> nb(snk);
std::streamsize total = 0;
- bool done = false;
- while (!done) {
- std::streamsize amt;
- done = (amt = iostreams::read(src, buf.data(), buffer_size)) ==
-1;
- if (amt != -1) {
- iostreams::write(nb, buf.data(), amt);
- total += amt;
- }
+ while (true) {
+ std::streamsize amt = iostreams::read(src, buf.data(),
buffer_size);
+ if (amt == -1)
+ break;
+ iostreams::write(nb, buf.data(), amt);
+ total += amt;
}
return total;
}
}}}
{{{
--- copy.hpp 2005-05-26 01:37:30.000000000 +0800
+++ copy1.hpp 2007-07-06 15:55:17.859375000 +0800
@@ -88,13 +88,12 @@
detail::basic_buffer<char_type> buf(buffer_size);
pair_type p = snk.output_sequence();
streamsize total = 0;
- bool done = false;
- while (!done) {
- streamsize amt;
- done = (amt = iostreams::read(src, buf.data(), buffer_size)) ==
-1;
+ while (true) {
+ streamsize amt = iostreams::read(src, buf.data(), buffer_size);
+ if(amt == -1)
+ break;
std::copy(buf.data(), buf.data() + amt, p.first + total);
- if (amt != -1)
- total += amt;
+ total += amt;
}
return total;
}
@@ -109,14 +108,12 @@
detail::basic_buffer<char_type> buf(buffer_size);
non_blocking_adapter<Sink> nb(snk);
std::streamsize total = 0;
- bool done = false;
- while (!done) {
- std::streamsize amt;
- done = (amt = iostreams::read(src, buf.data(), buffer_size)) ==
-1;
- if (amt != -1) {
- iostreams::write(nb, buf.data(), amt);
- total += amt;
- }
+ while (true) {
+ std::streamsize amt = iostreams::read(src, buf.data(),
buffer_size);
+ if (amt == -1)
+ break;
+ iostreams::write(nb, buf.data(), amt);
+ total += amt;
}
return total;
}
}}}
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1070#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:56 UTC