]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change handler with stdint
authorBastian Dehn <hhaalo@arcor.de>
Sat, 8 Feb 2025 18:45:21 +0000 (19:45 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 8 Feb 2025 18:45:21 +0000 (19:45 +0100)
src/kds_s2000w_handler.c
src/kds_s2000w_handler.h

index 83ede1ce95044ccfaf36d3f6e12b534876e6f0d3..5c882e1368baeeb56f71ad7013322541276cdfdf 100644 (file)
@@ -9,18 +9,18 @@
 
 #define SPACE 0x0a
 
-int _kds_s2000w_handler_find_first_data_byte(imagedata* image)
+uint32_t _kds_s2000w_handler_find_first_data_byte(imagedata* image)
 {
        kds_s2000w_debug_printf(ALL, "sane_kds_s2000w_net_find_first_data_byte");
 
        char* data = image->data;
-       int header_spaces = 3;
+       uint8_t header_spaces = 3;
 
        if (strncmp(data, "P4", 2) == 0)
                header_spaces = 2;
 
-       int space_count = 0;
-       int byte_count = 0;
+       uint32_t space_count = 0;
+       uint32_t byte_count = 0;
        for (byte_count = 0; byte_count < image->size; byte_count++) {
                if (data[byte_count] == SPACE)
                        space_count++;
@@ -113,8 +113,8 @@ void kds_s2000w_handler_open(const char* devicename, void** handle)
 
        // status code 408 waking up repeat open session
        response* resp = NULL;
-       int result = 0;
-       for (int i = 0; i < 30; i++) {
+       uint8_t result = 0;
+       for (uint32_t i = 0; i < 30; i++) {
                kds_s2000w_client_response_free(resp);
                resp = NULL;
                resp = kds_s2000w_client_response_init();
@@ -268,7 +268,7 @@ void kds_s2000w_handler_get_current_metadata(handler* h, metadata* params)
 
        blobdata* image = (blobdata*) h->image;
        blobdata* scanner_image = malloc(sizeof(blobdata));
-       int channels = 1;
+       uint8_t channels = 1;
 
        scanner_image->data = malloc(sizeof(char) *  image->size);
        scanner_image->size = image->size;
index e8657d94aa78c1fa171adc8cd065fa15eded3c7a..ab4105d74ae254abb5ae29fde78b2a9456c2558b 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef KDS_S2000W_HANDLER_H
 #define KDS_S2000W_HANDLER_H
+#include <stdint.h>
 #include <json-c/json.h>
 
 enum {
@@ -19,31 +20,31 @@ typedef struct {
 } imagedata;
 
 typedef struct {
-       int format;
-       int last_frame;
-       int bytes_per_line;
-       int pixels_per_line;
-       int lines;
-       int depth;
+       uint32_t format;
+       uint32_t last_frame;
+       uint32_t bytes_per_line;
+       uint32_t pixels_per_line;
+       uint32_t lines;
+       uint32_t depth;
 } metadata;
 
 typedef struct {
-       int current_image_number;
-       int available_images;
-       int downloaded_images;
-       int complete_scanned;
-       int feeder;
+       uint8_t current_image_number;
+       uint8_t available_images;
+       uint8_t downloaded_images;
+       uint8_t complete_scanned;
+       uint8_t feeder;
 } scanstatus;
 
 typedef struct {
-       int scan_started;
-       int cancel;
-       int read_size;
+       uint8_t scan_started;
+       uint8_t cancel;
+       uint64_t read_size;
 } readinfo;
 
 typedef struct {
-       long sessionid;
-       int state;
+       uint64_t sessionid;
+       uint8_t state;
        json_object* current_scanner_config;
        scanstatus* current_scan_status;
        readinfo* read_info;