]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
finish with eof
authorBastian Dehn <hhaalo@arcor.de>
Tue, 6 Feb 2024 20:59:21 +0000 (21:59 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 6 Feb 2024 20:59:21 +0000 (21:59 +0100)
src/kds_s2000w_net.c

index 6ab2e1a6d11588d0e03801d0b4ea1ed2fedd50ef..eaca9026bf5c468cee1ff1c93382a9653de5eccb 100644 (file)
@@ -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;
 }