1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
Description: Properly handle urls files that lack the EOL character at the end
Origin: upstream, https://github.com/akrennmair/newsbeuter/commit/d3c52c1221a8373cfa8dec07a23df6fd500320e3
--- a/src/urlreader.cpp
+++ b/src/urlreader.cpp
@@ -49,9 +49,9 @@
f.open(filename.c_str(),std::fstream::in);
if (f.is_open()) {
std::string line;
- do {
+ while (!f.eof()) {
getline(f,line);
- if (!f.eof() && line.length() > 0 && line[0] != '#') {
+ if (line.length() > 0 && line[0] != '#') {
std::vector<std::string> tokens = utils::tokenize_quoted(line);
if (!tokens.empty()) {
std::string url = tokens[0];
@@ -65,7 +65,7 @@
}
}
}
- } while (!f.eof());
+ };
}
}
|