| 1021 | // ###################################################################### |
| 1022 | |
| 1023 | void cmCTestBuildHandler::ProcessBuffer(char const* data, size_t length, |
| 1024 | size_t& tick, size_t tick_len, |
| 1025 | std::ostream& ofs, |
| 1026 | t_BuildProcessingQueueType* queue) |
| 1027 | { |
| 1028 | std::string::size_type const tick_line_len = 50; |
| 1029 | char const* ptr; |
| 1030 | for (ptr = data; ptr < data + length; ptr++) { |
| 1031 | queue->push_back(*ptr); |
| 1032 | } |
| 1033 | this->BuildOutputLogSize += length; |
| 1034 | |
| 1035 | // until there are any lines left in the buffer |
| 1036 | while (true) { |
| 1037 | // Find the end of line |
| 1038 | t_BuildProcessingQueueType::iterator it; |
| 1039 | for (it = queue->begin(); it != queue->end(); ++it) { |
| 1040 | if (*it == '\n') { |
| 1041 | break; |
| 1042 | } |
| 1043 | } |
| 1044 | |
| 1045 | // Once certain number of errors or warnings reached, ignore future errors |
| 1046 | // or warnings. |
| 1047 | if (this->TotalWarnings >= this->MaxWarnings) { |
| 1048 | this->WarningQuotaReached = true; |
| 1049 | } |
| 1050 | if (this->TotalErrors >= this->MaxErrors) { |
| 1051 | this->ErrorQuotaReached = true; |
| 1052 | } |
| 1053 | |
| 1054 | // If the end of line was found |
| 1055 | if (it != queue->end()) { |
| 1056 | // Create a contiguous array for the line |
| 1057 | this->CurrentProcessingLine.clear(); |
| 1058 | cm::append(this->CurrentProcessingLine, queue->begin(), it); |
| 1059 | this->CurrentProcessingLine.push_back(0); |
| 1060 | char const* line = this->CurrentProcessingLine.data(); |
| 1061 | |
| 1062 | // Process the line |
| 1063 | int lineType = this->ProcessSingleLine(line); |
| 1064 | |
| 1065 | // Erase the line from the queue |
| 1066 | queue->erase(queue->begin(), it + 1); |
| 1067 | |
| 1068 | // Depending on the line type, produce error or warning, or nothing |
| 1069 | cmCTestBuildErrorWarning errorwarning; |
| 1070 | bool found = false; |
| 1071 | switch (lineType) { |
| 1072 | case b_WARNING_LINE: |
| 1073 | this->LastTickChar = '*'; |
| 1074 | errorwarning.Error = false; |
| 1075 | found = true; |
| 1076 | this->TotalWarnings++; |
| 1077 | break; |
| 1078 | case b_ERROR_LINE: |
| 1079 | this->LastTickChar = '!'; |
| 1080 | errorwarning.Error = true; |
no test coverage detected