Commit 3ccef8c0 authored by Christian Hergert's avatar Christian Hergert

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.
parent 411985b9
......@@ -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)
......
......@@ -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)
......
......@@ -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:
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment