Commit 587cac86 authored by Simon Morlat's avatar Simon Morlat

automake build updated, fix warnings

parent 8cdc0840
......@@ -134,6 +134,13 @@ void *belle_sip_object_cast(belle_sip_object_t *obj, belle_sip_type_id_t id, con
char* belle_sip_object_to_string(belle_sip_object_t* obj);
unsigned int belle_sip_object_is_instance_of(belle_sip_object_t * obj,belle_sip_type_id_t id);
void *belle_sip_malloc(size_t size);
void *belle_sip_malloc0(size_t size);
void *belle_sip_realloc(void *ptr, size_t size);
void belle_sip_free(void *ptr);
char * belle_sip_strdup(const char *s);
BELLE_SIP_END_DECLS
#define BELLE_SIP_CAST(obj,_type) ((_type*)belle_sip_object_cast((belle_sip_object_t *)(obj), _type##_id, #_type, __FILE__, __LINE__))
......
ANTLR=antlr3
grammar_files= \
$(srcdir)/belle_sip_uri.g \
$(srcdir)/belle_sip_message.g
$(srcdir)/belle_sdp.g
generated_src= \
belle_sip_uriParser.c belle_sip_uriParser.h \
......
......@@ -134,11 +134,7 @@ void belle_sip_fd_source_init(belle_sip_source_t *s, belle_sip_source_func_t fun
extern "C"{
#endif
void *belle_sip_malloc(size_t size);
void *belle_sip_malloc0(size_t size);
void *belle_sip_realloc(void *ptr, size_t size);
void belle_sip_free(void *ptr);
char * belle_sip_strdup(const char *s);
#define belle_sip_new(type) (type*)belle_sip_malloc(sizeof(type))
#define belle_sip_new0(type) (type*)belle_sip_malloc0(sizeof(type))
......@@ -520,7 +516,7 @@ void belle_sip_response_get_return_hop(belle_sip_response_t *msg, belle_sip_hop_
#define IS_TOKEN(token) \
(INPUT->toStringTT(INPUT,LT(1),LT(strlen(#token)))->chars ?\
strcmp(#token,(const char*)(INPUT->toStringTT(INPUT,LT(1),LT(strlen(#token)))->chars)) == 0:0)
char* _belle_sip_str_dup_and_unquote_string(char* quoted_string);
char* _belle_sip_str_dup_and_unquote_string(const char* quoted_string);
#ifdef __cplusplus
}
......
This diff is collapsed.
......@@ -470,7 +470,7 @@ int belle_sip_param_pair_comp_func(const belle_sip_param_pair_t *a, const char*b
return strcmp(a->name,b);
}
char* _belle_sip_str_dup_and_unquote_string(char* quoted_string) {
char* _belle_sip_str_dup_and_unquote_string(const char* quoted_string) {
size_t value_size = strlen(quoted_string);
char* unquoted_string = belle_sip_malloc0(value_size-2+1);
strncpy(unquoted_string,quoted_string+1,value_size-2);
......
......@@ -9,7 +9,7 @@ belle_sip_tester_SOURCES= belle_sip_tester.c \
cast_test_SOURCES=cast_test.c
INCLUDES=-I$(top_srcdir)/include
INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/src
LDADD=$(top_builddir)/src/libbellesip.la -lcunit
......
......@@ -34,23 +34,23 @@ static void check_uri_and_headers(belle_sip_message_t* message) {
CU_ASSERT_PTR_NOT_NULL(belle_sip_request_get_uri(BELLE_SIP_REQUEST(message)));
}
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"From"));
BELLE_SIP_HEADER_FROM(belle_sip_message_get_header(message,"From"));
CU_ASSERT_PTR_NOT_NULL(BELLE_SIP_HEADER_FROM(belle_sip_message_get_header(message,"From")));
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"To"));
BELLE_SIP_HEADER_TO(belle_sip_message_get_header(message,"To"));
CU_ASSERT_PTR_NOT_NULL(BELLE_SIP_HEADER_TO(belle_sip_message_get_header(message,"To")));
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"CSeq"));
BELLE_SIP_HEADER_CSEQ(belle_sip_message_get_header(message,"CSeq"));
CU_ASSERT_PTR_NOT_NULL(BELLE_SIP_HEADER_CSEQ(belle_sip_message_get_header(message,"CSeq")));
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Via"));
BELLE_SIP_HEADER_VIA(belle_sip_message_get_header(message,"Via"));
CU_ASSERT_PTR_NOT_NULL(BELLE_SIP_HEADER_VIA(belle_sip_message_get_header(message,"Via")));
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Call-ID"));
BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header(message,"Call-ID"));
CU_ASSERT_PTR_NOT_NULL(BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header(message,"Call-ID")));
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Content-Length"));
BELLE_SIP_HEADER_CONTENT_LENGTH(belle_sip_message_get_header(message,"Content-Length"));
CU_ASSERT_PTR_NOT_NULL(BELLE_SIP_HEADER_CONTENT_LENGTH(belle_sip_message_get_header(message,"Content-Length")));
}
......@@ -147,9 +147,10 @@ static void testRegisterRaw(void) {
belle_sip_request_t* request = BELLE_SIP_REQUEST(message);
CU_ASSERT_STRING_EQUAL(belle_sip_request_get_method(request),"REGISTER");
CU_ASSERT_PTR_NOT_NULL(belle_sip_request_get_uri(request));
CU_ASSERT_STRING_EQUAL(belle_sip_message_get_body(request),"123456789");
CU_ASSERT_STRING_EQUAL(belle_sip_message_get_body(message),"123456789");
}
static void testOptionMessage(void) {
const char* raw_message = "REGISTER sip:192.168.0.20 SIP/2.0\r\n"\
"Via: SIP/2.0/UDP 192.168.1.8:5062;rport;branch=z9hG4bK1439638806\r\n"\
......@@ -188,6 +189,10 @@ int belle_sip_message_test_suite () {
if (NULL == CU_add_test(pSuite, "test of invite message", testInviteMessage)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test of options message", testOptionMessage)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test of register raw message", testRegisterRaw)) {
return CU_get_error();
}
......
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