修改设备互斥32位与64位交互BUG;设备打开失败返回真实的错误代码

This commit is contained in:
gb 2022-09-22 16:23:16 +08:00
parent c234e0158b
commit bd292e11db
2 changed files with 3 additions and 3 deletions

View File

@ -337,7 +337,7 @@ std::string shared_memory::read(void)
std::string ret("");
size_t len = 0;
int off = sizeof(size_t);
int off = 4; // sizeof(size_t);
memcpy(&len, buf, off);
ret = std::string(buf + off, len);
@ -351,7 +351,7 @@ int shared_memory::write(const char* data, size_t len)
return SCANNER_ERR_INSUFFICIENT_MEMORY;
char* buf = get_buf();
int off = sizeof(len);
int off = 4; // sizeof(len);
if (buf == (char*)-1)
return errno;

View File

@ -774,7 +774,7 @@ SANE_Status hg_sane_middleware::open(SANE_String_Const devicename, SANE_Handle*
return SANE_STATUS_ACCESS_DENIED;
}
else
return SANE_STATUS_UNSUPPORTED;
return (SANE_Status)err; // SANE_STATUS_UNSUPPORTED;
}
SANE_Option_Descriptor* hg_sane_middleware::from_json(scanner_handle h, json* jsn, int opt_no)
{