From 70c17d62d495c582a266bbba2a6513734b1ef6d4 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Sat, 1 Aug 2009 00:52:00 +0000 Subject: Minor changes inspired by testing with latest GCC. The latest GCC (what will become 4.5.x) has a few new warnings, that in these cases found some either downright buggy code, or at least seriously poorly designed code that could be improved. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@209759 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/misdn/ie.c | 2 +- channels/misdn/isdn_lib.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'channels') diff --git a/channels/misdn/ie.c b/channels/misdn/ie.c index 2e7fae998..1b9c799e4 100644 --- a/channels/misdn/ie.c +++ b/channels/misdn/ie.c @@ -242,7 +242,7 @@ static void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *c if (p[0] <= octet) goto done; - if (!p[octet++] & 0x80) + if (~p[octet++] & 0x80) goto l2; /* Wheee. V.110 speed information */ diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c index aef8936d9..f675798be 100644 --- a/channels/misdn/isdn_lib.c +++ b/channels/misdn/isdn_lib.c @@ -1906,9 +1906,7 @@ handle_event_nt(void *dat, void *arg) case CC_SETUP|INDICATION: { struct misdn_bchannel* bc=misdn_lib_get_free_bc(stack->port, 0, 1, 0); - if (!bc) - ERR_NO_CHANNEL: - { + if (!bc) { msg_t *dmsg; cb_log(4, stack->port, "Patch from MEIDANIS:Sending RELEASE_COMPLETE %x (No free Chan for you..)\n", hh->dinfo); dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST,MT_RELEASE_COMPLETE, hh->dinfo,sizeof(RELEASE_COMPLETE_t), 1); @@ -2106,8 +2104,15 @@ handle_event_nt(void *dat, void *arg) if (bc->channel<=0 || bc->channel==0xff) bc->channel=0; - if (find_free_chan_in_stack(stack,bc, bc->channel,0)<0) - goto ERR_NO_CHANNEL; + if (find_free_chan_in_stack(stack,bc, bc->channel,0)<0) { + msg_t *dmsg; + cb_log(4, stack->port, "Patch from MEIDANIS:Sending RELEASE_COMPLETE %x (No free Chan for you..)\n", hh->dinfo); + dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST,MT_RELEASE_COMPLETE, hh->dinfo,sizeof(RELEASE_COMPLETE_t), 1); + pthread_mutex_lock(&stack->nstlock); + stack->nst.manager_l3(&stack->nst, dmsg); + free_msg(msg); + return 0; + } break; case EVENT_RELEASE: case EVENT_RELEASE_COMPLETE: -- cgit v1.2.3