fix for dumping chained messages, load and dump everything (unconditionally) when checking/dumping configuration

This commit is contained in:
john30
2017-09-09 10:04:56 +02:00
parent 29cee10ff5
commit f6aeaae2cc
+7 -4
View File
@@ -1234,12 +1234,12 @@ void ChainedMessage::dumpField(const string& fieldName, bool withConditions, ost
bool first = true; bool first = true;
for (size_t index = 0; index < m_ids.size(); index++) { for (size_t index = 0; index < m_ids.size(); index++) {
vector<symbol_t> id = m_ids[index]; vector<symbol_t> id = m_ids[index];
for (auto it = id.begin()+2; it < id.end(); it++) {
if (first) { if (first) {
first = false; first = false;
} else { } else {
*output << VALUE_SEPARATOR; *output << VALUE_SEPARATOR;
} }
for (auto it = id.begin()+2; it < id.end(); it++) {
*output << hex << setw(2) << setfill('0') << static_cast<unsigned>(*it); *output << hex << setw(2) << setfill('0') << static_cast<unsigned>(*it);
} }
*output << LENGTH_SEPARATOR << dec << setw(0) << static_cast<unsigned>(m_lengths[index]); *output << LENGTH_SEPARATOR << dec << setw(0) << static_cast<unsigned>(m_lengths[index]);
@@ -1904,6 +1904,9 @@ result_t MessageMap::addDefaultFromFile(const string& filename, unsigned int lin
string key = filename+":"+type; string key = filename+":"+type;
const auto it = m_conditions.find(key); const auto it = m_conditions.find(key);
if (it != m_conditions.end()) { if (it != m_conditions.end()) {
if (m_addAll) {
return RESULT_OK;
}
*errorDescription = "condition "+type+" already defined"; *errorDescription = "condition "+type+" already defined";
return RESULT_ERR_DUPLICATE_NAME; return RESULT_ERR_DUPLICATE_NAME;
} }
@@ -2257,12 +2260,12 @@ result_t MessageMap::executeInstructions(void (*readMessageFunc)(Message* messag
bool removeSingletons = false; bool removeSingletons = false;
vector<Instruction*> remain; vector<Instruction*> remain;
for (const auto instruction : instructions) { for (const auto instruction : instructions) {
if (removeSingletons && instruction->isSingleton()) { if (!m_addAll && removeSingletons && instruction->isSingleton()) {
delete instruction; delete instruction;
continue; continue;
} }
Condition* condition = instruction->getCondition(); Condition* condition = instruction->getCondition();
bool execute = condition == NULL; bool execute = m_addAll || condition == NULL;
if (!execute) { if (!execute) {
string errorDescription; string errorDescription;
result_t result = resolveCondition(instruction->isSingleton()?readMessageFunc:NULL, condition, result_t result = resolveCondition(instruction->isSingleton()?readMessageFunc:NULL, condition,
@@ -2280,7 +2283,7 @@ result_t MessageMap::executeInstructions(void (*readMessageFunc)(Message* messag
} }
} }
if (execute) { if (execute) {
if (instruction->isSingleton()) { if (!m_addAll && instruction->isSingleton()) {
removeSingletons = true; removeSingletons = true;
} }
result_t result = instruction->execute(this, log); result_t result = instruction->execute(this, log);