MCPcopy Create free account
hub / github.com/Kitware/CMake / ProcessBuffer

Method ProcessBuffer

Source/CTest/cmCTestBuildHandler.cxx:1023–1155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1021// ######################################################################
1022
1023void 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;

Callers 1

RunMakeCommandMethod · 0.95

Calls 12

ProcessSingleLineMethod · 0.95
appendFunction · 0.85
moveFunction · 0.85
push_backMethod · 0.80
eraseMethod · 0.80
emplace_backMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45
dataMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected