Chromium Code Reviews| Index: processor/microdump.cc |
| diff --git a/processor/microdump.cc b/processor/microdump.cc |
| index bf628552932d253b476f587b3129e718dcad8873..414e13c0021ab3790f8af9c621334eaa57c28156 100644 |
| --- a/processor/microdump.cc |
| +++ b/processor/microdump.cc |
| @@ -76,6 +76,16 @@ std::vector<uint8_t> ParseHexBuf(const string& str) { |
| return buf; |
| } |
| +bool GetLine(std::istringstream* istream, string* str) { |
| + if (std::getline(*istream, *str)) { |
| + if (str->size() > 0 && str->at(str->size() - 1) == '\r') { |
|
Primiano Tucci (use gerrit)
2015/06/16 11:16:03
femtonit, maybe !str->empty() %% *str.rbegin() ==
simonb (inactive)
2015/06/19 12:47:27
Half-done. Also added copious commentary describi
|
| + str->erase(str->size() - 1); |
| + } |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| } // namespace |
| namespace google_breakpad { |
| @@ -183,7 +193,7 @@ Microdump::Microdump(const string& contents) |
| string arch; |
| std::istringstream stream(contents); |
| - while (std::getline(stream, line)) { |
| + while (GetLine(&stream, &line)) { |
| if (line.find(kGoogleBreakpadKey) == string::npos) { |
| continue; |
| } |
| @@ -214,7 +224,7 @@ Microdump::Microdump(const string& contents) |
| os_tokens >> arch; |
| os_tokens >> num_cpus; |
| os_tokens >> hw_arch; |
| - std::getline(os_tokens, os_version); |
| + GetLine(&os_tokens, &os_version); |
| os_version.erase(0, 1); // remove leading space. |
| system_info_->cpu = hw_arch; |