summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2021-12-23 12:38:28 +0000
committerPhilip Withnall <philip@tecnocode.co.uk>2022-06-01 15:27:17 +0000
commit141482017fbcac64f719da1788607ebe0f8ea0a5 (patch)
tree24939c805848059ed5e32531394e09b435d98aee
parentecbc52c9845fb3a4f1552cda4df2bff191f2c7b1 (diff)
Add missing S_ISREG definitions for VS2022
Otherwise building with VS2022 fails with: ``` Creating library D:/temp/29/.sw/out/323969/gnome.glib.gio-2.71.0.lib and object D:/temp/29/.sw/out/323969/gnome.glib.gio-2.71.0.exp xdgmime.c.4b279509.obj : error LNK2019: unresolved external symbol S_ISREG referenced in function _gio_xdg_get_mime_type_for_file xdgmimecache.c.79af418f.obj : error LNK2001: unresolved external symbol S_ISREG D:\temp\29\.sw\out\323969\gnome.glib.gio-2.71.0.dll : fatal error LNK1120: 1 unresolved externals ``` See https://gitlab.gnome.org/GNOME/glib/-/issues/2560 Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-rw-r--r--src/xdgmime.c4
-rw-r--r--src/xdgmimecache.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/xdgmime.c b/src/xdgmime.c
index f2b534f..f585a07 100644
--- a/src/xdgmime.c
+++ b/src/xdgmime.c
@@ -45,6 +45,10 @@
#include <unistd.h>
#include <assert.h>
+#ifndef S_ISREG
+#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
+#endif
+
typedef struct XdgDirTimeList XdgDirTimeList;
typedef struct XdgCallbackList XdgCallbackList;
diff --git a/src/xdgmimecache.c b/src/xdgmimecache.c
index acaed9d..34a520e 100644
--- a/src/xdgmimecache.c
+++ b/src/xdgmimecache.c
@@ -72,6 +72,10 @@
#define MAP_FAILED ((void *) -1)
#endif
+#ifndef S_ISREG
+#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
+#endif
+
#define MAJOR_VERSION 1
#define MINOR_VERSION_MIN 1
#define MINOR_VERSION_MAX 2