Browse Source

[multiple] use *(unsigned char *) with ctypes

personal/stbuehler/ci-build
Glenn Strauss 2 years ago
parent
commit
446866333f
  1. 2
      src/configparser.y
  2. 6
      src/mod_ssi.c
  3. 6
      src/mod_ssi_expr.c
  4. 4
      src/mod_webdav.c

2
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;

6
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 ... --> */

6
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 ' ':

4
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]);

Loading…
Cancel
Save