From: Bastian Dehn Date: Mon, 30 Dec 2024 10:31:52 +0000 (+0100) Subject: change find header with for loop X-Git-Tag: v1.0.19^2~1 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=01486bf4a4864efdd964b167cd72b15fb0456485;p=sane-kds-s2000w-net.git change find header with for loop --- diff --git a/src/kds_s2000w_net.c b/src/kds_s2000w_net.c index fd46d79..b8a89ac 100644 --- a/src/kds_s2000w_net.c +++ b/src/kds_s2000w_net.c @@ -23,14 +23,15 @@ int _sane_kds_s2000w_net_find_first_data_byte(imagedata* image) int space_count = 0; int byte_count = 0; - - while(space_count < header_spaces && byte_count < image->size) { + for (byte_count = 0; byte_count < image->size; byte_count++) { if (data[byte_count] == SPACE) space_count++; - byte_count++; + if (space_count >= header_spaces) + break; } + byte_count++; return byte_count; }