From 1c779d9067d6ac0ff72d1d9e458443cddb6d5d39 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Fri, 9 Sep 2022 16:50:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E4=BC=A0?= =?UTF-8?q?=E8=BE=93=E6=A8=A1=E5=BC=8F=E6=97=B6=E4=B8=8D=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E4=BC=A0=E5=9B=BE=E5=A4=B1=E8=B4=A5=EF=BC=9B?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DBMP=E6=96=87=E4=BB=B6=E9=95=BF=E5=BA=A6?= =?UTF-8?q?=E6=9C=AA=E8=AE=A1=E5=85=A5=E8=B0=83=E8=89=B2=E6=9D=BF=E9=95=BF?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sane/scanned_img.cpp | 2 +- twain/twain/huagaods.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sane/scanned_img.cpp b/sane/scanned_img.cpp index 7cd6d3f..8a11140 100644 --- a/sane/scanned_img.cpp +++ b/sane/scanned_img.cpp @@ -498,7 +498,7 @@ std::string scanned_img::file_header(SANE_ImageType type, float resolution, twai { BITMAPFILEHEADER fh = { 0 }; fh.bfType = MAKEWORD('B', 'M'); - fh.bfSize = sizeof(fh) + bih.biSizeImage + sizeof(bih); + fh.bfSize = sizeof(fh) + bih.biSizeImage + sizeof(bih) + pal_size; fh.bfOffBits = sizeof(fh) + sizeof(bih) + pal_size; h = std::string((char*)&fh, sizeof(fh)); diff --git a/twain/twain/huagaods.cpp b/twain/twain/huagaods.cpp index 9d957c6..4ca5539 100644 --- a/twain/twain/huagaods.cpp +++ b/twain/twain/huagaods.cpp @@ -1110,7 +1110,7 @@ Twpp::Result huagao_ds::pendingXfersStopFeeder(const Identity& origin, PendingXf Twpp::Result huagao_ds::imageFileXferGet(const Twpp::Identity& origin) { // assume that the file format has set before start-scanning, so we write-down the image content to file directly here ... - if (!scanner_.get() || scanner_->get_scanned_images() == 0) + if (!scanner_.get() || scanner_->get_scanned_images(-1) == 0) return seqError(); IScanImg *img = scanner_->take_first_image(TWAIN_XFER_File); @@ -1177,7 +1177,7 @@ Twpp::Result huagao_ds::imageFileXferGet(const Twpp::Identity& origin) conv.dst.data_len = target.length(); MoveFileA(target.c_str(), file.c_str()); if(scanner_->convert_image(&conv) != SCANNER_ERR_OK) - ret = { ReturnCode::Failure, ConditionCode::FileWriteError }; + ret = { ReturnCode::Failure, ConditionCode::OperationError }; DeleteFileA(file.c_str()); } }