diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 67cf3eca0..616a01772 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -127,5 +127,4 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") add_subdirectory(win) else() add_subdirectory(unix) - target_link_libraries(86Box glib-2.0) endif() diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 02f7737f8..605482638 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -33,7 +33,7 @@ #else /* Declare these functions to avoid warnings. They will redirect to strcasecmp and strncasecmp respectively. */ extern int stricmp(const char* s1, const char* s2); -extern int strnicmp(const char* s1, const char* s2, int n); +extern int strnicmp(const char* s1, const char* s2, size_t n); #endif #if defined(UNIX) && defined(FREEBSD) || defined(__APPLE__) diff --git a/src/network/slirp/tinyglib.c b/src/network/slirp/tinyglib.c index d44658f52..0639e2832 100644 --- a/src/network/slirp/tinyglib.c +++ b/src/network/slirp/tinyglib.c @@ -94,3 +94,40 @@ g_strv_length(gchar **str_array) ++i; return i; } + +/* Implementation borrowed from GLib itself. */ +gsize +g_strlcpy (gchar *dest, + const gchar *src, + gsize dest_size) +{ + gchar *d = dest; + const gchar *s = src; + gsize n = dest_size; + + if (dest == NULL) return 0; + if (src == NULL) return 0; + + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) + do + { + gchar c = *s++; + + *d++ = c; + if (c == 0) + break; + } + while (--n != 0); + + /* If not enough room in dest, add NUL and traverse rest of src */ + if (n == 0) + { + if (dest_size != 0) + *d = 0; + while (*s++) + ; + } + + return s - src - 1; /* count does not include NUL */ +}