| 73 | } |
| 74 | |
| 75 | std::string SuppressionList::parseFile(std::istream &istr) |
| 76 | { |
| 77 | // Change '\r' to '\n' in the istr |
| 78 | std::string filedata; |
| 79 | std::string line; |
| 80 | while (std::getline(istr, line)) |
| 81 | filedata += line + "\n"; |
| 82 | std::replace(filedata.begin(), filedata.end(), '\r', '\n'); |
| 83 | |
| 84 | // Parse filedata.. |
| 85 | std::istringstream istr2(filedata); |
| 86 | while (std::getline(istr2, line)) { |
| 87 | // Skip empty lines |
| 88 | if (line.empty()) |
| 89 | continue; |
| 90 | |
| 91 | std::string::size_type pos = 0; |
| 92 | while (pos < line.size() && std::isspace(line[pos])) |
| 93 | ++pos; |
| 94 | if (pos == line.size()) |
| 95 | continue; |
| 96 | |
| 97 | // Skip comments |
| 98 | if (line[pos] == '#') |
| 99 | continue; |
| 100 | if (pos < line.size() - 1 && line[pos] == '/' && line[pos + 1] == '/') |
| 101 | continue; |
| 102 | |
| 103 | std::string errmsg(addSuppressionLine(line)); |
| 104 | if (!errmsg.empty()) |
| 105 | return errmsg; |
| 106 | } |
| 107 | |
| 108 | return ""; |
| 109 | } |
| 110 | |
| 111 | |
| 112 | std::string SuppressionList::parseXmlFile(const char *filename) |