diff --git a/sane/scanner.cpp b/sane/scanner.cpp index 69489e3..31cccbc 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -1124,7 +1124,8 @@ bool scanner::set_option_value_with_parent(int sn, void* data, int* err) // retu strcpy(val, OPTION_VALUE_SMZS_LXSM); *err = hg_sane_middleware::instance()->set_option(handle_, scan_mode_id_, SANE_ACTION_SET_VALUE, val, &after); } - handled = false; + delete[] val; + // handled = false; } else { @@ -2461,11 +2462,14 @@ COM_API_IMPLEMENT(scanner, int, set_value(int sn, void* val)) SANE_Option_Descriptor* desc = hg_sane_middleware::instance()->get_option_descriptor(handle_, sn); { - wchar_t msg[128] = { 0 }; + wchar_t msg[256] = { 0 }; if (ex == ex_opts_.end()) - swprintf_s(msg, _countof(msg) - 1, L"set_value of ID: %d\r\n", sn); + swprintf_s(msg, _countof(msg) - 1, L"set_value of %s(%s) of ID %d\r\n", local_trans::a2u(desc->name, CP_UTF8).c_str(), local_trans::a2u(hg_sane_middleware::option_value_2_string(desc->type, val).c_str(), CP_UTF8).c_str(), sn); else - swprintf_s(msg, _countof(msg) - 1, L"set_value of ID: %d (base id = %d)\r\n", sn, ex->base_ind); + { + desc = hg_sane_middleware::instance()->get_option_descriptor(handle_, ex->base_ind); + swprintf_s(msg, _countof(msg) - 1, L"set_value of %s(0x%x) of ID %d, base id = %d)\r\n", local_trans::a2u(desc->name, CP_UTF8).c_str(), *(unsigned*)val, sn, ex->base_ind); + } log_info(msg, 0); } diff --git a/twain/twain/huagaods.cpp b/twain/twain/huagaods.cpp index 09a6494..9ad8352 100644 --- a/twain/twain/huagaods.cpp +++ b/twain/twain/huagaods.cpp @@ -1748,7 +1748,10 @@ void huagao_ds::init_support_caps(void) init = (int)data.currentItem(); { wchar_t info[128] = { 0 }, * des[] = { L"BlackWhite", L"Gray", L"Rgb" }; - swprintf_s(info, _countof(info) - 1, L"set CapType::IPixelType = %s\r\n", des[(int)init]); + if((int)init < _countof(des)) + swprintf_s(info, _countof(info) - 1, L"set CapType::IPixelType = %s\r\n", des[(int)init]); + else + swprintf_s(info, _countof(info) - 1, L"set CapType::IPixelType = 0x%x\r\n", (int)init); load_sane_util::log_info(info, 0); } int ret = SCANNER_ERR_OK;