|
33 | 33 |
|
34 | 34 | #include "xml.h" |
35 | 35 |
|
36 | | -static AnalyzerInformation::FilesTxt readFilesTxt(std::istream& filesTxt) |
| 36 | +static bool nextFilesTxtInfo(std::istream& filesTxt, AnalyzerInformation::Info& filesTxtInfo) |
37 | 37 | { |
38 | | - AnalyzerInformation::FilesTxt index; |
39 | 38 | std::string line; |
40 | 39 | while (std::getline(filesTxt, line)) { |
41 | | - AnalyzerInformation::Info filesTxtInfo; |
42 | | - if (!filesTxtInfo.parse(line)) |
43 | | - continue; // TODO: report error? |
44 | | - index.emplace(std::make_tuple(filesTxtInfo.sourceFile, filesTxtInfo.cfg, filesTxtInfo.fsFileId), filesTxtInfo.afile); |
| 40 | + if (filesTxtInfo.parse(line)) |
| 41 | + return true; |
| 42 | + // TODO: report error? |
45 | 43 | } |
| 44 | + return false; |
| 45 | +} |
| 46 | + |
| 47 | +static AnalyzerInformation::FilesTxt readFilesTxt(std::istream& filesTxt) |
| 48 | +{ |
| 49 | + AnalyzerInformation::FilesTxt index; |
| 50 | + AnalyzerInformation::Info filesTxtInfo; |
| 51 | + while (nextFilesTxtInfo(filesTxt, filesTxtInfo)) |
| 52 | + index.emplace(std::make_tuple(filesTxtInfo.sourceFile, filesTxtInfo.cfg, filesTxtInfo.fsFileId), filesTxtInfo.afile); |
46 | 53 | return index; |
47 | 54 | } |
48 | 55 |
|
@@ -240,11 +247,8 @@ std::string AnalyzerInformation::skipAnalysis(const tinyxml2::XMLDocument &analy |
240 | 247 | std::string AnalyzerInformation::getAnalyzerInfoFileFromFilesTxt(std::istream& filesTxt, const std::string &sourcefile, const std::string &cfg, size_t fsFileId) |
241 | 248 | { |
242 | 249 | const std::string simplifiedSourcefile = Path::simplifyPath(sourcefile); |
243 | | - std::string line; |
244 | | - while (std::getline(filesTxt,line)) { |
245 | | - AnalyzerInformation::Info filesTxtInfo; |
246 | | - if (!filesTxtInfo.parse(line)) |
247 | | - continue; // TODO: report error? |
| 250 | + AnalyzerInformation::Info filesTxtInfo; |
| 251 | + while (nextFilesTxtInfo(filesTxt, filesTxtInfo)) { |
248 | 252 | if (filesTxtInfo.sourceFile == simplifiedSourcefile && filesTxtInfo.cfg == cfg && filesTxtInfo.fsFileId == fsFileId) |
249 | 253 | return filesTxtInfo.afile; |
250 | 254 | } |
|
0 commit comments