diff --git a/device/scanner.rc b/device/scanner.rc
index d965968..3ebb6f2 100644
--- a/device/scanner.rc
+++ b/device/scanner.rc
@@ -51,8 +51,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 4,1015,2022,7081
- PRODUCTVERSION 4,1015,2022,7081
+ FILEVERSION 4,1018,2022,7181
+ PRODUCTVERSION 4,1018,2022,7181
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Äþ²¨»ª¸ßÐÅÏ¢¿Æ¼¼ÓÐÏÞ¹«Ë¾"
VALUE "FileDescription", "»ª¸ßɨÃèÒÇÓ¦ÓóÌÐò"
- VALUE "FileVersion", "4.1015.2022.7081"
+ VALUE "FileVersion", "4.1018.2022.7181"
VALUE "InternalName", "scanner.dll"
VALUE "LegalCopyright", "Copyright (C) 2022"
VALUE "OriginalFilename", "scanner.dll"
VALUE "ProductName", "HUAGOScan"
- VALUE "ProductVersion", "4.1015.2022.7081"
+ VALUE "ProductVersion", "4.1018.2022.7181"
END
END
BLOCK "VarFileInfo"
diff --git a/device/scanner.vcxproj b/device/scanner.vcxproj
index e5c1b19..0209fc2 100644
--- a/device/scanner.vcxproj
+++ b/device/scanner.vcxproj
@@ -211,6 +211,7 @@ move /Y "$(OutDirFullPath)$(ProjectName).pdb" "$(SolutionDir)..\..\sdk\lib\win\$
+
@@ -268,6 +269,7 @@ move /Y "$(OutDirFullPath)$(ProjectName).pdb" "$(SolutionDir)..\..\sdk\lib\win\$
+
diff --git a/device/scanner.vcxproj.filters b/device/scanner.vcxproj.filters
index 3ab1e17..b0c824f 100644
--- a/device/scanner.vcxproj.filters
+++ b/device/scanner.vcxproj.filters
@@ -183,6 +183,9 @@
image
+
+ dev
+
@@ -392,6 +395,9 @@
头文件
+
+ dev
+
diff --git a/sane/DlgArea.cpp b/sane/DlgArea.cpp
index d800d0a..a3e5c4e 100644
--- a/sane/DlgArea.cpp
+++ b/sane/DlgArea.cpp
@@ -123,7 +123,7 @@ void dlg_area::handle_command(WORD code, WORD id, HANDLE ctrl)
float num = .0f;
GetWindowTextW((HWND)ctrl, val, _countof(val) - 1);
- num = _wtof(val);
+ num = (float)_wtof(val);
if (id == IDC_EDIT_x)
{
if (num < .0f)
@@ -131,10 +131,10 @@ void dlg_area::handle_command(WORD code, WORD id, HANDLE ctrl)
if (num > paper_w_ - dlg_area::area_min_pixel)
num = paper_w_ - dlg_area::area_min_pixel;
x_ = num;
- user_sel_.left = whole_.left + x_ / ratio_;
+ user_sel_.left = whole_.left + (LONG)(x_ / ratio_);
if (x_ + w_ > paper_w_)
w_ = paper_w_ - x_;
- user_sel_.right = user_sel_.left + w_ / ratio_;
+ user_sel_.right = user_sel_.left + (LONG)(w_ / ratio_);
refresh_paper_info();
InvalidateRect(hwnd(), &whole_, FALSE);
}
@@ -145,21 +145,21 @@ void dlg_area::handle_command(WORD code, WORD id, HANDLE ctrl)
if (num > paper_h_ - dlg_area::area_min_pixel)
num = paper_h_ - dlg_area::area_min_pixel;
y_ = num;
- user_sel_.top = whole_.top + y_ / ratio_;
+ user_sel_.top = whole_.top + (LONG)(y_ / ratio_);
if (y_ + h_ > paper_h_)
h_ = paper_h_ - y_;
- user_sel_.bottom = user_sel_.top + h_ / ratio_;
+ user_sel_.bottom = user_sel_.top + (LONG)(h_ / ratio_);
refresh_paper_info();
InvalidateRect(hwnd(), &whole_, FALSE);
}
else if (id == IDC_EDIT_W)
{
if (num < dlg_area::area_min_pixel)
- num = dlg_area::area_min_pixel;
+ num = (float)dlg_area::area_min_pixel;
if (num > paper_w_)
num = paper_w_;
w_ = num;
- user_sel_.right = user_sel_.left + w_ / ratio_;
+ user_sel_.right = user_sel_.left + (LONG)(w_ / ratio_);
if (user_sel_.right > whole_.right)
{
OffsetRect(&user_sel_, whole_.right - user_sel_.right, 0);
@@ -175,11 +175,11 @@ void dlg_area::handle_command(WORD code, WORD id, HANDLE ctrl)
else if (id == IDC_EDIT_H)
{
if (num < dlg_area::area_min_pixel)
- num = dlg_area::area_min_pixel;
+ num = (float)dlg_area::area_min_pixel;
if (num > paper_h_)
num = paper_h_;
h_ = num;
- user_sel_.bottom = user_sel_.top + h_ / ratio_;
+ user_sel_.bottom = user_sel_.top + (LONG)(h_ / ratio_);
if (user_sel_.bottom > whole_.bottom)
{
OffsetRect(&user_sel_, 0, whole_.bottom - user_sel_.bottom);
@@ -323,7 +323,7 @@ void dlg_area::drag_blocks(std::vector& blocks)
}
float dlg_area::pos_2_area(int val, bool x)
{
- float r = x ? val - whole_.left : val - whole_.top;
+ float r = x ? (float)(val - whole_.left) : (float)(val - whole_.top);
r *= ratio_;
if (unit_ == PAPER_UNIT_INCH)
@@ -654,8 +654,8 @@ void dlg_area::set_paper(const wchar_t* name, float width_mm, float height_mm, f
xr = (r.right - r.left - xr) / 2;
yr = paper_h_0_ / ratio_;
yr = (r.bottom - r.top - yr) / 2;
- whole_.left = r.left + xr; whole_.right = r.right - xr;
- whole_.top = r.top + yr; whole_.bottom = r.bottom - yr;
+ whole_.left = r.left + (LONG)xr; whole_.right = r.right - (LONG)xr;
+ whole_.top = r.top + (LONG)yr; whole_.bottom = r.bottom - (LONG)yr;
clear_area();
}
@@ -684,10 +684,10 @@ void dlg_area::set_area(float x, float y, float w, float h)
}
if (h_ + y_ > paper_h_)
h_ = paper_h_ - y_;
- user_sel_.left = whole_.left + x_ / ratio_;
- user_sel_.top = whole_.top + y_ / ratio_;
- user_sel_.right = user_sel_.left + w_ / ratio_;
- user_sel_.bottom = user_sel_.top + h_ / ratio_;
+ user_sel_.left = whole_.left + (LONG)(x_ / ratio_);
+ user_sel_.top = whole_.top + (LONG)(y_ / ratio_);
+ user_sel_.right = user_sel_.left + (LONG)(w_ / ratio_);
+ user_sel_.bottom = user_sel_.top + (LONG)(h_ / ratio_);
refresh_paper_info();
}
diff --git a/sane/DlgGamma.cpp b/sane/DlgGamma.cpp
index 25941cd..41f5133 100644
--- a/sane/DlgGamma.cpp
+++ b/sane/DlgGamma.cpp
@@ -72,17 +72,17 @@ namespace calc
std::vector coef;
double** a = new double* [pt.size()];
- for (int i = 0; i < pt.size(); ++i)
+ for (int i = 0; i < (int)pt.size(); ++i)
a[i] = new double[pt.size() + 1];
- for (int i = 0; i < pt.size(); ++i)
+ for (int i = 0; i < (int)pt.size(); ++i)
{
- for (int j = 0; j < pt.size(); ++j)
+ for (int j = 0; j < (int)pt.size(); ++j)
a[i][j] = power(pt[i].x, pt.size() - j - 1);
a[i][pt.size()] = pt[i].y;
}
solve_matrix(a, pt.size(), coef);
- for (int i = 0; i < pt.size(); ++i)
+ for (int i = 0; i < (int)pt.size(); ++i)
delete[] a[i];
delete[] a;
@@ -254,7 +254,7 @@ int dlg_gamma::add_drag_point(int x, int y)
if (cur_->points.size() < MAX_KEY_POINTS + 2)
{
- for (int i = 2; i < cur_->points.size(); ++i)
+ for (int i = 2; i < (int)cur_->points.size(); ++i)
{
if (x < cur_->points[i].x)
{
@@ -279,12 +279,12 @@ int dlg_gamma::add_drag_point(int x, int y)
cur_->right = ind + 1;
if (cur_->left == 1)
cur_->left = 0;
- if (cur_->right >= cur_->points.size())
+ if (cur_->right >= (int)cur_->points.size())
cur_->right = 1;
}
else
{
- for (int i = 2; i < cur_->points.size(); ++i)
+ for (int i = 2; i < (int)cur_->points.size(); ++i)
{
if (x == cur_->points[i].x)
{
@@ -293,7 +293,7 @@ int dlg_gamma::add_drag_point(int x, int y)
cur_->right = ind + 1;
if (cur_->left == 1)
cur_->left = 0;
- if (cur_->right >= cur_->points.size())
+ if (cur_->right >= (int)cur_->points.size())
cur_->right = 1;
break;
}
@@ -306,7 +306,7 @@ int dlg_gamma::add_drag_point(int x, int y)
BYTE dlg_gamma::calc_value(BYTE x)
{
double y = .0f;
- for(int j = 0; j < cur_->points.size(); ++j)
+ for(int j = 0; j < (int)cur_->points.size(); ++j)
y += cur_->coefs[j] * calc::power(x, cur_->points.size() - j - 1);
if (y > 255.0f)
@@ -320,7 +320,7 @@ BYTE dlg_gamma::calc_value(BYTE x)
if (y > cur_->points[upper].y)
y = cur_->points[upper].y;
- return y + .5f;
+ return (BYTE)(y + .5f);
}
bool dlg_gamma::is_adjacent(POINT p1, POINT p2)
{
@@ -330,7 +330,7 @@ bool dlg_gamma::is_adjacent(POINT p1, POINT p2)
}
bool dlg_gamma::hit_test(int* x, int* y)
{
- for (int i = 2; i < cur_->points.size(); ++i)
+ for (int i = 2; i < (int)cur_->points.size(); ++i)
{
POINT pt = { *x, *y };
if (is_adjacent(pt, cur_->points[i]))
@@ -477,7 +477,7 @@ void dlg_gamma::on_paint(HDC hdc)
draw_current_curve(hdc);
SelectObject(hdc, drag);
- for (int i = 0; i < cur_->points.size(); ++i)
+ for (int i = 0; i < (int)cur_->points.size(); ++i)
{
draw_ellipse(hdc, cur_->points[i], 3, 3);
}
@@ -653,12 +653,12 @@ void dlg_gamma::get_gamma(SANE_Gamma* gamma)
//if (cur_ == &rgb_gray_)
{
cur_ = &rgb_gray_;
- gamma->pt_count = cur_->points.size() - 2;
+ gamma->pt_count = (SANE_Byte)(cur_->points.size() - 2);
// gamma->pt_count_r = gamma->pt_count_g = gamma->pt_count_b = 0;
- for (int i = 2; i < cur_->points.size(); ++i)
+ for (int i = 2; i < (int)cur_->points.size(); ++i)
{
- gamma->keypoint[i - 2].x = cur_->points[i].x;
- gamma->keypoint[i - 2].y = cur_->points[i].y;
+ gamma->keypoint[i - 2].x = (SANE_Byte)cur_->points[i].x;
+ gamma->keypoint[i - 2].y = (SANE_Byte)cur_->points[i].y;
}
for (int i = 0; i < 256; ++i)
@@ -669,31 +669,31 @@ void dlg_gamma::get_gamma(SANE_Gamma* gamma)
// gamma->pt_count = 0;
cur_ = &red_;
- gamma->pt_count_r = cur_->points.size() - 2;
- for (int i = 2; i < cur_->points.size(); ++i)
+ gamma->pt_count_r = (SANE_Byte)(cur_->points.size() - 2);
+ for (int i = 2; i < (int)cur_->points.size(); ++i)
{
- gamma->keypoint_r[i - 2].x = cur_->points[i].x;
- gamma->keypoint_r[i - 2].y = cur_->points[i].y;
+ gamma->keypoint_r[i - 2].x = (SANE_Byte)cur_->points[i].x;
+ gamma->keypoint_r[i - 2].y = (SANE_Byte)cur_->points[i].y;
}
for (int i = 0; i < 256; ++i)
gamma->table[i] = calc_value(i);
cur_ = &green_;
- gamma->pt_count_g = cur_->points.size() - 2;
- for (int i = 2; i < cur_->points.size(); ++i)
+ gamma->pt_count_g = (SANE_Byte)(cur_->points.size() - 2);
+ for (int i = 2; i < (int)cur_->points.size(); ++i)
{
- gamma->keypoint_g[i - 2].x = cur_->points[i].x;
- gamma->keypoint_g[i - 2].y = cur_->points[i].y;
+ gamma->keypoint_g[i - 2].x = (SANE_Byte)cur_->points[i].x;
+ gamma->keypoint_g[i - 2].y = (SANE_Byte)cur_->points[i].y;
}
for (int i = 0; i < 256; ++i)
gamma->table[256 + i] = calc_value(i);
cur_ = &blue_;
- gamma->pt_count_b = cur_->points.size() - 2;
- for (int i = 2; i < cur_->points.size(); ++i)
+ gamma->pt_count_b = (SANE_Byte)(cur_->points.size() - 2);
+ for (int i = 2; i < (int)cur_->points.size(); ++i)
{
- gamma->keypoint_b[i - 2].x = cur_->points[i].x;
- gamma->keypoint_b[i - 2].y = cur_->points[i].y;
+ gamma->keypoint_b[i - 2].x = (SANE_Byte)cur_->points[i].x;
+ gamma->keypoint_b[i - 2].y = (SANE_Byte)cur_->points[i].y;
}
for (int i = 0; i < 256; ++i)
gamma->table[512 + i] = calc_value(i);
diff --git a/sane/DlgPage.cpp b/sane/DlgPage.cpp
index 7c500ea..55c3f0d 100644
--- a/sane/DlgPage.cpp
+++ b/sane/DlgPage.cpp
@@ -314,7 +314,7 @@ HWND dlg_page::create_slider(int sn, int x, int y, double lower, double upper, d
size->cx = get_string_width(limit);
create_label(sn, limit, x, y, *size);
x += size->cx;
- size->cx = (upper - lower + step - 1) / step;
+ size->cx = (LONG)((upper - lower + step - 1) / step + .5f);
size->cx += 100;
size->cx /= 200;
size->cx *= 100;
@@ -370,16 +370,16 @@ HWND dlg_page::create_combox(int sn, int x, int y, std::vector& va
int h = vals.size() * 2 * size->cy;
HWND wnd = NULL;
- for (int i = 0; i < vals.size(); ++i)
+ for (int i = 0; i < (int)vals.size(); ++i)
{
if (size->cx < get_string_width(vals[i].c_str()))
size->cx = get_string_width(vals[i].c_str());
}
- size->cx + 20;
+ size->cx += 20;
wnd = CreateWindowW(WC_COMBOBOXW, L"", WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL, x, y, size->cx, h, hwnd(), NULL, g_my_inst, NULL);
SendMessage(wnd, CB_SETDROPPEDWIDTH, size->cx, 0);
- for (int i = 0; i < vals.size(); ++i)
+ for (int i = 0; i < (int)vals.size(); ++i)
{
SendMessageW(wnd, CB_ADDSTRING, 0, (LPARAM)vals[i].c_str());
if (vals[i] == cur_val)
@@ -603,13 +603,13 @@ void dlg_page::handle_command(WORD code, WORD id, HANDLE ctrl)
sane_.sane_io_control_api(dev_, IO_CTRL_CODE_GET_PAPER_SIZE, &utf8[0], &size);
dlg.set_paper(paper_.c_str(), (float)(size & 0x0ffff), float(size >> 16), dpi_);
sane_.sane_control_option_api(dev_, id_custom_left_, SANE_ACTION_GET_VALUE, &sf, NULL);
- x = SANE_UNFIX(sf);
+ x = (float)SANE_UNFIX(sf);
sane_.sane_control_option_api(dev_, id_custom_top_, SANE_ACTION_GET_VALUE, &sf, NULL);
- y = SANE_UNFIX(sf);
+ y = (float)SANE_UNFIX(sf);
sane_.sane_control_option_api(dev_, id_custom_right_, SANE_ACTION_GET_VALUE, &sf, NULL);
- w = SANE_UNFIX(sf) - x;
+ w = (float)SANE_UNFIX(sf) - x;
sane_.sane_control_option_api(dev_, id_custom_bottom_, SANE_ACTION_GET_VALUE, &sf, NULL);
- h = SANE_UNFIX(sf) - y;
+ h = (float)SANE_UNFIX(sf) - y;
dlg.set_area(x, y, w, h);
if (dlg.do_modal(parent_) == IDOK)
{
@@ -743,7 +743,7 @@ void* dlg_page::value_from_ctrl(HWND ctrl, SANE_Value_Type* type)
{
std::string utf8(local_trans::u2a(buf, CP_UTF8));
ret = new char[len + 2];
- if (utf8.length() > len)
+ if ((int)utf8.length() > len)
utf8.erase(len);
strcpy((char*)ret, utf8.c_str());
((char*)ret)[len] = 0;
@@ -841,12 +841,12 @@ void dlg_page::set_ctrl_value(HWND ctrl, SANE_Value_Type type, void* val, bool o
int id = GetWindowLong(ctrl, GWL_ID);
int ind = 0;
- for (; ind < ctrls_.size(); ++ind)
+ for (; ind < (int)ctrls_.size(); ++ind)
{
if (GetWindowLong(ctrls_[ind], GWL_ID) == id)
break;
}
- for (; ind < ctrls_.size(); ++ind)
+ for (; ind < (int)ctrls_.size(); ++ind)
{
if (GetWindowLong(ctrls_[ind], GWL_ID) != id)
break;
@@ -868,7 +868,7 @@ int dlg_page::find_control_ind(HWND wnd)
{
int ind = -1;
- for (int i = 0; i < ctrls_.size(); ++i)
+ for (int i = 0; i < (int)ctrls_.size(); ++i)
{
if (ctrls_[i] == wnd)
{
@@ -921,7 +921,7 @@ void dlg_page::control_action(HWND wnd)
if (id == dlg_page::dyn_id_base + id_dpi_)
{
if (type == SANE_TYPE_FIXED)
- dpi_ = SANE_UNFIX(*(SANE_Fixed*)val);
+ dpi_ = (float)SANE_UNFIX(*(SANE_Fixed*)val);
else
dpi_ = (float)(int)*(SANE_Int*)val;
}
@@ -1008,7 +1008,7 @@ bool dlg_page::add_control(int sn, const SANE_Option_Descriptor* desc, void* cur
SetPropW(wnd, dlg_page::property_size.c_str(), (HANDLE)desc->size);
if (desc->cap & SANE_CAP_INACTIVE)
{
- for (; pos < ctrls_.size(); ++pos)
+ for (; pos < (int)ctrls_.size(); ++pos)
EnableWindow(ctrls_[pos], FALSE);
}
if (is_sane_opt(OPTION_TITLE_ZDYSMQY, desc->title))
@@ -1034,7 +1034,7 @@ bool dlg_page::add_control(int sn, const SANE_Option_Descriptor* desc, void* cur
else if (is_sane_opt(OPTION_TITLE_FBL, desc->title))
{
if (desc->type == SANE_TYPE_FIXED)
- dpi_ = SANE_UNFIX(*(SANE_Fixed*)cur_val);
+ dpi_ = (float)SANE_UNFIX(*(SANE_Fixed*)cur_val);
else
dpi_ = (float)(int)*(SANE_Int*)cur_val;
id_dpi_ = sn;
@@ -1088,7 +1088,7 @@ bool dlg_page::refresh(int sn, const SANE_Option_Descriptor* desc, void* cur_val
int ind = 0;
sn += dlg_page::dyn_id_base;
- for (; ind < ctrls_.size(); ++ind)
+ for (; ind < (int)ctrls_.size(); ++ind)
{
if (GetWindowLong(ctrls_[ind], GWL_ID) == sn)
{
@@ -1097,7 +1097,7 @@ bool dlg_page::refresh(int sn, const SANE_Option_Descriptor* desc, void* cur_val
}
}
done_ = false;
- for (; ind < ctrls_.size(); ++ind)
+ for (; ind < (int)ctrls_.size(); ++ind)
{
if (GetWindowLong(ctrls_[ind], GWL_ID) != sn)
break;
diff --git a/sane/mem_dc.cpp b/sane/mem_dc.cpp
index d6b72f7..742e161 100644
--- a/sane/mem_dc.cpp
+++ b/sane/mem_dc.cpp
@@ -1,7 +1,7 @@
// DlgIndicator.cpp: 实现文件
//
-#include "mem_dc.h""
+#include "mem_dc.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
diff --git a/sane/sane.rc b/sane/sane.rc
index b3f9326..5046d40 100644
--- a/sane/sane.rc
+++ b/sane/sane.rc
@@ -248,8 +248,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 4,1015,2022,7081
- PRODUCTVERSION 4,1015,2022,7081
+ FILEVERSION 4,1018,2022,7181
+ PRODUCTVERSION 4,1018,2022,7181
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -266,12 +266,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Äþ²¨»ª¸ßÐÅÏ¢¿Æ¼¼ÓÐÏÞ¹«Ë¾"
VALUE "FileDescription", "»ª¸ßɨÃèÒÇÓ¦ÓóÌÐò"
- VALUE "FileVersion", "4.1015.2022.7081"
+ VALUE "FileVersion", "4.1018.2022.7181"
VALUE "InternalName", "sane.dll"
VALUE "LegalCopyright", "Copyright (C) 2022"
VALUE "OriginalFilename", "sane.dll"
VALUE "ProductName", "HUAGOScan"
- VALUE "ProductVersion", "4.1015.2022.7081"
+ VALUE "ProductVersion", "4.1018.2022.7181"
END
END
BLOCK "VarFileInfo"
diff --git a/sane/scanned_img.cpp b/sane/scanned_img.cpp
index 11706fa..cad3ffe 100644
--- a/sane/scanned_img.cpp
+++ b/sane/scanned_img.cpp
@@ -185,7 +185,7 @@ void mapping_buf::set_buffer(unsigned char*& buf, unsigned long long off, unsign
{
buf = buf_ + (off - offset_);
if (bytes)
- *bytes = mapped_bytes_ - (off - offset_);
+ *bytes = mapped_bytes_ - (unsigned int)(off - offset_);
}
unsigned char* mapping_buf::allocate(const wchar_t* file, unsigned long long size, bool force_file)
@@ -201,9 +201,10 @@ unsigned char* mapping_buf::allocate(const wchar_t* file, unsigned long long siz
{
try
{
- buf_ = new unsigned char[size];
+ buf_ = new unsigned char[(unsigned int)size];
is_mem_ = true;
- bytes_ = mapped_bytes_ = size;
+ bytes_ = size;
+ mapped_bytes_ = (unsigned int)size;
}
catch (...)
{
@@ -220,7 +221,7 @@ unsigned char* mapping_buf::buffer(unsigned long long off, unsigned int* bytes)
unsigned char* buf = NULL;
if (size > bytes_ - offset_)
- size = bytes_ - offset_;
+ size = (unsigned int)(bytes_ - offset_);
if (buf_ && off >= offset_ && size + (off - offset_) <= mapped_bytes_)
{
@@ -234,7 +235,7 @@ unsigned char* mapping_buf::buffer(unsigned long long off, unsigned int* bytes)
UnmapViewOfFile(buf_);
offset_ = off / map_unit_ * map_unit_;
- mapped_bytes_ = bytes_ - offset_;
+ mapped_bytes_ = (unsigned int)(bytes_ - offset_);
map();
if (buf_)
set_buffer(buf, off, bytes);
@@ -272,7 +273,7 @@ bool mapping_buf::save(const void* data, size_t* bytes, unsigned long long off)
}
bool mapping_buf::save(unsigned long long off, mapping_buf* mbuf, unsigned long long src_off)
{
- unsigned int len = mbuf->bytes() - src_off;
+ unsigned int len = (unsigned int)(mbuf->bytes() - src_off);
unsigned char* buf = mbuf->buffer(src_off, &len);
bool ret = false;
@@ -285,7 +286,7 @@ bool mapping_buf::save(unsigned long long off, mapping_buf* mbuf, unsigned long
ret = true;
break;
}
- len = mbuf->bytes() - src_off;
+ len = (unsigned int)(mbuf->bytes() - src_off);
buf = mbuf->buffer(src_off, &len);
}
@@ -369,7 +370,7 @@ scanned_img::scanned_img(SANE_Handle dev, SANE_Parameters head, int dpi
}
size_t bytes = line_bytes() * height();
- std::string h(file_header(fmt_.img_format, dpi, xfer));
+ std::string h(file_header(fmt_.img_format, (float)dpi, xfer));
unsigned char* dst = NULL;
bool ok = false;
@@ -394,7 +395,7 @@ scanned_img::scanned_img(SANE_Handle dev, SANE_Parameters head, int dpi
int want_to_read = head_.bytes_per_line, rcv = 0, dif = line_bytes() - head_.bytes_per_line;
while (dst)
{
- int r = want_to_read > len - rcv ? len - rcv : want_to_read;
+ int r = want_to_read > (int)(len) - rcv ? (int)(len)- rcv : want_to_read;
int ret = hg_sane_middleware::instance()->read(dev, dst + rcv, &r);
total += r;
if (ret != SANE_STATUS_GOOD)
@@ -435,7 +436,7 @@ scanned_img::scanned_img(SANE_Handle dev, SANE_Parameters head, void* data, unsi
}
size_t bytes = line_bytes() * head.lines;
- std::string h(file_header(fmt_.img_format, dpi, xfer));
+ std::string h(file_header(fmt_.img_format, (float)dpi, xfer));
unsigned char* dst = NULL, *src = (unsigned char*)data;
bool ok = false;
@@ -452,7 +453,7 @@ scanned_img::scanned_img(SANE_Handle dev, SANE_Parameters head, void* data, unsi
line_l *= -1;
else
off = data_->bytes() - line_l;
- for (; row < head.lines; ++row)
+ for (; row < (unsigned int)head.lines; ++row)
{
bytes = head.bytes_per_line;
if (!data_->save(src, &bytes, off))
@@ -486,7 +487,7 @@ std::string scanned_img::file_header(SANE_ImageType type, float resolution, twai
bih.biPlanes = 1;
bih.biHeight = height();
bih.biCompression = BI_RGB;
- bih.biXPelsPerMeter = bih.biYPelsPerMeter = resolution * 39.37f + .5f;
+ bih.biXPelsPerMeter = bih.biYPelsPerMeter = (LONG)(resolution * 39.37f + .5f);
if (bih.biBitCount == 1)
pal_size = 2 * sizeof(int);
@@ -532,7 +533,7 @@ void scanned_img::do_result(bool ok, twain_xfer xfer)
xfer == TWAIN_XFER_Memory)
{
// convert to black-white ...
- std::string head(file_header(SANE_IMAGE_TYPE_BMP, dpi_, TWAIN_XFER_File));
+ std::string head(file_header(SANE_IMAGE_TYPE_BMP, (float)dpi_, TWAIN_XFER_File));
size_t size = head.length();
mapping_buf* buf = new mapping_buf();
std::wstring file(file_ + L".tmp");
@@ -609,10 +610,10 @@ void scanned_img::swap_rgb(void)
dst = data_->buffer(off + cur, &len);
if (!dst)
break;
- if (len > l)
+ if (len > (unsigned int)l)
len = l;
len /= 3;
- for (int pos = 0; pos < len; ++pos)
+ for (int pos = 0; pos < (int)len; ++pos)
{
unsigned char uc = dst[pos * 3 + 0];
dst[pos * 3 + 0] = dst[pos * 3 + 2];
@@ -670,7 +671,7 @@ COM_API_IMPLEMENT(scanned_img, SANE_Frame, type(void))
}
COM_API_IMPLEMENT(scanned_img, unsigned int, bytes(void))
{
- return data_ ? data_->bytes() : 0;
+ return data_ ? (unsigned int)data_->bytes() : 0;
}
COM_API_IMPLEMENT(scanned_img, unsigned int, header_size(void))
{
diff --git a/sane/scanner.cpp b/sane/scanner.cpp
index c70fc0b..c49a3d5 100644
--- a/sane/scanner.cpp
+++ b/sane/scanner.cpp
@@ -188,7 +188,7 @@ int __stdcall scanner::to_int(SANE_Int v)
}
float __stdcall scanner::to_float(SANE_Fixed v)
{
- return SANE_UNFIX(v);
+ return (float)SANE_UNFIX(v);
}
void __stdcall scanner::ui_callback(int uev, void* sender, void* param)
{
@@ -646,7 +646,7 @@ int scanner::set_option_value(int sn, SANE_Value_Type type, int size, void* data
}
else if (type == SANE_TYPE_FIXED)
{
- *(float*)data = SANE_UNFIX(sf);
+ *(float*)data = (float)SANE_UNFIX(sf);
}
else if(buf)
{
@@ -1383,7 +1383,7 @@ EX_OPTION_HANDLER_IMPL(final_format)
{
int now = ff.img_format, init = SANE_IMAGE_TYPE_BMP;
std::vector all(sane_opt_trans::support_image_types());
- for (int i = 0; i < all.size(); ++i)
+ for (int i = 0; i < (int)all.size(); ++i)
{
value_role role = VAL_ROLE_NONE;
ff.img_format = (SANE_ImageType)all[i];
@@ -1741,7 +1741,7 @@ COM_API_IMPLEMENT(scanner, bool, get_value(int sn, set_opt_value setval, void* p
hg_sane_middleware::instance()->get_cur_value(handle_, sn, &cur);
if (sn == resolution_id_)
- dpi_ = SANE_UNFIX(cur) + .5f;
+ dpi_ = (int)(SANE_UNFIX(cur) + .5f);
do
{
if (desc->constraint_type == SANE_CONSTRAINT_RANGE)
@@ -1758,13 +1758,13 @@ COM_API_IMPLEMENT(scanner, bool, get_value(int sn, set_opt_value setval, void* p
role = value_role(role | VAL_ROLE_CURRENT);
if (v[i + 1] == def)
role = value_role(role | VAL_ROLE_DEFAULT);
- val = SANE_UNFIX(v[i + 1]);
+ val = (float)SANE_UNFIX(v[i + 1]);
if (!setval(&val, role, param))
break;
}
}
else
- set_cur_and_def_value(val, SANE_UNFIX(*(SANE_Fixed*)init), setval, param);
+ set_cur_and_def_value(val, (float)SANE_UNFIX(*(SANE_Fixed*)init), setval, param);
} while (0);
}
else if (desc->type == SANE_TYPE_STRING)
@@ -1831,7 +1831,7 @@ COM_API_IMPLEMENT(scanner, int, set_value(int sn, void* val))
if (sn == resolution_id_)
{
if (desc->type == SANE_TYPE_FIXED)
- dpi_ = *(float*)val + .5f;
+ dpi_ = (int)(*(float*)val + .5f);
else
dpi_ = *(int*)val;
}
diff --git a/sane/scanner.h b/sane/scanner.h
index fef8e14..6075393 100644
--- a/sane/scanner.h
+++ b/sane/scanner.h
@@ -142,7 +142,7 @@ class scanner : public ISaneInvoker, virtual public refer
sv.push_back(l);
sv.push_back(u);
std::sort(sv.begin(), sv.end());
- for (int i = 0; i < sv.size(); ++i)
+ for (int i = 0; i < (int)sv.size(); ++i)
{
if (i && sv[i] == sv[i - 1])
continue;
diff --git a/twain/brand.h b/twain/brand.h
index 4c8e5e6..e6c9ba1 100644
--- a/twain/brand.h
+++ b/twain/brand.h
@@ -6,9 +6,9 @@
#define OEM_NONE
#define VERSION_MAIN 4
-#define VERSION_SUB 1015
+#define VERSION_SUB 1018
#define VERSION_BUILD 2022
-#define VERSION_PATCH 7081
+#define VERSION_PATCH 7181
#define TO_STR(a) #a
#define TO_VER_STR(vs) TO_STR(v##vs)