Opened 10 years ago

Closed 9 years ago

#2894 closed Bugs (fixed)

Incorrect type for buffer_size and pback_size parameters

Reported by: gareth.sylvester-bradley@… Owned by: Jonathan Turkanis
Milestone: Boost 1.39.0 Component: iostreams
Version: Boost Development Trunk Severity: Problem
Keywords: Cc: mateusz@…


Documentation for stream::open says:

    void open( const T& t,
               std::streamsize buffer_size, 
               std::streamsize pback_size );

That seems right to me.

However, on some environments (64-bit), passing std::streamsize arguments causes compilation failure, since the actual implementation has these parameters as int everywhere [*], and the template forwarding stream constructor/open don't work correctly.

Explicitly casting arguments to int in client code works, but changing these parameters everywhere in Boost.Iostreams to std::streamsize fixes things for me.

[*] E.g. at line 16 of boost/iostreams/detail/push_params.hpp:

    , int buffer_size = -1 , int pback_size = -1 \

Change History (5)

comment:1 Changed 9 years ago by Daniel James

Resolution: fixed
Status: newclosed

(In [57608]) Hopefully fix #2894.

By Richard Smith

comment:2 Changed 9 years ago by Richard Webb <richard.webb@…>

Resolution: fixed
Status: closedreopened
Version: Boost 1.38.0Boost Development Trunk

It looks like the change to detail/streambuf/indirect_streambuf.hpp has caused a bunch of regression test failures. e.g. from :

From VC10: indirect_streambuf.hpp(171) : error C2782: 'const _Ty &std::max(const _Ty &,const _Ty &)' : template parameter '_Ty' is ambiguous

From GCC 4.4.1: indirect_streambuf.hpp:171: error: no matching function for call to ???max(int, std::streamsize&)??

Changing line 171 of indirect_streambuf.hpp to cast the '2' to a std::streamsize fixes the failures on VC10.

comment:3 Changed 9 years ago by mloskot <mateusz@…>

Cc: mateusz@… added

Just for records, link to file/line in current revision [source:trunk/boost/iostreams/detail/push_params.hpp@57608#L16 push_params.hpp:16] - it may be changed or even removed in future revs.

comment:4 Changed 9 years ago by Richard Webb <richard.webb@…>

Looks like indirect_streambuf.hpp has been fixed in [57710].

comment:5 Changed 9 years ago by Daniel James

Resolution: fixed
Status: reopenedclosed

(In [58633]) Merge iostream fixes, mostly by Richard Smith.

Fixes #3612, #3311, #2094, #3010, #2894, #3011, #3352, #3505.

Note: See TracTickets for help on using tickets.