Commit 35df0202 authored by Simon Morlat's avatar Simon Morlat

change version number management again

parent 8a5fbaab
SUBDIRS=include src tester
EXTRA_DIST = belle-sip.spec VERSION
EXTRA_DIST = belle-sip.spec
test:
cd tester && $(MAKE) test
......
......@@ -2,11 +2,9 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
m4_ifdef([m4_esyscmd_s],[
AC_INIT([belle-sip], m4_esyscmd_s([cat ./VERSION]), [jehan.monnier@linphone.org])
],[
AC_INIT([belle-sip], m4_esyscmd([echo -n `cat ./VERSION`]), [jehan.monnier@linphone.org])
])
AC_INIT([belle-sip],[1.2.3],[jehan.monnier@linphone.org])
AC_CONFIG_SRCDIR([src/belle_sip_utils.c])
AC_CONFIG_HEADERS([config.h])
......
......@@ -104,6 +104,7 @@ belle_sip_error_code belle_sip_uri_marshal(const belle_sip_uri_t* uri, char* buf
} else {
belle_sip_warning("no host found in this uri");
}
if (uri->port>0) {
error=belle_sip_snprintf(buff,buff_size,offset,":%i",uri->port);
if (error!=BELLE_SIP_OK) return error;
......@@ -111,27 +112,29 @@ belle_sip_error_code belle_sip_uri_marshal(const belle_sip_uri_t* uri, char* buf
{
belle_sip_parameters_t *encparams = belle_sip_parameters_new();
belle_sip_list_for_each2((void*)uri->params.param_list, (void*)encode_params, &encparams->param_list);
belle_sip_list_for_each2(uri->params.param_list, (void (*)(void *, void *))encode_params, &encparams->param_list);
error=belle_sip_parameters_marshal(encparams,buff,buff_size,offset);
belle_sip_object_unref((void*)encparams);
belle_sip_object_unref(encparams);
if (error!=BELLE_SIP_OK) return error;
}
belle_sip_parameters_t *encheaders = belle_sip_parameters_new();
belle_sip_list_for_each2((void*)uri->header_list->param_list, (void*)encode_headers, &encheaders->param_list);
for(list=encheaders->param_list;list!=NULL;list=list->next){
belle_sip_param_pair_t* container = list->data;
if (list == encheaders->param_list) {
//first case
error=belle_sip_snprintf(buff,buff_size,offset,"?%s=%s",container->name,container->value);
} else {
//subsequent headers
error=belle_sip_snprintf(buff,buff_size,offset,"&%s=%s",container->name,container->value);
{
belle_sip_list_t * encheaders = NULL;
belle_sip_list_for_each2(uri->header_list->param_list, (void (*)(void *, void *))encode_headers, &encheaders);
for(list=encheaders;list!=NULL;list=list->next){
belle_sip_param_pair_t* container = list->data;
if (list == encheaders) {
//first case
error=belle_sip_snprintf(buff,buff_size,offset,"?%s=%s",container->name,container->value);
} else {
//subsequent headers
error=belle_sip_snprintf(buff,buff_size,offset,"&%s=%s",container->name,container->value);
}
if (error!=BELLE_SIP_OK) break;
}
if (error!=BELLE_SIP_OK) break;
belle_sip_list_free_with_data(encheaders,(void (*)(void*))belle_sip_param_pair_destroy);
}
belle_sip_object_unref((void*)encheaders);
return error;
}
......
......@@ -565,7 +565,7 @@ belle_sip_param_pair_t* belle_sip_param_pair_new(const char* name,const char* va
void belle_sip_param_pair_destroy(belle_sip_param_pair_t* pair) {
if (pair->name) belle_sip_free(pair->name);
if (pair->value) belle_sip_free(pair->value);
belle_sip_free (pair);
belle_sip_free(pair);
}
int belle_sip_param_pair_comp_func(const belle_sip_param_pair_t *a, const char*b) {
......@@ -772,9 +772,8 @@ void belle_sip_util_copy_headers(belle_sip_message_t *orig, belle_sip_message_t
}
int belle_sip_get_char (const char*a,int n,char*out) {
char result;
unsigned int tmp;
if (*a=='%' && n>2) {
unsigned int tmp;
sscanf(a+1,"%02x",&tmp);
*out=(char)tmp;
return 3;
......@@ -782,19 +781,18 @@ int belle_sip_get_char (const char*a,int n,char*out) {
*out=*a;
return 1;
}
return result;
}
char* belle_sip_to_unescaped_string(const char* buff) {
char output_buff[BELLE_SIP_MAX_TO_STRING_SIZE];
char *output_buff=belle_sip_malloc(strlen(buff)+1);
unsigned int i;
unsigned int out_buff_index=0;
output_buff[BELLE_SIP_MAX_TO_STRING_SIZE-1]='\0';
for(i=0;buff[i]!='\0' &&i<BELLE_SIP_MAX_TO_STRING_SIZE /*to make sure last param can be stored in escaped form*/;) {
i+=belle_sip_get_char(buff+i,3,output_buff+out_buff_index++);
for(i=0; buff[i]!='\0'; out_buff_index++) {
i+=belle_sip_get_char(buff+i,3,output_buff+out_buff_index);
}
output_buff[out_buff_index]='\0';
return belle_sip_strdup(output_buff);
return output_buff;
}
#define BELLE_SIP_NO_ESCAPES_SIZE 257
......@@ -804,9 +802,11 @@ static void noescapes_add_list(char noescapes[BELLE_SIP_NO_ESCAPES_SIZE], const
++allowed;
}
}
static void noescapes_add_range(char noescapes[BELLE_SIP_NO_ESCAPES_SIZE], char first, char last) {
memset(noescapes + (unsigned int)first, 1, last-first+1);
}
static void noescapes_add_alfanums(char noescapes[BELLE_SIP_NO_ESCAPES_SIZE]) {
noescapes_add_range(noescapes, '0', '9');
noescapes_add_range(noescapes, 'A', 'Z');
......
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