Commit 7aeebbb8 authored by Ronan's avatar Ronan

fix(BodyHandler): belle_sip_multipart_body_handler_new_from_buffer use now a...

fix(BodyHandler): belle_sip_multipart_body_handler_new_from_buffer use now a const void* parameter instead of void* (buffer is not modified after all)
parent baf24e3c
......@@ -45,7 +45,7 @@ BELLESIP_EXPORT size_t belle_sip_body_handler_get_transfered_size(const belle_si
#define BELLE_SIP_MEMORY_BODY_HANDLER(obj) BELLE_SIP_CAST(obj,belle_sip_memory_body_handler_t)
BELLESIP_EXPORT belle_sip_memory_body_handler_t *belle_sip_memory_body_handler_new(belle_sip_body_handler_progress_callback_t progress_cb, void *data);
BELLESIP_EXPORT belle_sip_memory_body_handler_t *belle_sip_memory_body_handler_new_copy_from_buffer(const void *buffer, size_t bufsize,
BELLESIP_EXPORT belle_sip_memory_body_handler_t *belle_sip_memory_body_handler_new_copy_from_buffer(const void *buffer, size_t bufsize,
belle_sip_body_handler_progress_callback_t cb, void *user_data);
BELLESIP_EXPORT belle_sip_memory_body_handler_t *belle_sip_memory_body_handler_new_from_buffer(void *buffer, size_t bufsize,
belle_sip_body_handler_progress_callback_t cb, void *user_data);
......@@ -95,7 +95,7 @@ BELLESIP_EXPORT void belle_sip_file_body_handler_set_user_body_handler(belle_sip
#define BELLE_SIP_MULTIPART_BODY_HANDLER(obj) BELLE_SIP_CAST(obj,belle_sip_multipart_body_handler_t)
BELLESIP_EXPORT belle_sip_multipart_body_handler_t *belle_sip_multipart_body_handler_new(belle_sip_body_handler_progress_callback_t progress_cb, void *data, belle_sip_body_handler_t *first_part, const char *boundary);
BELLESIP_EXPORT belle_sip_multipart_body_handler_t *belle_sip_multipart_body_handler_new_from_buffer(void *buffer, size_t bufsize, const char *boundary);
BELLESIP_EXPORT belle_sip_multipart_body_handler_t *belle_sip_multipart_body_handler_new_from_buffer(const void *buffer, size_t bufsize, const char *boundary);
BELLESIP_EXPORT void belle_sip_multipart_body_handler_add_part(belle_sip_multipart_body_handler_t *obj, belle_sip_body_handler_t *part);
BELLESIP_EXPORT const belle_sip_list_t* belle_sip_multipart_body_handler_get_parts(const belle_sip_multipart_body_handler_t *obj);
......
......@@ -543,7 +543,7 @@ static void belle_sip_file_body_handler_begin_recv_transfer(belle_sip_body_handl
if (!obj->file) {
bctbx_error("Can't open file %s", obj->filepath);
}
if (obj->user_bh && obj->user_bh->start_cb) {
obj->user_bh->start_cb((belle_sip_user_body_handler_t*)&(obj->user_bh->base), obj->user_bh->base.user_data);
}
......@@ -566,11 +566,11 @@ static void belle_sip_file_body_handler_begin_send_transfer(belle_sip_body_handl
static void belle_sip_file_body_handler_end_transfer(belle_sip_body_handler_t *base) {
belle_sip_file_body_handler_t *obj = (belle_sip_file_body_handler_t *)base;
if (obj->user_bh && obj->user_bh->stop_cb) {
obj->user_bh->stop_cb((belle_sip_user_body_handler_t*)&(obj->user_bh->base), obj->user_bh->base.user_data);
}
if (obj->file) {
ssize_t ret;
ret = bctbx_file_close(obj->file);
......@@ -586,11 +586,11 @@ static void belle_sip_file_body_handler_recv_chunk(belle_sip_body_handler_t *bas
ssize_t ret;
if (obj->file == NULL) return;
if (obj->user_bh && obj->user_bh->recv_cb) {
obj->user_bh->recv_cb((belle_sip_user_body_handler_t*)&(obj->user_bh->base), msg, obj->user_bh->base.user_data, offset, buf, size);
}
ret = bctbx_file_write(obj->file, buf, size, offset);
if (ret == BCTBX_VFS_ERROR) {
bctbx_error("File body handler recv write error at offset %lu", (unsigned long)offset);
......@@ -609,12 +609,12 @@ static int belle_sip_file_body_handler_send_chunk(belle_sip_body_handler_t *base
return BELLE_SIP_STOP;
}
*size = (size_t)size_t_ret;
if (obj->user_bh && obj->user_bh->send_cb) {
int result = obj->user_bh->send_cb((belle_sip_user_body_handler_t*)&(obj->user_bh->base), msg, obj->user_bh->base.user_data, offset, buf, size);
if (result == BELLE_SIP_STOP) return result;
}
return (((obj->base.expected_size - offset) == (size_t)size_t_ret) || (*size == 0)) ? BELLE_SIP_STOP : BELLE_SIP_CONTINUE;
}
......@@ -823,7 +823,7 @@ belle_sip_multipart_body_handler_t *belle_sip_multipart_body_handler_new(belle_s
return obj;
}
belle_sip_multipart_body_handler_t *belle_sip_multipart_body_handler_new_from_buffer(void *buffer, size_t bufsize, const char *boundary) {
belle_sip_multipart_body_handler_t *belle_sip_multipart_body_handler_new_from_buffer(const void *buffer, size_t bufsize, const char *boundary) {
belle_sip_multipart_body_handler_t *obj_multipart = belle_sip_object_new(belle_sip_multipart_body_handler_t);
belle_sip_body_handler_t *obj = (belle_sip_body_handler_t *)obj_multipart;
belle_sip_body_handler_init((belle_sip_body_handler_t *)obj, belle_sip_multipart_body_handler_progress_cb, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment