Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
karasikov committed Mar 12, 2021
1 parent 97ddd99 commit ac51b61
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions include/sdsl/int_vector_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class int_vector_buffer
m_offset += file_offset;
if (mode & std::ios::out) {
m_ofile->open(m_filename, mode|(m_start ? std::ios::in : std::ios::openmode(0))|std::ios::binary);
if (!m_ofile->is_open())
if (!m_ofile)
throw_error("Could not open file for write");
m_ofile_pos = 0;
}
Expand Down Expand Up @@ -288,7 +288,7 @@ class int_vector_buffer
write_block();
if (m_start < m_offset) { // in case of int_vector, write header and trailing zeros
uint64_t size = m_size*width();
m_ofile->seekp(m_start, std::ios::beg);
m_ofile->seekp(m_start);
int_vector<t_width>::write_header(size, width(), *m_ofile);
int64_t wb = (size+7)/8;
if (wb%8) {
Expand All @@ -297,6 +297,7 @@ class int_vector_buffer
}
}
m_ofile->flush();
m_ofile->seekp(m_ofile_pos);
if (!m_ofile->good())
throw_error("flush failed");
}
Expand All @@ -310,10 +311,10 @@ class int_vector_buffer
m_ifile->close();
m_ofile->close();
m_ofile->open(m_filename, std::ios::out|std::ios::binary);
if (!m_ofile->is_open())
if (!m_ofile)
throw_error("Could not open file for write after reset");
m_ifile->open(m_filename, std::ios::in|std::ios::binary);
if (!m_ifile->is_open())
if (!m_ifile)
throw_error("Could not open file for read after reset");
// reset member variables
m_need_to_write = false;
Expand Down

0 comments on commit ac51b61

Please sign in to comment.