From e477ec0a180aaedb504ee5e6bf9a89a947b898a9 Mon Sep 17 00:00:00 2001 From: d0k3 Date: Tue, 2 Oct 2018 18:42:04 +0200 Subject: [PATCH] Fix compile errors introduced by bfc3363 Fixes #432 --- arm9/source/filesys/fsdrive.c | 13 +++++++------ arm9/source/filesys/fsgame.c | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/arm9/source/filesys/fsdrive.c b/arm9/source/filesys/fsdrive.c index 106f22a..c1de794 100644 --- a/arm9/source/filesys/fsdrive.c +++ b/arm9/source/filesys/fsdrive.c @@ -181,12 +181,13 @@ void SearchDirContents(DirStruct* contents, const char* path, const char* patter contents->n_entries = 0; // not required, but so what? } else { // create virtual '..' entry - contents->entry->p_name = 4; - contents->entry->name = contents->entry->path + entry->p_name; - strncpy(contents->entry->path, "*?*", 4); - strncpy(contents->entry->name, "..", 4); - contents->entry->type = T_DOTDOT; - contents->entry->size = 0; + DirEntry* entry = (DirEntry*) &(contents->entry); + entry->p_name = 4; + entry->name = entry->path + entry->p_name; + strncpy(entry->path, "*?*", 4); + strncpy(entry->name, "..", 4); + entry->type = T_DOTDOT; + entry->size = 0; contents->n_entries = 1; // search the path char fpath[256]; // 256 is the maximum length of a full path diff --git a/arm9/source/filesys/fsgame.c b/arm9/source/filesys/fsgame.c index 806c568..4d08899 100644 --- a/arm9/source/filesys/fsgame.c +++ b/arm9/source/filesys/fsgame.c @@ -15,8 +15,8 @@ void SetDirGoodNames(DirStruct* contents) { (plen + 1 + strnlen(goodname, 256) + 1 > 256)) continue; entry->p_name = plen + 1; - entry->name = entry->path + entry->p_name; - strncpy(entry->name, goodname, 256 - 1 - entry->p_name); + entry->name = entry->path + entry->p_name; + snprintf(entry->name, 256 - entry->p_name, "%s", goodname); } }