Subject: [Boost-bugs] [Boost C++ Libraries] #1070: [iostreams]boost\iostreams\copy.hpp line80 copy_impl
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-06-30 14:40:23
#1070: [iostreams]boost\iostreams\copy.hpp line80 copy_impl
--------------------------------+-------------------------------------------
Reporter: qbowater_at_[hidden] | Type: Bugs
Status: new | Milestone: To Be Determined
Component: None | Version: release 1.34.0
Severity: Showstopper | Keywords:
--------------------------------+-------------------------------------------
boost\iostreams\copy.hpp line 80 - line 100
{{{
#!cpp
template<typename Source, typename Sink>
std::streamsize copy_impl( Source& src, Sink& snk,
std::streamsize buffer_size,
mpl::false_, mpl::true_ )
{ // Copy from an indirect Source to a direct Sink.
using namespace std;
typedef typename char_type_of<Source>::type char_type;
typedef pair<char_type*, char_type*> pair_type;
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;
std::copy(buf.data(), buf.data() + amt, p.first + total);
if (amt != -1)
total += amt;
}
return total;
}
}}}
When "iostreams::read" return -1 ,amt equal -1,it will assert in std::copy
because iterator last < first.
Please read http://article.gmane.org/gmane.comp.lib.boost.devel/161764 for
detail.
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1070>
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:55 UTC