mirror of
https://github.com/libretro/RetroArch
synced 2025-02-02 14:54:10 +00:00
Fix BSD build. Convert strcpy()/strcat() to strl* variants.
This commit is contained in:
parent
45904ccd73
commit
753d2057bb
13
Makefile
13
Makefile
@ -16,6 +16,13 @@ else
|
||||
OSX := 0
|
||||
endif
|
||||
|
||||
BSD_LOCAL_INC =
|
||||
DYLIB_LIB = -ldl
|
||||
ifneq ($(findstring BSD,$(shell uname -a)),)
|
||||
BSD_LOCAL_INC = -I/usr/local/include
|
||||
DYLIB_LIB = -lc
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SRC), 1)
|
||||
LIBS += $(SRC_LIBS)
|
||||
DEFINES += $(SRC_CFLAGS)
|
||||
@ -68,7 +75,7 @@ endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
OBJ += gfx/sdl.o gfx/gl.o input/sdl.o audio/sdl.o fifo_buffer.o
|
||||
DEFINES += $(SDL_CFLAGS)
|
||||
DEFINES += $(SDL_CFLAGS) $(BSD_LOCAL_INC)
|
||||
LIBS += $(SDL_LIBS)
|
||||
ifeq ($(OSX),1)
|
||||
LIBS += -framework OpenGL
|
||||
@ -95,7 +102,7 @@ endif
|
||||
|
||||
ifeq ($(HAVE_DYLIB), 1)
|
||||
OBJ += gfx/ext.o audio/ext.o
|
||||
LIBS += -ldl
|
||||
LIBS += $(DYLIB_LIB)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FREETYPE), 1)
|
||||
@ -116,7 +123,7 @@ ifeq ($(HAVE_FFMPEG), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DYNAMIC), 1)
|
||||
LIBS += -ldl
|
||||
LIBS += $(DYLIB_LIB)
|
||||
else
|
||||
LIBS += $(libsnes)
|
||||
endif
|
||||
|
12
file.c
12
file.c
@ -572,15 +572,9 @@ char** dir_list_new(const char *dir, const char *ext)
|
||||
if (!dir_list[cur_ptr])
|
||||
goto error;
|
||||
|
||||
strcpy(dir_list[cur_ptr], dir);
|
||||
#ifdef _WIN32
|
||||
dir_list[cur_ptr][path_len] = '\\';
|
||||
strcpy(&dir_list[cur_ptr][path_len + 1], utf8_buf);
|
||||
#else
|
||||
dir_list[cur_ptr][path_len] = '/';
|
||||
strcpy(&dir_list[cur_ptr][path_len + 1], entry->d_name);
|
||||
#endif
|
||||
dir_list[cur_ptr][final_off - 1] = '\0';
|
||||
strlcpy(dir_list[cur_ptr], dir, final_off);
|
||||
strlcat(dir_list[cur_ptr], "/", final_off);
|
||||
strlcat(dir_list[cur_ptr], entry->d_name, final_off);
|
||||
|
||||
cur_ptr++;
|
||||
if (cur_ptr + 1 == cur_size) // Need to reserve for NULL.
|
||||
|
@ -3,6 +3,12 @@
|
||||
check_switch_c C99 -std=gnu99
|
||||
check_critical C99 "Cannot find C99 compatible compiler."
|
||||
|
||||
if [ "$OS" = BSD ]; then
|
||||
DYLIB=-lc
|
||||
else
|
||||
DYLIB=-ldl
|
||||
fi
|
||||
|
||||
if [ "$HAVE_DYNAMIC" = "yes" ] && [ "$HAVE_CONFIGFILE" = "no" ]; then
|
||||
echo "Cannot have dynamic loading of libsnes and no configfile support."
|
||||
echo "Dynamic loading requires config file support."
|
||||
@ -10,12 +16,12 @@ if [ "$HAVE_DYNAMIC" = "yes" ] && [ "$HAVE_CONFIGFILE" = "no" ]; then
|
||||
fi
|
||||
|
||||
if [ $HAVE_DYNAMIC != yes ]; then
|
||||
check_lib_cxx SNES $LIBSNES snes_init -ldl
|
||||
check_lib_cxx SNES $LIBSNES snes_init $DYLIB
|
||||
check_critical SNES "Cannot find libsnes."
|
||||
add_define_make libsnes $LIBSNES
|
||||
fi
|
||||
|
||||
check_lib DYLIB -ldl dlopen
|
||||
check_lib DYLIB $DYLIB dlopen
|
||||
check_lib NETPLAY -lc socket
|
||||
|
||||
check_lib ALSA -lasound snd_pcm_open
|
||||
@ -56,7 +62,7 @@ fi
|
||||
|
||||
check_pkgconf SRC samplerate
|
||||
|
||||
check_lib DYNAMIC -ldl dlopen
|
||||
check_lib DYNAMIC $DYLIB dlopen
|
||||
|
||||
check_pkgconf FREETYPE freetype2
|
||||
check_lib XVIDEO -lXv XvShmCreateImage
|
||||
|
16
settings.c
16
settings.c
@ -194,8 +194,8 @@ static config_file_t *open_default_config_file(void)
|
||||
if (appdata)
|
||||
{
|
||||
char conf_path[strlen(appdata) + strlen("/ssnes.cfg ")];
|
||||
strcpy(conf_path, appdata);
|
||||
strcat(conf_path, "/ssnes.cfg");
|
||||
strlcpy(conf_path, appdata, sizeof(conf_path));
|
||||
strlcat(conf_path, "/ssnes.cfg", sizeof(conf_path));
|
||||
conf = config_file_new(conf_path);
|
||||
}
|
||||
}
|
||||
@ -204,8 +204,8 @@ static config_file_t *open_default_config_file(void)
|
||||
if (home)
|
||||
{
|
||||
char conf_path[strlen(home) + strlen("/.ssnes.cfg ")];
|
||||
strcpy(conf_path, home);
|
||||
strcat(conf_path, "/.ssnes.cfg");
|
||||
strlcpy(conf_path, home, sizeof(conf_path));
|
||||
strlcat(conf_path, "/.ssnes.cfg", sizeof(conf_path));
|
||||
conf = config_file_new(conf_path);
|
||||
}
|
||||
if (!conf)
|
||||
@ -219,15 +219,15 @@ static config_file_t *open_default_config_file(void)
|
||||
if (xdg)
|
||||
{
|
||||
char conf_path[strlen(xdg) + strlen("/ssnes/ssnes.cfg ")];
|
||||
strcpy(conf_path, xdg);
|
||||
strcat(conf_path, "/ssnes/ssnes.cfg");
|
||||
strlcpy(conf_path, xdg, sizeof(conf_path));
|
||||
strlcat(conf_path, "/ssnes/ssnes.cfg", sizeof(conf_path));
|
||||
conf = config_file_new(conf_path);
|
||||
}
|
||||
else if (home)
|
||||
{
|
||||
char conf_path[strlen(home) + strlen("/.ssnes.cfg ")];
|
||||
strcpy(conf_path, home);
|
||||
strcat(conf_path, "/.ssnes.cfg");
|
||||
strlcpy(conf_path, home, sizeof(conf_path));
|
||||
strlcat(conf_path, "/.ssnes.cfg", sizeof(conf_path));
|
||||
conf = config_file_new(conf_path);
|
||||
}
|
||||
// Try this as a last chance...
|
||||
|
Loading…
x
Reference in New Issue
Block a user