diff options
-rw-r--r-- | justify.cc | 8 | ||||
-rw-r--r-- | src/line_accumulator.cc | 2 |
2 files changed, 7 insertions, 3 deletions
@@ -81,8 +81,12 @@ bool process(const boost::program_options::variables_map& variables) { justify::LineAccumulator acc{line_length, line_offset}; std::string token; - while ( std::cin >> token ) { - acc(token); + while ( std::cin.good() ) { + if ( std::cin >> token ) { + acc(token); + } else { + return true; + } } return true; diff --git a/src/line_accumulator.cc b/src/line_accumulator.cc index 4398c50..9ce389b 100644 --- a/src/line_accumulator.cc +++ b/src/line_accumulator.cc @@ -149,7 +149,7 @@ void LineAccumulator::justify() { std::for_each( indizes.begin(), indizes.begin() + this->getMissing(), - [&](std::uint8_t x) { + [&](const std::uint8_t x) { this->tokens_[x].second += 1; this->length_ += 1; } |