aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--justify.cc8
-rw-r--r--src/line_accumulator.cc2
2 files changed, 7 insertions, 3 deletions
diff --git a/justify.cc b/justify.cc
index 8120ded..c417dfd 100644
--- a/justify.cc
+++ b/justify.cc
@@ -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;
}