optimized
This commit is contained in:
@@ -708,16 +708,16 @@ result_t ValueListDataField::derive(const string& name, PartType partType, int d
|
|||||||
if (!m_dataType->isNumeric()) {
|
if (!m_dataType->isNumeric()) {
|
||||||
return RESULT_ERR_INVALID_ARG;
|
return RESULT_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
if (!values.empty()) {
|
|
||||||
const NumberDataType* num = reinterpret_cast<const NumberDataType*>(m_dataType);
|
const NumberDataType* num = reinterpret_cast<const NumberDataType*>(m_dataType);
|
||||||
|
if (!values.empty()) {
|
||||||
if (values.begin()->first < num->getMinValue() || values.rbegin()->first > num->getMaxValue()) {
|
if (values.begin()->first < num->getMinValue() || values.rbegin()->first > num->getMaxValue()) {
|
||||||
return RESULT_ERR_INVALID_ARG; // cannot use divisor != 1 for value list field
|
return RESULT_ERR_INVALID_ARG; // cannot use divisor != 1 for value list field
|
||||||
}
|
}
|
||||||
fields->push_back(new ValueListDataField(useName, *attributes,
|
fields->push_back(new ValueListDataField(useName, *attributes,
|
||||||
reinterpret_cast<const NumberDataType*>(m_dataType), partType, m_length, values));
|
num, partType, m_length, values));
|
||||||
} else {
|
} else {
|
||||||
fields->push_back(new ValueListDataField(useName, *attributes,
|
fields->push_back(new ValueListDataField(useName, *attributes,
|
||||||
reinterpret_cast<const NumberDataType*>(m_dataType), partType, m_length, m_values));
|
num, partType, m_length, m_values));
|
||||||
}
|
}
|
||||||
return RESULT_OK;
|
return RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user