Commit 7d8450e5 authored by Marco Trevisan's avatar Marco Trevisan Committed by Bastien Nocera
Browse files

device: Mark fingers names array as const and use unique name

With the stronger warnings enabled when building with meson, we get a
warning for all the fingers definitions:

  ../src/device.c:38:24: warning: initialization discards ‘const’ qualifier
  from pointer target type [-Wdiscarded-qualifiers]
    38 |  [FP_FINGER_UNKNOWN] = "unknown",

As the `fingers` array name was shadowed in another file:

  ../src/device.c:1000:11: warning: declaration of ‘fingers’ shadows a
  global declaration [-Wshadow]
    1000 |   GSList *fingers, *finger;
parent 95e95d29
......@@ -34,7 +34,7 @@
#include "fprintd.h"
#include "storage.h"
static char *fingers[] = {
static const char *FINGERS_NAMES[] = {
[FP_FINGER_UNKNOWN] = "unknown",
......@@ -298,7 +298,7 @@ finger_num_to_name (int finger_num)
return "any";
if (!FP_FINGER_IS_VALID (finger_num))
return NULL;
return fingers[finger_num];
return FINGERS_NAMES[finger_num];
static int
......@@ -310,7 +310,7 @@ finger_name_to_num (const char *finger_name)
return -1;
for (i = FP_FINGER_FIRST; i <= FP_FINGER_LAST; i++) {
if (g_str_equal (finger_name, fingers[i]))
if (g_str_equal (finger_name, FINGERS_NAMES[i]))
return i;
Supports Markdown
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