]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
refactor overread header bytes
authorBastian Dehn <hhaalo@arcor.de>
Fri, 17 May 2024 20:23:43 +0000 (22:23 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 17 May 2024 20:23:43 +0000 (22:23 +0200)
src/kds_s2000w_net.c

index 7d380b6ad527a6f2423f5eff07915744d83c300a..e1ec5b085c88a44bea59547319f9d0fd0084fa22 100644 (file)
@@ -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);