From 12b5d0385aa2c482a8db4dcb344e22d063e03f74 Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Tue, 3 Jan 2023 19:15:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=80=9F=E5=BA=A6=E7=9D=A1?= =?UTF-8?q?=E7=9C=A0=E8=AE=BE=E7=BD=AE=E5=BA=8F=E5=88=97=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/HGProductionTool/form_maininterface.cpp | 9 +++++---- code/base/test_base.cpp | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp index 1b80826..a9bc57c 100644 --- a/app/HGProductionTool/form_maininterface.cpp +++ b/app/HGProductionTool/form_maininterface.cpp @@ -398,19 +398,20 @@ void Form_mainInterface::setGlobalCfg(AnalysisJson analysisJson) vidpid.VID = jsonGlobal.vid_to; vidpid.PID = jsonGlobal.pid_to; p->cat = WRITE_CAT_VID_PID; - p->val = &vidpid.Value; + p->val = (void *) & vidpid.Value; + int t = *(int*)p->val; func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg); p->cat = WRITE_CAT_SPEED; - p->val = &jsonGlobal.speed_mode; + p->val = (void*)&jsonGlobal.speed_mode; func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg); p->cat = WRITE_CAT_SLEEP; - p->val = &jsonGlobal.sleep_time; + p->val = (void*)&jsonGlobal.sleep_time; func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg); p->cat = WRITE_CAT_SERIALNUM; - p->val = &m_serialNum; + p->val = (void*)&m_serialNum; func_test_go(WRITE_CFG_NAME, (const wchar_t*)p, m_hg); delete p; diff --git a/code/base/test_base.cpp b/code/base/test_base.cpp index e273604..18b4c6c 100644 --- a/code/base/test_base.cpp +++ b/code/base/test_base.cpp @@ -529,28 +529,28 @@ public: test_map_[HGPDTTOOLDB_NAME_PRESSUER_TEST_RGB_300DPI] = &test::test_pressuer_test_rgb_300dpi; test_map_[HGPDTTOOLDB_NAME_PRESSUER_TEST_GRAY_300DPI] = &test::test_pressuer_test_gray_300dpi; } - int set_test(const wchar_t* str) + int set_test(const wchar_t* name,const wchar_t* oper) { - if (!str) + if (!name) return SCANNER_ERR_NO_DATA; - set_test_name_ = str; + set_test_name_ = name; int ret = SCANNER_ERR_OK; - auto it = test_map_.find(str); + auto it = test_map_.find(name); if (it != test_map_.end()) { - ret = (this->*test_map_[str])((void *)str); + ret = (this->*test_map_[name])((void *)oper); } else { - helper_->test_callback(str, ui_helper::TEST_EVENT_NOT_FIND_TEST, NULL, false); + helper_->test_callback(name, ui_helper::TEST_EVENT_NOT_FIND_TEST, NULL, false); return ret; } if (ret != SCANNER_ERR_OK && ret != -1) { - helper_->test_callback(str, ui_helper::TEST_EVENT_IO_FAIL, NULL, ret); + helper_->test_callback(name, ui_helper::TEST_EVENT_IO_FAIL, NULL, ret); } return ret; } @@ -558,7 +558,8 @@ public: int set_init_cfg(void *data) { - LPWRITECFG cfg = (LPWRITECFG)data; + const wchar_t* p = (const wchar_t*)data; + LPWRITECFG cfg = (LPWRITECFG)p; unsigned int len = 0; int ret = SCANNER_ERR_OK; switch (cfg->cat) @@ -903,7 +904,7 @@ DECL_API(int) func_test_go(const wchar_t* NAME, const wchar_t* oper, ui_helper* SANE_Bool type = false; unsigned int len = sizeof(SANE_Bool); test ts(helper); - ret = ts.set_test(NAME); + ret = ts.set_test(NAME, oper); if (ret != SCANNER_ERR_OK) { return ret;