Fix warnings: tolower() and similar require uchar
utils.c: In function 'osmo_str2lower':
utils.c:277:3: warning: array subscript has type 'char' [-Wchar-subscripts]
out[i] = tolower(in[i]);
And according to man:
If c is neither an unsigned char value nor EOF, the behavior of these func‐
tions is undefined.
Change-Id: I3fed2ab6a4efba9f8a21fcf84a5b3a91e8df084f
diff --git a/src/utils.c b/src/utils.c
index a1881f0..1c176f8 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -274,7 +274,7 @@
unsigned int i;
for (i = 0; i < strlen(in); i++)
- out[i] = tolower(in[i]);
+ out[i] = tolower((const unsigned char)in[i]);
out[strlen(in)] = '\0';
}
@@ -287,7 +287,7 @@
unsigned int i;
for (i = 0; i < strlen(in); i++)
- out[i] = toupper(in[i]);
+ out[i] = toupper((const unsigned char)in[i]);
out[strlen(in)] = '\0';
}
#endif /* HAVE_CTYPE_H */