From c46ebc6a5ecf0f7b298fd2a441aff6f7685509ce Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 25 Aug 2021 02:01:39 +0600 Subject: [PATCH] Fix macOS compilation for real --- src/network/slirp/misc.c | 6 ++++++ src/unix/unix.c | 10 +++++----- src/unix/unix_sdl.c | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/network/slirp/misc.c b/src/network/slirp/misc.c index a0b41fa49..4b520fc43 100644 --- a/src/network/slirp/misc.c +++ b/src/network/slirp/misc.c @@ -7,6 +7,12 @@ #include #ifdef G_OS_UNIX #include +#include +#ifdef BSD +#define g_strlcpy strlcpy +#else +extern int g_strlcpy(gchar* dest, const gchar* src, gsize dest_size); +#endif #endif extern inline void insque(void *a, void *b) diff --git a/src/unix/unix.c b/src/unix/unix.c index 20fe1183d..41cfa9173 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include <86box/86box.h> #include <86box/keyboard.h> #include <86box/mouse.h> @@ -183,7 +183,7 @@ plat_tempfile(char *bufp, char *prefix, char *suffix) gettimeofday(&t, NULL); curtime = time(NULL); calendertime = localtime(&curtime); - sprintf(&bufp[strlen(bufp)], "%d%02d%02d-%02d%02d%02d-%03d%s", calendertime->tm_year, calendertime->tm_mon, calendertime->tm_mday, calendertime->tm_hour, calendertime->tm_min, calendertime->tm_sec, t.tv_usec / 1000, suffix); + sprintf(&bufp[strlen(bufp)], "%d%02d%02d-%02d%02d%02d-%03ld%s", calendertime->tm_year, calendertime->tm_mon, calendertime->tm_mday, calendertime->tm_hour, calendertime->tm_min, calendertime->tm_sec, t.tv_usec / 1000, suffix); } int @@ -514,14 +514,14 @@ do_stop(void) int ui_msgbox(int flags, void *message) { - fprintf(stderr, "Got msgbox request. Flags: 0x%X, msgid: %llu\n", flags, (uint64_t) message); + fprintf(stderr, "Got msgbox request. Flags: 0x%X, msgid: %llu\n", flags, (unsigned long long) message); return 0; } int ui_msgbox_header(int flags, void *message, void* header) { // Parameters that are passed will crash the program so keep these off for the time being. - fprintf(stderr, "Got msgbox request. Flags: 0x%X, msgid: %llu, hdrid: %llu\n", flags, (uint64_t) message, (uint64_t) header); + fprintf(stderr, "Got msgbox request. Flags: 0x%X, msgid: %llu, hdrid: %llu\n", flags, (unsigned long long) message, (unsigned long long) header); return 0; } @@ -742,4 +742,4 @@ void startblit() void endblit() { SDL_UnlockMutex(blitmtx); -} \ No newline at end of file +} diff --git a/src/unix/unix_sdl.c b/src/unix/unix_sdl.c index 43de3a09d..79e9749ac 100644 --- a/src/unix/unix_sdl.c +++ b/src/unix/unix_sdl.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include