Commit 90ffe1c9 authored by Allard van Mossel's avatar Allard van Mossel Committed by Guolin Ke
Browse files

Fixed bug where reads could be attempted in an index > read_cnt (#57)

parent a194045c
...@@ -112,7 +112,7 @@ public: ...@@ -112,7 +112,7 @@ public:
++i; ++i;
++total_cnt; ++total_cnt;
// skip end of line // skip end of line
while (buffer_process[i] == '\n' || buffer_process[i] == '\r') { ++i; } while ((buffer_process[i] == '\n' || buffer_process[i] == '\r') && i < read_cnt) { ++i; }
last_i = i; last_i = i;
} }
else { else {
...@@ -247,7 +247,7 @@ public: ...@@ -247,7 +247,7 @@ public:
++i; ++i;
++total_cnt; ++total_cnt;
// skip end of line // skip end of line
while (buffer_process[i] == '\n' || buffer_process[i] == '\r') { ++i; } while ((buffer_process[i] == '\n' || buffer_process[i] == '\r') && i < read_cnt) { ++i; }
last_i = i; last_i = i;
} }
else { else {
...@@ -281,7 +281,7 @@ public: ...@@ -281,7 +281,7 @@ public:
} }
INDEX_T ReadPartAndProcessParallel(const std::vector<INDEX_T>& used_data_indices, const std::function<void(INDEX_T, const std::vector<std::string>&)>& process_fun) { INDEX_T ReadPartAndProcessParallel(const std::vector<INDEX_T>& used_data_indices, const std::function<void(INDEX_T, const std::vector<std::string>&)>& process_fun) {
return ReadAllAndProcessParallelWithFilter(process_fun, return ReadAllAndProcessParallelWithFilter(process_fun,
[&used_data_indices](INDEX_T used_cnt ,INDEX_T total_cnt) { [&used_data_indices](INDEX_T used_cnt ,INDEX_T total_cnt) {
if (used_cnt < used_data_indices.size() && total_cnt == used_data_indices[used_cnt]) { if (used_cnt < used_data_indices.size() && total_cnt == used_data_indices[used_cnt]) {
return true; return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment