Tue May 20 09:32:10 EDT 2008 Pekka.Pessi@nokia.com

* sip_mime.c: use msg_content_type functions with sip_content_type


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8613 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-05-25 13:56:27 +00:00
parent 951cdf55aa
commit 6a54b3ec07
2 changed files with 7 additions and 44 deletions

View File

@ -1 +1 @@
Sun May 25 09:55:22 EDT 2008
Sun May 25 09:56:21 EDT 2008

View File

@ -554,46 +554,18 @@ SIP_HEADER_CLASS(content_type, "Content-Type", "c", c_params,
issize_t sip_content_type_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
{
sip_content_type_t *c;
assert(h);
c = h->sh_content_type;
/* "Content-type:" type/subtyp *(; parameter))) */
if (/* Parse protocol */
sip_version_d(&s, &c->c_type) == -1 || /* compacts token / token */
(c->c_subtype = strchr(c->c_type, '/')) == NULL ||
(*s == ';' && msg_params_d(home, &s, &c->c_params) == -1) ||
(*s != '\0'))
return -1;
c->c_subtype++;
return 0;
return msg_content_type_d(home, (msg_header_t *)h, s, slen);
}
issize_t sip_content_type_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
{
char *b0 = b, *end = b + bsiz;
sip_content_type_t const *c = h->sh_content_type;
MSG_STRING_E(b, end, c->c_type);
MSG_PARAMS_E(b, end, c->c_params, flags);
MSG_TERM_E(b, end);
return b - b0;
return msg_content_type_e(b, bsiz, (msg_header_t const *)h, flags);
}
static
isize_t sip_content_type_dup_xtra(sip_header_t const *h, isize_t offset)
{
sip_content_type_t const *c = h->sh_content_type;
MSG_PARAMS_SIZE(offset, c->c_params);
offset += MSG_STRING_SIZE(c->c_type);
return offset;
return msg_content_type_dup_xtra((msg_header_t *)h, offset);
}
/** Duplicate one #sip_content_type_t object */
@ -601,18 +573,9 @@ static
char *sip_content_type_dup_one(sip_header_t *dst, sip_header_t const *src,
char *b, isize_t xtra)
{
sip_content_type_t *c = dst->sh_content_type;
sip_content_type_t const *o = src->sh_content_type;
char *end = b + xtra;
b = msg_params_dup(&c->c_params, o->c_params, b, xtra);
MSG_STRING_DUP(b, c->c_type, o->c_type);
c->c_subtype = strchr(c->c_type, '/');
c->c_subtype++;
assert(b <= end); (void)end;
return b;
return msg_content_type_dup_one((msg_header_t *)dst,
(msg_header_t const *)src,
b, xtra);
}
/* ====================================================================== */