Merge pull request #11171 from AdmiralCurtiss/fatfs-zero-init
Zero-initialize structures passed to FatFs functions.
This commit is contained in:
commit
02abc086c6
|
@ -360,7 +360,7 @@ static bool Pack(const File::FSTEntry& entry, bool is_root, std::vector<u8>& tmp
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FIL dst;
|
FIL dst{};
|
||||||
const auto open_error_code =
|
const auto open_error_code =
|
||||||
f_open(&dst, entry.virtualName.c_str(), FA_CREATE_ALWAYS | FA_WRITE);
|
f_open(&dst, entry.virtualName.c_str(), FA_CREATE_ALWAYS | FA_WRITE);
|
||||||
if (open_error_code != FR_OK)
|
if (open_error_code != FR_OK)
|
||||||
|
@ -549,7 +549,7 @@ bool SyncSDFolderToSDImage(bool deterministic)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FATFS fs;
|
FATFS fs{};
|
||||||
const auto mount_error_code = f_mount(&fs, "", 0);
|
const auto mount_error_code = f_mount(&fs, "", 0);
|
||||||
if (mount_error_code != FR_OK)
|
if (mount_error_code != FR_OK)
|
||||||
{
|
{
|
||||||
|
@ -591,7 +591,7 @@ static bool Unpack(const std::string path, bool is_directory, const char* name,
|
||||||
{
|
{
|
||||||
if (!is_directory)
|
if (!is_directory)
|
||||||
{
|
{
|
||||||
FIL src;
|
FIL src{};
|
||||||
const auto open_error_code = f_open(&src, name, FA_READ);
|
const auto open_error_code = f_open(&src, name, FA_READ);
|
||||||
if (open_error_code != FR_OK)
|
if (open_error_code != FR_OK)
|
||||||
{
|
{
|
||||||
|
@ -667,7 +667,7 @@ static bool Unpack(const std::string path, bool is_directory, const char* name,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DIR directory;
|
DIR directory{};
|
||||||
const auto opendir_error_code = f_opendir(&directory, ".");
|
const auto opendir_error_code = f_opendir(&directory, ".");
|
||||||
if (opendir_error_code != FR_OK)
|
if (opendir_error_code != FR_OK)
|
||||||
{
|
{
|
||||||
|
@ -676,7 +676,7 @@ static bool Unpack(const std::string path, bool is_directory, const char* name,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILINFO entry;
|
FILINFO entry{};
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
const auto readdir_error_code = f_readdir(&directory, &entry);
|
const auto readdir_error_code = f_readdir(&directory, &entry);
|
||||||
|
@ -767,7 +767,7 @@ bool SyncSDImageToSDFolder()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FATFS fs;
|
FATFS fs{};
|
||||||
const auto mount_error_code = f_mount(&fs, "", 0);
|
const auto mount_error_code = f_mount(&fs, "", 0);
|
||||||
if (mount_error_code != FR_OK)
|
if (mount_error_code != FR_OK)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <limits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
@ -97,6 +98,10 @@ static DRESULT read_vff_header(IOS::HLE::FS::FileHandle* vff, FATFS* fs)
|
||||||
fs->id = 0;
|
fs->id = 0;
|
||||||
fs->cdir = 0;
|
fs->cdir = 0;
|
||||||
|
|
||||||
|
// invalidate window
|
||||||
|
fs->wflag = 0;
|
||||||
|
fs->winsect = std::numeric_limits<LBA_t>::max();
|
||||||
|
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +190,7 @@ namespace IOS::HLE::NWC24
|
||||||
{
|
{
|
||||||
static ErrorCode WriteFile(const std::string& filename, const std::vector<u8>& tmp_buffer)
|
static ErrorCode WriteFile(const std::string& filename, const std::vector<u8>& tmp_buffer)
|
||||||
{
|
{
|
||||||
FIL dst;
|
FIL dst{};
|
||||||
const auto open_error_code = f_open(&dst, filename.c_str(), FA_CREATE_ALWAYS | FA_WRITE);
|
const auto open_error_code = f_open(&dst, filename.c_str(), FA_CREATE_ALWAYS | FA_WRITE);
|
||||||
if (open_error_code != FR_OK)
|
if (open_error_code != FR_OK)
|
||||||
{
|
{
|
||||||
|
@ -269,7 +274,7 @@ ErrorCode OpenVFF(const std::string& path, const std::string& filename,
|
||||||
|
|
||||||
Common::ScopeGuard vff_delete_guard{[&] { fs->Delete(PID_KD, PID_KD, path); }};
|
Common::ScopeGuard vff_delete_guard{[&] { fs->Delete(PID_KD, PID_KD, path); }};
|
||||||
|
|
||||||
FATFS fatfs;
|
FATFS fatfs{};
|
||||||
const FRESULT fatfs_mount_error_code = f_mount(&fatfs, "", 0);
|
const FRESULT fatfs_mount_error_code = f_mount(&fatfs, "", 0);
|
||||||
if (fatfs_mount_error_code != FR_OK)
|
if (fatfs_mount_error_code != FR_OK)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue