diff --git a/libconfig/config_add_property.c b/libconfig/config_add_property.c index 103e9d2..3f31255 100644 --- a/libconfig/config_add_property.c +++ b/libconfig/config_add_property.c @@ -9,16 +9,16 @@ #include "libconfig.h" -int config_add_property(char* configuration, char* name, char* property) +int config_add_property(int8_t* configuration, char* name, char* property) { - int index = strlen(configuration); + int index = strlen((char*)configuration); if (index > 0) { configuration[index] = '\n'; index++; } - sprintf(configuration + index, + sprintf((char*)configuration + index, "%s %s", name, property); return index; diff --git a/libconfig/config_find_entry.c b/libconfig/config_find_entry.c index d848df1..62dd809 100644 --- a/libconfig/config_find_entry.c +++ b/libconfig/config_find_entry.c @@ -9,7 +9,7 @@ #include "libconfig.h" -int config_find_entry(char *configuration, char *name, char *property) +int config_find_entry(int8_t *configuration, char *name, char *property) { int index = 0; int last_index; diff --git a/libconfig/config_find_indexed_property.c b/libconfig/config_find_indexed_property.c index c4a8938..362e274 100644 --- a/libconfig/config_find_indexed_property.c +++ b/libconfig/config_find_indexed_property.c @@ -9,7 +9,7 @@ #include "libconfig.h" -int config_find_indexed_property(char *configuration, char *index_name, char *index_property, char *name, char *property) +int config_find_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property) { int index; int last_index; diff --git a/libconfig/config_get_indexed_property.c b/libconfig/config_get_indexed_property.c index 5bafc05..b6a6333 100644 --- a/libconfig/config_get_indexed_property.c +++ b/libconfig/config_get_indexed_property.c @@ -9,7 +9,7 @@ #include "libconfig.h" -int config_get_indexed_property(char *configuration, char *index_name, char *index_property, char *name, char *property) +int config_get_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property) { int index ; diff --git a/libconfig/config_get_next_property.c b/libconfig/config_get_next_property.c index fd5eeff..f42bac4 100644 --- a/libconfig/config_get_next_property.c +++ b/libconfig/config_get_next_property.c @@ -38,7 +38,7 @@ char *config_read_word(char *line, char **next) return word; } -int config_get_next_property(char *configuration, int index, char *name, char *property) +int config_get_next_property(int8_t *configuration, int index, char *name, char *property) { char *next_word, *next_line; char *current_name, *current_property; diff --git a/libconfig/config_get_property.c b/libconfig/config_get_property.c index dd22f95..16489ff 100644 --- a/libconfig/config_get_property.c +++ b/libconfig/config_get_property.c @@ -8,7 +8,7 @@ #include "libconfig.h" -int config_get_property(char *configuration, char *name, char *property) +int config_get_property(int8_t *configuration, char *name, char *property) { return config_get_indexed_property(configuration, NULL, NULL, name, property); } diff --git a/libconfig/config_remove_indexed_property.c b/libconfig/config_remove_indexed_property.c index 83aba50..2a613e9 100644 --- a/libconfig/config_remove_indexed_property.c +++ b/libconfig/config_remove_indexed_property.c @@ -9,7 +9,7 @@ #include "libconfig.h" -int config_remove_indexed_property(char *configuration, char *index_name, +int config_remove_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name) { int last_index; @@ -24,7 +24,7 @@ int config_remove_indexed_property(char *configuration, char *index_name, last_index, NULL, NULL); if (index != -1) { - len = strlen(configuration + index); + len = strlen((char*)configuration + index); memmove(configuration + last_index, configuration + index, len); } diff --git a/libconfig/config_remove_property.c b/libconfig/config_remove_property.c index 8001cbd..3a66cb4 100644 --- a/libconfig/config_remove_property.c +++ b/libconfig/config_remove_property.c @@ -9,7 +9,7 @@ #include "libconfig.h" -int config_remove_property(char *configuration, char *name) +int config_remove_property(int8_t *configuration, char *name) { return config_remove_indexed_property(configuration, name, NULL, NULL); } diff --git a/libconfig/config_set_indexed_property.c b/libconfig/config_set_indexed_property.c index 0c77ff0..19b7536 100644 --- a/libconfig/config_set_indexed_property.c +++ b/libconfig/config_set_indexed_property.c @@ -9,7 +9,7 @@ #include "libconfig.h" -int config_set_indexed_property(char *configuration, +int config_set_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property) { @@ -36,7 +36,7 @@ int config_set_indexed_property(char *configuration, { /* no, we add this property at the end */ - last_index = strlen(configuration); + last_index = strlen((char*)configuration); if (last_index > 0) last_index++; /* to insert a '\n' */ index = last_index; @@ -50,7 +50,7 @@ int config_set_indexed_property(char *configuration, last_index = config_find_entry(configuration + last_index, index_name, NULL); if (last_index == -1) { - last_index = strlen(configuration); + last_index = strlen((char*)configuration); if (last_index > 0) last_index++; /* to insert a '\n' */ } @@ -61,22 +61,22 @@ int config_set_indexed_property(char *configuration, { index = config_get_next_property(configuration, last_index, NULL, NULL); if (index == -1) - index = strlen(configuration); + index = strlen((char*)configuration); } - len = strlen(configuration + index); + len = strlen((char*)configuration + index); memmove(configuration + last_index + len_new, configuration + index, len); if (last_index > 0) configuration[last_index - 1] = '\n'; - sprintf(configuration + last_index, + sprintf((char*)configuration + last_index, "%s %s", name, property); configuration[last_index + len_new - 1] = '\n'; /* remove ending '\n' */ - len = strlen(configuration + last_index); + len = strlen((char*)configuration + last_index); if (configuration[last_index + len - 1] == '\n') len--; configuration[last_index + len] = 0; diff --git a/libconfig/config_set_property.c b/libconfig/config_set_property.c index b27632f..efd24ef 100644 --- a/libconfig/config_set_property.c +++ b/libconfig/config_set_property.c @@ -9,7 +9,7 @@ #include "libconfig.h" -int config_set_property(char *configuration, char *name, char *property) +int config_set_property(int8_t *configuration, char *name, char *property) { return config_set_indexed_property(configuration, NULL, NULL, name, property); diff --git a/libconfig/libconfig.h b/libconfig/libconfig.h index 6355560..fa2a58f 100644 --- a/libconfig/libconfig.h +++ b/libconfig/libconfig.h @@ -4,14 +4,16 @@ * */ +#include + extern char *config_read_word(char *line, char **next); -extern int config_get_next_property(char *configuration, int index, char *name, char *property); -extern int config_get_indexed_property(char *configuration, char *index_name, char *index_property, char *name, char *property); -extern int config_get_property(char *configuration, char *name, char *property); -extern int config_remove_property(char *configuration, char *name); -extern int config_set_property(char *configuration, char *name, char *property); -extern int config_set_indexed_property(char *configuration, char *index_name, char *index_property, char *name, char *property); -extern int config_remove_indexed_property(char *configuration, char *index_name, char *index_property, char *name); -extern int config_find_indexed_property(char *configuration, char *index_name, char *index_property, char *name, char *property); -extern int config_find_entry(char *configuration, char *name, char *property); -extern int config_add_property(char* configuration, char* name, char* property); +extern int config_get_next_property(int8_t *configuration, int index, char *name, char *property); +extern int config_get_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property); +extern int config_get_property(int8_t *configuration, char *name, char *property); +extern int config_remove_property(int8_t *configuration, char *name); +extern int config_set_property(int8_t *configuration, char *name, char *property); +extern int config_set_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property); +extern int config_remove_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name); +extern int config_find_indexed_property(int8_t *configuration, char *index_name, char *index_property, char *name, char *property); +extern int config_find_entry(int8_t *configuration, char *name, char *property); +extern int config_add_property(int8_t* configuration, char* name, char* property); diff --git a/libemile/emile_second_get_configuration.c b/libemile/emile_second_get_configuration.c index 8914d18..f88e970 100644 --- a/libemile/emile_second_get_configuration.c +++ b/libemile/emile_second_get_configuration.c @@ -12,9 +12,9 @@ #include "libemile.h" #include "emile.h" -char* emile_second_get_configuration(int fd) +int8_t* emile_second_get_configuration(int fd) { - char *conf = NULL; + int8_t *conf = NULL; emile_l2_header_t header; int ret; int size; @@ -35,7 +35,7 @@ char* emile_second_get_configuration(int fd) goto exit; size = read_short(&header.conf_size); - conf = (char*)malloc(size); + conf = (int8_t*)malloc(size); if (conf == NULL) goto exit; diff --git a/libemile/emile_second_get_param.c b/libemile/emile_second_get_param.c index df072a2..8826d12 100644 --- a/libemile/emile_second_get_param.c +++ b/libemile/emile_second_get_param.c @@ -15,7 +15,7 @@ int emile_second_get_param(int fd, char *kernel, char *parameters, char *initrd) { int ret; int drive, second, size; - char *configuration; + int8_t *configuration; /* can work on an image or directly on second level file */ diff --git a/libemile/emile_second_set_configuration.c b/libemile/emile_second_set_configuration.c index ddb5f4d..9218570 100644 --- a/libemile/emile_second_set_configuration.c +++ b/libemile/emile_second_set_configuration.c @@ -14,7 +14,7 @@ #include "emile.h" #include "bootblock.h" -int emile_second_set_configuration(int fd, char *configuration) +int emile_second_set_configuration(int fd, int8_t *configuration) { emile_l2_header_t header; int ret; @@ -25,7 +25,7 @@ int emile_second_set_configuration(int fd, char *configuration) if (configuration == NULL) return EEMILE_CANNOT_READ_SECOND; - len = strlen (configuration) + 1; /* + 1 for ending 0 */ + len = strlen ((char*)configuration) + 1; /* + 1 for ending 0 */ memset(&header, 0, sizeof(header)); diff --git a/libemile/emile_second_set_param.c b/libemile/emile_second_set_param.c index 8c692af..75ddf22 100644 --- a/libemile/emile_second_set_param.c +++ b/libemile/emile_second_set_param.c @@ -14,7 +14,7 @@ int emile_second_set_param(int fd, char *kernel, char *parameters, char *initrd) { int ret; - char *configuration; + int8_t *configuration; off_t offset; offset = lseek(fd, 0, SEEK_CUR); diff --git a/libemile/libemile.h b/libemile/libemile.h index dc9e888..eced52d 100644 --- a/libemile/libemile.h +++ b/libemile/libemile.h @@ -135,12 +135,12 @@ extern int emile_map_set_bootinfo(emile_map_t *map, int bootstart, int bootsize, extern int emile_map_set_driver_info(emile_map_t *map, int number, int block, int size, int type); extern int emile_map_set_driver_number(emile_map_t *map, int number); extern int emile_block0_write(emile_map_t *map); -extern char* emile_second_get_configuration(int fd); -extern int emile_second_set_configuration(int fd, char *configuration); -extern int emile_second_get_next_property(char *configuration, int index, char *name, char *property); -extern int emile_second_get_property(char *configuration, char *name, char *property); -extern void emile_second_set_property(char *configuration, char *name, char *property); -extern void emile_second_remove_property(char *configuration, char *name); +extern int8_t* emile_second_get_configuration(int fd); +extern int emile_second_set_configuration(int fd, int8_t *configuration); +extern int emile_second_get_next_property(int8_t *configuration, int index, char *name, char *property); +extern int emile_second_get_property(int8_t *configuration, char *name, char *property); +extern void emile_second_set_property(int8_t *configuration, char *name, char *property); +extern void emile_second_remove_property(int8_t *configuration, char *name); extern int emile_second_set_param(int fd, char *kernel, char *parameters, char *initrd); extern int emile_second_get_param(int fd, char *kernel, char *parameters, char *initrd); extern unsigned long emile_map_get_driver_signature(emile_map_t* map); diff --git a/tools/emile-install.c b/tools/emile-install.c index f1a78a8..8245ac2 100644 --- a/tools/emile-install.c +++ b/tools/emile-install.c @@ -65,7 +65,7 @@ static int get_info(char *image, int verbose) int drive_num; int second_offset; int second_size; - char * configuration; + int8_t * configuration; char property[1024]; char title[1024]; int index; @@ -192,7 +192,7 @@ static int set_config(char *image, int verbose, char *config_path, char* kernel_image = NULL; char* ramdisk = NULL; emile_config* config; - char *configuration; + int8_t *configuration; int timeout; int gestaltid; int default_entry; @@ -332,7 +332,7 @@ static int set_config(char *image, int verbose, char *config_path, if (kernel_ondisk != NULL) free(kernel_ondisk); - if (strlen(configuration) > 1023) + if (strlen((char*)configuration) > 1023) { int tmpfd; char *conf; @@ -342,7 +342,7 @@ static int set_config(char *image, int verbose, char *config_path, " will store it at end of floppy\n"); tmpfd = mkstemp(tmpfile); - write(tmpfd, configuration, strlen(configuration) + 1); + write(tmpfd, configuration, strlen((char*)configuration) + 1); close(tmpfd); conf = emile_floppy_add(fd, tmpfile); diff --git a/tools/emile-set-output.c b/tools/emile-set-output.c index 52617d9..5ff9637 100644 --- a/tools/emile-set-output.c +++ b/tools/emile-set-output.c @@ -88,7 +88,7 @@ static void usage(int argc, char** argv) static int display_output(char* image) { int drive, second, size; - char *configuration; + int8_t *configuration; char property[256]; int fd; @@ -162,7 +162,7 @@ static int set_output(char* image, int drive, second, size; int fd; int ret; - char *configuration; + int8_t *configuration; char property[32]; int offset; diff --git a/tools/emile.c b/tools/emile.c index 391eda4..42704a5 100644 --- a/tools/emile.c +++ b/tools/emile.c @@ -346,7 +346,7 @@ static char *get_map_name(char *filename) } -static int add_file(char *configuration, +static int add_file(int8_t *configuration, char *index, char *property, char *path, char *map_path) { struct emile_container *container; @@ -407,7 +407,7 @@ static int add_file(char *configuration, return 0; } -static char *set_config(emile_config *config, int drive) +static int8_t *set_config(emile_config *config, int drive) { int default_entry; int gestaltid; @@ -420,7 +420,7 @@ static char *set_config(emile_config *config, int drive) char *title; char buf[16]; int ret; - char *configuration; + int8_t *configuration; configuration = malloc(65536); if (configuration == NULL) @@ -518,7 +518,7 @@ static char *set_config(emile_config *config, int drive) } } while (!emile_config_read_next(config)); - if (strlen(configuration) > 1023) + if (strlen((char*)configuration) > 1023) { int fd; char* bootconfig = "/boot/emile/.bootconfig"; @@ -535,7 +535,7 @@ static char *set_config(emile_config *config, int drive) } - write(fd, configuration, strlen(configuration) + 1); + write(fd, configuration, strlen((char*)configuration) + 1); close(fd); free(configuration); @@ -572,7 +572,7 @@ int main(int argc, char **argv) emile_config *config; int drive, second, size; int fd; - char *configuration; + int8_t *configuration; while(1) {