Skip to content

Commit

Permalink
clean up some coverity-identified issues, mostly uninitialized class …
Browse files Browse the repository at this point in the history
…members
  • Loading branch information
jeking3 committed Aug 14, 2018
1 parent 1e9ef0a commit 5692d34
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions example/line_wrapping_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class line_wrapping_stdio_filter : public stdio_filter {
class line_wrapping_input_filter : public input_filter {
public:
explicit line_wrapping_input_filter(int line_length = 80)
: line_length_(line_length), col_no_(0), has_next_(false)
: line_length_(line_length), col_no_(0), next_(0), has_next_(false)
{ }

template<typename Source>
Expand Down Expand Up @@ -91,7 +91,7 @@ class line_wrapping_input_filter : public input_filter {
int line_length_;
int col_no_;
int next_;
int has_next_;
bool has_next_;
};

class line_wrapping_output_filter : public output_filter {
Expand Down
1 change: 1 addition & 0 deletions include/boost/iostreams/detail/adapter/direct_adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class direct_adapter_base {
explicit direct_adapter_base(const Direct& d);
typedef is_convertible<category, two_sequence> is_double;
struct pointers {
pointers() : beg(0), ptr(0), end(0) { }
char_type *beg, *ptr, *end;
};
void init_input(mpl::true_);
Expand Down
2 changes: 1 addition & 1 deletion include/boost/iostreams/detail/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void basic_buffer<Ch, Alloc>::swap(basic_buffer& rhs)

template<typename Ch, typename Alloc>
buffer<Ch, Alloc>::buffer(std::streamsize buffer_size)
: basic_buffer<Ch, Alloc>(buffer_size) { }
: basic_buffer<Ch, Alloc>(buffer_size), ptr_(data()), eptr_(data() + buffer_size) { }

template<typename Ch, typename Alloc>
inline void buffer<Ch, Alloc>::set(std::streamsize ptr, std::streamsize end)
Expand Down
2 changes: 1 addition & 1 deletion src/lzma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void lzma_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(int error)
namespace detail {

lzma_base::lzma_base()
: stream_(new lzma_stream)
: stream_(new lzma_stream), level(lzma::default_compression)
{ }

lzma_base::~lzma_base() { delete static_cast<lzma_stream*>(stream_); }
Expand Down
3 changes: 2 additions & 1 deletion src/zlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ void zlib_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(int error)
namespace detail {

zlib_base::zlib_base()
: stream_(new z_stream), calculate_crc_(false), crc_(0), crc_imp_(0)
: stream_(new z_stream), calculate_crc_(false), crc_(0), crc_imp_(0),
total_in_(0), total_out_(0)
{ }

zlib_base::~zlib_base() { delete static_cast<z_stream*>(stream_); }
Expand Down
2 changes: 1 addition & 1 deletion test/detail/temp_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class temp_file {

// Constructs a temp file which does not initially exist.
temp_file() { set_name(); }
~temp_file() { std::remove(name_.c_str()); }
~temp_file() { (void)std::remove(name_.c_str()); }
const ::std::string name() const { return name_; }
operator const ::std::string() const { return name_; }
private:
Expand Down
2 changes: 1 addition & 1 deletion test/mapped_file_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ void mapped_file_test()
{
boost::iostreams::test::test_file orig;
char name[50];
std::strcpy(name, orig.name().c_str());
std::strncpy(name, orig.name().c_str(), 50);

mapped_file mf((char*) name);

Expand Down

0 comments on commit 5692d34

Please sign in to comment.