diff options
-rw-r--r-- | include/afb-req-itf.h | 4 | ||||
-rw-r--r-- | src/afb-hreq.c | 12 | ||||
-rw-r--r-- | src/afb-hreq.h | 4 | ||||
-rw-r--r-- | src/afb-ws-json.c | 4 |
4 files changed, 12 insertions, 12 deletions
diff --git a/include/afb-req-itf.h b/include/afb-req-itf.h index df133f5c..111b1d53 100644 --- a/include/afb-req-itf.h +++ b/include/afb-req-itf.h @@ -31,7 +31,7 @@ struct afb_req_itf { void (*success)(void *req_closure, struct json_object *obj, const char *info); void (*fail)(void *req_closure, const char *status, const char *info); const char *(*raw)(void *req_closure, size_t *size); - void (*send)(void *req_closure, char *buffer, size_t size); + void (*send)(void *req_closure, const char *buffer, size_t size); void *(*context_get)(void *ctx_closure); void (*context_set)(void *ctx_closure, void *context, void (*free_context)(void*)); int (*session_create)(void *req_closure); @@ -80,7 +80,7 @@ static inline const char *afb_req_raw(struct afb_req req, size_t *size) return req.itf->raw(req.req_closure, size); } -static inline void afb_req_send(struct afb_req req, char *buffer, size_t size) +static inline void afb_req_send(struct afb_req req, const char *buffer, size_t size) { req.itf->send(req.req_closure, buffer, size); } diff --git a/src/afb-hreq.c b/src/afb-hreq.c index 6b7d64be..cc12da59 100644 --- a/src/afb-hreq.c +++ b/src/afb-hreq.c @@ -68,7 +68,7 @@ static struct afb_arg req_get(struct afb_hreq *hreq, const char *name); static void req_fail(struct afb_hreq *hreq, const char *status, const char *info); static void req_success(struct afb_hreq *hreq, json_object *obj, const char *info); static const char *req_raw(struct afb_hreq *hreq, size_t *size); -static void req_send(struct afb_hreq *hreq, char *buffer, size_t size); +static void req_send(struct afb_hreq *hreq, const char *buffer, size_t size); static int req_session_create(struct afb_hreq *hreq); static int req_session_check(struct afb_hreq *hreq, int refresh); static void req_session_close(struct afb_hreq *hreq); @@ -194,19 +194,19 @@ void afb_hreq_reply_empty(struct afb_hreq *hreq, unsigned status, ...) va_end(args); } -void afb_hreq_reply_static(struct afb_hreq *hreq, unsigned status, size_t size, char *buffer, ...) +void afb_hreq_reply_static(struct afb_hreq *hreq, unsigned status, size_t size, const char *buffer, ...) { va_list args; va_start(args, buffer); - afb_hreq_reply_v(hreq, status, MHD_create_response_from_buffer((unsigned)size, buffer, MHD_RESPMEM_PERSISTENT), args); + afb_hreq_reply_v(hreq, status, MHD_create_response_from_buffer((unsigned)size, (char*)buffer, MHD_RESPMEM_PERSISTENT), args); va_end(args); } -void afb_hreq_reply_copy(struct afb_hreq *hreq, unsigned status, size_t size, char *buffer, ...) +void afb_hreq_reply_copy(struct afb_hreq *hreq, unsigned status, size_t size, const char *buffer, ...) { va_list args; va_start(args, buffer); - afb_hreq_reply_v(hreq, status, MHD_create_response_from_buffer((unsigned)size, buffer, MHD_RESPMEM_MUST_COPY), args); + afb_hreq_reply_v(hreq, status, MHD_create_response_from_buffer((unsigned)size, (char*)buffer, MHD_RESPMEM_MUST_COPY), args); va_end(args); } @@ -661,7 +661,7 @@ static const char *req_raw(struct afb_hreq *hreq, size_t *size) return result; } -static void req_send(struct afb_hreq *hreq, char *buffer, size_t size) +static void req_send(struct afb_hreq *hreq, const char *buffer, size_t size) { afb_hreq_reply_free(hreq, MHD_HTTP_OK, size, buffer, NULL); } diff --git a/src/afb-hreq.h b/src/afb-hreq.h index a8df015e..82e6b65a 100644 --- a/src/afb-hreq.h +++ b/src/afb-hreq.h @@ -73,9 +73,9 @@ extern struct AFB_clientCtx *afb_hreq_context(struct afb_hreq *hreq); extern int afb_hreq_init_cookie(int port, const char *path, int maxage); -extern void afb_hreq_reply_static(struct afb_hreq *hreq, unsigned status, size_t size, char *buffer, ...); +extern void afb_hreq_reply_static(struct afb_hreq *hreq, unsigned status, size_t size, const char *buffer, ...); -extern void afb_hreq_reply_copy(struct afb_hreq *hreq, unsigned status, size_t size, char *buffer, ...); +extern void afb_hreq_reply_copy(struct afb_hreq *hreq, unsigned status, size_t size, const char *buffer, ...); extern void afb_hreq_reply_free(struct afb_hreq *hreq, unsigned status, size_t size, char *buffer, ...); diff --git a/src/afb-ws-json.c b/src/afb-ws-json.c index 9387f8d7..e1347f14 100644 --- a/src/afb-ws-json.c +++ b/src/afb-ws-json.c @@ -142,7 +142,7 @@ static struct afb_arg wsreq_get(struct afb_wsreq *wsreq, const char *name); static void wsreq_fail(struct afb_wsreq *wsreq, const char *status, const char *info); static void wsreq_success(struct afb_wsreq *wsreq, struct json_object *obj, const char *info); static const char *wsreq_raw(struct afb_wsreq *wsreq, size_t *size); -static void wsreq_send(struct afb_wsreq *wsreq, char *buffer, size_t size); +static void wsreq_send(struct afb_wsreq *wsreq, const char *buffer, size_t size); static int wsreq_session_create(struct afb_wsreq *wsreq); static int wsreq_session_check(struct afb_wsreq *wsreq, int refresh); static void wsreq_session_close(struct afb_wsreq *wsreq); @@ -427,7 +427,7 @@ static const char *wsreq_raw(struct afb_wsreq *wsreq, size_t *size) return wsreq->obj; } -static void wsreq_send(struct afb_wsreq *wsreq, char *buffer, size_t size) +static void wsreq_send(struct afb_wsreq *wsreq, const char *buffer, size_t size) { afb_ws_text(wsreq->aws->ws, buffer, size); } |