fix get raw value bug
This commit is contained in:
parent
90b03e47fe
commit
459cafeb26
|
@ -351,19 +351,19 @@ data_type sane_cfg_provider::type_from_string(const char* type_desc)
|
|||
if(root->get_value(key, bv))
|
||||
{
|
||||
val = std::string((char*)&bv, sizeof(bv));
|
||||
if(*type)
|
||||
if(type)
|
||||
*type = DATA_TYPE_BOOL;
|
||||
}
|
||||
else if(root->get_value(key, nv))
|
||||
{
|
||||
val = std::string((char*)&nv, sizeof(nv));
|
||||
if(*type)
|
||||
if(type)
|
||||
*type = DATA_TYPE_INT4;
|
||||
}
|
||||
else if(root->get_value(key, fv))
|
||||
{
|
||||
val = std::string((char*)&fv, sizeof(fv));
|
||||
if(*type)
|
||||
if(type)
|
||||
*type = DATA_TYPE_FLOAT;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -360,16 +360,17 @@ int32_t img_resizer::set_config(const char* cfg_name, void* data, size_t* len, u
|
|||
}
|
||||
bool img_resizer::update_enabled(const char* name, std::function<GET_SANE_OPT_PROTO> get_opt)
|
||||
{
|
||||
uint32_t dtype = 0;
|
||||
std::string val("");
|
||||
|
||||
if(get_opt("cis-dpi", "cur", val, &dtype) == 0)
|
||||
{
|
||||
if(dtype == DATA_TYPE_INT4)
|
||||
enable_ = dpi_ != *(int*)val.c_str();
|
||||
else if(dtype == DATA_TYPE_FLOAT)
|
||||
enable_ = dpi_ != (int)*(double*)val.c_str();
|
||||
}
|
||||
// uint32_t dtype = 0;
|
||||
// std::string val("");
|
||||
//
|
||||
// if(get_opt("cis-dpi", "cur", val, &dtype) == 0)
|
||||
// {
|
||||
// if(dtype == DATA_TYPE_INT4)
|
||||
// enable_ = dpi_ != *(int*)val.c_str();
|
||||
// else if(dtype == DATA_TYPE_FLOAT)
|
||||
// enable_ = dpi_ != (int)*(double*)val.c_str();
|
||||
// }
|
||||
enable_ = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue