修复warnings

This commit is contained in:
gb 2022-07-18 10:55:01 +08:00
parent e0bec194d4
commit 9c208f2a27
12 changed files with 105 additions and 96 deletions

View File

@ -51,8 +51,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,1015,2022,7081 FILEVERSION 4,1018,2022,7181
PRODUCTVERSION 4,1015,2022,7081 PRODUCTVERSION 4,1018,2022,7181
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -69,12 +69,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "宁波华高信息科技有限公司" VALUE "CompanyName", "宁波华高信息科技有限公司"
VALUE "FileDescription", "华高扫描仪应用程序" VALUE "FileDescription", "华高扫描仪应用程序"
VALUE "FileVersion", "4.1015.2022.7081" VALUE "FileVersion", "4.1018.2022.7181"
VALUE "InternalName", "scanner.dll" VALUE "InternalName", "scanner.dll"
VALUE "LegalCopyright", "Copyright (C) 2022" VALUE "LegalCopyright", "Copyright (C) 2022"
VALUE "OriginalFilename", "scanner.dll" VALUE "OriginalFilename", "scanner.dll"
VALUE "ProductName", "HUAGOScan" VALUE "ProductName", "HUAGOScan"
VALUE "ProductVersion", "4.1015.2022.7081" VALUE "ProductVersion", "4.1018.2022.7181"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -211,6 +211,7 @@ move /Y "$(OutDirFullPath)$(ProjectName).pdb" "$(SolutionDir)..\..\sdk\lib\win\$
<ClCompile Include="..\..\code_device\hgdriver\hgdev\hg_scanner_239.cpp" /> <ClCompile Include="..\..\code_device\hgdriver\hgdev\hg_scanner_239.cpp" />
<ClCompile Include="..\..\code_device\hgdriver\hgdev\hg_scanner_300.cpp" /> <ClCompile Include="..\..\code_device\hgdriver\hgdev\hg_scanner_300.cpp" />
<ClCompile Include="..\..\code_device\hgdriver\hgdev\hg_scanner_400.cpp" /> <ClCompile Include="..\..\code_device\hgdriver\hgdev\hg_scanner_400.cpp" />
<ClCompile Include="..\..\code_device\hgdriver\hgdev\hg_scanner_402.cpp" />
<ClCompile Include="..\..\code_device\hgdriver\hgdev\ImageMatQueue.cpp" /> <ClCompile Include="..\..\code_device\hgdriver\hgdev\ImageMatQueue.cpp" />
<ClCompile Include="..\..\code_device\hgdriver\hgdev\ImageMultiOutput.cpp" /> <ClCompile Include="..\..\code_device\hgdriver\hgdev\ImageMultiOutput.cpp" />
<ClCompile Include="..\..\code_device\hgdriver\hgdev\image_process.cpp" /> <ClCompile Include="..\..\code_device\hgdriver\hgdev\image_process.cpp" />
@ -268,6 +269,7 @@ move /Y "$(OutDirFullPath)$(ProjectName).pdb" "$(SolutionDir)..\..\sdk\lib\win\$
<ClInclude Include="..\..\code_device\hgdriver\hgdev\hg_scanner_239.h" /> <ClInclude Include="..\..\code_device\hgdriver\hgdev\hg_scanner_239.h" />
<ClInclude Include="..\..\code_device\hgdriver\hgdev\hg_scanner_300.h" /> <ClInclude Include="..\..\code_device\hgdriver\hgdev\hg_scanner_300.h" />
<ClInclude Include="..\..\code_device\hgdriver\hgdev\hg_scanner_400.h" /> <ClInclude Include="..\..\code_device\hgdriver\hgdev\hg_scanner_400.h" />
<ClInclude Include="..\..\code_device\hgdriver\hgdev\hg_scanner_402.h" />
<ClInclude Include="..\..\code_device\hgdriver\hgdev\ImageMatQueue.h" /> <ClInclude Include="..\..\code_device\hgdriver\hgdev\ImageMatQueue.h" />
<ClInclude Include="..\..\code_device\hgdriver\hgdev\ImageMultiOutput.h" /> <ClInclude Include="..\..\code_device\hgdriver\hgdev\ImageMultiOutput.h" />
<ClInclude Include="..\..\code_device\hgdriver\hgdev\image_process.h" /> <ClInclude Include="..\..\code_device\hgdriver\hgdev\image_process.h" />

View File

@ -183,6 +183,9 @@
<ClCompile Include="..\..\code_device\hgdriver\ImageProcess\G4Tiff.cpp"> <ClCompile Include="..\..\code_device\hgdriver\ImageProcess\G4Tiff.cpp">
<Filter>image</Filter> <Filter>image</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\code_device\hgdriver\hgdev\hg_scanner_402.cpp">
<Filter>dev</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\code_device\hgdriver\ImageProcess\ImageApply.h"> <ClInclude Include="..\..\code_device\hgdriver\ImageProcess\ImageApply.h">
@ -392,6 +395,9 @@
<ClInclude Include="..\..\code_device\hgdriver\wrapper\hg_log.h"> <ClInclude Include="..\..\code_device\hgdriver\wrapper\hg_log.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\code_device\hgdriver\hgdev\hg_scanner_402.h">
<Filter>dev</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="device.def"> <None Include="device.def">

View File

@ -123,7 +123,7 @@ void dlg_area::handle_command(WORD code, WORD id, HANDLE ctrl)
float num = .0f; float num = .0f;
GetWindowTextW((HWND)ctrl, val, _countof(val) - 1); GetWindowTextW((HWND)ctrl, val, _countof(val) - 1);
num = _wtof(val); num = (float)_wtof(val);
if (id == IDC_EDIT_x) if (id == IDC_EDIT_x)
{ {
if (num < .0f) 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) if (num > paper_w_ - dlg_area::area_min_pixel)
num = paper_w_ - dlg_area::area_min_pixel; num = paper_w_ - dlg_area::area_min_pixel;
x_ = num; x_ = num;
user_sel_.left = whole_.left + x_ / ratio_; user_sel_.left = whole_.left + (LONG)(x_ / ratio_);
if (x_ + w_ > paper_w_) if (x_ + w_ > paper_w_)
w_ = paper_w_ - x_; w_ = paper_w_ - x_;
user_sel_.right = user_sel_.left + w_ / ratio_; user_sel_.right = user_sel_.left + (LONG)(w_ / ratio_);
refresh_paper_info(); refresh_paper_info();
InvalidateRect(hwnd(), &whole_, FALSE); 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) if (num > paper_h_ - dlg_area::area_min_pixel)
num = paper_h_ - dlg_area::area_min_pixel; num = paper_h_ - dlg_area::area_min_pixel;
y_ = num; y_ = num;
user_sel_.top = whole_.top + y_ / ratio_; user_sel_.top = whole_.top + (LONG)(y_ / ratio_);
if (y_ + h_ > paper_h_) if (y_ + h_ > paper_h_)
h_ = paper_h_ - y_; h_ = paper_h_ - y_;
user_sel_.bottom = user_sel_.top + h_ / ratio_; user_sel_.bottom = user_sel_.top + (LONG)(h_ / ratio_);
refresh_paper_info(); refresh_paper_info();
InvalidateRect(hwnd(), &whole_, FALSE); InvalidateRect(hwnd(), &whole_, FALSE);
} }
else if (id == IDC_EDIT_W) else if (id == IDC_EDIT_W)
{ {
if (num < dlg_area::area_min_pixel) if (num < dlg_area::area_min_pixel)
num = dlg_area::area_min_pixel; num = (float)dlg_area::area_min_pixel;
if (num > paper_w_) if (num > paper_w_)
num = paper_w_; num = paper_w_;
w_ = num; 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) if (user_sel_.right > whole_.right)
{ {
OffsetRect(&user_sel_, whole_.right - user_sel_.right, 0); 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) else if (id == IDC_EDIT_H)
{ {
if (num < dlg_area::area_min_pixel) if (num < dlg_area::area_min_pixel)
num = dlg_area::area_min_pixel; num = (float)dlg_area::area_min_pixel;
if (num > paper_h_) if (num > paper_h_)
num = paper_h_; num = paper_h_;
h_ = num; 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) if (user_sel_.bottom > whole_.bottom)
{ {
OffsetRect(&user_sel_, 0, whole_.bottom - user_sel_.bottom); OffsetRect(&user_sel_, 0, whole_.bottom - user_sel_.bottom);
@ -323,7 +323,7 @@ void dlg_area::drag_blocks(std::vector<DRAGRECT>& blocks)
} }
float dlg_area::pos_2_area(int val, bool x) 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_; r *= ratio_;
if (unit_ == PAPER_UNIT_INCH) 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; xr = (r.right - r.left - xr) / 2;
yr = paper_h_0_ / ratio_; yr = paper_h_0_ / ratio_;
yr = (r.bottom - r.top - yr) / 2; yr = (r.bottom - r.top - yr) / 2;
whole_.left = r.left + xr; whole_.right = r.right - xr; whole_.left = r.left + (LONG)xr; whole_.right = r.right - (LONG)xr;
whole_.top = r.top + yr; whole_.bottom = r.bottom - yr; whole_.top = r.top + (LONG)yr; whole_.bottom = r.bottom - (LONG)yr;
clear_area(); clear_area();
} }
@ -684,10 +684,10 @@ void dlg_area::set_area(float x, float y, float w, float h)
} }
if (h_ + y_ > paper_h_) if (h_ + y_ > paper_h_)
h_ = paper_h_ - y_; h_ = paper_h_ - y_;
user_sel_.left = whole_.left + x_ / ratio_; user_sel_.left = whole_.left + (LONG)(x_ / ratio_);
user_sel_.top = whole_.top + y_ / ratio_; user_sel_.top = whole_.top + (LONG)(y_ / ratio_);
user_sel_.right = user_sel_.left + w_ / ratio_; user_sel_.right = user_sel_.left + (LONG)(w_ / ratio_);
user_sel_.bottom = user_sel_.top + h_ / ratio_; user_sel_.bottom = user_sel_.top + (LONG)(h_ / ratio_);
refresh_paper_info(); refresh_paper_info();
} }

View File

@ -72,17 +72,17 @@ namespace calc
std::vector<double> coef; std::vector<double> coef;
double** a = new double* [pt.size()]; 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]; 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][j] = power(pt[i].x, pt.size() - j - 1);
a[i][pt.size()] = pt[i].y; a[i][pt.size()] = pt[i].y;
} }
solve_matrix(a, pt.size(), coef); 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[i];
delete[] a; delete[] a;
@ -254,7 +254,7 @@ int dlg_gamma::add_drag_point(int x, int y)
if (cur_->points.size() < MAX_KEY_POINTS + 2) 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) if (x < cur_->points[i].x)
{ {
@ -279,12 +279,12 @@ int dlg_gamma::add_drag_point(int x, int y)
cur_->right = ind + 1; cur_->right = ind + 1;
if (cur_->left == 1) if (cur_->left == 1)
cur_->left = 0; cur_->left = 0;
if (cur_->right >= cur_->points.size()) if (cur_->right >= (int)cur_->points.size())
cur_->right = 1; cur_->right = 1;
} }
else 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) if (x == cur_->points[i].x)
{ {
@ -293,7 +293,7 @@ int dlg_gamma::add_drag_point(int x, int y)
cur_->right = ind + 1; cur_->right = ind + 1;
if (cur_->left == 1) if (cur_->left == 1)
cur_->left = 0; cur_->left = 0;
if (cur_->right >= cur_->points.size()) if (cur_->right >= (int)cur_->points.size())
cur_->right = 1; cur_->right = 1;
break; break;
} }
@ -306,7 +306,7 @@ int dlg_gamma::add_drag_point(int x, int y)
BYTE dlg_gamma::calc_value(BYTE x) BYTE dlg_gamma::calc_value(BYTE x)
{ {
double y = .0f; 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); y += cur_->coefs[j] * calc::power(x, cur_->points.size() - j - 1);
if (y > 255.0f) if (y > 255.0f)
@ -320,7 +320,7 @@ BYTE dlg_gamma::calc_value(BYTE x)
if (y > cur_->points[upper].y) if (y > cur_->points[upper].y)
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) 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) 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 }; POINT pt = { *x, *y };
if (is_adjacent(pt, cur_->points[i])) if (is_adjacent(pt, cur_->points[i]))
@ -477,7 +477,7 @@ void dlg_gamma::on_paint(HDC hdc)
draw_current_curve(hdc); draw_current_curve(hdc);
SelectObject(hdc, drag); 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); draw_ellipse(hdc, cur_->points[i], 3, 3);
} }
@ -653,12 +653,12 @@ void dlg_gamma::get_gamma(SANE_Gamma* gamma)
//if (cur_ == &rgb_gray_) //if (cur_ == &rgb_gray_)
{ {
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; // 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].x = (SANE_Byte)cur_->points[i].x;
gamma->keypoint[i - 2].y = cur_->points[i].y; gamma->keypoint[i - 2].y = (SANE_Byte)cur_->points[i].y;
} }
for (int i = 0; i < 256; ++i) for (int i = 0; i < 256; ++i)
@ -669,31 +669,31 @@ void dlg_gamma::get_gamma(SANE_Gamma* gamma)
// gamma->pt_count = 0; // gamma->pt_count = 0;
cur_ = &red_; cur_ = &red_;
gamma->pt_count_r = cur_->points.size() - 2; gamma->pt_count_r = (SANE_Byte)(cur_->points.size() - 2);
for (int i = 2; i < cur_->points.size(); ++i) 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].x = (SANE_Byte)cur_->points[i].x;
gamma->keypoint_r[i - 2].y = cur_->points[i].y; gamma->keypoint_r[i - 2].y = (SANE_Byte)cur_->points[i].y;
} }
for (int i = 0; i < 256; ++i) for (int i = 0; i < 256; ++i)
gamma->table[i] = calc_value(i); gamma->table[i] = calc_value(i);
cur_ = &green_; cur_ = &green_;
gamma->pt_count_g = cur_->points.size() - 2; gamma->pt_count_g = (SANE_Byte)(cur_->points.size() - 2);
for (int i = 2; i < cur_->points.size(); ++i) 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].x = (SANE_Byte)cur_->points[i].x;
gamma->keypoint_g[i - 2].y = cur_->points[i].y; gamma->keypoint_g[i - 2].y = (SANE_Byte)cur_->points[i].y;
} }
for (int i = 0; i < 256; ++i) for (int i = 0; i < 256; ++i)
gamma->table[256 + i] = calc_value(i); gamma->table[256 + i] = calc_value(i);
cur_ = &blue_; cur_ = &blue_;
gamma->pt_count_b = cur_->points.size() - 2; gamma->pt_count_b = (SANE_Byte)(cur_->points.size() - 2);
for (int i = 2; i < cur_->points.size(); ++i) 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].x = (SANE_Byte)cur_->points[i].x;
gamma->keypoint_b[i - 2].y = cur_->points[i].y; gamma->keypoint_b[i - 2].y = (SANE_Byte)cur_->points[i].y;
} }
for (int i = 0; i < 256; ++i) for (int i = 0; i < 256; ++i)
gamma->table[512 + i] = calc_value(i); gamma->table[512 + i] = calc_value(i);

View File

@ -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); size->cx = get_string_width(limit);
create_label(sn, limit, x, y, *size); create_label(sn, limit, x, y, *size);
x += size->cx; x += size->cx;
size->cx = (upper - lower + step - 1) / step; size->cx = (LONG)((upper - lower + step - 1) / step + .5f);
size->cx += 100; size->cx += 100;
size->cx /= 200; size->cx /= 200;
size->cx *= 100; size->cx *= 100;
@ -370,16 +370,16 @@ HWND dlg_page::create_combox(int sn, int x, int y, std::vector<std::wstring>& va
int h = vals.size() * 2 * size->cy; int h = vals.size() * 2 * size->cy;
HWND wnd = NULL; 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())) if (size->cx < get_string_width(vals[i].c_str()))
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); 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); 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()); SendMessageW(wnd, CB_ADDSTRING, 0, (LPARAM)vals[i].c_str());
if (vals[i] == cur_val) 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); 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_); 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); 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); 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); 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); 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); dlg.set_area(x, y, w, h);
if (dlg.do_modal(parent_) == IDOK) 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)); std::string utf8(local_trans::u2a(buf, CP_UTF8));
ret = new char[len + 2]; ret = new char[len + 2];
if (utf8.length() > len) if ((int)utf8.length() > len)
utf8.erase(len); utf8.erase(len);
strcpy((char*)ret, utf8.c_str()); strcpy((char*)ret, utf8.c_str());
((char*)ret)[len] = 0; ((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 id = GetWindowLong(ctrl, GWL_ID);
int ind = 0; int ind = 0;
for (; ind < ctrls_.size(); ++ind) for (; ind < (int)ctrls_.size(); ++ind)
{ {
if (GetWindowLong(ctrls_[ind], GWL_ID) == id) if (GetWindowLong(ctrls_[ind], GWL_ID) == id)
break; break;
} }
for (; ind < ctrls_.size(); ++ind) for (; ind < (int)ctrls_.size(); ++ind)
{ {
if (GetWindowLong(ctrls_[ind], GWL_ID) != id) if (GetWindowLong(ctrls_[ind], GWL_ID) != id)
break; break;
@ -868,7 +868,7 @@ int dlg_page::find_control_ind(HWND wnd)
{ {
int ind = -1; int ind = -1;
for (int i = 0; i < ctrls_.size(); ++i) for (int i = 0; i < (int)ctrls_.size(); ++i)
{ {
if (ctrls_[i] == wnd) 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 (id == dlg_page::dyn_id_base + id_dpi_)
{ {
if (type == SANE_TYPE_FIXED) if (type == SANE_TYPE_FIXED)
dpi_ = SANE_UNFIX(*(SANE_Fixed*)val); dpi_ = (float)SANE_UNFIX(*(SANE_Fixed*)val);
else else
dpi_ = (float)(int)*(SANE_Int*)val; 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); SetPropW(wnd, dlg_page::property_size.c_str(), (HANDLE)desc->size);
if (desc->cap & SANE_CAP_INACTIVE) if (desc->cap & SANE_CAP_INACTIVE)
{ {
for (; pos < ctrls_.size(); ++pos) for (; pos < (int)ctrls_.size(); ++pos)
EnableWindow(ctrls_[pos], FALSE); EnableWindow(ctrls_[pos], FALSE);
} }
if (is_sane_opt(OPTION_TITLE_ZDYSMQY, desc->title)) 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)) else if (is_sane_opt(OPTION_TITLE_FBL, desc->title))
{ {
if (desc->type == SANE_TYPE_FIXED) if (desc->type == SANE_TYPE_FIXED)
dpi_ = SANE_UNFIX(*(SANE_Fixed*)cur_val); dpi_ = (float)SANE_UNFIX(*(SANE_Fixed*)cur_val);
else else
dpi_ = (float)(int)*(SANE_Int*)cur_val; dpi_ = (float)(int)*(SANE_Int*)cur_val;
id_dpi_ = sn; id_dpi_ = sn;
@ -1088,7 +1088,7 @@ bool dlg_page::refresh(int sn, const SANE_Option_Descriptor* desc, void* cur_val
int ind = 0; int ind = 0;
sn += dlg_page::dyn_id_base; sn += dlg_page::dyn_id_base;
for (; ind < ctrls_.size(); ++ind) for (; ind < (int)ctrls_.size(); ++ind)
{ {
if (GetWindowLong(ctrls_[ind], GWL_ID) == sn) 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; done_ = false;
for (; ind < ctrls_.size(); ++ind) for (; ind < (int)ctrls_.size(); ++ind)
{ {
if (GetWindowLong(ctrls_[ind], GWL_ID) != sn) if (GetWindowLong(ctrls_[ind], GWL_ID) != sn)
break; break;

View File

@ -1,7 +1,7 @@
// DlgIndicator.cpp: 实现文件 // DlgIndicator.cpp: 实现文件
// //
#include "mem_dc.h"" #include "mem_dc.h"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //

View File

@ -248,8 +248,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,1015,2022,7081 FILEVERSION 4,1018,2022,7181
PRODUCTVERSION 4,1015,2022,7081 PRODUCTVERSION 4,1018,2022,7181
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -266,12 +266,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "宁波华高信息科技有限公司" VALUE "CompanyName", "宁波华高信息科技有限公司"
VALUE "FileDescription", "华高扫描仪应用程序" VALUE "FileDescription", "华高扫描仪应用程序"
VALUE "FileVersion", "4.1015.2022.7081" VALUE "FileVersion", "4.1018.2022.7181"
VALUE "InternalName", "sane.dll" VALUE "InternalName", "sane.dll"
VALUE "LegalCopyright", "Copyright (C) 2022" VALUE "LegalCopyright", "Copyright (C) 2022"
VALUE "OriginalFilename", "sane.dll" VALUE "OriginalFilename", "sane.dll"
VALUE "ProductName", "HUAGOScan" VALUE "ProductName", "HUAGOScan"
VALUE "ProductVersion", "4.1015.2022.7081" VALUE "ProductVersion", "4.1018.2022.7181"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -185,7 +185,7 @@ void mapping_buf::set_buffer(unsigned char*& buf, unsigned long long off, unsign
{ {
buf = buf_ + (off - offset_); buf = buf_ + (off - offset_);
if (bytes) 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) 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 try
{ {
buf_ = new unsigned char[size]; buf_ = new unsigned char[(unsigned int)size];
is_mem_ = true; is_mem_ = true;
bytes_ = mapped_bytes_ = size; bytes_ = size;
mapped_bytes_ = (unsigned int)size;
} }
catch (...) catch (...)
{ {
@ -220,7 +221,7 @@ unsigned char* mapping_buf::buffer(unsigned long long off, unsigned int* bytes)
unsigned char* buf = NULL; unsigned char* buf = NULL;
if (size > bytes_ - offset_) if (size > bytes_ - offset_)
size = bytes_ - offset_; size = (unsigned int)(bytes_ - offset_);
if (buf_ && off >= offset_ && size + (off - offset_) <= mapped_bytes_) 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_); UnmapViewOfFile(buf_);
offset_ = off / map_unit_ * map_unit_; offset_ = off / map_unit_ * map_unit_;
mapped_bytes_ = bytes_ - offset_; mapped_bytes_ = (unsigned int)(bytes_ - offset_);
map(); map();
if (buf_) if (buf_)
set_buffer(buf, off, bytes); 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) 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); unsigned char* buf = mbuf->buffer(src_off, &len);
bool ret = false; bool ret = false;
@ -285,7 +286,7 @@ bool mapping_buf::save(unsigned long long off, mapping_buf* mbuf, unsigned long
ret = true; ret = true;
break; break;
} }
len = mbuf->bytes() - src_off; len = (unsigned int)(mbuf->bytes() - src_off);
buf = mbuf->buffer(src_off, &len); 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(); 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; unsigned char* dst = NULL;
bool ok = false; 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; int want_to_read = head_.bytes_per_line, rcv = 0, dif = line_bytes() - head_.bytes_per_line;
while (dst) 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); int ret = hg_sane_middleware::instance()->read(dev, dst + rcv, &r);
total += r; total += r;
if (ret != SANE_STATUS_GOOD) 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; 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; unsigned char* dst = NULL, *src = (unsigned char*)data;
bool ok = false; bool ok = false;
@ -452,7 +453,7 @@ scanned_img::scanned_img(SANE_Handle dev, SANE_Parameters head, void* data, unsi
line_l *= -1; line_l *= -1;
else else
off = data_->bytes() - line_l; off = data_->bytes() - line_l;
for (; row < head.lines; ++row) for (; row < (unsigned int)head.lines; ++row)
{ {
bytes = head.bytes_per_line; bytes = head.bytes_per_line;
if (!data_->save(src, &bytes, off)) 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.biPlanes = 1;
bih.biHeight = height(); bih.biHeight = height();
bih.biCompression = BI_RGB; 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) if (bih.biBitCount == 1)
pal_size = 2 * sizeof(int); pal_size = 2 * sizeof(int);
@ -532,7 +533,7 @@ void scanned_img::do_result(bool ok, twain_xfer xfer)
xfer == TWAIN_XFER_Memory) xfer == TWAIN_XFER_Memory)
{ {
// convert to black-white ... // 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(); size_t size = head.length();
mapping_buf* buf = new mapping_buf(); mapping_buf* buf = new mapping_buf();
std::wstring file(file_ + L".tmp"); std::wstring file(file_ + L".tmp");
@ -609,10 +610,10 @@ void scanned_img::swap_rgb(void)
dst = data_->buffer(off + cur, &len); dst = data_->buffer(off + cur, &len);
if (!dst) if (!dst)
break; break;
if (len > l) if (len > (unsigned int)l)
len = l; len = l;
len /= 3; len /= 3;
for (int pos = 0; pos < len; ++pos) for (int pos = 0; pos < (int)len; ++pos)
{ {
unsigned char uc = dst[pos * 3 + 0]; unsigned char uc = dst[pos * 3 + 0];
dst[pos * 3 + 0] = dst[pos * 3 + 2]; 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)) 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)) COM_API_IMPLEMENT(scanned_img, unsigned int, header_size(void))
{ {

View File

@ -188,7 +188,7 @@ int __stdcall scanner::to_int(SANE_Int v)
} }
float __stdcall scanner::to_float(SANE_Fixed 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) 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) else if (type == SANE_TYPE_FIXED)
{ {
*(float*)data = SANE_UNFIX(sf); *(float*)data = (float)SANE_UNFIX(sf);
} }
else if(buf) else if(buf)
{ {
@ -1383,7 +1383,7 @@ EX_OPTION_HANDLER_IMPL(final_format)
{ {
int now = ff.img_format, init = SANE_IMAGE_TYPE_BMP; int now = ff.img_format, init = SANE_IMAGE_TYPE_BMP;
std::vector<int> all(sane_opt_trans::support_image_types()); std::vector<int> 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; value_role role = VAL_ROLE_NONE;
ff.img_format = (SANE_ImageType)all[i]; 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); hg_sane_middleware::instance()->get_cur_value(handle_, sn, &cur);
if (sn == resolution_id_) if (sn == resolution_id_)
dpi_ = SANE_UNFIX(cur) + .5f; dpi_ = (int)(SANE_UNFIX(cur) + .5f);
do do
{ {
if (desc->constraint_type == SANE_CONSTRAINT_RANGE) 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); role = value_role(role | VAL_ROLE_CURRENT);
if (v[i + 1] == def) if (v[i + 1] == def)
role = value_role(role | VAL_ROLE_DEFAULT); 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)) if (!setval(&val, role, param))
break; break;
} }
} }
else else
set_cur_and_def_value<float>(val, SANE_UNFIX(*(SANE_Fixed*)init), setval, param); set_cur_and_def_value<float>(val, (float)SANE_UNFIX(*(SANE_Fixed*)init), setval, param);
} while (0); } while (0);
} }
else if (desc->type == SANE_TYPE_STRING) 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 (sn == resolution_id_)
{ {
if (desc->type == SANE_TYPE_FIXED) if (desc->type == SANE_TYPE_FIXED)
dpi_ = *(float*)val + .5f; dpi_ = (int)(*(float*)val + .5f);
else else
dpi_ = *(int*)val; dpi_ = *(int*)val;
} }

View File

@ -142,7 +142,7 @@ class scanner : public ISaneInvoker, virtual public refer
sv.push_back(l); sv.push_back(l);
sv.push_back(u); sv.push_back(u);
std::sort(sv.begin(), sv.end()); 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]) if (i && sv[i] == sv[i - 1])
continue; continue;

View File

@ -6,9 +6,9 @@
#define OEM_NONE #define OEM_NONE
#define VERSION_MAIN 4 #define VERSION_MAIN 4
#define VERSION_SUB 1015 #define VERSION_SUB 1018
#define VERSION_BUILD 2022 #define VERSION_BUILD 2022
#define VERSION_PATCH 7081 #define VERSION_PATCH 7181
#define TO_STR(a) #a #define TO_STR(a) #a
#define TO_VER_STR(vs) TO_STR(v##vs) #define TO_VER_STR(vs) TO_STR(v##vs)