This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgHello Max, Neels Hofmeyr, Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/2963
to look at the new patch set (#2).
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
---
M src/gsm/gsm_utils.c
M src/logging.c
M src/utils.c
3 files changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/63/2963/2
diff --git a/src/gsm/gsm_utils.c b/src/gsm/gsm_utils.c
index 9cb5df6..ab7defa 100644
--- a/src/gsm/gsm_utils.c
+++ b/src/gsm/gsm_utils.c
@@ -595,7 +595,7 @@
/*! \brief Parse string name of a GSM band */
enum gsm_band gsm_band_parse(const char* mhz)
{
- while (*mhz && !isdigit(*mhz))
+ while (*mhz && !isdigit((unsigned char)*mhz))
mhz++;
if (*mhz == '\0')
diff --git a/src/logging.c b/src/logging.c
index 3b3dd05..0128eda 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -847,7 +847,7 @@
char name[name_len];
for (j = 0; j < name_len; j++)
- name[j] = tolower(info->cat[i].name[j]);
+ name[j] = tolower((unsigned char)info->cat[i].name[j]);
name[name_len-1] = '\0';
ret = snprintf(str + offset, rem, "%s|", name+1);
@@ -869,7 +869,7 @@
char loglevel_str[loglevel_str_len];
for (j = 0; j < loglevel_str_len; j++)
- loglevel_str[j] = tolower(loglevel_strs[i].str[j]);
+ loglevel_str[j] = tolower((unsigned char)loglevel_strs[i].str[j]);
loglevel_str[loglevel_str_len-1] = '\0';
ret = snprintf(str + offset, rem, "%s|", loglevel_str);
diff --git a/src/utils.c b/src/utils.c
index 6392918..d05dc15 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -275,7 +275,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';
}
@@ -288,7 +288,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 */
--
To view, visit https://gerrit.osmocom.org/2963
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3fed2ab6a4efba9f8a21fcf84a5b3a91e8df084f
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>