diff --git a/fusee/fusee-primary/src/fs_utils.c b/fusee/fusee-primary/src/fs_utils.c
index 5b9b9f8fd..da561a266 100644
--- a/fusee/fusee-primary/src/fs_utils.c
+++ b/fusee/fusee-primary/src/fs_utils.c
@@ -23,13 +23,16 @@ FATFS sd_fs;
static bool g_sd_mounted = false;
static bool g_sd_initialized = false;
static bool g_ahb_redirect_enabled = false;
+sdmmc_t g_sd_sdmmc;
+sdmmc_device_t g_sd_device;
+
bool mount_sd(void)
{
/* Already mounted. */
if (g_sd_mounted)
return true;
-
+
/* Enable AHB redirection if necessary. */
if (!g_ahb_redirect_enabled) {
mc_enable_ahb_redirect();
@@ -41,7 +44,7 @@ bool mount_sd(void)
if (sdmmc_device_sd_init(&g_sd_device, &g_sd_sdmmc, SDMMC_BUS_WIDTH_4BIT, SDMMC_SPEED_UHS_SDR104))
{
g_sd_initialized = true;
-
+
/* Mount SD. */
if (f_mount(&sd_fs, "", 1) == FR_OK) {
print(SCREEN_LOG_LEVEL_INFO, "Mounted SD card!\n");
@@ -63,7 +66,7 @@ void unmount_sd(void)
sdmmc_device_finish(&g_sd_device);
g_sd_mounted = false;
}
-
+
/* Disable AHB redirection if necessary. */
if (g_ahb_redirect_enabled) {
mc_disable_ahb_redirect();
@@ -81,13 +84,13 @@ uint32_t get_file_size(const char *filename)
FIL f;
if (f_open(&f, filename, FA_READ) != FR_OK)
return 0;
-
+
/* Get the file size. */
uint32_t file_size = f_size(&f);
-
+
/* Close the file. */
f_close(&f);
-
+
return file_size;
}
@@ -101,10 +104,10 @@ int read_from_file(void *dst, uint32_t dst_size, const char *filename)
FIL f;
if (f_open(&f, filename, FA_READ) != FR_OK)
return 0;
-
+
/* Sync. */
f_sync(&f);
-
+
/* Read from file. */
UINT br = 0;
int res = f_read(&f, dst, dst_size, &br);
@@ -118,7 +121,7 @@ int write_to_file(void *src, uint32_t src_size, const char *filename)
/* SD card hasn't been mounted yet. */
if (!g_sd_mounted)
return 0;
-
+
/* Open the file for writing. */
FIL f;
if (f_open(&f, filename, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)
diff --git a/fusee/fusee-primary/src/fs_utils.h b/fusee/fusee-primary/src/fs_utils.h
index 8cb0f326c..1e25b2b82 100644
--- a/fusee/fusee-primary/src/fs_utils.h
+++ b/fusee/fusee-primary/src/fs_utils.h
@@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-
+
#ifndef FUSEE_FS_UTILS_H
#define FUSEE_FS_UTILS_H
@@ -23,8 +23,8 @@
#include "sdmmc/sdmmc.h"
#include "utils.h"
-sdmmc_t g_sd_sdmmc;
-sdmmc_device_t g_sd_device;
+extern sdmmc_t g_sd_sdmmc;
+extern sdmmc_device_t g_sd_device;
bool mount_sd(void);
void unmount_sd(void);
diff --git a/fusee/fusee-primary/src/lib/ini.c b/fusee/fusee-primary/src/lib/ini.c
index 63626c72d..ccf4640d2 100644
--- a/fusee/fusee-primary/src/lib/ini.c
+++ b/fusee/fusee-primary/src/lib/ini.c
@@ -70,7 +70,10 @@ static char* find_chars_or_comment(const char* s, const char* chars)
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
static char* strncpy0(char* dest, const char* src, size_t size)
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(dest, src, size - 1);
+#pragma GCC diagnostic pop
dest[size - 1] = '\0';
return dest;
}
diff --git a/fusee/fusee-secondary/src/lib/ini.c b/fusee/fusee-secondary/src/lib/ini.c
index 63626c72d..ccf4640d2 100644
--- a/fusee/fusee-secondary/src/lib/ini.c
+++ b/fusee/fusee-secondary/src/lib/ini.c
@@ -70,7 +70,10 @@ static char* find_chars_or_comment(const char* s, const char* chars)
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
static char* strncpy0(char* dest, const char* src, size_t size)
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(dest, src, size - 1);
+#pragma GCC diagnostic pop
dest[size - 1] = '\0';
return dest;
}
diff --git a/fusee/fusee-secondary/src/nxboot.c b/fusee/fusee-secondary/src/nxboot.c
index 07974428f..d82b9b1eb 100644
--- a/fusee/fusee-secondary/src/nxboot.c
+++ b/fusee/fusee-secondary/src/nxboot.c
@@ -119,10 +119,16 @@ static int emummc_ini_handler(void *user, const char *section, const char *name,
} else if (strcmp(name, EMUMMC_ID_KEY) == 0) {
sscanf(value, "%lx", &emummc_cfg->id);
} else if (strcmp(name, EMUMMC_PATH_KEY) == 0) {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(emummc_cfg->path, value, sizeof(emummc_cfg->path) - 1);
+#pragma GCC diagnostic pop
emummc_cfg->path[sizeof(emummc_cfg->path) - 1] = '\0';
} else if (strcmp(name, EMUMMC_NINTENDO_PATH_KEY) == 0) {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(emummc_cfg->nintendo_path, value, sizeof(emummc_cfg->nintendo_path) - 1);
+#pragma GCC diagnostic pop
emummc_cfg->nintendo_path[sizeof(emummc_cfg->nintendo_path) - 1] = '\0';
} else {
return 0;
@@ -356,7 +362,10 @@ static bool nxboot_configure_emummc(exo_emummc_config_t *exo_emummc_config) {
/* Initialize values from emummc config. */
exo_emummc_config->base_cfg.id = emummc_cfg.id;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(exo_emummc_config->emu_dir_path, emummc_cfg.nintendo_path, sizeof(exo_emummc_config->emu_dir_path));
+#pragma GCC diagnostic pop
exo_emummc_config->emu_dir_path[sizeof(exo_emummc_config->emu_dir_path) - 1] = '\0';
if (emummc_cfg.enabled) {
@@ -370,7 +379,10 @@ static bool nxboot_configure_emummc(exo_emummc_config_t *exo_emummc_config) {
}
} else if (is_valid_folder(emummc_cfg.path)) {
exo_emummc_config->base_cfg.type = EMUMMC_TYPE_FILES;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(exo_emummc_config->file_cfg.path, emummc_cfg.path, sizeof(exo_emummc_config->file_cfg.path));
+#pragma GCC diagnostic pop
exo_emummc_config->file_cfg.path[sizeof(exo_emummc_config->file_cfg.path) - 1] = '\0';
int num_parts = 0;
diff --git a/sept/sept-secondary/src/fs_utils.c b/sept/sept-secondary/src/fs_utils.c
index 5b9b9f8fd..6426f67e5 100644
--- a/sept/sept-secondary/src/fs_utils.c
+++ b/sept/sept-secondary/src/fs_utils.c
@@ -23,13 +23,15 @@ FATFS sd_fs;
static bool g_sd_mounted = false;
static bool g_sd_initialized = false;
static bool g_ahb_redirect_enabled = false;
+sdmmc_t g_sd_sdmmc;
+sdmmc_device_t g_sd_device;
bool mount_sd(void)
{
/* Already mounted. */
if (g_sd_mounted)
return true;
-
+
/* Enable AHB redirection if necessary. */
if (!g_ahb_redirect_enabled) {
mc_enable_ahb_redirect();
@@ -41,7 +43,7 @@ bool mount_sd(void)
if (sdmmc_device_sd_init(&g_sd_device, &g_sd_sdmmc, SDMMC_BUS_WIDTH_4BIT, SDMMC_SPEED_UHS_SDR104))
{
g_sd_initialized = true;
-
+
/* Mount SD. */
if (f_mount(&sd_fs, "", 1) == FR_OK) {
print(SCREEN_LOG_LEVEL_INFO, "Mounted SD card!\n");
@@ -63,7 +65,7 @@ void unmount_sd(void)
sdmmc_device_finish(&g_sd_device);
g_sd_mounted = false;
}
-
+
/* Disable AHB redirection if necessary. */
if (g_ahb_redirect_enabled) {
mc_disable_ahb_redirect();
@@ -81,13 +83,13 @@ uint32_t get_file_size(const char *filename)
FIL f;
if (f_open(&f, filename, FA_READ) != FR_OK)
return 0;
-
+
/* Get the file size. */
uint32_t file_size = f_size(&f);
-
+
/* Close the file. */
f_close(&f);
-
+
return file_size;
}
@@ -101,10 +103,10 @@ int read_from_file(void *dst, uint32_t dst_size, const char *filename)
FIL f;
if (f_open(&f, filename, FA_READ) != FR_OK)
return 0;
-
+
/* Sync. */
f_sync(&f);
-
+
/* Read from file. */
UINT br = 0;
int res = f_read(&f, dst, dst_size, &br);
@@ -118,7 +120,7 @@ int write_to_file(void *src, uint32_t src_size, const char *filename)
/* SD card hasn't been mounted yet. */
if (!g_sd_mounted)
return 0;
-
+
/* Open the file for writing. */
FIL f;
if (f_open(&f, filename, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)
diff --git a/sept/sept-secondary/src/fs_utils.h b/sept/sept-secondary/src/fs_utils.h
index 8cb0f326c..1e25b2b82 100644
--- a/sept/sept-secondary/src/fs_utils.h
+++ b/sept/sept-secondary/src/fs_utils.h
@@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-
+
#ifndef FUSEE_FS_UTILS_H
#define FUSEE_FS_UTILS_H
@@ -23,8 +23,8 @@
#include "sdmmc/sdmmc.h"
#include "utils.h"
-sdmmc_t g_sd_sdmmc;
-sdmmc_device_t g_sd_device;
+extern sdmmc_t g_sd_sdmmc;
+extern sdmmc_device_t g_sd_device;
bool mount_sd(void);
void unmount_sd(void);
diff --git a/sept/sept-secondary/src/lib/ini.c b/sept/sept-secondary/src/lib/ini.c
index 63626c72d..ccf4640d2 100644
--- a/sept/sept-secondary/src/lib/ini.c
+++ b/sept/sept-secondary/src/lib/ini.c
@@ -70,7 +70,10 @@ static char* find_chars_or_comment(const char* s, const char* chars)
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
static char* strncpy0(char* dest, const char* src, size_t size)
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(dest, src, size - 1);
+#pragma GCC diagnostic pop
dest[size - 1] = '\0';
return dest;
}