Fix compiler warnings regarding const modifiers
This commit is contained in:
+1
-1
@@ -132,7 +132,7 @@ int http_parse_header_field(http_hdr *hdr, const char *buf, const char *end_ptr,
|
||||
if (hdr->last_field_num > list_size(hdr->fields))
|
||||
return http_error(HTTP_ERROR_GENERAL);
|
||||
|
||||
char *pos1 = (char *) buf, *pos2 = (char *) end_ptr;
|
||||
const char *pos1 = buf, *pos2 = end_ptr;
|
||||
if (buf[0] == ' ' || buf[0] == '\t') {
|
||||
if (hdr->last_field_num == -1)
|
||||
return http_error(HTTP_ERROR_GENERAL);
|
||||
|
||||
+4
-4
@@ -211,13 +211,13 @@ int proxy_request_header(http_req *req, sock *sock) {
|
||||
if (forwarded == NULL) {
|
||||
http_add_header_field(&req->hdr, "X-Forwarded-Host", http_get_header_field(&req->hdr, "Host"));
|
||||
} else {
|
||||
char *ptr = strchr(forwarded, ',');
|
||||
const char *ptr = strchr(forwarded, ',');
|
||||
unsigned long len;
|
||||
if (ptr != NULL) len = ptr - forwarded;
|
||||
else len = strlen(forwarded);
|
||||
ptr = strstr(forwarded, "host=");
|
||||
if ((ptr - forwarded) < len) {
|
||||
char *end = strchr(ptr, ';');
|
||||
const char *end = strchr(ptr, ';');
|
||||
if (end == NULL) len -= (ptr - forwarded);
|
||||
else len = (end - ptr);
|
||||
len -= 5;
|
||||
@@ -233,13 +233,13 @@ int proxy_request_header(http_req *req, sock *sock) {
|
||||
if (forwarded == NULL) {
|
||||
http_add_header_field(&req->hdr, "X-Forwarded-Proto", sock->enc ? "https" : "http");
|
||||
} else {
|
||||
char *ptr = strchr(forwarded, ',');
|
||||
const char *ptr = strchr(forwarded, ',');
|
||||
unsigned long len;
|
||||
if (ptr != NULL) len = ptr - forwarded;
|
||||
else len = strlen(forwarded);
|
||||
ptr = strstr(forwarded, "proto=");
|
||||
if ((ptr - forwarded) < len) {
|
||||
char *end = strchr(ptr, ';');
|
||||
const char *end = strchr(ptr, ';');
|
||||
if (end == NULL) len -= (ptr - forwarded);
|
||||
else len = (end - ptr);
|
||||
len -= 6;
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ int path_exists(const char *path) {
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mode) {
|
||||
int uri_init(http_uri *uri, const char *webroot, char *uri_str, int dir_mode) {
|
||||
char buf0[1024], buf1[1024], buf2[1024], buf3[1024], buf4[1024];
|
||||
int p_len;
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ typedef struct {
|
||||
} http_uri;
|
||||
|
||||
|
||||
int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mode);
|
||||
int uri_init(http_uri *uri, const char *webroot, char *uri_str, int dir_mode);
|
||||
|
||||
int uri_init_cache(http_uri *uri);
|
||||
|
||||
|
||||
+2
-2
@@ -193,7 +193,7 @@ int strcpy_rem_webroot(char *dst, const char *src, const char *webroot) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int str_trim(char **start, char **end) {
|
||||
int str_trim(const char **start, const char **end) {
|
||||
if (start == NULL || end == NULL || *start == NULL || *end == NULL)
|
||||
return -1;
|
||||
|
||||
@@ -204,7 +204,7 @@ int str_trim(char **start, char **end) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int str_trim_lws(char **start, char **end) {
|
||||
int str_trim_lws(const char **start, const char **end) {
|
||||
if (start == NULL || end == NULL || *start == NULL || *end == NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
+2
-2
@@ -33,9 +33,9 @@ int mime_is_text(const char *restrict type);
|
||||
|
||||
int strcpy_rem_webroot(char *dst, const char *str, const char *webroot);
|
||||
|
||||
int str_trim(char **start, char **end);
|
||||
int str_trim(const char **start, const char **end);
|
||||
|
||||
int str_trim_lws(char **start, char **end);
|
||||
int str_trim_lws(const char **start, const char **end);
|
||||
|
||||
int streq(const char *restrict str1, const char *restrict str2);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void local_handler_func(client_ctx_t *ctx) {
|
||||
static int range_handler(client_ctx_t *ctx) {
|
||||
char buf[64];
|
||||
long num0, num1, num2;
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
int mode;
|
||||
const char *range = http_get_header_field(&ctx->req.hdr, "Range");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user