From 760d02243271bf4302379fe3e47cbd08ed0e0b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Fri, 8 Apr 2022 10:35:26 +0200 Subject: [PATCH] rom: Little fixes to get rid of warnings --- src/mem/rom.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mem/rom.c b/src/mem/rom.c index 99d6bb582..2e9697801 100644 --- a/src/mem/rom.c +++ b/src/mem/rom.c @@ -77,11 +77,11 @@ rom_add_path(const char* path) // Save the path, turning it into absolute if needed. if (!plat_path_abs((char*) path)) { - plat_getcwd(cwd, 1024); + plat_getcwd(cwd, sizeof(cwd)); plat_path_slash(cwd); - snprintf(rom_path->path, 1024, "%s%s%c", cwd, path, 0); + snprintf(rom_path->path, sizeof(rom_path->path), "%s%s", cwd, path); } else { - strncpy(rom_path->path, path, 1024); + snprintf(rom_path->path, sizeof(rom_path->path), "%s", path); } // Ensure the path ends with a separator. @@ -98,13 +98,13 @@ rom_fopen(char *fn, char *mode) if (strstr(fn, "roms/") == fn) { /* Relative path */ - do { + for(rom_path_t *rom_path = &rom_paths; rom_path != NULL; rom_path = rom_path->next) { plat_append_filename(temp, rom_path->path, fn + 5); - if (fp = plat_fopen(temp, mode)) { + if ((fp = plat_fopen(temp, mode)) != NULL) { return fp; } - } while(rom_path = rom_path->next); + } return fp; } else { @@ -122,14 +122,14 @@ rom_getfile(char *fn, char *s, int size) if (strstr(fn, "roms/") == fn) { /* Relative path */ - do { + for(rom_path_t *rom_path = &rom_paths; rom_path != NULL; rom_path = rom_path->next) { plat_append_filename(temp, rom_path->path, fn + 5); if (rom_present(temp)) { strncpy(s, temp, size); return 1; } - } while(rom_path = rom_path->next); + } return 0; } else {