summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-03-23 17:40:46 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2020-03-24 20:14:47 -0400
commitb1006b8245c438400bda9e18993ac9cb9a6b5708 (patch)
tree0d9287b770c9512edb7cc7ea9e10a56c7d872f86
parent930dcfdec1f98eeede45acecb935dea5bc918612 (diff)
downloadlighttpd-1.x-personal/gstrauss/master.tar.gz
lighttpd-1.x-personal/gstrauss/master.zip
[multiple] use *(unsigned char *) with ctypespersonal/gstrauss/master
-rw-r--r--src/configparser.y2
-rw-r--r--src/mod_ssi.c6
-rw-r--r--src/mod_ssi_expr.c6
-rw-r--r--src/mod_webdav.c4
4 files changed, 10 insertions, 8 deletions
diff --git a/src/configparser.y b/src/configparser.y
index e3d36c1a..eae39f88 100644
--- a/src/configparser.y
+++ b/src/configparser.y
@@ -331,7 +331,7 @@ value(A) ::= INTEGER(B). {
errno = 0;
((data_integer *)(A))->value = strtol(B->ptr, &endptr, 10);
/* skip trailing whitespace */
- if (endptr != B->ptr) while (isspace(*endptr)) endptr++;
+ if (endptr != B->ptr) while (isspace(*(unsigned char *)endptr)) endptr++;
if (0 != errno || *endptr != '\0') {
fprintf(stderr, "error parsing number: '%s'\n", B->ptr);
ctx->ok = 0;
diff --git a/src/mod_ssi.c b/src/mod_ssi.c
index 2683b5bb..bf379299 100644
--- a/src/mod_ssi.c
+++ b/src/mod_ssi.c
@@ -939,7 +939,7 @@ static int process_ssi_stmt(request_st * const r, handler_ctx * const p, const c
}
-static int mod_ssi_parse_ssi_stmt_value(const char * const s, const int len) {
+static int mod_ssi_parse_ssi_stmt_value(const unsigned char * const s, const int len) {
int n;
const int c = (s[0] == '"' ? '"' : s[0] == '\'' ? '\'' : 0);
if (0 != c) {
@@ -963,7 +963,7 @@ static int mod_ssi_parse_ssi_stmt_value(const char * const s, const int len) {
}
}
-static int mod_ssi_parse_ssi_stmt_offlen(int o[10], const char * const s, const int len) {
+static int mod_ssi_parse_ssi_stmt_offlen(int o[10], const unsigned char * const s, const int len) {
/**
* <!--#element attribute=value attribute=value ... -->
@@ -1021,7 +1021,7 @@ static void mod_ssi_parse_ssi_stmt(request_st * const r, handler_ctx * const p,
int o[10];
int m;
- const int n = mod_ssi_parse_ssi_stmt_offlen(o, s, len);
+ const int n = mod_ssi_parse_ssi_stmt_offlen(o, (unsigned char *)s, len);
char *l[6] = { s, NULL, NULL, NULL, NULL, NULL };
if (-1 == n) {
/* ignore <!--#comment ... --> */
diff --git a/src/mod_ssi_expr.c b/src/mod_ssi_expr.c
index 5e727242..ac27ab00 100644
--- a/src/mod_ssi_expr.c
+++ b/src/mod_ssi_expr.c
@@ -201,9 +201,9 @@ static int ssi_expr_tokenizer(handler_ctx *p,
buffer_copy_string_len(token, t->input + t->offset + 2, i-3);
} else {
- for (i = 1; isalpha(t->input[t->offset + i]) ||
+ for (i = 1; isalpha(((unsigned char *)t->input)[t->offset + i]) ||
t->input[t->offset + i] == '_' ||
- ((i > 1) && isdigit(t->input[t->offset + i])); i++);
+ ((i > 1) && isdigit(((unsigned char *)t->input)[t->offset + i])); i++);
buffer_copy_string_len(token, t->input + t->offset + 1, i-1);
}
@@ -223,7 +223,7 @@ static int ssi_expr_tokenizer(handler_ctx *p,
break;
default:
- for (i = 0; isgraph(t->input[t->offset + i]); i++) {
+ for (i = 0; isgraph(((unsigned char *)t->input)[t->offset + i]); i++) {
char d = t->input[t->offset + i];
switch(d) {
case ' ':
diff --git a/src/mod_webdav.c b/src/mod_webdav.c
index 4ade89b4..2c9b2f3f 100644
--- a/src/mod_webdav.c
+++ b/src/mod_webdav.c
@@ -270,11 +270,13 @@ int mod_webdav_plugin_init(plugin *p) {
strncmp((const char *)(s), (fixed), sizeof(fixed))
#include <ctype.h> /* isupper() tolower() */
+__attribute_noinline__
static void
-webdav_str_len_to_lower (char * const restrict s, const uint32_t len)
+webdav_str_len_to_lower (char * const ss, const uint32_t len)
{
/*(caller must ensure that len not truncated to (int);
* for current intended use, NAME_MAX typically <= 255)*/
+ unsigned char * const restrict s = (unsigned char *)ss;
for (int i = 0; i < (int)len; ++i) {
if (isupper(s[i]))
s[i] = tolower(s[i]);