Commit 64a97bd3 authored by Simon Morlat's avatar Simon Morlat
Browse files

add belle_sip_message_assign_body()

parent 73b5a36e
......@@ -106,9 +106,10 @@ BELLESIP_EXPORT void belle_sip_message_remove_header(belle_sip_message_t *msg, c
BELLESIP_EXPORT char *belle_sip_message_to_string(belle_sip_message_t *msg);
BELLESIP_EXPORT const char* belle_sip_message_get_body(belle_sip_message_t *msg);
BELLESIP_EXPORT void belle_sip_message_set_body(belle_sip_message_t *msg,const char* body,unsigned int size);
/*message keep ownership of the null terminated body buffer
void belle_sip_message_assign_body(belle_sip_message_t *msg,char* body);*/
BELLESIP_EXPORT void belle_sip_message_assign_body(belle_sip_message_t *msg, char* body, unsigned int size);
BELLESIP_EXPORT int belle_sip_response_get_status_code(const belle_sip_response_t *response);
BELLESIP_EXPORT void belle_sip_response_set_status_code(belle_sip_response_t *response,int status);
......
......@@ -372,16 +372,18 @@ void belle_sip_message_set_body(belle_sip_message_t *msg, const char* body, unsi
}
if (body){
msg->body = belle_sip_malloc(size+1);
msg->body_length=size;
memcpy(msg->body,body,size);
msg->body[size]='\0';
}
}
void belle_sip_message_assign_body(belle_sip_message_t *msg, char* body) {
void belle_sip_message_assign_body(belle_sip_message_t *msg, char* body, unsigned int size) {
if (msg->body) {
belle_sip_free((void*)body);
belle_sip_free(body);
}
msg->body = body;
msg->body_length = size;
}
struct _belle_sip_response{
......
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