修复文件传输模式时不等待导致传图失败;修复BMP文件长度未计入调色板长度

This commit is contained in:
gb 2022-09-09 16:50:32 +08:00
parent 09916baf44
commit 1c779d9067
2 changed files with 3 additions and 3 deletions

View File

@ -498,7 +498,7 @@ std::string scanned_img::file_header(SANE_ImageType type, float resolution, twai
{ {
BITMAPFILEHEADER fh = { 0 }; BITMAPFILEHEADER fh = { 0 };
fh.bfType = MAKEWORD('B', 'M'); 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; fh.bfOffBits = sizeof(fh) + sizeof(bih) + pal_size;
h = std::string((char*)&fh, sizeof(fh)); h = std::string((char*)&fh, sizeof(fh));

View File

@ -1110,7 +1110,7 @@ Twpp::Result huagao_ds::pendingXfersStopFeeder(const Identity& origin, PendingXf
Twpp::Result huagao_ds::imageFileXferGet(const Twpp::Identity& origin) 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 ... // 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(); return seqError();
IScanImg *img = scanner_->take_first_image(TWAIN_XFER_File); 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(); conv.dst.data_len = target.length();
MoveFileA(target.c_str(), file.c_str()); MoveFileA(target.c_str(), file.c_str());
if(scanner_->convert_image(&conv) != SCANNER_ERR_OK) if(scanner_->convert_image(&conv) != SCANNER_ERR_OK)
ret = { ReturnCode::Failure, ConditionCode::FileWriteError }; ret = { ReturnCode::Failure, ConditionCode::OperationError };
DeleteFileA(file.c_str()); DeleteFileA(file.c_str());
} }
} }