增加配置版本信息;修复浮点型数值获取BUG

This commit is contained in:
gb 2022-09-26 17:31:57 +08:00
parent 9677f8354f
commit b764b210e9
4 changed files with 23 additions and 4 deletions

View File

@ -889,10 +889,9 @@ void* dlg_page::value_from_ctrl(HWND ctrl, SANE_Value_Type* type)
else if (cmpstr(cls, WC_EDITW) == 0 || cmpstr(cls, WC_COMBOBOXW) == 0)
{
int len = (int)GetPropW(host, dlg_page::property_size.c_str());
wchar_t* buf = new wchar_t[len + 2];
wchar_t* buf = new wchar_t[len + 8];
GetWindowTextW(ctrl, buf, len);
buf[len] = 0;
GetWindowTextW(ctrl, buf, len + 6);
if (tp == SANE_TYPE_INT)
{
ret = new char[sizeof(SANE_Int)];
@ -905,6 +904,7 @@ void* dlg_page::value_from_ctrl(HWND ctrl, SANE_Value_Type* type)
}
else if (tp == SANE_TYPE_STRING)
{
buf[len] = 0;
std::string utf8(local_trans::u2a(buf, CP_UTF8));
ret = new char[len + 2];
if ((int)utf8.length() > len)

View File

@ -3,6 +3,8 @@
#include <stdlib.h>
#include <string.h>
#include "../../sdk/include/huagao/brand.h"
#if defined(WIN32) || defined(_WIN64)
#define bzero(b, s) memset(b, 0, s)
#endif
@ -1067,6 +1069,12 @@ namespace gb
{
if (jsn_)
{
{
char ver[40] = { 0 };
sprintf_s(ver, "%u.%u", VERSION_MAIN, VERSION_SUB);
jsn_->set_value("ver", ver);
}
std::string cont(jsn_->to_string(false)), encode("");
gb::base64 b64;

View File

@ -979,6 +979,8 @@ EX_OPTION_HANDLER_IMPL(paper)
int now = sane_opt_trans::paper_to_twain(buf),
init = sane_opt_trans::paper_to_twain(def),
val = 0;
local_utility::free_memory(def);
do
{
if (desc->constraint_type == SANE_CONSTRAINT_STRING_LIST)
@ -1176,6 +1178,7 @@ EX_OPTION_HANDLER_IMPL(duplex)
setv(&val, VAL_ROLE_DEFAULT, data);
}
}
local_utility::free_memory(init);
}
else
{

View File

@ -444,6 +444,14 @@ static void copy_type(bool& to, Bool from)
{
to = (bool)from;
}
static void copy_type(BYTE& to, bool from)
{
to = from;
}
static void copy_type(bool& to, BYTE from)
{
to = (bool)from;
}
static void copy_type(UInt32& to, int from)
{
to = from;
@ -2683,7 +2691,7 @@ void huagao_ds::init_support_caps_ex(void)
{ \
if(type == VAL_TYPE_BOOL) \
{ \
SET_SANE_CAP(bool, Bool, name) \
SET_SANE_CAP(bool, BYTE, name) \
} \
else if(type == VAL_TYPE_INT) \
{ \