]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add header write bytes
authorBastian Dehn <hhaalo@arcor.de>
Sat, 10 Feb 2024 13:44:48 +0000 (14:44 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 10 Feb 2024 13:49:12 +0000 (14:49 +0100)
tools/convert.c

index a6d41a1783e2e1a339904c762c1842d459637a08..82fc05eb7424d367c9ec319b5b65c3c5e6849e4d 100644 (file)
@@ -32,6 +32,25 @@ void write_file(blobdata* output)
        fptr = NULL;
 }
 
+void printf_header_bytes(const char* data)
+{
+       const int header_spaces = 3;
+       const char space = 0x0a;
+       int space_count = 0;
+       int byte_count = 0;
+
+       while(space_count < header_spaces && byte_count < 50) {
+               printf("%02hhx ", data[byte_count]);
+               if (data[byte_count] == space) {
+                       space_count++;
+               }
+
+               byte_count++;
+       }
+
+       printf("\nheader has %i bytes\n", byte_count);
+}
+
 int main(int argc, char* argv[])
 {
        blobdata input;
@@ -47,6 +66,7 @@ int main(int argc, char* argv[])
        kds_s2000w_convert_jpg_to_pnm_With_depth(&input, &output, 8);
        kds_s2000w_convert_terminate();
 
+       printf_header_bytes((const char*) output.data);
        write_file(&output);
 
        free(input.data);