corrected csv err position reporting
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]
|
const string typeStr = *it++; // basetype[:len]|template[:name]
|
||||||
|
vector<string>::iterator typePos = it;
|
||||||
if (typeStr.empty()) {
|
if (typeStr.empty()) {
|
||||||
if (!name.empty() || hasPartStr) {
|
if (!name.empty() || hasPartStr) {
|
||||||
result = RESULT_ERR_MISSING_TYPE;
|
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);
|
result = SingleDataField::create(typeName, length, firstType ? name : "", firstType ? comment : "", firstType ? unit : "", partType, divisor, values, constantValue, verifyValue, add);
|
||||||
if (add != NULL) {
|
if (add != NULL) {
|
||||||
fields.push_back(add);
|
fields.push_back(add);
|
||||||
} else if (result == RESULT_OK) {
|
} else {
|
||||||
result = RESULT_ERR_NOTFOUND; // type not found
|
it = typePos; // back to type
|
||||||
|
if (result == RESULT_OK) {
|
||||||
|
result = RESULT_ERR_NOTFOUND; // type not found
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (!constantValue.empty()) {
|
} else if (!constantValue.empty()) {
|
||||||
|
it = typePos; // back to type
|
||||||
result = RESULT_ERR_INVALID_ARG; // invalid value list
|
result = RESULT_ERR_INVALID_ARG; // invalid value list
|
||||||
} else { // template[:name]
|
} else { // template[:name]
|
||||||
string fieldName;
|
string fieldName;
|
||||||
@@ -217,6 +222,9 @@ result_t DataField::create(vector<string>::iterator& it,
|
|||||||
fieldName = (firstType && lastType) ? name : "";
|
fieldName = (firstType && lastType) ? name : "";
|
||||||
}
|
}
|
||||||
result = templ->derive(fieldName, firstType ? comment : "", firstType ? unit : "", partType, divisor, values, fields);
|
result = templ->derive(fieldName, firstType ? comment : "", firstType ? unit : "", partType, divisor, values, fields);
|
||||||
|
if (result != RESULT_OK) {
|
||||||
|
it = typePos; // back to type
|
||||||
|
}
|
||||||
}
|
}
|
||||||
firstType = false;
|
firstType = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user