]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change optimize config string termination
authorBastian Dehn <hhaalo@arcor.de>
Sat, 27 Sep 2025 10:18:42 +0000 (12:18 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 27 Sep 2025 10:18:42 +0000 (12:18 +0200)
src/kds_s2000w_config.c
src/kds_s2000w_handler.c

index 519fed2320204cc94c8239c0ff65955014ac46c5..dcf473ecf8ab48497daa72a181b23ee30d1dbb92 100644 (file)
 program_config* _kds_s2000w_config_init()
 {
        program_config* config = malloc(sizeof(program_config));
+
        config->scanner_url = malloc(sizeof(char));
        config->username = malloc(sizeof(char));
-       *config->scanner_url = 0;
-       *config->username = 0;
+       *config->scanner_url = '\0';
+       *config->username = '\0';
        config->log_level = 0;
        config->heartbeat = 1;
        config->ssl_verify = 0;
@@ -46,7 +47,7 @@ char* kds_s2000w_config_read(const char* filename)
 
        char* config_string = malloc(sizeof(char) * config_size + 1);
        fread(config_string, config_size, 1, config_file);
-       config_string[config_size] = 0;
+       config_string[config_size] = '\0';
 
        fclose(config_file);
        config_file = NULL;
index 25f4fe45afaf053b8358ac63daf9838527d9ef20..4d8c5c234e569deee50f3df14108128cc2eff352 100644 (file)
@@ -17,7 +17,7 @@ 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;
+       char* data = (char*) image->data;
        uint8_t header_spaces = 3;
 
        if (strncmp(data, "P4", 2) == 0)