[libdazzle] build: fix build for mingw64



commit 3ccef8c092cc33cd6678185a19eda57a85685b9e
Author: Christian Hergert <chergert redhat com>
Date:   Mon Nov 9 09:03:43 2020 -0800

    build: fix build for mingw64
    
    This fixes some issues where the types were causing different alignment
    rules for Windows than we expect elsewhere.
    
    This supercedes !48, and is based upon ZUHONG TAO's work there to include
    the necessary changes for alignment fixes.

 src/files/dzl-recursive-file-monitor.c |  4 ++++
 src/search/dzl-fuzzy-mutable-index.c   |  5 +++++
 src/search/dzl-trie.c                  | 16 +++++++++-------
 tests/test-directory-reaper.c          |  2 ++
 4 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/src/files/dzl-recursive-file-monitor.c b/src/files/dzl-recursive-file-monitor.c
index 824fd83..b09fbf9 100644
--- a/src/files/dzl-recursive-file-monitor.c
+++ b/src/files/dzl-recursive-file-monitor.c
@@ -174,7 +174,11 @@ resolve_file (GFile *file)
     return g_object_ref (file);
 
   orig_path = g_file_get_path (file);
+#ifdef G_OS_UNIX
   real_path = realpath (orig_path, NULL);
+#else
+  real_path = _fullpath (orig_path, NULL, _MAX_PATH);
+#endif
 
   /* unlikely, but PATH_MAX exceeded */
   if (real_path == NULL)
diff --git a/src/search/dzl-fuzzy-mutable-index.c b/src/search/dzl-fuzzy-mutable-index.c
index 49a6c8a..b34a8b5 100644
--- a/src/search/dzl-fuzzy-mutable-index.c
+++ b/src/search/dzl-fuzzy-mutable-index.c
@@ -62,8 +62,13 @@ struct _DzlFuzzyMutableIndex
 #pragma pack(push, 1)
 typedef struct
 {
+#ifdef G_OS_WIN32
+  guint32 id;
+  guint16 pos;
+#else
   guint64 id : 32;
   guint64 pos : 16;
+#endif
 } DzlFuzzyMutableIndexItem;
 #pragma pack(pop)
 
diff --git a/src/search/dzl-trie.c b/src/search/dzl-trie.c
index b4ac47c..75ed5f6 100644
--- a/src/search/dzl-trie.c
+++ b/src/search/dzl-trie.c
@@ -71,16 +71,17 @@ G_DEFINE_BOXED_TYPE (DzlTrie, dzl_trie, dzl_trie_ref, dzl_trie_unref)
  * @children: The children #DzlTrieNodeChunk or %NULL. If the chunk is
  *   inline the DzlTrieNode, then there will be fewer items.
  */
-DZL_ALIGNED_BEGIN(1)
+#pragma pack(push, 1)
 struct _DzlTrieNodeChunk
 {
    DzlTrieNodeChunk *next;
-   gboolean          is_inline : 1;
-   guint             flags : 7;
-   guint             count : 8;
+   guint16           is_inline : 1;
+   guint16           flags : 7;
+   guint16           count : 8;
    guint8            keys[6];
    DzlTrieNode      *children[0];
-} DZL_ALIGNED_END(1);
+};
+#pragma pack(pop)
 
 /**
  * DzlTrieNode:
@@ -90,13 +91,14 @@ struct _DzlTrieNodeChunk
  * @chunk: The first chunk in the chain. Inline chunks have fewer children
  *    elements than extra allocated chunks so that they are cache aligned.
  */
-DZL_ALIGNED_BEGIN(1)
+#pragma pack(push, 1)
 struct _DzlTrieNode
 {
    DzlTrieNode      *parent;
    gpointer          value;
    DzlTrieNodeChunk  chunk;
-} DZL_ALIGNED_END(1);
+};
+#pragma pack(pop)
 
 /**
  * DzlTrie:
diff --git a/tests/test-directory-reaper.c b/tests/test-directory-reaper.c
index 99bfcd7..a185bd2 100644
--- a/tests/test-directory-reaper.c
+++ b/tests/test-directory-reaper.c
@@ -75,6 +75,7 @@ test_reaper_basic (void)
       g_assert_cmpint (r, ==, TRUE);
     }
 
+#ifdef G_OS_UNIX
   /* Add a symlink to ../ so that we keep ourselves honest ;) */
   {
     g_autofree gchar *cwd = g_get_current_dir ();
@@ -95,6 +96,7 @@ test_reaper_basic (void)
   g_assert_cmpint (0, ==, symlink ("../../../out-of-tree", "reaper/a/b/d"));
   g_assert_true (g_file_test ("reaper/a/b/d", G_FILE_TEST_IS_SYMLINK));
   g_assert_true (g_file_test ("reaper/a/b/d", G_FILE_TEST_EXISTS));
+#endif
 
   dzl_directory_reaper_add_directory (reaper, file, 0);
 


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