aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cookie.c4
-rw-r--r--src/file.c5
-rw-r--r--src/loadfiles.c10
-rw-r--r--src/multipart.c6
-rw-r--r--src/param.c6
-rw-r--r--src/parse.c4
-rw-r--r--src/request.c2
-rw-r--r--src/response.c6
8 files changed, 23 insertions, 20 deletions
diff --git a/src/cookie.c b/src/cookie.c
index ebca599..c6a4956 100644
--- a/src/cookie.c
+++ b/src/cookie.c
@@ -17,8 +17,8 @@ void magi_cookies_free(struct magi_cookies *cookies)
}
}
-void magi_cookies_add(struct magi_cookies **cookies,
- struct magi_cookie *newitem)
+void magi_cookies_add(struct magi_cookies **cookies,
+ const struct magi_cookie *newitem)
{
struct magi_cookies *node = malloc(sizeof(*node));
if (node) {
diff --git a/src/file.c b/src/file.c
index 30b085c..b3727f1 100644
--- a/src/file.c
+++ b/src/file.c
@@ -4,7 +4,8 @@
#include <string.h>
-void magi_files_add(struct magi_files **files, struct magi_file *newitem)
+void magi_files_add(struct magi_files **files,
+ const struct magi_file *newitem)
{
struct magi_files *node = malloc(sizeof(*node));
if (node) {
@@ -15,7 +16,7 @@ void magi_files_add(struct magi_files **files, struct magi_file *newitem)
}
const struct magi_file *magi_files_get(const struct magi_files *files,
- const char *name)
+ const char *name)
{
if (!files || !name) {
return 0;
diff --git a/src/loadfiles.c b/src/loadfiles.c
index 963e351..49cf503 100644
--- a/src/loadfiles.c
+++ b/src/loadfiles.c
@@ -34,11 +34,11 @@ void magi_loadfiles_free(struct magi_loadfiles *table)
table->count = 0;
}
-static void loadfiles_callback(void *userdata,
- int newfile,
- struct magi_file *file,
- char *addon,
- int addon_len)
+static void loadfiles_callback(void *userdata,
+ int newfile,
+ const struct magi_file *file,
+ const char *addon,
+ int addon_len)
{
int pos;
struct magi_loadfiles *table = userdata;
diff --git a/src/multipart.c b/src/multipart.c
index a412603..75cbc25 100644
--- a/src/multipart.c
+++ b/src/multipart.c
@@ -124,7 +124,7 @@ static int param_end(struct automata *a)
a->newfile, &a->file, a->buf, a->buf_size);
a->request->callback.act(a->request->callback.userdata,
0, &a->file, 0, 0);
- a->newfile = 1;
+ a->newfile = 1;
a->readed -= a->buf_size;
a->buf_size = 0;
magi_files_add(&a->request->files, &a->file);
@@ -215,7 +215,7 @@ static void apply_callback(struct automata *a)
if (a->file.filename && full) {
a->request->callback.act(a->request->callback.userdata,
a->newfile, &a->file, a->buf, a->buf_size);
- a->newfile = 0;
+ a->newfile = 0;
a->readed -= a->buf_size;
a->buf_size = 0;
}
@@ -270,7 +270,7 @@ static void *data_add(struct automata *a, char c)
*/
static void *state_begin(struct automata *a, char c)
{
- if (sepget(a) != c) { /* 'c' is not wanted character from separator; */
+ if (sepget(a) != c) { /* c is not wanted character from separator; */
a->boundary_pos = 0; /* so nullify progress in reading separator. */
} else {
a->boundary_pos++;
diff --git a/src/param.c b/src/param.c
index 5854231..adc2b8b 100644
--- a/src/param.c
+++ b/src/param.c
@@ -4,7 +4,8 @@
#include <string.h>
-void magi_params_add(struct magi_params **params, struct magi_param *newitem)
+void magi_params_add(struct magi_params **params,
+ const struct magi_param *newitem)
{
struct magi_params *node = malloc(sizeof(*node));
if (node) {
@@ -14,7 +15,8 @@ void magi_params_add(struct magi_params **params, struct magi_param *newitem)
}
}
-void magi_params_set(struct magi_params **params, struct magi_param *newitem)
+void magi_params_set(struct magi_params **params,
+ const struct magi_param *newitem)
{
if (!*params) {
magi_params_add(params, newitem);
diff --git a/src/parse.c b/src/parse.c
index fa8b54a..0ca1cd9 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -164,7 +164,7 @@ static int next(void *userdata)
if (last) {
free(buffer);
buffer = 0;
- return EOF;
+ return EOF;
}
left = fread(buffer, 1, size, stdin);
last = left != size;
@@ -203,7 +203,7 @@ int magi_parse_body(struct magi_request *request)
char *boundary = bound(t);
if (boundary && *boundary) {
magi_parse_multipart(request, boundary, next,
- &request->limits.read_buffer);
+ &request->limits.read_buffer);
} else {
*e = magi_error_nobound;
}
diff --git a/src/request.c b/src/request.c
index e957889..d401e67 100644
--- a/src/request.c
+++ b/src/request.c
@@ -13,7 +13,7 @@ void magi_request_init(struct magi_request *request)
request->limits.params_meta = 0;
request->limits.params_head = 0;
request->limits.params_body = 0;
- request->limits.read_buffer = 65536;
+ request->limits.read_buffer = 65536;
}
}
diff --git a/src/response.c b/src/response.c
index 43da57e..8809837 100644
--- a/src/response.c
+++ b/src/response.c
@@ -25,7 +25,7 @@ static void response_headers(struct magi_params *p)
}
}
-void magi_response_send(struct magi_response *r)
+void magi_response_send(const struct magi_response *r)
{
response_headers(r->head_response);
response_headers(r->head_general);
@@ -94,8 +94,8 @@ void magi_response_cookie(struct magi_response *r,
magi_params_add(&r->head_general, &addon);
}
-void magi_response_cookie_complex(struct magi_response *r,
- struct magi_cookie *c)
+void magi_response_cookie_complex(struct magi_response *r,
+ const struct magi_cookie *c)
{
char *pointer;
struct magi_param addon;