examples: Port enroll and verify examples to new storage

This ports the enroll and verify examples to the new storage so that
they do not need any deprecated API anymore.
This commit is contained in:
Benjamin Berg 2019-06-13 15:10:59 +02:00 committed by Benjamin Berg
parent a9600e23a1
commit 16875d7776
2 changed files with 7 additions and 9 deletions

View file

@ -24,6 +24,8 @@
#include <libfprint/fprint.h> #include <libfprint/fprint.h>
#include "storage.h"
struct fp_dscv_dev *discover_device(struct fp_dscv_dev **discovered_devs) struct fp_dscv_dev *discover_device(struct fp_dscv_dev **discovered_devs)
{ {
struct fp_dscv_dev *ddev = discovered_devs[0]; struct fp_dscv_dev *ddev = discovered_devs[0];
@ -142,10 +144,7 @@ int main(void)
if (!data) if (!data)
goto out_close; goto out_close;
#pragma GCC diagnostic push r = print_data_save(data, RIGHT_INDEX);
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
r = fp_print_data_save(data, RIGHT_INDEX);
#pragma GCC diagnostic pop
if (r < 0) if (r < 0)
fprintf(stderr, "Data save failed, code %d\n", r); fprintf(stderr, "Data save failed, code %d\n", r);

View file

@ -24,6 +24,8 @@
#include <libfprint/fprint.h> #include <libfprint/fprint.h>
#include "storage.h"
struct fp_dscv_dev *discover_device(struct fp_dscv_dev **discovered_devs) struct fp_dscv_dev *discover_device(struct fp_dscv_dev **discovered_devs)
{ {
struct fp_dscv_dev *ddev = discovered_devs[0]; struct fp_dscv_dev *ddev = discovered_devs[0];
@ -117,11 +119,8 @@ int main(void)
printf("Opened device. Loading previously enrolled right index finger " printf("Opened device. Loading previously enrolled right index finger "
"data...\n"); "data...\n");
#pragma GCC diagnostic push data = print_data_load(dev, RIGHT_INDEX);
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" if (!data) {
r = fp_print_data_load(dev, RIGHT_INDEX, &data);
#pragma GCC diagnostic pop
if (r != 0) {
fprintf(stderr, "Failed to load fingerprint, error %d\n", r); fprintf(stderr, "Failed to load fingerprint, error %d\n", r);
fprintf(stderr, "Did you remember to enroll your right index finger " fprintf(stderr, "Did you remember to enroll your right index finger "
"first?\n"); "first?\n");