解决sane配置类型为desp->constraint_type == SANE_CONSTRAINT_NONE时导致的问题

This commit is contained in:
luoliangyi 2024-03-08 14:27:35 +08:00
parent 0ff946eab1
commit b1c6eb6899
2 changed files with 34 additions and 31 deletions

View File

@ -560,9 +560,9 @@ HGLibDeviceParamGroup* HGLibDeviceImpl::GetParamGroupList(HGUInt* count)
devParam.valueType = HGLIB_OPTION_VALUETYPE_ENUM;
devParam.stringValue = value;
assert(SANE_CONSTRAINT_STRING_LIST == desp->constraint_type);
devParam.rangeType = HGLIB_OPTION_VALUERANGETYPE_ENUMLIST;
if (SANE_CONSTRAINT_STRING_LIST == desp->constraint_type)
{
const SANE_String_Const* p = desp->constraint.string_list;
while (NULL != *p)
{
@ -572,6 +572,7 @@ HGLibDeviceParamGroup* HGLibDeviceImpl::GetParamGroupList(HGUInt* count)
assert(!devParams.empty());
devParams[devParams.size() - 1].devParams.push_back(devParam);
}
}
else if (SANE_TYPE_INT == desp->type)
{
@ -763,14 +764,15 @@ HGLibDeviceParam* HGLibDeviceImpl::GetParam(HGUInt option)
devParam.valueType = HGLIB_OPTION_VALUETYPE_ENUM;
devParam.stringValue = value;
assert(SANE_CONSTRAINT_STRING_LIST == desp->constraint_type);
devParam.rangeType = HGLIB_OPTION_VALUERANGETYPE_ENUMLIST;
if (SANE_CONSTRAINT_STRING_LIST == desp->constraint_type)
{
const SANE_String_Const* p = desp->constraint.string_list;
while (NULL != *p)
{
devParam.stringValueList.push_back(*p);
++p;
}
}
}
else if (SANE_TYPE_INT == desp->type)

View File

@ -3528,9 +3528,9 @@ namespace ver_2
devParam.valueType = 1;
devParam.stringValue = value;
assert(SANE_CONSTRAINT_STRING_LIST == desp->constraint_type);
devParam.rangeType = 1;
if (SANE_CONSTRAINT_STRING_LIST == desp->constraint_type)
{
const SANE_String_Const* p = desp->constraint.string_list;
while (NULL != *p)
{
@ -3540,6 +3540,7 @@ namespace ver_2
assert(!devParams.empty());
devParams[devParams.size() - 1].devParams.push_back(devParam);
}
}
else if (SANE_TYPE_INT == desp->type)
{