mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
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;
This commit is contained in:
committed by
Bastien Nocera
parent
95e95d2910
commit
7d8450e5ab
@ -34,7 +34,7 @@
|
||||
#include "fprintd.h"
|
||||
#include "storage.h"
|
||||
|
||||
static char *fingers[] = {
|
||||
static const char *FINGERS_NAMES[] = {
|
||||
[FP_FINGER_UNKNOWN] = "unknown",
|
||||
"left-thumb",
|
||||
"left-index-finger",
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user