From: Bastian Dehn Date: Fri, 17 May 2024 20:23:43 +0000 (+0200) Subject: refactor overread header bytes X-Git-Tag: v1.0.3^2~10 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=bafbc790a3e9bcb2159b9a5f22d010a77036d0dd;p=sane-kds-s2000w-net.git refactor overread header bytes --- 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);