Files
libfprint/debian/patches/fpi-device-Adjust-padding-based-on-actual-gpointer-size.patch
T
2021-10-31 23:08:38 +01:00

96 lines
3.2 KiB
Diff

From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Sun, 31 Oct 2021 19:19:41 +0100
Subject: fpi-device: Adjust padding based on actual gpointer size
In some architectures pointer size is different. So let's adapt it to it
---
libfprint/fpi-device.h | 12 ++++++++++++
tests/test-fp-todv1-types.c | 4 ++--
tests/tod-drivers/base-fpi-device.h | 12 ++++++++++++
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/libfprint/fpi-device.h b/libfprint/fpi-device.h
index aba30b1..299b1d7 100644
--- a/libfprint/fpi-device.h
+++ b/libfprint/fpi-device.h
@@ -73,7 +73,13 @@ struct _FpIdEntry
/*< private >*/
/* padding for future expansion */
+#if GLIB_SIZEOF_VOID_P == 8
gpointer _padding_dummy[13];
+#elif GLIB_SIZEOF_VOID_P == 4
+ gpointer _padding_dummy[11];
+#else
+ G_STATIC_ASSERT("Unexpected pointer size")
+#endif
};
/**
@@ -186,7 +192,13 @@ struct _FpDeviceClass
/*< private >*/
/* padding for future expansion */
+#if GLIB_SIZEOF_VOID_P == 8
gpointer _padding_dummy[27];
+#elif GLIB_SIZEOF_VOID_P == 4
+ gpointer _padding_dummy[26];
+#else
+ G_STATIC_ASSERT("Unexpected pointer size")
+#endif
};
void fpi_device_class_auto_initialize_features (FpDeviceClass *device_class);
diff --git a/tests/test-fp-todv1-types.c b/tests/test-fp-todv1-types.c
index 6846faa..b9bbea0 100644
--- a/tests/test-fp-todv1-types.c
+++ b/tests/test-fp-todv1-types.c
@@ -109,13 +109,13 @@ check_compatiblity_auto (GType old_type, GType current_type)
type ## TODV ## major ## _ ## minor ## _ ## micro
#define check_struct_size(type, major, minor, micro) \
- g_debug ("Checking " # type " size @ " G_STRLOC); \
+ g_debug ("Checking " # type " v" #major "." #minor "." #micro " size @ " G_STRLOC); \
g_assert_cmpuint (sizeof (tod_versioned_type (type, major, minor, micro)), \
==, \
sizeof (type))
#define check_struct_member(type, major, minor, micro, member) \
- g_debug ("Checking " # type "'s " # member " offset @ " G_STRLOC); \
+ g_debug ("Checking " # type " v" #major "." #minor "." #micro "'s " # member " offset @ " G_STRLOC); \
g_assert_cmpuint (G_STRUCT_OFFSET (tod_versioned_type (type, major, minor, micro), member), \
==, \
G_STRUCT_OFFSET (type, member))
diff --git a/tests/tod-drivers/base-fpi-device.h b/tests/tod-drivers/base-fpi-device.h
index fe68e5b..9be6a72 100644
--- a/tests/tod-drivers/base-fpi-device.h
+++ b/tests/tod-drivers/base-fpi-device.h
@@ -172,7 +172,13 @@ struct _FpIdEntryTODV1_92_0
/*< private >*/
/* padding for future expansion */
+#if GLIB_SIZEOF_VOID_P == 8
gpointer _padding_dummy[13];
+#elif GLIB_SIZEOF_VOID_P == 4
+ gpointer _padding_dummy[11];
+#else
+ G_STATIC_ASSERT("Unexpected pointer size")
+#endif
};
typedef struct _FpIdEntryTODV1_92_0 FpIdEntryTODV1_92_0;
@@ -260,7 +266,13 @@ struct _FpDeviceClassTODV1_94_0
/*< private >*/
/* padding for future expansion */
+#if GLIB_SIZEOF_VOID_P == 8
gpointer _padding_dummy[27];
+#elif GLIB_SIZEOF_VOID_P == 4
+ gpointer _padding_dummy[26];
+#else
+ G_STATIC_ASSERT("Unexpected pointer size")
+#endif
};
typedef struct _FpDeviceClassTODV1_94_0 FpDeviceClassTODV1_94_0;