适配win平台
This commit is contained in:
parent
30f5bdfdbc
commit
f9caa700a9
|
@ -460,7 +460,6 @@ void hg_scanner::thread_image_handle(void)
|
|||
int hg_scanner::hg_version_init_handle()
|
||||
{
|
||||
int ret = SCANNER_ERR_OK;
|
||||
#ifndef WIN32
|
||||
string scanner_path = utils::get_module_full_path(SCANNER_DRIVER_PART_NAME);
|
||||
if (scanner_path.empty())
|
||||
{
|
||||
|
@ -470,6 +469,8 @@ int hg_scanner::hg_version_init_handle()
|
|||
if(pos++ == std::string::npos)
|
||||
pos = 0;
|
||||
scanner_path.erase(pos);
|
||||
|
||||
#ifndef WIN32
|
||||
string HGVersionlib_path = scanner_path + HGVERSION_LIBNANE;
|
||||
|
||||
if (access(HGVersionlib_path.c_str(), F_OK) != 0)
|
||||
|
@ -490,9 +491,6 @@ int hg_scanner::hg_version_init_handle()
|
|||
HGVersion_Free_ = (SDKHGVersion_Free_)dlsym(Dynamicopen_HGVersion_pHandle_, "HGVersion_DestroyMgr");
|
||||
|
||||
#else
|
||||
string scanner_path = hg_log::get_module_full_path(LIBNAME);
|
||||
scanner_path = scanner_path.substr(0, scanner_path.size() - strlen(LIBNAME));
|
||||
|
||||
string HGVersionlib_path = scanner_path + HGVERSION_LIBNANE;
|
||||
wchar_t* Prclibbuffer = new wchar_t[HGVersionlib_path.length() + 1];
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "sane_option.h"
|
||||
#include <lang/app_language.h>
|
||||
#include "../sdk/hginclude/utils.h"
|
||||
#include <huagao/brand.h>
|
||||
|
||||
#ifndef SIGUSR1
|
||||
#define SIGUSR1 10
|
||||
|
@ -254,18 +255,7 @@ namespace local_utility
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
template<typename ... Args>
|
||||
void to_log(int level, const char* fmt, Args ... args)
|
||||
{
|
||||
size_t size = snprintf(nullptr, 0, fmt, args ...) + 2;
|
||||
std::unique_ptr<char[]> buf(new char[size]);
|
||||
|
||||
snprintf(buf.get(), size, fmt, args ...);
|
||||
hg_scanner_log(buf.get(), level);
|
||||
}
|
||||
|
||||
|
||||
std::string get_module_full_path(const char* name)
|
||||
{
|
||||
char buf[260] = {0};
|
||||
|
|
|
@ -52,7 +52,7 @@ static void match_paper(char* buf, int cx, int cy)
|
|||
else
|
||||
strcpy(buf, from_default_language(g_paper[index].title, NULL));
|
||||
|
||||
utils::to_log(LOG_LEVEL_DEBUG, "match paper(%u * %u) to '%s'\n", cx, cy, (char*)buf);
|
||||
local_utility::to_log(LOG_LEVEL_DEBUG, "match paper(%u * %u) to '%s'\n", cx, cy, (char*)buf);
|
||||
}
|
||||
|
||||
|
||||
|
@ -397,7 +397,7 @@ scanner_err sane_std_opts::set_value(scanner_handle h, int opt, void* buf)
|
|||
long len = 0;
|
||||
void* data = from_known_opt_value(op, buf, &len);
|
||||
|
||||
utils::to_log(LOG_LEVEL_DEBUG, "%d->%d: %s\n", opt, op->user.opt, (char*)data);
|
||||
local_utility::to_log(LOG_LEVEL_DEBUG, "%d->%d: %s\n", opt, op->user.opt, (char*)data);
|
||||
|
||||
statu = hg_scanner_set_parameter(h, (const char*)op->user.opt, data, &len);
|
||||
if (statu == SCANNER_ERR_NOT_EXACT)
|
||||
|
|
|
@ -15,11 +15,22 @@
|
|||
#include "../sdk/hginclude/huagaoxxx_warraper_ex.h"
|
||||
#include "sane/sane_ex.h"
|
||||
#include "json.h"
|
||||
#include <memory>
|
||||
|
||||
namespace local_utility
|
||||
{
|
||||
void* acquire_memory(size_t bytes, const char* info);
|
||||
void free_memory(void* m);
|
||||
|
||||
template<typename ... Args>
|
||||
void to_log(int level, const char* fmt, Args ... args)
|
||||
{
|
||||
size_t size = snprintf(nullptr, 0, fmt, args ...) + 2;
|
||||
std::unique_ptr<char[]> buf(new char[size]);
|
||||
|
||||
snprintf(buf.get(), size, fmt, args ...);
|
||||
hg_scanner_log(buf.get(), level);
|
||||
}
|
||||
};
|
||||
|
||||
class sane_std_opts
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "utils.h"
|
||||
|
||||
#include "huagao/brand.h"
|
||||
#include "ini_file.h"
|
||||
|
||||
|
||||
#include <mutex>
|
||||
|
@ -55,7 +56,6 @@ int gettimeofday(TIMEV* tv, struct timezone* tz)
|
|||
|
||||
#else
|
||||
|
||||
#include "ini_file.h"
|
||||
#include <map>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <unistd.h>
|
||||
|
|
Loading…
Reference in New Issue