From: Bastian Dehn Date: Sat, 10 Feb 2024 10:45:35 +0000 (+0100) Subject: Revert "read color three bytes blocks" X-Git-Tag: v1.0.0^2~313 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=784b90a8a1ab8ec9b5f892ec6a879cc7ff628ed9;p=sane-kds-s2000w-net.git Revert "read color three bytes blocks" This reverts commit e0596b0af6ff0d75391c4249911cee617931374d. --- diff --git a/src/kds_s2000w_net.c b/src/kds_s2000w_net.c index ff781e0..53fbd41 100644 --- a/src/kds_s2000w_net.c +++ b/src/kds_s2000w_net.c @@ -31,14 +31,6 @@ int _sane_kds_s2000w_net_find_first_data_byte(const char* data) return byte_count; } -int _sane_kds_s2000w_net_get_max_length(int max_length) { - while (max_length % 3 != 0) { - max_length--; - } - - return max_length; -} - SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback authorize) { *version_code = SANE_VERSION_CODE(1, 0, 0); @@ -257,7 +249,7 @@ SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data, read_size += skip_header_bytes; } - if (readed_lines >= current_metadata.lines) { + if (readed_lines >= current_metadata.lines ) { printf("Image is loaded\n"); read_size = 0; *length = 0; @@ -276,6 +268,7 @@ SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data, return SANE_STATUS_CANCELLED; } + int maxlen = 0; if (current_metadata.bytes_per_line < max_length) { maxlen = current_metadata.bytes_per_line - readed_bytes_per_line; @@ -283,9 +276,6 @@ SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data, maxlen = max_length - readed_bytes_per_line; } - if (current_metadata.format == 1) - maxlen = _sane_kds_s2000w_net_get_max_length(maxlen); - *length = maxlen; memcpy(data, current_metadata.image + skip_header_bytes + read_size, *length);