summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-09-11 19:27:56 +0200
committercgzones <cgzones@googlemail.com>2020-09-17 22:03:24 +0200
commit8a849bc85a1d59ffc77e6bff1aa3da2d4bcd746c (patch)
tree6c9b11a31534d493ead2ce107fb927421a9696df
parent1f5bd5c4c84c53915bcdd68398e77269fe26328c (diff)
Call character checking function with unsigned char
See https://wiki.sei.cmu.edu/confluence/display/c/STR37-C.+Arguments+to+character-handling+functions+must+be+representable+as+an+unsigned+char
-rw-r--r--AvailableColumnsPanel.c2
-rw-r--r--CategoriesPanel.c2
-rw-r--r--ColumnsPanel.c2
-rw-r--r--IncSet.c2
-rw-r--r--MainPanel.c2
-rw-r--r--Panel.c2
6 files changed, 6 insertions, 6 deletions
diff --git a/AvailableColumnsPanel.c b/AvailableColumnsPanel.c
index 8aedde24..0d9749e7 100644
--- a/AvailableColumnsPanel.c
+++ b/AvailableColumnsPanel.c
@@ -45,7 +45,7 @@ static HandlerResult AvailableColumnsPanel_eventHandler(Panel* super, int ch) {
}
default:
{
- if (ch < 255 && isalpha(ch))
+ if (0 < ch && ch < 255 && isalpha((unsigned char)ch))
result = Panel_selectByTyping(super, ch);
break;
}
diff --git a/CategoriesPanel.c b/CategoriesPanel.c
index 8a1e16df..c12b3905 100644
--- a/CategoriesPanel.c
+++ b/CategoriesPanel.c
@@ -81,7 +81,7 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
break;
}
default:
- if (ch < 255 && isalpha(ch))
+ if (0 < ch && ch < 255 && isalpha((unsigned char)ch))
result = Panel_selectByTyping(super, ch);
if (result == BREAK_LOOP)
result = IGNORED;
diff --git a/ColumnsPanel.c b/ColumnsPanel.c
index 587175c8..318c7af8 100644
--- a/ColumnsPanel.c
+++ b/ColumnsPanel.c
@@ -91,7 +91,7 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) {
}
default:
{
- if (ch < 255 && isalpha(ch))
+ if (0 < ch && ch < 255 && isalpha((unsigned char)ch))
result = Panel_selectByTyping(super, ch);
if (result == BREAK_LOOP)
result = IGNORED;
diff --git a/IncSet.c b/IncSet.c
index e9e28934..b9a1d92d 100644
--- a/IncSet.c
+++ b/IncSet.c
@@ -137,7 +137,7 @@ bool IncSet_handleKey(IncSet* this, int ch, Panel* panel, IncMode_GetPanelValue
if (size == 0) return true;
IncMode_find(mode, panel, getPanelValue, 1);
doSearch = false;
- } else if (ch < 255 && isprint((char)ch)) {
+ } else if (0 < ch && ch < 255 && isprint((unsigned char)ch)) {
if (mode->index < INCMODE_MAX) {
mode->buffer[mode->index] = ch;
mode->index++;
diff --git a/MainPanel.c b/MainPanel.c
index eb7e663d..4390dad6 100644
--- a/MainPanel.c
+++ b/MainPanel.c
@@ -79,7 +79,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
} else if (ch != ERR && ch > 0 && ch < KEY_MAX && this->keys[ch]) {
reaction |= (this->keys[ch])(this->state);
result = HANDLED;
- } else if (isdigit(ch)) {
+ } else if (0 < ch && ch < 255 && isdigit((unsigned char)ch)) {
MainPanel_pidSearch(this, ch);
} else {
if (ch != ERR) {
diff --git a/Panel.c b/Panel.c
index b77483d9..315f3887 100644
--- a/Panel.c
+++ b/Panel.c
@@ -411,7 +411,7 @@ HandlerResult Panel_selectByTyping(Panel* this, int ch) {
this->eventHandlerState = xCalloc(100, sizeof(char));
char* buffer = this->eventHandlerState;
- if (ch > 0 && ch < 255 && isalnum(ch)) {
+ if (0 < ch && ch < 255 && isalnum((unsigned char)ch)) {
int len = strlen(buffer);
if (len < 99) {
buffer[len] = ch;

© 2014-2024 Faster IT GmbH | imprint | privacy policy