installer: Fix lots of constify issues

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
Michael Tremer
2024-04-05 12:59:33 +00:00
committed by Arne Fitzenreiter
parent eb3ede284b
commit 16640487b0
3 changed files with 10 additions and 10 deletions

View File

@@ -285,7 +285,7 @@ struct hw_disk** hw_find_disks(struct hw* hw, const char* sourcedrive) {
struct hw_disk** disks = ret;
// Determine the disk device of source if it is a partition
char* sourcedisk = NULL;
const char* sourcedisk = NULL;
char syssource[PATH_MAX];
(void)snprintf(syssource, sizeof(syssource) - 1, "/sys/class/block/%s", sourcedrive + 5);
struct udev_device* s_dev = udev_device_new_from_syspath(hw->udev, syssource);
@@ -424,7 +424,7 @@ void hw_free_disks(struct hw_disk** disks) {
free(disks);
}
unsigned int hw_count_disks(const struct hw_disk** disks) {
unsigned int hw_count_disks(struct hw_disk** disks) {
unsigned int ret = 0;
while (*disks++)
@@ -437,7 +437,7 @@ struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection) {
struct hw_disk** ret = hw_create_disks();
struct hw_disk** selected_disks = ret;
unsigned int num_disks = hw_count_disks((const struct hw_disk**)disks);
unsigned int num_disks = hw_count_disks(disks);
for (unsigned int i = 0; i < num_disks; i++) {
if (!selection || selection[i]) {
@@ -454,7 +454,7 @@ struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection) {
return ret;
}
struct hw_disk** hw_select_first_disk(const struct hw_disk** disks) {
struct hw_disk** hw_select_first_disk(struct hw_disk** disks) {
struct hw_disk** ret = hw_create_disks();
struct hw_disk** selected_disks = ret;

View File

@@ -136,9 +136,9 @@ char* hw_find_source_medium(struct hw* hw);
struct hw_disk** hw_find_disks(struct hw* hw, const char* sourcedrive);
void hw_free_disks(struct hw_disk** disks);
unsigned int hw_count_disks(const struct hw_disk** disks);
unsigned int hw_count_disks(struct hw_disk** disks);
struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection);
struct hw_disk** hw_select_first_disk(const struct hw_disk** disks);
struct hw_disk** hw_select_first_disk(struct hw_disk** disks);
struct hw_destination* hw_make_destination(struct hw* hw, int part_type, struct hw_disk** disks,
int disable_swap, int filesystem);

View File

@@ -192,11 +192,11 @@ static int newtLicenseBox(const char* title, const char* text, int width, int he
return ret;
}
int write_lang_configs(char* lang) {
int write_lang_configs(const char* lang) {
struct keyvalue *kv = initkeyvalues();
/* default stuff for main/settings. */
replacekeyvalue(kv, "LANGUAGE", lang);
replacekeyvalue(kv, "LANGUAGE", (char*)lang);
replacekeyvalue(kv, "HOSTNAME", DISTRO_SNAME);
replacekeyvalue(kv, "THEME", "ipfire");
writekeyvalues(kv, "/harddisk" CONFIG_ROOT "/main/settings");
@@ -279,7 +279,7 @@ static struct config {
int disable_swap;
char download_url[STRING_SIZE];
char postinstall[STRING_SIZE];
char* language;
const char* language;
} config = {
.unattended = 0,
.serial_console = 0,
@@ -606,7 +606,7 @@ int main(int argc, char *argv[]) {
// or if we are running in unattended mode, we will select
// the first disk and go with that one
} else if ((num_disks == 1) || (config.unattended && num_disks >= 1)) {
selected_disks = hw_select_first_disk((const struct hw_disk**)disks);
selected_disks = hw_select_first_disk(disks);
// more than one usable disk has been found and
// the user needs to choose what to do with them