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()); } }