[glib: 1/2] xdgmime: Add missing S_ISREG definitions for VS2022




commit 954a8724c2ba40e0860af034aba33910b9c9b67c
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Dec 23 12:35:48 2021 +0000

    xdgmime: 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
    ```
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Fixes: #2560

 gio/xdgmime/xdgmime.c      | 4 ++++
 gio/xdgmime/xdgmimecache.c | 4 ++++
 2 files changed, 8 insertions(+)
---
diff --git a/gio/xdgmime/xdgmime.c b/gio/xdgmime/xdgmime.c
index 72264da0f..9ab676048 100644
--- a/gio/xdgmime/xdgmime.c
+++ b/gio/xdgmime/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/gio/xdgmime/xdgmimecache.c b/gio/xdgmime/xdgmimecache.c
index c89349e08..f80f122a1 100644
--- a/gio/xdgmime/xdgmimecache.c
+++ b/gio/xdgmime/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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]