修复获取默认值为SANE_FIX类型时的BUG;记录打开失败时的进程日志

This commit is contained in:
gb 2022-09-26 17:30:44 +08:00
parent a12b9c9315
commit 7fd8983389
4 changed files with 8 additions and 5 deletions

View File

@ -204,7 +204,7 @@ void autoCrop_desaskew_fillBlank(const cv::Mat& src, cv::Mat& dst, bool isAutoCr
cv::RotatedRect rect = hg::getBoundingRect(maxContour); cv::RotatedRect rect = hg::getBoundingRect(maxContour);
#ifndef x86_64 #ifndef x86_64 // for illegal instruction: vfmadd132ps
if (dispersion) if (dispersion)
{ {
cv::Mat mat_dispersion = src(cv::boundingRect(maxContour)); cv::Mat mat_dispersion = src(cv::boundingRect(maxContour));

View File

@ -629,6 +629,7 @@ bool usb_io::make_singleton(void)
str.insert(0, "\350\256\276\345\244\207\345\267\262\347\273\217\350\242\253\350\277\233\347\250\213 '"); str.insert(0, "\350\256\276\345\244\207\345\267\262\347\273\217\350\242\253\350\277\233\347\250\213 '");
str += "' \345\215\240\347\224\250"; str += "' \345\215\240\347\224\250";
init_err_msg_ = str; init_err_msg_ = str;
VLOG_MINI_1(LOG_LEVEL_FATAL, "Open failed: %s\n", str.c_str());
return false; return false;
} }

View File

@ -1145,8 +1145,10 @@ void* hg_sane_middleware::get_default_value(scanner_handle handle, int option)
double v = .0f; double v = .0f;
jsn->get_value("default", v); jsn->get_value("default", v);
data = local_utility::acquire_memory(sizeof(v), ""); SANE_Fixed sd = hg_sane_middleware::double_2_sane_fixed(v);
memcpy(data, &v, sizeof(v)); data = local_utility::acquire_memory(sizeof(sd), "");
memcpy(data, &sd, sizeof(sd));
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "option %d default value is: %f\n", option, v); VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "option %d default value is: %f\n", option, v);
} }
else if (val == "string") else if (val == "string")

View File

@ -187,8 +187,8 @@ public:
SANE_Option_Descriptor* get_option_descriptor(SANE_Handle h, SANE_Int option); SANE_Option_Descriptor* get_option_descriptor(SANE_Handle h, SANE_Int option);
SANE_Status set_option(SANE_Handle h, SANE_Int option, SANE_Action action, void* value, SANE_Int* after_do); SANE_Status set_option(SANE_Handle h, SANE_Int option, SANE_Action action, void* value, SANE_Int* after_do);
bool get_cur_value(SANE_Handle handle, int option, void* value, SANE_Value_Type* type = NULL); bool get_cur_value(SANE_Handle handle, int option, void* value, SANE_Value_Type* type = NULL); // SANE_type
void* get_def_value(SANE_Handle handle, int option); // caller should call local_utility::free_memory to free the returned value void* get_def_value(SANE_Handle handle, int option); // caller should call local_utility::free_memory to free the returned value, SANE_type
// extension ... // extension ...
SANE_Status io_control(SANE_Handle h, unsigned long code, void* data, unsigned* len); SANE_Status io_control(SANE_Handle h, unsigned long code, void* data, unsigned* len);