Simplify string ops with already compiled-in functions

This commit is contained in:
CTCaer
2019-12-04 15:56:53 +02:00
parent 74452074f6
commit 29a51124fd
14 changed files with 54 additions and 63 deletions

View File

@@ -363,7 +363,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_storage_t
FIL partialIdxFp;
char partialIdxFilename[12];
memcpy(partialIdxFilename, "partial.idx", 12);
strcpy(partialIdxFilename, "partial.idx");
s_printf(gui->txt_buf, "#96FF00 SD Card free space:# %d MiB\n#96FF00 Total backup size:# %d MiB\n\n",
sd_fs.free_clst * sd_fs.csize >> SECTORS_TO_MIB_COEFF,
@@ -769,7 +769,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
bootPart.lba_end = (BOOT_PART_SIZE / NX_EMMC_BLOCKSIZE) - 1;
for (i = 0; i < 2; i++)
{
memcpy(bootPart.name, "BOOT", 5);
strcpy(bootPart.name, "BOOT");
bootPart.name[4] = (u8)('0' + i);
bootPart.name[5] = 0;
@@ -1349,7 +1349,7 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
bootPart.lba_end = (BOOT_PART_SIZE / NX_EMMC_BLOCKSIZE) - 1;
for (i = 0; i < 2; i++)
{
memcpy(bootPart.name, "BOOT", 4);
strcpy(bootPart.name, "BOOT");
bootPart.name[4] = (u8)('0' + i);
bootPart.name[5] = 0;

View File

@@ -368,7 +368,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
bootPart.lba_end = (BOOT_PART_SIZE / NX_EMMC_BLOCKSIZE) - 1;
for (i = 0; i < 2; i++)
{
memcpy(bootPart.name, "BOOT", 5);
strcpy(bootPart.name, "BOOT");
bootPart.name[4] = (u8)('0' + i);
bootPart.name[5] = 0;
@@ -623,7 +623,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start)
bootPart.lba_end = (BOOT_PART_SIZE / NX_EMMC_BLOCKSIZE) - 1;
for (i = 0; i < 2; i++)
{
memcpy(bootPart.name, "BOOT", 5);
strcpy(bootPart.name, "BOOT");
bootPart.name[4] = (u8)('0' + i);
bootPart.name[5] = 0;

View File

@@ -278,13 +278,13 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
s_printf(dram_man, "Samsung %s", (!dram_id) ? "4GB" : "6GB");
break;
case 1:
memcpy(dram_man, "Hynix 4GB", 10);
strcpy(dram_man, "Hynix 4GB");
break;
case 2:
memcpy(dram_man, "Micron 4GB", 11);
strcpy(dram_man, "Micron 4GB");
break;
default:
memcpy(dram_man, "Unknown", 8);
strcpy(dram_man, "Unknown");
break;
}

View File

@@ -277,9 +277,9 @@ static lv_res_t _create_window_unset_abit_tool(lv_obj_t *btn)
u32 total = 0;
if (!nintendo_folder)
memcpy(path, "", 1);
path[0] = 0;
else
memcpy(path, "Nintendo", 9);
strcpy(path, "Nintendo");
u32 ufidx = 0;
@@ -288,7 +288,7 @@ static lv_res_t _create_window_unset_abit_tool(lv_obj_t *btn)
// Also fix the emuMMC Nintendo folders.
if (nintendo_folder)
{
memcpy(path, "emuMMC", 7);
strcpy(path, "emuMMC");
_fix_attributes(&ufidx, lb_val, path, &total, nintendo_folder, nintendo_folder);
}