Fix compile errors and get rid of glib dependency
This commit is contained in:
@@ -127,5 +127,4 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|||||||
add_subdirectory(win)
|
add_subdirectory(win)
|
||||||
else()
|
else()
|
||||||
add_subdirectory(unix)
|
add_subdirectory(unix)
|
||||||
target_link_libraries(86Box glib-2.0)
|
|
||||||
endif()
|
endif()
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#else
|
#else
|
||||||
/* Declare these functions to avoid warnings. They will redirect to strcasecmp and strncasecmp respectively. */
|
/* 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 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
|
#endif
|
||||||
|
|
||||||
#if defined(UNIX) && defined(FREEBSD) || defined(__APPLE__)
|
#if defined(UNIX) && defined(FREEBSD) || defined(__APPLE__)
|
||||||
|
@@ -94,3 +94,40 @@ g_strv_length(gchar **str_array)
|
|||||||
++i;
|
++i;
|
||||||
return 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 */
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user