From 7b60c3d1620b9cda93ee2cbf54b935b24b8abd5a Mon Sep 17 00:00:00 2001 From: CTCaer Date: Fri, 4 Oct 2024 22:09:06 +0300 Subject: [PATCH] hekate/nyx: constify more args --- bootloader/hos/fss.c | 2 +- bootloader/hos/pkg2.c | 2 +- bootloader/hos/pkg2.h | 2 +- bootloader/hos/pkg2_ini_kippatch.c | 8 ++++---- bootloader/hos/pkg2_ini_kippatch.h | 2 +- bootloader/l4t/l4t.c | 2 +- bootloader/main.c | 2 +- nyx/nyx_gui/frontend/fe_emmc_tools.c | 4 ++-- nyx/nyx_gui/frontend/fe_emummc_tools.c | 2 +- nyx/nyx_gui/frontend/gui_tools_partition_manager.c | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bootloader/hos/fss.c b/bootloader/hos/fss.c index 6bb66f0..42e6312 100644 --- a/bootloader/hos/fss.c +++ b/bootloader/hos/fss.c @@ -31,7 +31,7 @@ extern hekate_config h_cfg; -extern bool is_ipl_updated(void *buf, char *path, bool force); +extern bool is_ipl_updated(void *buf, const char *path, bool force); // FSS0 Magic and Meta header offset. #define FSS0_MAGIC 0x30535346 diff --git a/bootloader/hos/pkg2.c b/bootloader/hos/pkg2.c index 290b6b6..5158f6e 100644 --- a/bootloader/hos/pkg2.c +++ b/bootloader/hos/pkg2.c @@ -170,7 +170,7 @@ static void parse_external_kip_patches() ext_patches_parsed = true; } -const pkg2_kernel_id_t *pkg2_identify(u8 *hash) +const pkg2_kernel_id_t *pkg2_identify(const u8 *hash) { for (u32 i = 0; i < ARRAY_SIZE(_pkg2_kernel_ids); i++) { diff --git a/bootloader/hos/pkg2.h b/bootloader/hos/pkg2.h index 7bd2449..e99b20e 100644 --- a/bootloader/hos/pkg2.h +++ b/bootloader/hos/pkg2.h @@ -159,7 +159,7 @@ void pkg2_merge_kip(link_t *info, pkg2_kip1_t *kip1); void pkg2_get_ids(kip1_id_t **ids, u32 *entries); const char *pkg2_patch_kips(link_t *info, char *patch_names); -const pkg2_kernel_id_t *pkg2_identify(u8 *hash); +const pkg2_kernel_id_t *pkg2_identify(const u8 *hash); pkg2_hdr_t *pkg2_decrypt(void *data, u8 kb, bool is_exo); void pkg2_build_encrypt(void *dst, void *hos_ctxt, link_t *kips_info, bool is_exo); diff --git a/bootloader/hos/pkg2_ini_kippatch.c b/bootloader/hos/pkg2_ini_kippatch.c index 08aa5ad..9567eef 100644 --- a/bootloader/hos/pkg2_ini_kippatch.c +++ b/bootloader/hos/pkg2_ini_kippatch.c @@ -95,7 +95,7 @@ static ini_kip_sec_t *_ini_create_kip_section(link_t *dst, ini_kip_sec_t *ksec, return ksec; } -int ini_patch_parse(link_t *dst, char *ini_path) +int ini_patch_parse(link_t *dst, const char *ini_path) { FIL fp; u32 lblen; @@ -154,15 +154,15 @@ int ini_patch_parse(link_t *dst, char *ini_path) pt->length = strtol(&lbuf[pos], NULL, 16); pos += str_start + 1; - u8 *buf = malloc(pt->length * 2); + u8 *data = malloc(pt->length * 2); // Set patch source data. str_start = _find_patch_section_name(&lbuf[pos], lblen - pos, ','); - pt->src_data = _htoa(NULL, &lbuf[pos], pt->length, buf); + pt->src_data = _htoa(NULL, &lbuf[pos], pt->length, data); pos += str_start + 1; // Set patch destination data. - pt->dst_data = _htoa(NULL, &lbuf[pos], pt->length, buf + pt->length); + pt->dst_data = _htoa(NULL, &lbuf[pos], pt->length, data + pt->length); } list_append(&ksec->pts, &pt->link); diff --git a/bootloader/hos/pkg2_ini_kippatch.h b/bootloader/hos/pkg2_ini_kippatch.h index e32f040..07881c1 100644 --- a/bootloader/hos/pkg2_ini_kippatch.h +++ b/bootloader/hos/pkg2_ini_kippatch.h @@ -37,6 +37,6 @@ typedef struct _ini_kip_sec_t link_t link; } ini_kip_sec_t; -int ini_patch_parse(link_t *dst, char *ini_path); +int ini_patch_parse(link_t *dst, const char *ini_path); #endif diff --git a/bootloader/l4t/l4t.c b/bootloader/l4t/l4t.c index bcc025c..c731017 100644 --- a/bootloader/l4t/l4t.c +++ b/bootloader/l4t/l4t.c @@ -851,7 +851,7 @@ static int _l4t_sc7_exit_config(bool t210b01) return 1; } -static void _l4t_bl33_cfg_set_key(char *env, char *key, char *val) +static void _l4t_bl33_cfg_set_key(char *env, const char *key, const char *val) { strcat(env, key); strcat(env, "="); diff --git a/bootloader/main.c b/bootloader/main.c index d3e0cf9..6867474 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -120,7 +120,7 @@ static void _reloc_patcher(u32 payload_dst, u32 payload_src, u32 payload_size) } } -bool is_ipl_updated(void *buf, char *path, bool force) +bool is_ipl_updated(void *buf, const char *path, bool force) { ipl_ver_meta_t *update_ft = (ipl_ver_meta_t *)(buf + PATCHED_RELOC_SZ + sizeof(boot_cfg_t)); diff --git a/nyx/nyx_gui/frontend/fe_emmc_tools.c b/nyx/nyx_gui/frontend/fe_emmc_tools.c index 3562594..b49929c 100644 --- a/nyx/nyx_gui/frontend/fe_emmc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emmc_tools.c @@ -105,7 +105,7 @@ static void _get_valid_partition(u32 *sector_start, u32 *sector_size, u32 *part_ *sector_start = *sector_start + 0x8000; } -static lv_obj_t *create_mbox_text(char *text, bool button_ok) +static lv_obj_t *create_mbox_text(const char *text, bool button_ok) { lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL); lv_obj_set_style(dark_bg, &mbox_darken); @@ -137,7 +137,7 @@ static void _update_filename(char *outFilename, u32 sdPathLen, u32 currPartIdx) itoa(currPartIdx, &outFilename[sdPathLen], 10); } -static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 lba_curr, char *outFilename, emmc_part_t *part) +static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 lba_curr, const char *outFilename, const emmc_part_t *part) { FIL fp; FIL hashFp; diff --git a/nyx/nyx_gui/frontend/fe_emummc_tools.c b/nyx/nyx_gui/frontend/fe_emummc_tools.c index 929a936..d4a1a96 100644 --- a/nyx/nyx_gui/frontend/fe_emummc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emummc_tools.c @@ -143,7 +143,7 @@ void update_emummc_base_folder(char *outFilename, u32 sdPathLen, u32 currPartIdx itoa(currPartIdx, &outFilename[sdPathLen], 10); } -static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part) +static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_storage_t *storage, const emmc_part_t *part) { static const u32 FAT32_FILESIZE_LIMIT = 0xFFFFFFFF; static const u32 SECTORS_TO_MIB_COEFF = 11; diff --git a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c index 114035c..c46feda 100644 --- a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c +++ b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c @@ -85,7 +85,7 @@ l4t_flasher_ctxt_t l4t_flash_ctxt; lv_obj_t *btn_flash_l4t; lv_obj_t *btn_flash_android; -int _copy_file(const char *src, const char *dst, char *path) +int _copy_file(const char *src, const char *dst, const char *path) { FIL fp_src; FIL fp_dst; @@ -265,7 +265,7 @@ out: return res; } -static void _create_gpt_partition(gpt_t *gpt, u8 *gpt_idx, u32 *curr_part_lba, u32 size_lba, char *name, int name_size) +static void _create_gpt_partition(gpt_t *gpt, u8 *gpt_idx, u32 *curr_part_lba, u32 size_lba, const char *name, int name_size) { static const u8 linux_part_guid[] = { 0xAF, 0x3D, 0xC6, 0x0F, 0x83, 0x84, 0x72, 0x47, 0x8E, 0x79, 0x3D, 0x69, 0xD8, 0x47, 0x7D, 0xE4 }; u8 random_number[16];