Merge branch 'master' of github.com:john30/ebusd
This commit is contained in:
+10
-2
@@ -93,6 +93,7 @@ result_t DataField::create(vector<string>::iterator& it,
|
||||
}
|
||||
|
||||
const string typeStr = *it++; // basetype[:len]|template[:name]
|
||||
vector<string>::iterator typePos = it;
|
||||
if (typeStr.empty()) {
|
||||
if (!name.empty() || hasPartStr) {
|
||||
result = RESULT_ERR_MISSING_TYPE;
|
||||
@@ -203,10 +204,14 @@ result_t DataField::create(vector<string>::iterator& it,
|
||||
result = SingleDataField::create(typeName, length, firstType ? name : "", firstType ? comment : "", firstType ? unit : "", partType, divisor, values, constantValue, verifyValue, add);
|
||||
if (add != NULL) {
|
||||
fields.push_back(add);
|
||||
} else if (result == RESULT_OK) {
|
||||
result = RESULT_ERR_NOTFOUND; // type not found
|
||||
} else {
|
||||
it = typePos; // back to type
|
||||
if (result == RESULT_OK) {
|
||||
result = RESULT_ERR_NOTFOUND; // type not found
|
||||
}
|
||||
}
|
||||
} else if (!constantValue.empty()) {
|
||||
it = typePos; // back to type
|
||||
result = RESULT_ERR_INVALID_ARG; // invalid value list
|
||||
} else { // template[:name]
|
||||
string fieldName;
|
||||
@@ -217,6 +222,9 @@ result_t DataField::create(vector<string>::iterator& it,
|
||||
fieldName = (firstType && lastType) ? name : "";
|
||||
}
|
||||
result = templ->derive(fieldName, firstType ? comment : "", firstType ? unit : "", partType, divisor, values, fields);
|
||||
if (result != RESULT_OK) {
|
||||
it = typePos; // back to type
|
||||
}
|
||||
}
|
||||
firstType = false;
|
||||
}
|
||||
|
||||
@@ -1678,8 +1678,9 @@ result_t MessageMap::addFromFile(vector<string>::iterator& begin, const vector<s
|
||||
string types = *restart;
|
||||
Condition* condition = NULL;
|
||||
result_t result = readConditions(types, filename, condition);
|
||||
if (result!=RESULT_OK)
|
||||
if (result!=RESULT_OK) {
|
||||
return result;
|
||||
}
|
||||
if (types.length()>0 && types[0]=='!') {
|
||||
// instruction
|
||||
types = types.substr(1);
|
||||
@@ -1699,11 +1700,11 @@ result_t MessageMap::addFromFile(vector<string>::iterator& begin, const vector<s
|
||||
}
|
||||
return RESULT_OK;
|
||||
}
|
||||
if (types.length() == 0)
|
||||
if (types.length() == 0) {
|
||||
types.append("r");
|
||||
else if (types.find(']')!=string::npos)
|
||||
} else if (types.find(']')!=string::npos) {
|
||||
return RESULT_ERR_INVALID_ARG;
|
||||
|
||||
}
|
||||
result = RESULT_ERR_EOF;
|
||||
DataFieldTemplates* templates = getTemplates(filename);
|
||||
istringstream stream(types);
|
||||
@@ -1719,16 +1720,19 @@ result_t MessageMap::addFromFile(vector<string>::iterator& begin, const vector<s
|
||||
Message* message = *it;
|
||||
if (result == RESULT_OK) {
|
||||
result = add(message);
|
||||
if (result==RESULT_ERR_DUPLICATE_NAME)
|
||||
if (result==RESULT_ERR_DUPLICATE_NAME) {
|
||||
begin = restart+3; // mark name as invalid
|
||||
else if (result==RESULT_ERR_DUPLICATE)
|
||||
} else if (result==RESULT_ERR_DUPLICATE) {
|
||||
begin = restart+8; // mark ID as invalid
|
||||
}
|
||||
}
|
||||
if (result != RESULT_OK)
|
||||
if (result != RESULT_OK) {
|
||||
delete message; // delete all remaining messages on error
|
||||
}
|
||||
}
|
||||
if (result != RESULT_OK)
|
||||
if (result != RESULT_OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user