]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change find header with for loop
authorBastian Dehn <hhaalo@arcor.de>
Mon, 30 Dec 2024 10:31:52 +0000 (11:31 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 30 Dec 2024 10:31:52 +0000 (11:31 +0100)
src/kds_s2000w_net.c

index fd46d79c288b7bb8e38e14f2a7ad64b13d522ec1..b8a89acfc0d1b5f989156acfae9391b51b34edbc 100644 (file)
@@ -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;
 }