mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-06-11 02:28:05 +00:00
libfprint: Use a macro to easily compute TOD padding
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "fp-image.h"
|
||||
#include "tod/tod-macros.h"
|
||||
|
||||
/**
|
||||
* fpi_frame:
|
||||
@@ -110,7 +111,9 @@ struct fpi_line_asmbl_ctx
|
||||
unsigned char (*get_pixel)(struct fpi_line_asmbl_ctx *ctx,
|
||||
GSList *line,
|
||||
unsigned int x);
|
||||
gpointer _padding_dummy[32];
|
||||
|
||||
/*< private >*/
|
||||
TOD_PADDING (32, 0);
|
||||
};
|
||||
|
||||
FpImage *fpi_assemble_lines (struct fpi_line_asmbl_ctx *ctx,
|
||||
|
||||
+9
-14
@@ -23,6 +23,7 @@
|
||||
#include "fp-device.h"
|
||||
#include "fp-image.h"
|
||||
#include "fpi-print.h"
|
||||
#include "tod/tod-macros.h"
|
||||
|
||||
/**
|
||||
* FpiDeviceUdevSubtype:
|
||||
@@ -73,13 +74,10 @@ 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
|
||||
TOD_PADDING_ALIGNED (16,
|
||||
sizeof (guint) * 2 +
|
||||
sizeof (FpiDeviceUdevSubtypeFlags) +
|
||||
sizeof (gpointer));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -192,13 +190,10 @@ 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
|
||||
TOD_PADDING_ALIGNED8 (32,
|
||||
sizeof (FpDeviceFeature) +
|
||||
sizeof (gint32) * 2 +
|
||||
sizeof (gpointer) * 3);
|
||||
};
|
||||
|
||||
void fpi_device_class_auto_initialize_features (FpDeviceClass *device_class);
|
||||
|
||||
@@ -117,7 +117,7 @@ struct _FpImageDeviceClass
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[32];
|
||||
TOD_PADDING (32, 0);
|
||||
};
|
||||
|
||||
void fpi_image_device_set_bz3_threshold (FpImageDevice *self,
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "fp-image.h"
|
||||
#include "tod/tod-macros.h"
|
||||
|
||||
/**
|
||||
* FpiImageFlags:
|
||||
@@ -69,7 +70,7 @@ struct _FpImage
|
||||
GPtrArray *minutiae;
|
||||
guint ref_count;
|
||||
|
||||
gpointer _padding_dummy[32];
|
||||
TOD_PADDING (32, 0);
|
||||
};
|
||||
|
||||
gint fpi_std_sq_dev (const guint8 *buf,
|
||||
|
||||
@@ -75,7 +75,7 @@ struct _FpiSpiTransfer
|
||||
GDestroyNotify free_buffer_rd;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[32];
|
||||
TOD_PADDING (32, 0);
|
||||
};
|
||||
|
||||
GType fpi_spi_transfer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
@@ -103,9 +103,8 @@ struct _FpiUsbTransfer
|
||||
/* Data free function */
|
||||
GDestroyNotify free_buffer;
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[32];
|
||||
TOD_PADDING (32, 0);
|
||||
};
|
||||
|
||||
GType fpi_usb_transfer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Shared library loader for libfprint
|
||||
* Copyright (C) 2021 Marco Trevisan <marco.trevisan@canonical.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define TOD_PADDING(original, wasted) \
|
||||
char _tod_expansion_padding[(GLIB_SIZEOF_VOID_P * (original)) - (wasted)];
|
||||
|
||||
#define TOD_PADDING_ALIGNED(original, wasted) \
|
||||
TOD_PADDING (original, (wasted) + GLIB_SIZEOF_VOID_P)
|
||||
|
||||
#define TOD_PADDING_ALIGNED4(original, wasted) \
|
||||
TOD_PADDING (original, (wasted) + (GLIB_SIZEOF_VOID_P == 4 ? GLIB_SIZEOF_VOID_P : 0))
|
||||
|
||||
#define TOD_PADDING_ALIGNED8(original, wasted) \
|
||||
TOD_PADDING (original, (wasted) + (GLIB_SIZEOF_VOID_P == 8 ? GLIB_SIZEOF_VOID_P : 0))
|
||||
Reference in New Issue
Block a user