Modify

Ticket #3839 (closed Bugs: fixed)

Opened 4 years ago

Last modified 4 years ago

[iostreams]write.hpp:write_device_impl<ostream_tag> tries access non-member f

Reported by: cppljevans@… Owned by: danieljames
Milestone: Boost 1.43.0 Component: iostreams
Version: Boost 1.41.0 Severity: Problem
Keywords: Cc:

Description

In the boost/iostreams/write.hpp file, in template specialization:

struct write_device_impl<ostream_tag>

the line:

return !traits_type::eq_int_type( t.rdbuf()->s.sputc(),

should be changed to:

return !traits_type::eq_int_type( t.rdbuf()->sputc(c),

because a streambuf has no s member and the proposed changed reflects what's done elsewhere in the same file.

Attachments

compose_indent_ostream~1.4~.cpp Download (926 bytes) - added by cppljevans@… 4 years ago.
demo of bug
indent.hpp Download (2.0 KB) - added by cppljevans@… 4 years ago.
file #included by previous attachment
ticket3839~demo.cpp Download (437 bytes) - added by cppljevans@… 4 years ago.
simpler bug demo

Change History

comment:1 Changed 4 years ago by steven_watanabe

It disturbs me that the tests don't catch this. Do you have a small test case that fails because of this?

Changed 4 years ago by cppljevans@…

demo of bug

Changed 4 years ago by cppljevans@…

file #included by previous attachment

Changed 4 years ago by cppljevans@…

simpler bug demo

comment:2 Changed 4 years ago by danieljames

(In [60228]) Fix write_device_impl<ostream_tag>

And enchance the newline tests so that they test it. Refs #3839

comment:3 Changed 4 years ago by danieljames

I've added a test to newline_tests, but it would be better if we had some more direct tests for write.hpp.

comment:4 Changed 4 years ago by steven_watanabe

  • Owner set to turkanis
  • Component changed from None to iostreams

comment:5 Changed 4 years ago by danieljames

  • Owner changed from turkanis to danieljames
  • Status changed from new to assigned

comment:6 Changed 4 years ago by anonymous

  • Milestone changed from Boost 1.42.0 to Boost 1.43.0

comment:7 Changed 4 years ago by danieljames

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [60666]) Merge iostreams.

  • Fix write_device_impl<ostream_tag>. Fixes #3839
  • Fix error checks after calling SetFilePointer?. Fixes #3953
  • Gzip filter shouldn't require its source to be peekable. Fixes #3723.
  • In position_to_offset, only cast to stream_offset after calculating _Myoff. Fixes #3969.
  • ptrdiff_t is in std. Fixes #2505.
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.