From: Bastian Dehn Date: Tue, 6 Feb 2024 20:59:21 +0000 (+0100) Subject: finish with eof X-Git-Tag: v1.0.0^2~325 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=16348c4c7a7e774673368560bc9760d5e826d159;p=sane-kds-s2000w-net.git finish with eof --- diff --git a/src/kds_s2000w_net.c b/src/kds_s2000w_net.c index 6ab2e1a..eaca902 100644 --- a/src/kds_s2000w_net.c +++ b/src/kds_s2000w_net.c @@ -221,14 +221,8 @@ SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data, if (current_metadata.scanned_all_complete && !cancel) { printf("scan is finished\n"); read_size = 0; - _sane_kds_s2000w_net_cancel(NULL); - return SANE_STATUS_GOOD; - } - - if (read_size >= current_metadata.size) { - printf("Image is loaded\n"); - read_size = 0; *length = 0; + _sane_kds_s2000w_net_cancel(NULL); return SANE_STATUS_EOF; } @@ -256,6 +250,13 @@ SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data, printf("length: %i\n", *length); printf("read size: %i\n", read_size); + if (read_size >= current_metadata.size) { + printf("Image is loaded\n"); + read_size = 0; + *length = 0; + return SANE_STATUS_EOF; + } + return SANE_STATUS_GOOD; }