修改Windows平台判断,为Win64作准备

This commit is contained in:
gb 2022-07-18 16:56:03 +08:00
parent 8cd888301a
commit 592bd6ce31
29 changed files with 75 additions and 77 deletions

View File

@ -1,5 +1,5 @@
#include "G4Tiff.h" #include "G4Tiff.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <io.h> #include <io.h>
#else #else
#include <fcntl.h> #include <fcntl.h>

View File

@ -3,7 +3,7 @@
//#include <boost/thread/mutex.hpp> //#include <boost/thread/mutex.hpp>
//#include <boost/thread/condition_variable.hpp> //#include <boost/thread/condition_variable.hpp>
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <Windows.h> #include <Windows.h>
#endif #endif
#include <mutex> #include <mutex>

View File

@ -5,7 +5,7 @@
#include "PaperSize.h" #include "PaperSize.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
class IMat2Bmp { class IMat2Bmp {
public: public:
virtual ~IMat2Bmp() {} virtual ~IMat2Bmp() {}

View File

@ -3,7 +3,7 @@
#include <map> #include <map>
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <Windows.h> #include <Windows.h>
#endif #endif
#include "common_setting.h" #include "common_setting.h"

View File

@ -21,7 +21,7 @@ typedef struct hg_tag_SIZE
typedef CSSIZE CSSIZEL; typedef CSSIZE CSSIZEL;
typedef CSSIZE* PCSSIZEL, * LPCSSIZEL; typedef CSSIZE* PCSSIZEL, * LPCSSIZEL;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <Windows.h> #include <Windows.h>
#else #else
typedef CSSIZE Size; typedef CSSIZE Size;

View File

@ -1,7 +1,7 @@
#ifndef FILE_TOOLS_H #ifndef FILE_TOOLS_H
#define FILE_TOOLS_H #define FILE_TOOLS_H
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <vector> #include <vector>
#include <io.h> #include <io.h>
#include <fstream> #include <fstream>

View File

@ -2,7 +2,7 @@
#include "../wrapper/hg_log.h" #include "../wrapper/hg_log.h"
#include "huagao/hgscanner_error.h" #include "huagao/hgscanner_error.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
//#include "scanner_manager.h" //#include "scanner_manager.h"
#else #else
#include <string.h> #include <string.h>
@ -32,7 +32,7 @@ void free_memory(void* ptr)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// windows event ... // windows event ...
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
int __stdcall sem_init(sem_t* handle, int, int) int __stdcall sem_init(sem_t* handle, int, int)
{ {
if (!handle) if (!handle)
@ -160,7 +160,7 @@ shared_memory::~shared_memory()
void shared_memory::init(void) void shared_memory::init(void)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
char name[40] = { 0 }; char name[40] = { 0 };
DWORD* key = (DWORD*)&key_; DWORD* key = (DWORD*)&key_;
HANDLE h = NULL; HANDLE h = NULL;
@ -244,7 +244,7 @@ void shared_memory::init(void)
void shared_memory::clear(void) void shared_memory::clear(void)
{ {
if (obj_ != (void*)-1) if (obj_ != (void*)-1)
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
CloseHandle((HANDLE)obj_); CloseHandle((HANDLE)obj_);
#else #else
{ {
@ -261,7 +261,7 @@ void shared_memory::clear(void)
} }
char* shared_memory::get_buf(void) char* shared_memory::get_buf(void)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
char* buf = (char*)MapViewOfFile((HANDLE)obj_, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0); char* buf = (char*)MapViewOfFile((HANDLE)obj_, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
if (!buf) if (!buf)
buf = (char*)-1; buf = (char*)-1;
@ -275,14 +275,14 @@ char* shared_memory::get_buf(void)
} }
void shared_memory::release_buf(void* buf) void shared_memory::release_buf(void* buf)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
UnmapViewOfFile(buf); UnmapViewOfFile(buf);
#else #else
shmdt(buf); shmdt(buf);
#endif #endif
} }
#ifndef WIN32 #if !defined(WIN32) && !defined(_WIN64)
std::string shared_memory::get_proc_name_by_pid(pid_t pid) std::string shared_memory::get_proc_name_by_pid(pid_t pid)
{ {
char path[512] = { 0 }; char path[512] = { 0 };
@ -378,7 +378,7 @@ HANDLE_NAME tiny_file_map::open_file_for_mapping(const char* file, unsigned* byt
{ {
HANDLE_NAME ret = INVALID_HANDLE_NAME; HANDLE_NAME ret = INVALID_HANDLE_NAME;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
HANDLE f = INVALID_HANDLE_VALUE; HANDLE f = INVALID_HANDLE_VALUE;
if (create) if (create)
{ {
@ -442,7 +442,7 @@ HANDLE_NAME tiny_file_map::open_file_for_mapping(const char* file, unsigned* byt
} }
void tiny_file_map::close_handle_name(HANDLE_NAME h) void tiny_file_map::close_handle_name(HANDLE_NAME h)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
CloseHandle(h); CloseHandle(h);
#else #else
::close(h); ::close(h);
@ -452,7 +452,7 @@ void* tiny_file_map::sys_map_api(HANDLE_NAME h, int access, unsigned int off, un
{ {
void* mem = nullptr; void* mem = nullptr;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
mem = MapViewOfFile(h, access, 0, off, size); mem = MapViewOfFile(h, access, 0, off, size);
if (err) if (err)
{ {
@ -484,7 +484,7 @@ void* tiny_file_map::sys_map_api(HANDLE_NAME h, int access, unsigned int off, un
} }
void tiny_file_map::sys_unmap_api(void* buf, size_t size) void tiny_file_map::sys_unmap_api(void* buf, size_t size)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
UnmapViewOfFile(buf); UnmapViewOfFile(buf);
#else #else
munmap(buf, size); munmap(buf, size);
@ -495,7 +495,7 @@ int tiny_file_map::map_to_mem(unsigned int off)
{ {
int err = SCANNER_ERR_OUT_OF_RANGE; int err = SCANNER_ERR_OUT_OF_RANGE;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
int acc = FILE_MAP_READ | FILE_MAP_WRITE; int acc = FILE_MAP_READ | FILE_MAP_WRITE;
#else #else
int acc = PROT_READ | PROT_WRITE; int acc = PROT_READ | PROT_WRITE;

View File

@ -5,7 +5,7 @@
// created on 2022-03-01 // created on 2022-03-01
// //
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <Windows.h> #include <Windows.h>
#define sem_t HANDLE #define sem_t HANDLE
@ -120,7 +120,7 @@ class shared_memory : public refer
char* get_buf(void); char* get_buf(void);
void release_buf(void* buf); void release_buf(void* buf);
#ifndef WIN32 #if !defined(WIN32) && !defined(_WIN64)
static std::string get_proc_name_by_pid(pid_t pid); static std::string get_proc_name_by_pid(pid_t pid);
#endif #endif
@ -138,7 +138,7 @@ public:
}; };
// buffer // buffer
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#define HANDLE_NAME HANDLE #define HANDLE_NAME HANDLE
#define INVALID_HANDLE_NAME NULL #define INVALID_HANDLE_NAME NULL
#else #else

View File

@ -2,7 +2,7 @@
#include "../wrapper/hg_log.h" #include "../wrapper/hg_log.h"
#include "sane/sane_option_definitions.h" #include "sane/sane_option_definitions.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include "scanner_manager.h" #include "scanner_manager.h"
#include <direct.h> #include <direct.h>
#endif #endif
@ -161,7 +161,7 @@ std::string hg_scanner::temporary_file(char* tail, char* head)
if (!tail) if (!tail)
tail = (char*)""; tail = (char*)"";
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
char me[MAX_PATH] = { 0 }, * n = NULL; char me[MAX_PATH] = { 0 }, * n = NULL;
GetModuleFileNameA(NULL, me, _countof(me) - 1); GetModuleFileNameA(NULL, me, _countof(me) - 1);
@ -902,7 +902,7 @@ int hg_scanner::setting_help(int sn, void* data)
printf("helpfile = %s\r\n",helpfile.c_str()); printf("helpfile = %s\r\n",helpfile.c_str());
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
com = ""; com = "";
helpfile.insert(0, hg_log::get_scanner_path()); helpfile.insert(0, hg_log::get_scanner_path());
FILE* src = fopen(helpfile.c_str(), "rb"); FILE* src = fopen(helpfile.c_str(), "rb");

View File

@ -21,7 +21,7 @@
#include "StopWatch.h" #include "StopWatch.h"
#include "PaperSize.h" #include "PaperSize.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -329,6 +329,6 @@ public:
#else #else
static const std::string helpfile_ ="/opt/apps/scanner-driver-huagao/doc/HuaGoScan_scanSettings_Help_manual.pdf";//帮助文档路径 static const std::string helpfile_ ="/opt/apps/scanner-driver-huagao/doc/HuaGoScan_scanSettings_Help_manual.pdf";//帮助文档路径
#endif #endif
#elif defined(WIN32) #elif defined(WIN32) || defined(_WIN64)
static const std::string helpfile_ = "docs\\help_setting.pdf"; static const std::string helpfile_ = "docs\\help_setting.pdf";
#endif #endif

View File

@ -1,7 +1,7 @@
#include "hg_scanner_200.h" #include "hg_scanner_200.h"
#include "../wrapper/hg_log.h" #include "../wrapper/hg_log.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include "scanner_manager.h" #include "scanner_manager.h"
#endif #endif

View File

@ -2,7 +2,7 @@
#include "../wrapper/hg_log.h" #include "../wrapper/hg_log.h"
#include "filetools.h" #include "filetools.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include "scanner_manager.h" #include "scanner_manager.h"
#endif #endif

View File

@ -1,7 +1,7 @@
#include "hg_scanner_300.h" #include "hg_scanner_300.h"
#include "../wrapper/hg_log.h" #include "../wrapper/hg_log.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include "scanner_manager.h" #include "scanner_manager.h"
#endif #endif

View File

@ -1,7 +1,7 @@
#include "hg_scanner_400.h" #include "hg_scanner_400.h"
#include "../wrapper/hg_log.h" #include "../wrapper/hg_log.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include "scanner_manager.h" #include "scanner_manager.h"
#endif #endif

View File

@ -2,7 +2,7 @@
#include "../wrapper/hg_log.h" #include "../wrapper/hg_log.h"
#include "filetools.h" #include "filetools.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include "scanner_manager.h" #include "scanner_manager.h"
#endif #endif

View File

@ -3,7 +3,7 @@
#include <vector> #include <vector>
#include <string.h> #include <string.h>
#ifndef WIN32 #if !defined(WIN32) && !defined(_WIN64)
#include <unistd.h> #include <unistd.h>
#pragma pack(push) #pragma pack(push)
#pragma pack(1) #pragma pack(1)
@ -47,7 +47,7 @@ typedef struct BITMAPINFOHEADER
#include "ImageMultiOutput.h" #include "ImageMultiOutput.h"
#include "PaperSize.h" #include "PaperSize.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include "scanner_manager.h" #include "scanner_manager.h"
#include "ocr/hanwangOCRdetect.h" #include "ocr/hanwangOCRdetect.h"
#else #else
@ -607,7 +607,7 @@ namespace hg_imgproc
if (img_conf_.is_autotext) if (img_conf_.is_autotext)
rotatetype = CImageApplyRotation::RotationType::AutoTextOrientation; rotatetype = CImageApplyRotation::RotationType::AutoTextOrientation;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
char szIniFile[MAX_PATH] = {0}; char szIniFile[MAX_PATH] = {0};
SHGetSpecialFolderPathA(NULL, szIniFile, CSIDL_WINDOWS, TRUE); SHGetSpecialFolderPathA(NULL, szIniFile, CSIDL_WINDOWS, TRUE);
strcat(szIniFile, "\\twain_32\\HuaGoScan\\tessdata"); strcat(szIniFile, "\\twain_32\\HuaGoScan\\tessdata");

View File

@ -6,11 +6,9 @@
if(code == cls) \ if(code == cls) \
return #cls; return #cls;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include "scanner_manager.h" #include "scanner_manager.h"
#endif #else
#ifndef WIN32
void memset(void* buf, unsigned char fill, int len) void memset(void* buf, unsigned char fill, int len)
{ {
unsigned char* data = (unsigned char*)buf; unsigned char* data = (unsigned char*)buf;
@ -47,7 +45,7 @@ usb_manager::~usb_manager()
run_ = false; run_ = false;
wait_pnp_.notify(); wait_pnp_.notify();
libusb_context* ctx = nullptr; libusb_context* ctx = nullptr;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
ctx = context_; ctx = context_;
libusb_quit(ctx); libusb_quit(ctx);
#endif #endif
@ -98,7 +96,7 @@ void usb_manager::usb_log_callback(libusb_context* ctx, libusb_log_level level,
int usb_manager::register_usb_pnp(void) int usb_manager::register_usb_pnp(void)
{ {
libusb_context* ctx = nullptr; libusb_context* ctx = nullptr;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
ctx = context_; ctx = context_;
#endif #endif
int ret = libusb_hotplug_register_callback(ctx, (libusb_hotplug_event)(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT), int ret = libusb_hotplug_register_callback(ctx, (libusb_hotplug_event)(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT),
@ -1138,7 +1136,7 @@ unsigned int usb_io::set_timeout(unsigned int to)
to_ = to; to_ = to;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
if (handle_) if (handle_)
{ {
libusb_set_timeout(handle_, to_); libusb_set_timeout(handle_, to_);

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include "win_usb/win_usb.h" #include "win_usb/win_usb.h"
#else #else
#include <libusb-1.0/libusb.h> #include <libusb-1.0/libusb.h>

View File

@ -4,7 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include <stdarg.h> #include <stdarg.h>
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <Windows.h> #include <Windows.h>
#include <direct.h> #include <direct.h>
#include <Psapi.h> #include <Psapi.h>
@ -183,7 +183,7 @@ extern "C"
return true; return true;
} }
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
static std::string u2a(const wchar_t* u, UINT cp = CP_ACP) static std::string u2a(const wchar_t* u, UINT cp = CP_ACP)
{ {
std::string a(""); std::string a("");
@ -300,7 +300,7 @@ extern "C"
} }
std::string format_current_thread_id(void) std::string format_current_thread_id(void)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
return format_ptr((void*)GetCurrentThreadId()); return format_ptr((void*)GetCurrentThreadId());
#else #else
return format_ptr((void*)pthread_self()); return format_ptr((void*)pthread_self());
@ -352,7 +352,7 @@ extern "C"
{ {
std::string utf8(""); std::string utf8("");
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
utf8 = u2a(u, CP_UTF8); utf8 = u2a(u, CP_UTF8);
#else #else
#endif #endif
@ -360,7 +360,7 @@ extern "C"
} }
std::string pe_path(std::string* name) std::string pe_path(std::string* name)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
wchar_t path[MAX_PATH] = { 0 }, * last = NULL; wchar_t path[MAX_PATH] = { 0 }, * last = NULL;
GetModuleFileNameW(NULL, path, _countof(path) - 1); GetModuleFileNameW(NULL, path, _countof(path) - 1);
@ -396,7 +396,7 @@ extern "C"
} }
unsigned long long available_memory(void) unsigned long long available_memory(void)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
MEMORYSTATUSEX ms; MEMORYSTATUSEX ms;
if (GlobalMemoryStatusEx(&ms)) if (GlobalMemoryStatusEx(&ms))
@ -433,7 +433,7 @@ extern "C"
ff.pattern = module_part_name; ff.pattern = module_part_name;
str_tolower(ff.pattern); str_tolower(ff.pattern);
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#else #else
sprintf(path, "/proc/%u/map_files/", getpid()); sprintf(path, "/proc/%u/map_files/", getpid());
#endif #endif
@ -448,7 +448,7 @@ extern "C"
unsigned int get_page_size(unsigned int* map_unit) unsigned int get_page_size(unsigned int* map_unit)
{ {
unsigned int ps = 1024; unsigned int ps = 1024;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
SYSTEM_INFO si = { 0 }; SYSTEM_INFO si = { 0 };
GetSystemInfo(&si); GetSystemInfo(&si);
@ -526,7 +526,7 @@ extern "C"
if (home.empty()) if (home.empty())
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
std::string env("LOCALAPPDATA"), lead(""); std::string env("LOCALAPPDATA"), lead("");
#else #else
std::string env("HOME"), lead("."); std::string env("HOME"), lead(".");
@ -622,7 +622,7 @@ extern "C"
} }
#endif #endif
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
void hg_debug_log(int level, const char* info) void hg_debug_log(int level, const char* info)
{ {
hg_log::log(level, info); hg_log::log(level, info);

View File

@ -8,7 +8,7 @@
#include <string> #include <string>
#include "../../sdk/hginclude/huagaoxxx_warraper_ex.h" #include "../../sdk/hginclude/huagaoxxx_warraper_ex.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#define bzero(a, l) memset(a, 0, l) #define bzero(a, l) memset(a, 0, l)
#define PATH_SEPARATOR "\\" #define PATH_SEPARATOR "\\"
#define DLL_EXTESION ".dll" #define DLL_EXTESION ".dll"

View File

@ -1,9 +1,9 @@
#include "../../sdk/hginclude/huagaoxxx_warraper_ex.h" #include "../../sdk/hginclude/huagaoxxx_warraper_ex.h"
#include "../wrapper/hg_log.h" #include "../wrapper/hg_log.h"
#include "../hgdev/scanner_manager.h" #include "../hgdev/scanner_manager.h"
#include <iostream> #include <iostream>
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <fileapi.h> #include <fileapi.h>
#else #else
#include <sys/vfs.h> #include <sys/vfs.h>
@ -37,7 +37,7 @@ extern "C"
path(PATH_SEPARATOR), path(PATH_SEPARATOR),
scanner(g_scanner_path), scanner(g_scanner_path),
sane(hg_log::get_module_full_path((g_sane_name + DLL_EXTESION).c_str())); sane(hg_log::get_module_full_path((g_sane_name + DLL_EXTESION).c_str()));
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
size_t pos = g_scanner_path.rfind('\\'); size_t pos = g_scanner_path.rfind('\\');
if (pos++ != std::string::npos) if (pos++ != std::string::npos)
g_scanner_path.erase(pos); g_scanner_path.erase(pos);
@ -284,7 +284,7 @@ extern "C"
{ {
int ret = SCANNER_ERR_OK; int ret = SCANNER_ERR_OK;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
ULARGE_INTEGER av = { 0 }, ULARGE_INTEGER av = { 0 },
all = { 0 }; all = { 0 };
if (GetDiskFreeSpaceExA(path, &av, &all, NULL)) if (GetDiskFreeSpaceExA(path, &av, &all, NULL))
@ -330,7 +330,7 @@ extern "C"
} }
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
{ {

View File

@ -6,7 +6,7 @@
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#define bzero(b, s) memset(b, 0, s) #define bzero(b, s) memset(b, 0, s)
#endif #endif
@ -19,7 +19,7 @@ simple_ini::~simple_ini()
std::string simple_ini::temporary_path(void) std::string simple_ini::temporary_path(void)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
char path[MAX_PATH] = { 0 }; char path[MAX_PATH] = { 0 };
if (GetTempPathA(_countof(path) - 1, path)) if (GetTempPathA(_countof(path) - 1, path))
@ -57,7 +57,7 @@ void simple_ini::trime(char*& ptr)
int simple_ini::load(const char* local_file) int simple_ini::load(const char* local_file)
{ {
int ret = 0; int ret = 0;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
file_ = local_file; file_ = local_file;
#else #else
values_.clear(); values_.clear();
@ -134,7 +134,7 @@ int simple_ini::load(const char* local_file)
return ret; return ret;
} }
#ifndef WIN32 #if !defined(WIN32) && !defined(_WIN64)
int simple_ini::save(const char* local_file) int simple_ini::save(const char* local_file)
{ {
FILE* dst = fopen(local_file, "wb"); FILE* dst = fopen(local_file, "wb");
@ -164,7 +164,7 @@ int simple_ini::save(const char* local_file)
std::string simple_ini::get(const char* sec, const char* key, const char* default_val) std::string simple_ini::get(const char* sec, const char* key, const char* default_val)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
char str[MAX_PATH] = { 0 }; char str[MAX_PATH] = { 0 };
GetPrivateProfileStringA(sec, key, default_val, str, _countof(str), file_.c_str()); GetPrivateProfileStringA(sec, key, default_val, str, _countof(str), file_.c_str());
@ -183,7 +183,7 @@ std::string simple_ini::get(const char* sec, const char* key, const char* defaul
} }
void simple_ini::set(const char* sec, const char* key, const char* val) void simple_ini::set(const char* sec, const char* key, const char* val)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
WritePrivateProfileStringA(sec, key, val, file_.c_str()); WritePrivateProfileStringA(sec, key, val, file_.c_str());
#else #else
std::vector<SECKEY>::iterator it = std::find(values_.begin(), values_.end(), sec); std::vector<SECKEY>::iterator it = std::find(values_.begin(), values_.end(), sec);
@ -217,7 +217,7 @@ void simple_ini::set(const char* sec, const char* key, const char* val)
} }
void simple_ini::remove(const char* sec, const char* key) void simple_ini::remove(const char* sec, const char* key)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#else #else
std::vector<SECKEY>::iterator it = std::find(values_.begin(), values_.end(), sec); std::vector<SECKEY>::iterator it = std::find(values_.begin(), values_.end(), sec);
if (it == values_.end()) if (it == values_.end())
@ -230,7 +230,7 @@ void simple_ini::remove(const char* sec, const char* key)
} }
void simple_ini::remove(const char* sec) void simple_ini::remove(const char* sec)
{ {
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
std::vector<SECKEY>::iterator it = std::find(values_.begin(), values_.end(), sec); std::vector<SECKEY>::iterator it = std::find(values_.begin(), values_.end(), sec);
if (it != values_.end()) if (it != values_.end())
values_.erase(it); values_.erase(it);

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <Windows.h> #include <Windows.h>
#else #else
#include <string.h> #include <string.h>
@ -42,7 +42,7 @@ class simple_ini
}SECKEY; }SECKEY;
std::vector<SECKEY> values_; std::vector<SECKEY> values_;
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
std::string file_; std::string file_;
#endif #endif
@ -56,7 +56,7 @@ public:
public: public:
int load(const char* local_file); int load(const char* local_file);
#ifndef WIN32 #if !defined(WIN32) && !defined(_WIN64)
int save(const char* local_file); int save(const char* local_file);
#endif #endif

View File

@ -3,7 +3,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#define bzero(b, s) memset(b, 0, s) #define bzero(b, s) memset(b, 0, s)
#endif #endif

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <Windows.h> #include <Windows.h>
#endif #endif

View File

@ -5,7 +5,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <mutex> #include <mutex>
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#include <windows.h> #include <windows.h>
#include <direct.h> #include <direct.h>
#define pthread_t DWORD #define pthread_t DWORD
@ -335,7 +335,7 @@ hg_sane_middleware::hg_sane_middleware(void) : opt_0_(nullptr), std_opt_(nullptr
hg_scanner_set_sane_info(g_sane_name.c_str(), sane_ver); hg_scanner_set_sane_info(g_sane_name.c_str(), sane_ver);
hg_scanner_initialize(local_utility::ui_cb, NULL); hg_scanner_initialize(local_utility::ui_cb, NULL);
#ifndef WIN32 #if defined(WIN32) || defined(_WIN64)
char path[512] = { 0 }; char path[512] = { 0 };
size_t pos = 0; size_t pos = 0;
@ -2020,7 +2020,7 @@ extern "C" { // avoid compiler exporting name in C++ style !!!
} }
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
HMODULE g_my_inst = NULL; HMODULE g_my_inst = NULL;
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
{ {

View File

@ -7,7 +7,7 @@
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#define bzero(b, s) memset(b, 0, s) #define bzero(b, s) memset(b, 0, s)
#else #else
#include <iconv.h> #include <iconv.h>

View File

@ -7,7 +7,7 @@
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#define bzero(b, s) memset(b, 0, s) #define bzero(b, s) memset(b, 0, s)
#else #else
#include <iconv.h> #include <iconv.h>

View File

@ -27,7 +27,7 @@
#include "huagao/hgscanner_error.h" #include "huagao/hgscanner_error.h"
#include "sane/sane_ex.h" #include "sane/sane_ex.h"
#ifdef WIN32 #if defined(WIN32) || defined(_WIN64)
#ifndef HGSCANNER_EXPORT #ifndef HGSCANNER_EXPORT
#ifdef _DEBUG #ifdef _DEBUG
#pragma comment(lib, "debug/scanner.lib") #pragma comment(lib, "debug/scanner.lib")