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))
|
if(root->get_value(key, bv))
|
||||||
{
|
{
|
||||||
val = std::string((char*)&bv, sizeof(bv));
|
val = std::string((char*)&bv, sizeof(bv));
|
||||||
if(*type)
|
if(type)
|
||||||
*type = DATA_TYPE_BOOL;
|
*type = DATA_TYPE_BOOL;
|
||||||
}
|
}
|
||||||
else if(root->get_value(key, nv))
|
else if(root->get_value(key, nv))
|
||||||
{
|
{
|
||||||
val = std::string((char*)&nv, sizeof(nv));
|
val = std::string((char*)&nv, sizeof(nv));
|
||||||
if(*type)
|
if(type)
|
||||||
*type = DATA_TYPE_INT4;
|
*type = DATA_TYPE_INT4;
|
||||||
}
|
}
|
||||||
else if(root->get_value(key, fv))
|
else if(root->get_value(key, fv))
|
||||||
{
|
{
|
||||||
val = std::string((char*)&fv, sizeof(fv));
|
val = std::string((char*)&fv, sizeof(fv));
|
||||||
if(*type)
|
if(type)
|
||||||
*type = DATA_TYPE_FLOAT;
|
*type = DATA_TYPE_FLOAT;
|
||||||
}
|
}
|
||||||
else
|
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)
|
bool img_resizer::update_enabled(const char* name, std::function<GET_SANE_OPT_PROTO> get_opt)
|
||||||
{
|
{
|
||||||
uint32_t dtype = 0;
|
// uint32_t dtype = 0;
|
||||||
std::string val("");
|
// std::string val("");
|
||||||
|
//
|
||||||
if(get_opt("cis-dpi", "cur", val, &dtype) == 0)
|
// if(get_opt("cis-dpi", "cur", val, &dtype) == 0)
|
||||||
{
|
// {
|
||||||
if(dtype == DATA_TYPE_INT4)
|
// if(dtype == DATA_TYPE_INT4)
|
||||||
enable_ = dpi_ != *(int*)val.c_str();
|
// enable_ = dpi_ != *(int*)val.c_str();
|
||||||
else if(dtype == DATA_TYPE_FLOAT)
|
// else if(dtype == DATA_TYPE_FLOAT)
|
||||||
enable_ = dpi_ != (int)*(double*)val.c_str();
|
// enable_ = dpi_ != (int)*(double*)val.c_str();
|
||||||
}
|
// }
|
||||||
|
enable_ = true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue