From b1c6eb68991561bb28221d36c5ef1fab7dc25bb0 Mon Sep 17 00:00:00 2001 From: luoliangyi <87842688@qq.com> Date: Fri, 8 Mar 2024 14:27:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3sane=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=BAdesp->constraint=5Ftype=20=3D=3D=20S?= =?UTF-8?q?ANE=5FCONSTRAINT=5FNONE=E6=97=B6=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/scannerlib/HGLibDeviceImpl.cpp | 42 ++++++++++++++++-------------- sdk/webservice/ManagerV2.cpp | 23 ++++++++-------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/sdk/scannerlib/HGLibDeviceImpl.cpp b/sdk/scannerlib/HGLibDeviceImpl.cpp index c079c3ca..4d421c7c 100644 --- a/sdk/scannerlib/HGLibDeviceImpl.cpp +++ b/sdk/scannerlib/HGLibDeviceImpl.cpp @@ -560,18 +560,19 @@ 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) + { + devParam.stringValueList.push_back(*p); + ++p; + } - devParam.rangeType = HGLIB_OPTION_VALUERANGETYPE_ENUMLIST; - const SANE_String_Const* p = desp->constraint.string_list; - while (NULL != *p) - { - devParam.stringValueList.push_back(*p); - ++p; - } - - assert(!devParams.empty()); - devParams[devParams.size() - 1].devParams.push_back(devParam); + assert(!devParams.empty()); + devParams[devParams.size() - 1].devParams.push_back(devParam); + } } else if (SANE_TYPE_INT == desp->type) { @@ -763,15 +764,16 @@ 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; - const SANE_String_Const* p = desp->constraint.string_list; - while (NULL != *p) - { - devParam.stringValueList.push_back(*p); - ++p; - } + 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) { diff --git a/sdk/webservice/ManagerV2.cpp b/sdk/webservice/ManagerV2.cpp index 684f5a2d..6932cdfe 100644 --- a/sdk/webservice/ManagerV2.cpp +++ b/sdk/webservice/ManagerV2.cpp @@ -3528,18 +3528,19 @@ 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) + { + devParam.stringValueList.push_back(*p); + ++p; + } - devParam.rangeType = 1; - const SANE_String_Const* p = desp->constraint.string_list; - while (NULL != *p) - { - devParam.stringValueList.push_back(*p); - ++p; - } - - assert(!devParams.empty()); - devParams[devParams.size() - 1].devParams.push_back(devParam); + assert(!devParams.empty()); + devParams[devParams.size() - 1].devParams.push_back(devParam); + } } else if (SANE_TYPE_INT == desp->type) {