From bafbc790a3e9bcb2159b9a5f22d010a77036d0dd Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Fri, 17 May 2024 22:23:43 +0200 Subject: [PATCH] refactor overread header bytes --- src/kds_s2000w_net.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/kds_s2000w_net.c b/src/kds_s2000w_net.c index 7d380b6..e1ec5b0 100644 --- a/src/kds_s2000w_net.c +++ b/src/kds_s2000w_net.c @@ -234,11 +234,8 @@ SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data, maxlen = h->pnm_image->size - h->read_info->read_size; // read image - if (h->pnm_image->data != NULL) { - int skip_header_bytes = _sane_kds_s2000w_net_find_first_data_byte(h->pnm_image->data); - if (h->read_info->read_size <= 0) - h->read_info->read_size += skip_header_bytes; - } + if (h->pnm_image->data != NULL && h->read_info->read_size <= 0) + h->read_info->read_size += _sane_kds_s2000w_net_find_first_data_byte(h->pnm_image->data); *length = maxlen; memcpy(data, h->pnm_image->data + h->read_info->read_size, *length); -- 2.39.5