mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-15 16:39:14 +00:00
Thu May 22 10:38:06 EDT 2008 Pekka.Pessi@nokia.com
* msg_parser.c: fixed klocwork issues git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8636 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
9915a97a17
commit
f816f01efe
@ -1 +1 @@
|
|||||||
Sun May 25 11:20:57 EDT 2008
|
Sun May 25 11:21:21 EDT 2008
|
||||||
|
@ -1312,8 +1312,8 @@ issize_t msg_extract_payload(msg_t *msg, msg_pub_t *mo,
|
|||||||
char b[], isize_t bsiz,
|
char b[], isize_t bsiz,
|
||||||
int eos)
|
int eos)
|
||||||
{
|
{
|
||||||
msg_mclass_t const *mc = msg->m_class;
|
msg_mclass_t const *mc;
|
||||||
msg_href_t const *hr = mc->mc_payload;
|
msg_href_t const *hr;
|
||||||
msg_header_t *h, *h0;
|
msg_header_t *h, *h0;
|
||||||
msg_payload_t *pl;
|
msg_payload_t *pl;
|
||||||
char *x;
|
char *x;
|
||||||
@ -1322,6 +1322,8 @@ issize_t msg_extract_payload(msg_t *msg, msg_pub_t *mo,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
assert(!msg->m_chunk);
|
assert(!msg->m_chunk);
|
||||||
|
mc = msg->m_class;
|
||||||
|
hr = mc->mc_payload;
|
||||||
|
|
||||||
if (return_payload == NULL)
|
if (return_payload == NULL)
|
||||||
return_payload = &h0;
|
return_payload = &h0;
|
||||||
@ -1334,7 +1336,7 @@ issize_t msg_extract_payload(msg_t *msg, msg_pub_t *mo,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
append_parsed(msg, mo, hr, h, 0);
|
append_parsed(msg, mo, hr, h, 0);
|
||||||
pl = h->sh_payload;
|
pl = (msg_payload_t*)h;
|
||||||
*return_payload = h;
|
*return_payload = h;
|
||||||
|
|
||||||
if (bsiz >= body_len) {
|
if (bsiz >= body_len) {
|
||||||
@ -1832,9 +1834,15 @@ char *msg_as_string(su_home_t *home, msg_t *msg, msg_pub_t *pub, int flags,
|
|||||||
else
|
else
|
||||||
bsiz = used + n + 1;
|
bsiz = used + n + 1;
|
||||||
|
|
||||||
|
if (bsiz < msg_min_size) {
|
||||||
|
errno = ENOMEM;
|
||||||
|
su_free(home, b);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
b2 = su_realloc(home, b, bsiz);
|
b2 = su_realloc(home, b, bsiz);
|
||||||
|
|
||||||
if (b2 == NULL || bsiz < msg_min_size) {
|
if (b2 == NULL) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
su_free(home, b);
|
su_free(home, b);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1896,7 +1904,7 @@ int msg_serialize(msg_t *msg, msg_pub_t *pub)
|
|||||||
msg_header_t **separator;
|
msg_header_t **separator;
|
||||||
msg_header_t **payload;
|
msg_header_t **payload;
|
||||||
msg_header_t **multipart;
|
msg_header_t **multipart;
|
||||||
msg_mclass_t const *mc = msg->m_class;
|
msg_mclass_t const *mc;
|
||||||
msg_header_t **tail, ***ptail;
|
msg_header_t **tail, ***ptail;
|
||||||
|
|
||||||
if (!msg)
|
if (!msg)
|
||||||
@ -1914,6 +1922,7 @@ int msg_serialize(msg_t *msg, msg_pub_t *pub)
|
|||||||
|
|
||||||
serialize_first(msg, h);
|
serialize_first(msg, h);
|
||||||
|
|
||||||
|
mc = msg->m_class;
|
||||||
separator = (msg_header_t **)((char *)pub + mc->mc_separator->hr_offset);
|
separator = (msg_header_t **)((char *)pub + mc->mc_separator->hr_offset);
|
||||||
payload = (msg_header_t **)((char *)pub + mc->mc_payload->hr_offset);
|
payload = (msg_header_t **)((char *)pub + mc->mc_payload->hr_offset);
|
||||||
if (mc->mc_multipart->hr_class)
|
if (mc->mc_multipart->hr_class)
|
||||||
@ -2115,13 +2124,14 @@ void msg_insert_chain(msg_t *msg,
|
|||||||
msg_header_t **head,
|
msg_header_t **head,
|
||||||
msg_header_t *h)
|
msg_header_t *h)
|
||||||
{
|
{
|
||||||
msg_mclass_t const *mc = msg->m_class;
|
msg_mclass_t const *mc;
|
||||||
msg_header_t **hh;
|
msg_header_t **hh;
|
||||||
msg_header_t **separator;
|
msg_header_t **separator;
|
||||||
msg_header_t **payload;
|
msg_header_t **payload;
|
||||||
|
|
||||||
assert(msg && pub && head && h);
|
assert(msg && pub && head && h);
|
||||||
|
|
||||||
|
mc = msg->m_class;
|
||||||
separator = (msg_header_t **)((char *)pub + mc->mc_separator->hr_offset);
|
separator = (msg_header_t **)((char *)pub + mc->mc_separator->hr_offset);
|
||||||
payload = (msg_header_t **)((char *)pub + mc->mc_payload->hr_offset);
|
payload = (msg_header_t **)((char *)pub + mc->mc_payload->hr_offset);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user