Boost logo

Boost :

Subject: [boost] boost::iostreams::detail::basic_buffer int usage
From: Judson Weissert (judson_at_[hidden])
Date: 2011-08-05 17:37:49


Hello,

I believe there is a type conflict in boost/iostreams/detail/buffer.hpp.

------ Snippet from buffer.hpp ------
class basic_buffer {
...
  basic_buffer (int buffer_size);
...
  std::streamsize size_;
};
------ End snippet ------

Here is some example code that triggers the same warnings I was receiving:

// Tested with boost 1.46.1
// Compiler Microsoft VC2010 SP1.
// Compiled with cl /EHsc /W3 repro.cpp

#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>

int
main (int, char *[])
{
  static const char b[] = { 'A', 'B', 'C' };
  boost::iostreams::array_source as (b, 3);
  boost::iostreams::filtering_streambuf <boost::iostreams::input> in;
  in.push (as);

  // This line generates a 'std::streamsize' to 'int' warning.
  // See also boost/iostreams/detail/buffer.hpp
  boost::iostreams::copy (in, std::cout);

  return 0;
}

Perhaps the fix is as simple as s/int/std::streamsize/g within
buffer.hpp. Any thoughts?

Thanks,

Judson


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk