summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex White <alex.white@oarcorp.com>2021-06-18 15:52:27 -0500
committerJoel Sherrill <joel@rtems.org>2021-06-28 15:31:05 -0500
commit654e09087a5639f55500372b7bdc88c5c9d3fa18 (patch)
treecee7c62da5502849b5c1ddc001f18972d33f8947
parentcovoar/CoverageMapBase: Use reference for iteration in validAddress (diff)
downloadrtems-tools-654e09087a5639f55500372b7bdc88c5c9d3fa18.tar.bz2
covoar/Explanations.cc: Handle newline at end of file
-rw-r--r--tester/covoar/Explanations.cc24
1 files changed, 11 insertions, 13 deletions
diff --git a/tester/covoar/Explanations.cc b/tester/covoar/Explanations.cc
index 1449fb2..9b4c1f6 100644
--- a/tester/covoar/Explanations.cc
+++ b/tester/covoar/Explanations.cc
@@ -85,24 +85,22 @@ namespace Coverage {
line++;
// Get the explanation
- while (1) {
- explain.getline( inputBuffer, MAX_LINE_LENGTH );
- // fprintf( stderr, "%d - %s\n", line, inputBuffer );
- if (explain.fail()) {
- std::ostringstream what;
- what << "line " << line
- << "out of sync at the explanation";
- throw rld::error( what, "Explanations::load" );
- }
- inputBuffer[ strlen(inputBuffer) - 1] = '\0';
+ for (std::string input_line; std::getline( explain, input_line ); ) {
line++;
- const char delimiter[4] = "+++";
- if (!strncmp( inputBuffer, delimiter, 3 )) {
+ const std::string delimiter = "+++";
+ if (input_line.compare( delimiter ) == 0) {
break;
}
// XXX only taking last line. Needs to be a vector
- e.explanation.push_back( inputBuffer );
+ e.explanation.push_back( input_line );
+ }
+
+ if (explain.fail()) {
+ std::ostringstream what;
+ what << "line " << line
+ << "out of sync at the explanation";
+ throw rld::error( what, "Explanations::load" );
}
// Add this to the set of Explanations