git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 44a35e57f69c24ae68b1afa79a45f9805767772c
parent 038a2c5892b925e339b497739c95749fe4729c6a
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sun, 14 Apr 2024 00:22:14 +0300

Avoid GCC false positives

Diffstat:
MMakefile2+-
MSDL/main.c5+++--
MSDL/utils.c3++-
3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile @@ -164,7 +164,7 @@ endif # These must come before the -Wno- flags WARNINGS += -Werror -Wall -Wno-unknown-warning -Wno-unknown-warning-option -Wno-missing-braces -WARNINGS += -Wno-nonnull -Wno-unused-result -Wno-multichar -Wno-int-in-bool-context +WARNINGS += -Wno-nonnull -Wno-unused-result -Wno-multichar -Wno-int-in-bool-context -Wno-format-truncation # Only add this flag if the compiler supports it ifeq ($(shell $(CC) -x c -c $(NULL) -o $(NULL) -Werror -Wpartial-availability 2> $(NULL); echo $$?),0) diff --git a/SDL/main.c b/SDL/main.c @@ -4,6 +4,7 @@ #include <ctype.h> #include <unistd.h> #include <errno.h> +#include <limits.h> #include <OpenDialog/open_dialog.h> #include <SDL.h> #include <Core/gb.h> @@ -689,7 +690,7 @@ static void load_boot_rom(GB_gameboy_t *gb, GB_boot_rom_t type) }; bool use_built_in = true; if (configuration.bootrom_path[0]) { - static char path[4096]; + static char path[PATH_MAX + 1]; snprintf(path, sizeof(path), "%s/%s", configuration.bootrom_path, names[type]); use_built_in = GB_load_boot_rom(gb, path); } @@ -890,7 +891,7 @@ restart: } } -static char prefs_path[1024] = {0, }; +static char prefs_path[PATH_MAX + 1] = {0, }; static void save_configuration(void) { diff --git a/SDL/utils.c b/SDL/utils.c @@ -2,6 +2,7 @@ #include <stdio.h> #include <string.h> #include <unistd.h> +#include <limits.h> #include "utils.h" static const char *resource_folder(void) @@ -18,7 +19,7 @@ static const char *resource_folder(void) char *resource_path(const char *filename) { - static char path[1024]; + static char path[PATH_MAX + 1]; snprintf(path, sizeof(path), "%s%s", resource_folder(), filename); #ifdef DATA_DIR

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.