Hi Jonas,
On 10/26/2018 05:13 AM, Jonas Bonn wrote:
From: Jonas Bonn <[email protected]>
Addresses following warning:
src/simutil.c:1546:12: error: comparison of constant 8 with expression
of type
'enum sim_cphs_service' is always false
[-Werror,-Wtautological-constant-out-of-range-compare]
if (index >= 2 * 4u)
This is clang right?
---
src/simutil.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/simutil.c b/src/simutil.c
index 9287df17..7f0e316e 100644
--- a/src/simutil.c
+++ b/src/simutil.c
@@ -1543,9 +1543,6 @@ gboolean sim_sst_is_active(unsigned char *efsst, unsigned
char len,
gboolean sim_cphs_is_active(unsigned char *cphs, enum sim_cphs_service index)
{
- if (index >= 2 * 4u)
- return FALSE;
-
This is where gcc & clang give differing advice. In theory there's
nothing preventing index from being any value up to
MAX_UCHAR/MAX_USHRT/MAX_UINT depending on what the compiler chooses to
represent enums as.
return ((cphs[index / 4] >> ((index % 4) * 2)) & 3) == 3;
}
Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono