debian/patches: Cherry-pick post-release upstream cleanups

This commit is contained in:
Marco Trevisan (Treviño)
2022-10-14 00:59:50 +02:00
parent 81230b793c
commit 73ceb9e39c
6 changed files with 399 additions and 0 deletions
@@ -0,0 +1,116 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Thu, 13 Oct 2022 19:42:50 +0200
Subject: fp-device: Move FpDevice private functions to public library
This these functions are not really needed by anything else than
FpDevice, so move them back to the cpp file, so that we don't expose
them in the private library, given that we don't need them
---
libfprint/fp-device-private.h | 3 ---
libfprint/fp-device.c | 26 ++++++++++++++++++++++++++
libfprint/fpi-device.c | 27 ---------------------------
3 files changed, 26 insertions(+), 30 deletions(-)
diff --git a/libfprint/fp-device-private.h b/libfprint/fp-device-private.h
index 9b2ea27..759a678 100644
--- a/libfprint/fp-device-private.h
+++ b/libfprint/fp-device-private.h
@@ -111,8 +111,6 @@ typedef struct
GDestroyNotify enroll_progress_destroy;
} FpEnrollData;
-void enroll_data_free (FpEnrollData *enroll_data);
-
typedef struct
{
FpPrint *enrolled_print; /* verify */
@@ -128,7 +126,6 @@ typedef struct
GDestroyNotify match_destroy;
} FpMatchData;
-void match_data_free (FpMatchData *match_data);
void fpi_device_suspend (FpDevice *device);
void fpi_device_resume (FpDevice *device);
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
index 17178d1..c143644 100644
--- a/libfprint/fp-device.c
+++ b/libfprint/fp-device.c
@@ -1088,6 +1088,15 @@ fp_device_resume_finish (FpDevice *device,
return g_task_propagate_boolean (G_TASK (result), error);
}
+static void
+enroll_data_free (FpEnrollData *data)
+{
+ if (data->enroll_progress_destroy)
+ data->enroll_progress_destroy (data->enroll_progress_data);
+ data->enroll_progress_data = NULL;
+ g_clear_object (&data->print);
+ g_free (data);
+}
/**
* fp_device_enroll:
@@ -1217,6 +1226,23 @@ fp_device_enroll_finish (FpDevice *device,
return g_task_propagate_pointer (G_TASK (result), error);
}
+static void
+match_data_free (FpMatchData *data)
+{
+ g_clear_object (&data->print);
+ g_clear_object (&data->match);
+ g_clear_error (&data->error);
+
+ if (data->match_destroy)
+ data->match_destroy (data->match_data);
+ data->match_data = NULL;
+
+ g_clear_object (&data->enrolled_print);
+ g_clear_pointer (&data->gallery, g_ptr_array_unref);
+
+ g_free (data);
+}
+
/**
* fp_device_verify:
* @device: a #FpDevice
diff --git a/libfprint/fpi-device.c b/libfprint/fpi-device.c
index ba75065..1b9fa8f 100644
--- a/libfprint/fpi-device.c
+++ b/libfprint/fpi-device.c
@@ -522,33 +522,6 @@ fpi_device_get_driver_data (FpDevice *device)
return priv->driver_data;
}
-void
-enroll_data_free (FpEnrollData *data)
-{
- if (data->enroll_progress_destroy)
- data->enroll_progress_destroy (data->enroll_progress_data);
- data->enroll_progress_data = NULL;
- g_clear_object (&data->print);
- g_free (data);
-}
-
-void
-match_data_free (FpMatchData *data)
-{
- g_clear_object (&data->print);
- g_clear_object (&data->match);
- g_clear_error (&data->error);
-
- if (data->match_destroy)
- data->match_destroy (data->match_data);
- data->match_data = NULL;
-
- g_clear_object (&data->enrolled_print);
- g_clear_pointer (&data->gallery, g_ptr_array_unref);
-
- g_free (data);
-}
-
/**
* fpi_device_get_enroll_data:
* @device: The #FpDevice
@@ -0,0 +1,81 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Tue, 17 Dec 2019 04:33:20 +0100
Subject: fp-image: Remove config.h inclusion in fpi-header
And also avoid defining a function we expose depending on it's presency.
---
libfprint/fp-image.c | 1 +
libfprint/fpi-image.c | 9 +++++++--
libfprint/fpi-image.h | 3 ---
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/libfprint/fp-image.c b/libfprint/fp-image.c
index f19c5df..8870cfa 100644
--- a/libfprint/fp-image.c
+++ b/libfprint/fp-image.c
@@ -24,6 +24,7 @@
#include "fpi-image.h"
#include "fpi-log.h"
+#include <config.h>
#include <nbis.h>
/**
diff --git a/libfprint/fpi-image.c b/libfprint/fpi-image.c
index b21982e..98f412a 100644
--- a/libfprint/fpi-image.c
+++ b/libfprint/fpi-image.c
@@ -24,6 +24,7 @@
#include "fpi-log.h"
#include <nbis.h>
+#include <config.h>
#ifdef HAVE_PIXMAN
#include <pixman.h>
@@ -107,12 +108,12 @@ fpi_mean_sq_diff_norm (const guint8 *buf1,
return res / size;
}
-#ifdef HAVE_PIXMAN
FpImage *
fpi_image_resize (FpImage *orig_img,
guint w_factor,
guint h_factor)
{
+#ifdef HAVE_PIXMAN
int new_width = orig_img->width * w_factor;
int new_height = orig_img->height * h_factor;
pixman_image_t *orig, *resized;
@@ -145,5 +146,9 @@ fpi_image_resize (FpImage *orig_img,
pixman_image_unref (resized);
return newimg;
-}
+#else
+ fp_err ("Libfprint compiled without pixman support, impossible to resize");
+
+ return g_object_ref (orig_img);
#endif
+}
diff --git a/libfprint/fpi-image.h b/libfprint/fpi-image.h
index fcd62b8..3554bb7 100644
--- a/libfprint/fpi-image.h
+++ b/libfprint/fpi-image.h
@@ -20,7 +20,6 @@
#pragma once
-#include <config.h>
#include "fp-image.h"
/**
@@ -77,8 +76,6 @@ gint fpi_mean_sq_diff_norm (const guint8 *buf1,
const guint8 *buf2,
gint size);
-#if HAVE_PIXMAN
FpImage *fpi_image_resize (FpImage *orig,
guint w_factor,
guint h_factor);
-#endif
@@ -0,0 +1,33 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Thu, 13 Oct 2022 12:03:31 +0200
Subject: fpi-image: Check for PIXMAN presency using #ifdef
That's a defined variable that may be there or not, and currently we
warn with:
- fpi-image.c:29:5: warning: "HAVE_PIXMAN" is not defined, evaluates to 0
---
libfprint/fpi-image.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libfprint/fpi-image.c b/libfprint/fpi-image.c
index 47aac8d..b21982e 100644
--- a/libfprint/fpi-image.c
+++ b/libfprint/fpi-image.c
@@ -25,7 +25,7 @@
#include <nbis.h>
-#if HAVE_PIXMAN
+#ifdef HAVE_PIXMAN
#include <pixman.h>
#endif
@@ -107,7 +107,7 @@ fpi_mean_sq_diff_norm (const guint8 *buf1,
return res / size;
}
-#if HAVE_PIXMAN
+#ifdef HAVE_PIXMAN
FpImage *
fpi_image_resize (FpImage *orig_img,
guint w_factor,
@@ -0,0 +1,19 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Thu, 13 Oct 2022 22:25:23 +0200
Subject: meson: Actually bump the version to 1.94.5
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index e25a173..7bcd978 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
project('libfprint', [ 'c', 'cpp' ],
- version: '1.94.4',
+ version: '1.94.5',
license: 'LGPLv2.1+',
default_options: [
'buildtype=debugoptimized',
+5
View File
@@ -0,0 +1,5 @@
meson-Actually-bump-the-version-to-1.94.5.patch
fp-device-Move-FpDevice-private-functions-to-public-libra.patch
test-device-fake-Add-more-logging-showing-the-current-dev.patch
fpi-image-Check-for-PIXMAN-presency-using-ifdef.patch
fp-image-Remove-config.h-inclusion-in-fpi-header.patch
@@ -0,0 +1,145 @@
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Thu, 13 Oct 2022 19:46:58 +0200
Subject: test-device-fake: Add more logging showing the current device action
---
tests/test-device-fake.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/tests/test-device-fake.c b/tests/test-device-fake.c
index 321bfe5..558ea91 100644
--- a/tests/test-device-fake.c
+++ b/tests/test-device-fake.c
@@ -20,6 +20,7 @@
#define FP_COMPONENT "fake_test_dev"
+#include "fpi-log.h"
#include "test-device-fake.h"
G_DEFINE_TYPE (FpiDeviceFake, fpi_device_fake, FP_TYPE_DEVICE)
@@ -29,12 +30,28 @@ static const FpIdEntry driver_ids[] = {
{ .virtual_envvar = NULL }
};
+static void
+ (debug_action) (FpDevice * device,
+ const gchar *func)
+{
+ g_autofree char *action_str = NULL;
+
+ action_str = g_enum_to_string (FPI_TYPE_DEVICE_ACTION,
+ fpi_device_get_current_action (device));
+
+ fp_dbg ("%s: Device %s in action %s\n",
+ func, fp_device_get_name (device), action_str);
+}
+
+#define debug_action(d) (debug_action) ((d), G_STRFUNC)
+
static void
fpi_device_fake_probe (FpDevice *device)
{
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_probe;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_PROBE);
@@ -55,6 +72,7 @@ fpi_device_fake_open (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_open;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_OPEN);
@@ -72,6 +90,7 @@ fpi_device_fake_close (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_close;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CLOSE);
@@ -90,6 +109,7 @@ fpi_device_fake_enroll (FpDevice *device)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *print = fake_dev->ret_print;
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_enroll;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_ENROLL);
@@ -118,6 +138,7 @@ fpi_device_fake_verify (FpDevice *device)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *print = fake_dev->ret_print;
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_verify;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_VERIFY);
@@ -149,6 +170,7 @@ fpi_device_fake_identify (FpDevice *device)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *match = fake_dev->ret_match;
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_identify;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_IDENTIFY);
@@ -197,6 +219,7 @@ fpi_device_fake_capture (FpDevice *device)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
gboolean wait_for_finger;
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_capture;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CAPTURE);
@@ -216,6 +239,7 @@ fpi_device_fake_list (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_list;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_LIST);
@@ -233,6 +257,7 @@ fpi_device_fake_delete (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_delete;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_DELETE);
@@ -251,6 +276,7 @@ fpi_device_fake_clear_storage (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_clear_storage;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CLEAR_STORAGE);
@@ -268,6 +294,7 @@ fpi_device_fake_cancel (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_cancel;
g_assert_cmpuint (fpi_device_get_current_action (device), !=, FPI_DEVICE_ACTION_NONE);
}
@@ -277,6 +304,7 @@ fpi_device_fake_suspend (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_suspend;
fpi_device_suspend_complete (device, g_steal_pointer (&fake_dev->ret_suspend));
@@ -287,6 +315,7 @@ fpi_device_fake_resume (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
+ debug_action (device);
fake_dev->last_called_function = fpi_device_fake_resume;
fpi_device_resume_complete (device, g_steal_pointer (&fake_dev->ret_resume));