fs: Remove remaining compiler warnings

This commit is contained in:
Joel16 2022-08-01 23:56:48 -04:00
parent c5e4ddb4ac
commit 0a94bd9476
2 changed files with 6 additions and 6 deletions

View File

@ -160,7 +160,7 @@ namespace FS {
}
Result ChangeDirNext(const char path[FS_MAX_PATH], std::vector<FsDirectoryEntry> &entries) {
char new_cwd[FS_MAX_PATH + 1];
char new_cwd[FS_MAX_PATH];
const char *sep = (std::strncmp(cfg.cwd, "/", 2) == 0)? "" : "/"; // Don't append / if at /
if ((std::snprintf(new_cwd, FS_MAX_PATH, "%s%s%s", cfg.cwd, sep, path)) > 0)
@ -177,14 +177,14 @@ namespace FS {
return FS::ChangeDir(new_cwd, entries);
}
static int BuildPath(FsDirectoryEntry &entry, char path[FS_MAX_PATH + 1], const char filename[FS_MAX_PATH]) {
if ((std::snprintf(path, FS_MAX_PATH, "%s%s%s", cfg.cwd, (std::strncmp(cfg.cwd, "/", 2) == 0)? "" : "/", entry.name? entry.name : "")) > 0)
static int BuildPath(FsDirectoryEntry &entry, char path[FS_MAX_PATH], const char filename[FS_MAX_PATH]) {
if ((std::snprintf(path, FS_MAX_PATH, "%s%s%s", cfg.cwd, (std::strncmp(cfg.cwd, "/", 2) == 0)? "" : "/", entry.name)) > 0)
return 0;
return -1;
}
static int BuildPath(char path[FS_MAX_PATH + 1], const char filename[FS_MAX_PATH]) {
static int BuildPath(char path[FS_MAX_PATH], const char filename[FS_MAX_PATH]) {
if ((std::snprintf(path, FS_MAX_PATH, "%s%s%s", cfg.cwd, (std::strncmp(cfg.cwd, "/", 2) == 0)? "" : "/", filename[0] != '\0'? filename : "")) > 0)
return 0;

View File

@ -89,7 +89,7 @@ namespace Popups {
if (ImGui::Button(strings[cfg.lang][Lang::OptionsNewFolder], ImVec2(200, 50))) {
std::string name = Keyboard::GetText(strings[cfg.lang][Lang::OptionsFolderPrompt], strings[cfg.lang][Lang::OptionsNewFolder]);
char path[FS_MAX_PATH];
std::snprintf(path, FS_MAX_PATH, "%s/%s", cfg.cwd, name.c_str());
std::snprintf(path, FS_MAX_PATH + 2, "%s/%s", cfg.cwd, name.c_str());
if (R_SUCCEEDED(fsFsCreateDirectory(fs, path))) {
FS::GetDirList(cfg.cwd, data.entries);
@ -106,7 +106,7 @@ namespace Popups {
if (ImGui::Button(strings[cfg.lang][Lang::OptionsNewFile], ImVec2(200, 50))) {
std::string name = Keyboard::GetText(strings[cfg.lang][Lang::OptionsFilePrompt], strings[cfg.lang][Lang::OptionsNewFile]);
char path[FS_MAX_PATH];
std::snprintf(path, FS_MAX_PATH, "%s/%s", cfg.cwd, name.c_str());
std::snprintf(path, FS_MAX_PATH + 2, "%s/%s", cfg.cwd, name.c_str());
if (R_SUCCEEDED(fsFsCreateFile(fs, path, 0, 0))) {
FS::GetDirList(cfg.cwd, data.entries);