Index: addons/chan_mobile.c =================================================================== --- addons/chan_mobile.c (revision 228266) +++ addons/chan_mobile.c (working copy) @@ -2319,7 +2319,7 @@ { char cmd[10]; - switch(digit) { + switch (digit) { case '0': case '1': case '2': @@ -4113,7 +4113,7 @@ ast_debug(1, "Reading configuration for device %s.\n", cat); adapter_str = ast_variable_retrieve(cfg, cat, "adapter"); - if(ast_strlen_zero(adapter_str)) { + if (ast_strlen_zero(adapter_str)) { ast_log(LOG_ERROR, "Skipping device %s. No adapter specified.\n", cat); goto e_return; } Index: addons/chan_ooh323.c =================================================================== --- addons/chan_ooh323.c (revision 228266) +++ addons/chan_ooh323.c (working copy) @@ -394,7 +394,7 @@ ch->priority = 1; - if(!ast_test_flag(i, H323_OUTGOING)) { + if (!ast_test_flag(i, H323_OUTGOING)) { if (!ast_strlen_zero(i->caller_h323id)) { pbx_builtin_setvar_helper(ch, "_CALLER_H323ID", i->caller_h323id); @@ -435,7 +435,7 @@ ast_log(LOG_WARNING, "Unable to allocate channel structure\n"); - if(ch) ast_channel_unlock(ch); + if (ch) ast_channel_unlock(ch); if (gH323Debug) ast_verbose("+++ h323_new\n"); @@ -654,7 +654,7 @@ } else { ast_mutex_lock(&p->lock); p->callToken = (char*)ast_malloc(AST_MAX_EXTENSION); - if(!p->callToken) + if (!p->callToken) { ast_mutex_unlock(&p->lock); ast_mutex_lock(&iflock); @@ -887,17 +887,17 @@ ast_mutex_lock(&p->lock); ast_set_flag(p, H323_OUTGOING); if (ast->connected.id.number) { - if(p->callerid_num) free(p->callerid_num); + if (p->callerid_num) free(p->callerid_num); p->callerid_num = strdup(ast->connected.id.number); } if (ast->connected.id.name) { - if(p->callerid_name) + if (p->callerid_name) free(p->callerid_name); p->callerid_name = strdup(ast->connected.id.name); } else { ast->connected.id.name = strdup(gCallerID); - if(p->callerid_name) + if (p->callerid_name) free(p->callerid_name); p->callerid_name = strdup(ast->connected.id.name); } @@ -911,7 +911,7 @@ if ((val = pbx_builtin_getvar_helper(ast, "CALLER_H323DIALEDDIGITS"))) { ast_copy_string(p->caller_dialedDigits, val, sizeof(p->caller_dialedDigits)); - if(!p->callerid_num) + if (!p->callerid_num) p->callerid_num = strdup(val); } @@ -936,7 +936,7 @@ for (i=0;i<480 && !isRunning(p->callToken);i++) usleep(12000); - if(OO_TESTFLAG(p->flags, H323_DISABLEGK)) { + if (OO_TESTFLAG(p->flags, H323_DISABLEGK)) { res = ooRunCall(destination, p->callToken, AST_MAX_EXTENSION, &opts); } else { res = ooRunCall(destination, p->callToken, AST_MAX_EXTENSION, NULL); @@ -1463,7 +1463,7 @@ p = find_call(call); - if(!p) { + if (!p) { ast_log(LOG_ERROR, "No matching call found\n"); return -1; } @@ -1506,7 +1506,7 @@ p = find_call(call); - if(!p) { + if (!p) { ast_log(LOG_ERROR, "No matching call found\n"); return -1; } @@ -1622,18 +1622,18 @@ } ast_copy_string(p->caller_h323id, alias->value, sizeof(p->caller_h323id)); } - else if(alias->type == T_H225AliasAddress_dialedDigits) + else if (alias->type == T_H225AliasAddress_dialedDigits) { - if(!p->callerid_num) + if (!p->callerid_num) p->callerid_num = strdup(alias->value); ast_copy_string(p->caller_dialedDigits, alias->value, sizeof(p->caller_dialedDigits)); } - else if(alias->type == T_H225AliasAddress_email_ID) + else if (alias->type == T_H225AliasAddress_email_ID) { ast_copy_string(p->caller_email, alias->value, sizeof(p->caller_email)); } - else if(alias->type == T_H225AliasAddress_url_ID) + else if (alias->type == T_H225AliasAddress_url_ID) { ast_copy_string(p->caller_url, alias->value, sizeof(p->caller_url)); } @@ -1641,15 +1641,15 @@ } number[0] = '\0'; - if(ooCallGetCalledPartyNumber(call, number, OO_MAX_NUMBER_LENGTH)== OO_OK) { + if (ooCallGetCalledPartyNumber(call, number, OO_MAX_NUMBER_LENGTH)== OO_OK) { strncpy(p->exten, number, sizeof(p->exten)-1); } else { update_our_aliases(call, p); if (!ast_strlen_zero(p->callee_dialedDigits)) { ast_copy_string(p->exten, p->callee_dialedDigits, sizeof(p->exten)); - } else if(!ast_strlen_zero(p->callee_h323id)) { + } else if (!ast_strlen_zero(p->callee_h323id)) { ast_copy_string(p->exten, p->callee_h323id, sizeof(p->exten)); - } else if(!ast_strlen_zero(p->callee_email)) { + } else if (!ast_strlen_zero(p->callee_email)) { ast_copy_string(p->exten, p->callee_email, sizeof(p->exten)); if ((at = strchr(p->exten, '@'))) { *at = '\0'; @@ -1664,7 +1664,7 @@ } user = find_user(p->callerid_name, call->remoteIP); - if(user && (user->incominglimit == 0 || user->inUse < user->incominglimit)) { + if (user && (user->incominglimit == 0 || user->inUse < user->incominglimit)) { ast_mutex_lock(&user->lock); p->username = strdup(user->name); p->neighbor.user = user->mUseIP ? ast_strdup(user->mIP) : @@ -1706,7 +1706,7 @@ /* Incoming call */ c = ooh323_new(p, AST_STATE_RING, p->username, 0, NULL); - if(!c) { + if (!c) { ast_mutex_unlock(&p->lock); ast_log(LOG_ERROR, "Could not create ast_channel\n"); return -1; @@ -1744,13 +1744,13 @@ if (!ast_strlen_zero(p->callerid_num)) { i = 0; while (*(p->callerid_num + i) != '\0') { - if(!isdigit(*(p->callerid_num+i))) { break; } + if (!isdigit(*(p->callerid_num+i))) { break; } i++; } - if(*(p->callerid_num+i) == '\0') + if (*(p->callerid_num+i) == '\0') ooCallSetCallingPartyNumber(call, p->callerid_num); else { - if(!p->callerid_name) + if (!p->callerid_name) ooCallSetCallerId(call, p->callerid_num); } } @@ -1820,13 +1820,13 @@ if (p->callerid_num) { i = 0; while (*(p->callerid_num + i) != '\0') { - if(!isdigit(*(p->callerid_num+i))) { break; } + if (!isdigit(*(p->callerid_num+i))) { break; } i++; } - if(*(p->callerid_num+i) == '\0') + if (*(p->callerid_num+i) == '\0') ooCallSetCallingPartyNumber(call, p->callerid_num); else { - if(!p->callerid_name) + if (!p->callerid_name) ooCallSetCallerId(call, p->callerid_num); } } @@ -1893,7 +1893,7 @@ return -1; } - if(ast_test_flag(p, H323_OUTGOING)) { + if (ast_test_flag(p, H323_OUTGOING)) { ast_mutex_lock(&p->lock); if (!p->owner) { ast_mutex_unlock(&p->lock); @@ -1954,7 +1954,7 @@ } } - if(p->owner) { + if (p->owner) { p->owner->tech_pvt = NULL; ast_channel_unlock(p->owner); p->owner = NULL; @@ -2020,24 +2020,24 @@ if (peer) { cur = peerl.peers; ast_mutex_lock(&peerl.lock); - while(cur) { - if(cur==peer) break; + while (cur) { + if (cur==peer) break; prev = cur; cur = cur->next; } if (cur) { - if(prev) + if (prev) prev->next = cur->next; else peerl.peers = cur->next; } ast_mutex_unlock(&peerl.lock); - if(peer->h323id) free(peer->h323id); - if(peer->email) free(peer->email); - if(peer->url) free(peer->url); - if(peer->e164) free(peer->e164); + if (peer->h323id) free(peer->h323id); + if (peer->email) free(peer->email); + if (peer->url) free(peer->url); + if (peer->e164) free(peer->e164); free(peer); } @@ -2218,7 +2218,7 @@ ast_copy_string(peer->accountcode, v->value, sizeof(peer->accountcode)); } else if (!strcasecmp(v->name, "rtptimeout")) { peer->rtptimeout = atoi(v->value); - if(peer->rtptimeout < 0) + if (peer->rtptimeout < 0) peer->rtptimeout = gRTPTimeout; } else if (!strcasecmp(v->name, "rtpmask")) { if ((peer->rtpmask = malloc(sizeof(struct OOH323Regex))) && @@ -2661,7 +2661,7 @@ peer = peerl.peers; while (peer) { ast_mutex_lock(&peer->lock); - if(!strcmp(peer->name, a->argv[3])) + if (!strcmp(peer->name, a->argv[3])) break; else { prev = peer; @@ -2803,7 +2803,7 @@ user = userl.users; while (user) { ast_mutex_lock(&user->lock); - if(!strcmp(user->name, a->argv[3])) { + if (!strcmp(user->name, a->argv[3])) { break; } else { prev = user; @@ -2887,7 +2887,7 @@ ast_mutex_lock(&userl.lock); user = userl.users; - while(user) + while (user) { ast_mutex_lock(&user->lock); ast_cli(a->fd, FORMAT1, user->name, @@ -3025,7 +3025,7 @@ ast_cli(a->fd, "%-20s%s\n", "AMA flags: ", ast_cdr_flags2str(gAMAFLAGS)); pAlias = gAliasList; - if(pAlias) { + if (pAlias) { ast_cli(a->fd, "%-20s\n", "Aliases: "); } while (pAlias) { @@ -3130,7 +3130,7 @@ ooH323EpSetLocalAddress(gIP, gPort); ooH323EpSetCallerID(gCallerID); - if(ooH323EpSetTCPPortRange(ooconfig.mTCPPortStart, + if (ooH323EpSetTCPPortRange(ooconfig.mTCPPortStart, ooconfig.mTCPPortEnd) == OO_FAILED) { ast_log(LOG_ERROR, "h225portrange: Failed to set range\n"); } @@ -3155,10 +3155,10 @@ ast_mutex_lock(&peerl.lock); peer = peerl.peers; while (peer) { - if(peer->h323id) ooH323EpAddAliasH323ID(peer->h323id); - if(peer->email) ooH323EpAddAliasEmailID(peer->email); - if(peer->e164) ooH323EpAddAliasDialedDigits(peer->e164); - if(peer->url) ooH323EpAddAliasURLID(peer->url); + if (peer->h323id) ooH323EpAddAliasH323ID(peer->h323id); + if (peer->email) ooH323EpAddAliasEmailID(peer->email); + if (peer->e164) ooH323EpAddAliasDialedDigits(peer->e164); + if (peer->url) ooH323EpAddAliasURLID(peer->url); peer = peer->next; } ast_mutex_unlock(&peerl.lock); @@ -3383,7 +3383,7 @@ /* Unlink us from the owner if we have one */ if (cur->owner) { - while(ast_channel_trylock(cur->owner)) { + while (ast_channel_trylock(cur->owner)) { ast_debug(1,"Failed to grab lock, trying again\n"); DEADLOCK_AVOIDANCE(&cur->lock); } @@ -3401,10 +3401,10 @@ /* decrement user/peer count */ - if(!ast_test_flag(cur, H323_OUTGOING)) { + if (!ast_test_flag(cur, H323_OUTGOING)) { if (cur->neighbor.user) { user = find_user(p->callerid_name, cur->neighbor.user); - if(user && user->inUse > 0) { + if (user && user->inUse > 0) { ast_mutex_lock(&user->lock); user->inUse--; ast_mutex_unlock(&user->lock); @@ -3437,11 +3437,11 @@ cur = cur->next; ast_mutex_destroy(&prev->lock); - if(prev->h323id) free(prev->h323id); - if(prev->email) free(prev->email); - if(prev->url) free(prev->url); - if(prev->e164) free(prev->e164); - if(prev->rtpmask) { + if (prev->h323id) free(prev->h323id); + if (prev->email) free(prev->email); + if (prev->url) free(prev->url); + if (prev->e164) free(prev->e164); + if (prev->rtpmask) { ast_mutex_lock(&prev->rtpmask->lock); prev->rtpmask->inuse--; ast_mutex_unlock(&prev->rtpmask->lock); @@ -3472,7 +3472,7 @@ cur = cur->next; ast_mutex_destroy(&prev->lock); - if(prev->rtpmask) { + if (prev->rtpmask) { ast_mutex_lock(&prev->rtpmask->lock); prev->rtpmask->inuse--; ast_mutex_unlock(&prev->rtpmask->lock); @@ -3836,7 +3836,7 @@ ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp), p->rtp, 2, "audio", "G726-32", AST_RTP_OPT_G726_NONSTANDARD); - if(gH323Debug) + if (gH323Debug) ast_verbose("+++ setup_rtp_connection\n"); return; @@ -3846,7 +3846,7 @@ { struct ooh323_pvt *p = NULL; - if(gH323Debug) + if (gH323Debug) ast_verbose("--- close_rtp_connection\n"); p = find_call(call); @@ -3861,7 +3861,7 @@ } ast_mutex_unlock(&p->lock); - if(gH323Debug) + if (gH323Debug) ast_verbose("+++ close_rtp_connection\n"); return; @@ -3956,7 +3956,7 @@ ast_channel_unlock(p->owner); ast_mutex_unlock(&p->lock); - if(gH323Debug) + if (gH323Debug) ast_verbose("+++ setup_udptl_connection\n"); return; @@ -3966,7 +3966,7 @@ { struct ooh323_pvt *p = NULL; - if(gH323Debug) + if (gH323Debug) ast_verbose("--- close_udptl_connection\n"); p = find_call(call); @@ -4002,7 +4002,7 @@ ast_channel_unlock(p->owner); ast_mutex_unlock(&p->lock); - if(gH323Debug) + if (gH323Debug) ast_verbose("+++ close_udptl_connection\n"); return; Index: addons/format_mp3.c =================================================================== --- addons/format_mp3.c (revision 228266) +++ addons/format_mp3.c (working copy) @@ -118,12 +118,12 @@ p->lastseek = ftell(s->f); p->sbuflen = fread(p->sbuf, 1, MP3_SCACHE, s->f); - if(p->sbuflen < 0) { + if (p->sbuflen < 0) { ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", p->sbuflen, strerror(errno)); return -1; } res = decodeMP3(&p->mp,p->sbuf,p->sbuflen,p->dbuf,MP3_DCACHE,&p->dbuflen); - if(res != MP3_OK) + if (res != MP3_OK) return -1; p->sbuflen -= p->dbuflen; p->dbufoffset = 0; @@ -135,7 +135,7 @@ struct mp3_private *p = s->_private; int res=0; - if((res = decodeMP3(&p->mp,NULL,0,p->dbuf,MP3_DCACHE,&p->dbuflen)) == MP3_OK) { + if ((res = decodeMP3(&p->mp,NULL,0,p->dbuf,MP3_DCACHE,&p->dbuflen)) == MP3_OK) { p->sbuflen -= p->dbuflen; p->dbufoffset = 0; } @@ -147,37 +147,37 @@ struct mp3_private *p = s->_private; int res = 0, bytes = 0; - if(p->seek) { + if (p->seek) { ExitMP3(&p->mp); InitMP3(&p->mp, OUTSCALE); fseek(s->f, 0, SEEK_SET); p->sbuflen = p->dbuflen = p->offset = 0; - while(p->offset < p->seek) { - if(mp3_squeue(s)) + while (p->offset < p->seek) { + if (mp3_squeue(s)) return -1; - while(p->offset < p->seek && ((res = mp3_dqueue(s))) == MP3_OK) { - for(bytes = 0 ; bytes < p->dbuflen ; bytes++) { + while (p->offset < p->seek && ((res = mp3_dqueue(s))) == MP3_OK) { + for (bytes = 0 ; bytes < p->dbuflen ; bytes++) { p->dbufoffset++; p->offset++; - if(p->offset >= p->seek) + if (p->offset >= p->seek) break; } } - if(res == MP3_ERR) + if (res == MP3_ERR) return -1; } p->seek = 0; return 0; } - if(p->dbuflen == 0) { - if(p->sbuflen) { + if (p->dbuflen == 0) { + if (p->sbuflen) { res = mp3_dqueue(s); - if(res == MP3_ERR) + if (res == MP3_ERR) return -1; } - if(! p->sbuflen || res != MP3_OK) { - if(mp3_squeue(s)) + if (! p->sbuflen || res != MP3_OK) { + if (mp3_squeue(s)) return -1; } @@ -195,22 +195,22 @@ /* Send a frame from the file to the appropriate channel */ - if(mp3_queue(s)) + if (mp3_queue(s)) return NULL; - if(p->dbuflen) { - for(p->buflen=0; p->buflen < MP3_BUFLEN && p->buflen < p->dbuflen; p->buflen++) { + if (p->dbuflen) { + for (p->buflen=0; p->buflen < MP3_BUFLEN && p->buflen < p->dbuflen; p->buflen++) { s->buf[p->buflen + AST_FRIENDLY_OFFSET] = p->dbuf[p->buflen+p->dbufoffset]; p->sbufoffset++; } p->dbufoffset += p->buflen; p->dbuflen -= p->buflen; - if(p->buflen < MP3_BUFLEN) { - if(mp3_queue(s)) + if (p->buflen < MP3_BUFLEN) { + if (mp3_queue(s)) return NULL; - for(save = p->buflen; p->buflen < MP3_BUFLEN; p->buflen++) { + for (save = p->buflen; p->buflen < MP3_BUFLEN; p->buflen++) { s->buf[p->buflen + AST_FRIENDLY_OFFSET] = p->dbuf[(p->buflen-save)+p->dbufoffset]; p->sbufoffset++; } Index: addons/mp3/common.c =================================================================== --- addons/mp3/common.c (revision 228266) +++ addons/mp3/common.c (working copy) @@ -45,7 +45,7 @@ { alloc_0, alloc_1, alloc_2, alloc_3 , alloc_4 }; static int sblims[5] = { 27 , 30 , 8, 12 , 30 }; - if(fr->lsf) + if (fr->lsf) table = 4; else table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index]; @@ -61,13 +61,13 @@ #if 0 int head_check(unsigned long head) { - if( (head & 0xffe00000) != 0xffe00000) + if ( (head & 0xffe00000) != 0xffe00000) return FALSE; - if(!((head>>17)&3)) + if (!((head>>17)&3)) return FALSE; - if( ((head>>12)&0xf) == 0xf) + if ( ((head>>12)&0xf) == 0xf) return FALSE; - if( ((head>>10)&0x3) == 0x3 ) + if ( ((head>>10)&0x3) == 0x3 ) return FALSE; return TRUE; } @@ -80,7 +80,7 @@ */ int decode_header(struct frame *fr,unsigned long newhead) { - if( newhead & (1<<20) ) { + if ( newhead & (1<<20) ) { fr->lsf = (newhead & (1<<19)) ? 0x0 : 0x1; fr->mpeg25 = 0; } @@ -90,18 +90,18 @@ } fr->lay = 4-((newhead>>17)&3); - if( ((newhead>>10)&0x3) == 0x3) { + if ( ((newhead>>10)&0x3) == 0x3) { ast_log(LOG_WARNING,"Stream error\n"); return (0); } - if(fr->mpeg25) { + if (fr->mpeg25) { fr->sampling_frequency = 6 + ((newhead>>10)&0x3); } else fr->sampling_frequency = ((newhead>>10)&0x3) + (fr->lsf*3); fr->error_protection = ((newhead>>16)&0x1)^0x1; - if(fr->mpeg25) /* allow Bitrate change for 2.5 ... */ + if (fr->mpeg25) /* allow Bitrate change for 2.5 ... */ fr->bitrate_index = ((newhead>>12)&0xf); fr->bitrate_index = ((newhead>>12)&0xf); @@ -115,13 +115,13 @@ fr->stereo = (fr->mode == MPG_MD_MONO) ? 1 : 2; - if(!fr->bitrate_index) + if (!fr->bitrate_index) { ast_log(LOG_WARNING,"Free format not supported.\n"); return (0); } - switch(fr->lay) + switch (fr->lay) { case 1: #if 0 @@ -151,14 +151,14 @@ case 3: #if 0 fr->do_layer = do_layer3; - if(fr->lsf) + if (fr->lsf) ssize = (fr->stereo == 1) ? 9 : 17; else ssize = (fr->stereo == 1) ? 17 : 32; #endif #if 0 - if(fr->error_protection) + if (fr->error_protection) ssize += 2; #endif fr->framesize = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000; @@ -208,7 +208,7 @@ { unsigned long rval; - if(!number_of_bits) + if (!number_of_bits) return 0; { Index: addons/mp3/decode_i386.c =================================================================== --- addons/mp3/decode_i386.c (revision 228266) +++ addons/mp3/decode_i386.c (working copy) @@ -21,8 +21,8 @@ /* old WRITE_SAMPLE */ #define WRITE_SAMPLE(samples,sum,clip) \ - if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \ - else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \ + if ( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \ + else if ( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \ else { *(samples) = sum; } int synth_1to1_mono(struct mpstr *mp,real *bandPtr,unsigned char *samples,int *pnt) @@ -35,7 +35,7 @@ ret = synth_1to1(mp,bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; - for(i=0;i<32;i++) { + for (i=0;i<32;i++) { *( (short *) samples) = *tmp1; samples += 2; tmp1 += 2; @@ -58,7 +58,7 @@ bo = mp->synth_bo; - if(!channel) { + if (!channel) { bo--; bo &= 0xf; buf = mp->synth_buffs[0]; @@ -68,7 +68,7 @@ buf = mp->synth_buffs[1]; } - if(bo & 0x1) { + if (bo & 0x1) { b0 = buf[0]; bo1 = bo; dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); Index: addons/mp3/decode_ntom.c =================================================================== --- addons/mp3/decode_ntom.c (revision 228266) +++ addons/mp3/decode_ntom.c (working copy) @@ -17,8 +17,8 @@ #include "mpglib.h" #define WRITE_SAMPLE(samples,sum,clip) \ - if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \ - else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \ + if ( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \ + else if ( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \ else { *(samples) = sum; } #define NTOM_MUL (32768) @@ -28,10 +28,10 @@ int synth_ntom_set_step(long m,long n) { - if(param.verbose > 1) + if (param.verbose > 1) ast_log(LOG_WARNING,"Init rate converter: %ld->%ld\n",m,n); - if(n >= 96000 || m >= 96000 || m == 0 || n == 0) { + if (n >= 96000 || m >= 96000 || m == 0 || n == 0) { ast_log(LOG_WARNING,"NtoM converter: illegal rates\n"); return (1); } @@ -39,7 +39,7 @@ n *= NTOM_MUL; ntom_step = n / m; - if(ntom_step > 8*NTOM_MUL) { + if (ntom_step > 8*NTOM_MUL) { ast_log(LOG_WARNING,"max. 1:8 conversion allowed!\n"); return (1); } @@ -61,7 +61,7 @@ ret = synth_ntom(mp, bandPtr,0,(unsigned char *) samples_tmp,&pnt1); samples += *pnt; - for(i=0;i<(pnt1>>2);i++) { + for (i=0;i<(pnt1>>2);i++) { *( (short *)samples) = *tmp1; samples += 2; tmp1 += 2; @@ -86,7 +86,7 @@ bo = mp->synth_bo; - if(!channel) { + if (!channel) { bo--; bo &= 0xf; buf = mp->synth_buffs[0]; @@ -99,7 +99,7 @@ ntom = ntom_val[1]; } - if(bo & 0x1) { + if (bo & 0x1) { b0 = buf[0]; bo1 = bo; dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); @@ -121,7 +121,7 @@ real sum; ntom += ntom_step; - if(ntom < NTOM_MUL) { + if (ntom < NTOM_MUL) { window += 16; b0 += 16; continue; @@ -144,7 +144,7 @@ sum += *window++ * *b0++; sum -= *window++ * *b0++; - while(ntom >= NTOM_MUL) { + while (ntom >= NTOM_MUL) { WRITE_SAMPLE(samples,sum,clip); samples += step; ntom -= NTOM_MUL; @@ -152,7 +152,7 @@ } ntom += ntom_step; - if(ntom >= NTOM_MUL) + if (ntom >= NTOM_MUL) { real sum; sum = window[0x0] * b0[0x0]; @@ -164,7 +164,7 @@ sum += window[0xC] * b0[0xC]; sum += window[0xE] * b0[0xE]; - while(ntom >= NTOM_MUL) { + while (ntom >= NTOM_MUL) { WRITE_SAMPLE(samples,sum,clip); samples += step; ntom -= NTOM_MUL; @@ -179,7 +179,7 @@ real sum; ntom += ntom_step; - if(ntom < NTOM_MUL) { + if (ntom < NTOM_MUL) { window -= 16; b0 += 16; continue; @@ -202,7 +202,7 @@ sum -= *(--window) * *b0++; sum -= *(--window) * *b0++; - while(ntom >= NTOM_MUL) { + while (ntom >= NTOM_MUL) { WRITE_SAMPLE(samples,sum,clip); samples += step; ntom -= NTOM_MUL; Index: addons/mp3/interface.c =================================================================== --- addons/mp3/interface.c (revision 228266) +++ addons/mp3/interface.c (working copy) @@ -43,7 +43,7 @@ struct buf *b,*bn; b = mp->tail; - while(b) { + while (b) { free(b->pnt); bn = b->next; free(b); @@ -56,12 +56,12 @@ struct buf *nbuf; nbuf = malloc( sizeof(struct buf) ); - if(!nbuf) { + if (!nbuf) { ast_log(LOG_WARNING,"Out of memory!\n"); return NULL; } nbuf->pnt = malloc(size); - if(!nbuf->pnt) { + if (!nbuf->pnt) { free(nbuf); return NULL; } @@ -71,7 +71,7 @@ nbuf->prev = mp->head; nbuf->pos = 0; - if(!mp->tail) { + if (!mp->tail) { mp->tail = nbuf; } else { @@ -89,7 +89,7 @@ struct buf *buf = mp->tail; mp->tail = buf->next; - if(mp->tail) + if (mp->tail) mp->tail->prev = NULL; else { mp->tail = mp->head = NULL; @@ -105,10 +105,10 @@ unsigned int b;int pos; pos = mp->tail->pos; - while(pos >= mp->tail->size) { + while (pos >= mp->tail->size) { remove_buf(mp); pos = mp->tail->pos; - if(!mp->tail) { + if (!mp->tail) { /* We may pick up this error a few times*/ /* But things have gone pear shaped */ ast_log(LOG_WARNING,"Fatal Buffer error!\n"); @@ -141,7 +141,7 @@ mp->header = head; - if(error){ + if (error){ return (1); }else return (0); @@ -150,13 +150,13 @@ static int head_check(unsigned long head) { - if( (head & 0xffe00000) != 0xffe00000) + if ( (head & 0xffe00000) != 0xffe00000) return FALSE; - if(!((head>>17)&3)) + if (!((head>>17)&3)) return FALSE; - if( ((head>>12)&0xf) == 0xf || ((head>>12)&0xf) == 0) + if ( ((head>>12)&0xf) == 0xf || ((head>>12)&0xf) == 0) return FALSE; - if( ((head>>10)&0x3) == 0x3 ) + if ( ((head>>10)&0x3) == 0x3 ) return FALSE; if ((head & 0xffff0000) == 0xfffe0000) return FALSE; @@ -191,42 +191,42 @@ long n,m; int down_sample_sblimit; - if(osize < 4608) { + if (osize < 4608) { ast_log(LOG_WARNING,"To less out space\n"); return MP3_ERR; } - if(in) { - if(addbuf(mp,in,isize) == NULL) { + if (in) { + if (addbuf(mp,in,isize) == NULL) { return MP3_ERR; } } /* First decode header */ - if(mp->framesize == 0) { - if(mp->bsize < 4) { + if (mp->framesize == 0) { + if (mp->bsize < 4) { return MP3_NEED_MORE; } if (read_head(mp)) return MP3_ERR; - if(!head_check(mp->header) ) { + if (!head_check(mp->header) ) { int i; ast_log(LOG_WARNING,"Junk at the beginning of frame %08lx\n",mp->header); /* step in byte steps through next 64K */ - for(i=0;i<65536;i++) { - if(!mp->bsize) + for (i=0;i<65536;i++) { + if (!mp->bsize) return MP3_NEED_MORE; - if(head_shift(mp)) + if (head_shift(mp)) return MP3_ERR; - if(head_check(mp->header)) + if (head_check(mp->header)) break; } - if(i == 65536) { + if (i == 65536) { ast_log(LOG_WARNING,"Giving up searching valid MPEG header\n"); return MP3_ERR; } @@ -250,7 +250,7 @@ return MP3_ERR; - if(n>m) { + if (n>m) { down_sample_sblimit = SBLIMIT * m; down_sample_sblimit /= n; } @@ -264,7 +264,7 @@ } - if(mp->fr.framesize > mp->bsize) + if (mp->fr.framesize > mp->bsize) return MP3_NEED_MORE; (mp->worksample).wordpointer = mp->bsspace[mp->bsnum] + 512; @@ -272,10 +272,10 @@ (mp->worksample).bitindex = 0; len = 0; - while(len < mp->framesize) { + while (len < mp->framesize) { int nlen; int blen = mp->tail->size - mp->tail->pos; - if( (mp->framesize - len) <= blen) { + if ( (mp->framesize - len) <= blen) { nlen = mp->framesize-len; } else { @@ -285,13 +285,13 @@ len += nlen; mp->tail->pos += nlen; mp->bsize -= nlen; - if(mp->tail->pos == mp->tail->size) { + if (mp->tail->pos == mp->tail->size) { remove_buf(mp); } } *done = 0; - if(mp->fr.error_protection) + if (mp->fr.error_protection) getbits(mp, 16); if (do_layer3(mp,(unsigned char *) out,done)) @@ -306,7 +306,7 @@ int set_pointer(struct mpstr *mp, long backstep) { unsigned char *bsbufold; - if(mp->fsizeold < 0 && backstep > 0) { + if (mp->fsizeold < 0 && backstep > 0) { ast_log(LOG_WARNING,"Can't step back %ld!\n",backstep); return MP3_ERR; } Index: addons/mp3/layer3.c =================================================================== --- addons/mp3/layer3.c (revision 228266) +++ addons/mp3/layer3.c (working copy) @@ -101,10 +101,10 @@ { int i,j,k,l; - for(i=-256;i<118+4;i++) + for (i=-256;i<118+4;i++) gainpow2[i+256] = pow((double)2.0,-0.25 * (double) (i+210) ); - for(i=0;i<8207;i++) + for (i=0;i<8207;i++) ispow[i] = pow((double)i,(double)4.0/3.0); for (i=0;i<8;i++) @@ -115,12 +115,12 @@ aa_ca[i] = Ci[i]/sq; } - for(i=0;i<18;i++) + for (i=0;i<18;i++) { win[0][i] = win[1][i] = 0.5 * sin( M_PI / 72.0 * (double) (2*(i+0) +1) ) / cos ( M_PI * (double) (2*(i+0) +19) / 72.0 ); win[0][i+18] = win[3][i+18] = 0.5 * sin( M_PI / 72.0 * (double) (2*(i+18)+1) ) / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 ); } - for(i=0;i<6;i++) + for (i=0;i<6;i++) { win[1][i+18] = 0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 ); win[3][i+12] = 0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 ); @@ -129,33 +129,33 @@ win[3][i+6 ] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*(i+6 )+19) / 72.0 ); } - for(i=0;i<9;i++) + for (i=0;i<9;i++) COS9[i] = cos( M_PI / 18.0 * (double) i); - for(i=0;i<9;i++) + for (i=0;i<9;i++) tfcos36[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 ); - for(i=0;i<3;i++) + for (i=0;i<3;i++) tfcos12[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 ); COS6_1 = cos( M_PI / 6.0 * (double) 1); COS6_2 = cos( M_PI / 6.0 * (double) 2); - for(i=0;i<12;i++) + for (i=0;i<12;i++) { win[2][i] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 ); - for(j=0;j<6;j++) + for (j=0;j<6;j++) COS1[i][j] = cos( M_PI / 24.0 * (double) ((2*i+7)*(2*j+1)) ); } - for(j=0;j<4;j++) { + for (j=0;j<4;j++) { static int len[4] = { 36,36,12,36 }; - for(i=0;i 0) { - if( i & 1 ) + if (i > 0) { + if ( i & 1 ) p1 = pow(base,(i+1.0)*0.5); else p2 = pow(base,i*0.5); @@ -179,7 +179,7 @@ } } - for(j=0;j<9;j++) + for (j=0;j<9;j++) { struct bandInfoStruct *bi = &bandInfo[j]; int *mp; @@ -188,16 +188,16 @@ mp = map[j][0] = mapbuf0[j]; bdf = bi->longDiff; - for(i=0,cb = 0; cb < 8 ; cb++,i+=*bdf++) { + for (i=0,cb = 0; cb < 8 ; cb++,i+=*bdf++) { *mp++ = (*bdf) >> 1; *mp++ = i; *mp++ = 3; *mp++ = cb; } bdf = bi->shortDiff+3; - for(cb=3;cb<13;cb++) { + for (cb=3;cb<13;cb++) { int l = (*bdf++) >> 1; - for(lwin=0;lwin<3;lwin++) { + for (lwin=0;lwin<3;lwin++) { *mp++ = l; *mp++ = i + lwin; *mp++ = lwin; @@ -209,9 +209,9 @@ mp = map[j][1] = mapbuf1[j]; bdf = bi->shortDiff+0; - for(i=0,cb=0;cb<13;cb++) { + for (i=0,cb=0;cb<13;cb++) { int l = (*bdf++) >> 1; - for(lwin=0;lwin<3;lwin++) { + for (lwin=0;lwin<3;lwin++) { *mp++ = l; *mp++ = i + lwin; *mp++ = lwin; @@ -223,7 +223,7 @@ mp = map[j][2] = mapbuf2[j]; bdf = bi->longDiff; - for(cb = 0; cb < 22 ; cb++) { + for (cb = 0; cb < 22 ; cb++) { *mp++ = (*bdf++) >> 1; *mp++ = cb; } @@ -231,43 +231,43 @@ } - for(i=0;i<5;i++) { - for(j=0;j<6;j++) { - for(k=0;k<6;k++) { + for (i=0;i<5;i++) { + for (j=0;j<6;j++) { + for (k=0;k<6;k++) { int n = k + j * 6 + i * 36; i_slen2[n] = i|(j<<3)|(k<<6)|(3<<12); } } } - for(i=0;i<4;i++) { - for(j=0;j<4;j++) { - for(k=0;k<4;k++) { + for (i=0;i<4;i++) { + for (j=0;j<4;j++) { + for (k=0;k<4;k++) { int n = k + j * 4 + i * 16; i_slen2[n+180] = i|(j<<3)|(k<<6)|(4<<12); } } } - for(i=0;i<4;i++) { - for(j=0;j<3;j++) { + for (i=0;i<4;i++) { + for (j=0;j<3;j++) { int n = j + i * 3; i_slen2[n+244] = i|(j<<3) | (5<<12); n_slen2[n+500] = i|(j<<3) | (2<<12) | (1<<15); } } - for(i=0;i<5;i++) { - for(j=0;j<5;j++) { - for(k=0;k<4;k++) { - for(l=0;l<4;l++) { + for (i=0;i<5;i++) { + for (j=0;j<5;j++) { + for (k=0;k<4;k++) { + for (l=0;l<4;l++) { int n = l + k * 4 + j * 16 + i * 80; n_slen2[n] = i|(j<<3)|(k<<6)|(l<<9)|(0<<12); } } } } - for(i=0;i<5;i++) { - for(j=0;j<5;j++) { - for(k=0;k<4;k++) { + for (i=0;i<5;i++) { + for (j=0;j<5;j++) { + for (k=0;k<4;k++) { int n = k + j * 4 + i * 20; n_slen2[n+400] = i|(j<<3)|(k<<6)|(1<<12); } @@ -279,15 +279,15 @@ void init_layer3_sample_limits(struct mpstr *mp, int down_sample_sblimit) { int i,j; - for(j=0;j<9;j++) { - for(i=0;i<23;i++) { + for (j=0;j<9;j++) { + for (i=0;i<23;i++) { (mp->longLimit)[j][i] = (bandInfo[j].longIdx[i] - 1 + 8) / 18 + 1; - if((mp->longLimit)[j][i] > (down_sample_sblimit) ) + if ((mp->longLimit)[j][i] > (down_sample_sblimit) ) (mp->longLimit)[j][i] = down_sample_sblimit; } - for(i=0;i<14;i++) { + for (i=0;i<14;i++) { (mp->shortLimit)[j][i] = (bandInfo[j].shortIdx[i] - 1) / 18 + 1; - if((mp->shortLimit)[j][i] > (down_sample_sblimit) ) + if ((mp->shortLimit)[j][i] > (down_sample_sblimit) ) (mp->shortLimit)[j][i] = down_sample_sblimit; } } @@ -324,16 +324,16 @@ gr_info->part2_3_length = getbits(mp, 12); gr_info->big_values = getbits_fast(mp, 9); - if(gr_info->big_values > 288) { + if (gr_info->big_values > 288) { ast_log(LOG_WARNING,"big_values too large!\n"); gr_info->big_values = 288; } gr_info->pow2gain = gainpow2+256 - getbits_fast(mp, 8) + powdiff; - if(ms_stereo) + if (ms_stereo) gr_info->pow2gain += 2; gr_info->scalefac_compress = getbits_fast(mp, 4); /* window-switching flag == 1 for block_Type != 0 .. and block-type == 0 -> win-sw-flag = 0 */ - if(get1bit(mp)) + if (get1bit(mp)) { int i; gr_info->block_type = getbits_fast(mp, 2); @@ -345,10 +345,10 @@ * but to satisfy some verifications tools we set it either. */ gr_info->table_select[2] = 0; - for(i=0;i<3;i++) + for (i=0;i<3;i++) gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(mp, 3)<<3); - if(gr_info->block_type == 0) { + if (gr_info->block_type == 0) { ast_log(LOG_WARNING,"Blocktype == 0 and window-switching == 1 not allowed.\n"); return (1); } @@ -399,16 +399,16 @@ gr_info->part2_3_length = getbits(mp, 12); gr_info->big_values = getbits_fast(mp, 9); - if(gr_info->big_values > 288) { + if (gr_info->big_values > 288) { ast_log(LOG_WARNING,"big_values too large!\n"); gr_info->big_values = 288; } gr_info->pow2gain = gainpow2+256 - getbits_fast(mp, 8) + powdiff; - if(ms_stereo) + if (ms_stereo) gr_info->pow2gain += 2; gr_info->scalefac_compress = getbits(mp, 9); /* window-switching flag == 1 for block_Type != 0 .. and block-type == 0 -> win-sw-flag = 0 */ - if(get1bit(mp)) + if (get1bit(mp)) { int i; gr_info->block_type = getbits_fast(mp, 2); @@ -420,18 +420,18 @@ * but to satisfy some verifications tools we set it either. */ gr_info->table_select[2] = 0; - for(i=0;i<3;i++) + for (i=0;i<3;i++) gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(mp, 3)<<3); - if(gr_info->block_type == 0) { + if (gr_info->block_type == 0) { ast_log(LOG_WARNING,"Blocktype == 0 and window-switching == 1 not allowed.\n"); return (1); } /* region_count/start parameters are implicit in this case. */ /* check this again! */ - if(gr_info->block_type == 2) + if (gr_info->block_type == 2) gr_info->region1start = 36>>1; - else if(sfreq == 8) + else if (sfreq == 8) /* check this for 2.5 and sfreq=8 */ gr_info->region1start = 108>>1; else @@ -493,16 +493,16 @@ int i; int scfsi = gr_info->scfsi; - if(scfsi < 0) { /* scfsi < 0 => granule == 0 */ - for(i=11;i;i--) + if (scfsi < 0) { /* scfsi < 0 => granule == 0 */ + for (i=11;i;i--) *scf++ = getbits_fast(mp, num0); - for(i=10;i;i--) + for (i=10;i;i--) *scf++ = getbits_fast(mp, num1); numbits = (num0 + num1) * 10 + num0; } else { numbits = 0; - if(!(scfsi & 0x8)) { + if (!(scfsi & 0x8)) { for (i=6;i;i--) *scf++ = getbits_fast(mp, num0); numbits += num0 * 6; @@ -512,7 +512,7 @@ *scf++ = 0; *scf++ = 0; *scf++ = 0; } - if(!(scfsi & 0x4)) { + if (!(scfsi & 0x4)) { for (i=5;i;i--) *scf++ = getbits_fast(mp, num0); numbits += num0 * 5; @@ -522,8 +522,8 @@ *scf++ = 0; *scf++ = 0; } - if(!(scfsi & 0x2)) { - for(i=5;i;i--) + if (!(scfsi & 0x2)) { + for (i=5;i;i--) *scf++ = getbits_fast(mp, num1); numbits += num1 * 5; } @@ -532,7 +532,7 @@ *scf++ = 0; *scf++ = 0; } - if(!(scfsi & 0x1)) { + if (!(scfsi & 0x1)) { for (i=5;i;i--) *scf++ = getbits_fast(mp, num1); numbits += num1 * 5; @@ -565,7 +565,7 @@ { { 6, 9, 9,9 } , { 6, 9,12,6 } , { 15,18,0,0} , { 6,15,12,0 } , { 6,12, 9,6 } , { 6,18,9,0} } }; - if(i_stereo) /* i_stereo AND second channel -> do_layer3() checks this */ + if (i_stereo) /* i_stereo AND second channel -> do_layer3() checks this */ slen = i_slen2[gr_info->scalefac_compress>>1]; else slen = n_slen2[gr_info->scalefac_compress]; @@ -573,30 +573,30 @@ gr_info->preflag = (slen>>15) & 0x1; n = 0; - if( gr_info->block_type == 2 ) { + if ( gr_info->block_type == 2 ) { n++; - if(gr_info->mixed_block_flag) + if (gr_info->mixed_block_flag) n++; } pnt = stab[n][(slen>>12)&0x7]; - for(i=0;i<4;i++) { + for (i=0;i<4;i++) { int num = slen & 0x7; slen >>= 3; - if(num) { - for(j=0;j<(int)(pnt[i]);j++) + if (num) { + for (j=0;j<(int)(pnt[i]);j++) *scf++ = getbits_fast(mp, num); numbits += pnt[i] * num; } else { - for(j=0;j<(int)(pnt[i]);j++) + for (j=0;j<(int)(pnt[i]);j++) *scf++ = 0; } } n = (n << 1) + 1; - for(i=0;iblock_type == 2) { + if (gr_info->block_type == 2) { /* * decoding with short or mixed mode BandIndex table */ @@ -650,7 +650,7 @@ register real v = 0.0; register int *m,mc; - if(gr_info->mixed_block_flag) { + if (gr_info->mixed_block_flag) { max[3] = -1; max[0] = max[1] = max[2] = 2; m = map[sfreq][0]; @@ -664,17 +664,17 @@ } mc = 0; - for(i=0;i<2;i++) { + for (i=0;i<2;i++) { int lp = l[i]; struct newhuff *h = ht+gr_info->table_select[i]; - for(;lp;lp--,mc--) { + for (;lp;lp--,mc--) { register int x,y; - if( (!mc) ) { + if ( (!mc) ) { mc = *m++; xrpnt = ((real *) xr) + (*m++); lwin = *m++; cb = *m++; - if(lwin == 3) { + if (lwin == 3) { v = gr_info->pow2gain[(*scf++) << shift]; step = 1; } @@ -685,7 +685,7 @@ } { register short *val = h->table; - while((y=*val++)<0) { + while ((y=*val++)<0) { if (get1bit(mp)) val -= y; part2remain--; @@ -693,18 +693,18 @@ x = y >> 4; y &= 0xf; } - if(x == 15) { + if (x == 15) { max[lwin] = cb; part2remain -= h->linbits+1; x += getbits(mp, h->linbits); - if(get1bit(mp)) + if (get1bit(mp)) *xrpnt = -ispow[x] * v; else *xrpnt = ispow[x] * v; } - else if(x) { + else if (x) { max[lwin] = cb; - if(get1bit(mp)) + if (get1bit(mp)) *xrpnt = -ispow[x] * v; else *xrpnt = ispow[x] * v; @@ -713,18 +713,18 @@ else *xrpnt = 0.0; xrpnt += step; - if(y == 15) { + if (y == 15) { max[lwin] = cb; part2remain -= h->linbits+1; y += getbits(mp, h->linbits); - if(get1bit(mp)) + if (get1bit(mp)) *xrpnt = -ispow[y] * v; else *xrpnt = ispow[y] * v; } - else if(y) { + else if (y) { max[lwin] = cb; - if(get1bit(mp)) + if (get1bit(mp)) *xrpnt = -ispow[y] * v; else *xrpnt = ispow[y] * v; @@ -735,13 +735,13 @@ xrpnt += step; } } - for(;l3 && (part2remain > 0);l3--) { + for (;l3 && (part2remain > 0);l3--) { struct newhuff *h = htc+gr_info->count1table_select; register short *val = h->table,a; - while((a=*val++)<0) { + while ((a=*val++)<0) { part2remain--; - if(part2remain < 0) { + if (part2remain < 0) { part2remain++; a = 0; break; @@ -750,14 +750,14 @@ val -= a; } - for(i=0;i<4;i++) { - if(!(i & 1)) { - if(!mc) { + for (i=0;i<4;i++) { + if (!(i & 1)) { + if (!mc) { mc = *m++; xrpnt = ((real *) xr) + (*m++); lwin = *m++; cb = *m++; - if(lwin == 3) { + if (lwin == 3) { v = gr_info->pow2gain[(*scf++) << shift]; step = 1; } @@ -768,14 +768,14 @@ } mc--; } - if( (a & (0x8>>i)) ) { + if ( (a & (0x8>>i)) ) { max[lwin] = cb; part2remain--; - if(part2remain < 0) { + if (part2remain < 0) { part2remain++; break; } - if(get1bit(mp)) + if (get1bit(mp)) *xrpnt = -v; else *xrpnt = v; @@ -786,11 +786,11 @@ } } - while( m < me ) { - if(!mc) { + while ( m < me ) { + if (!mc) { mc = *m++; xrpnt = ((real *) xr) + *m++; - if( (*m++) == 3) + if ( (*m++) == 3) step = 1; else step = 3; @@ -837,21 +837,21 @@ /* * long hash table values */ - for(i=0;i<3;i++) { + for (i=0;i<3;i++) { int lp = l[i]; struct newhuff *h = ht+gr_info->table_select[i]; - for(;lp;lp--,mc--) { + for (;lp;lp--,mc--) { int x,y; - if(!mc) { + if (!mc) { mc = *m++; v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift]; cb = *m++; } { register short *val = h->table; - while((y=*val++)<0) { + while ((y=*val++)<0) { if (get1bit(mp)) val -= y; part2remain--; @@ -863,14 +863,14 @@ max = cb; part2remain -= h->linbits+1; x += getbits(mp, h->linbits); - if(get1bit(mp)) + if (get1bit(mp)) *xrpnt++ = -ispow[x] * v; else *xrpnt++ = ispow[x] * v; } - else if(x) { + else if (x) { max = cb; - if(get1bit(mp)) + if (get1bit(mp)) *xrpnt++ = -ispow[x] * v; else *xrpnt++ = ispow[x] * v; @@ -883,14 +883,14 @@ max = cb; part2remain -= h->linbits+1; y += getbits(mp, h->linbits); - if(get1bit(mp)) + if (get1bit(mp)) *xrpnt++ = -ispow[y] * v; else *xrpnt++ = ispow[y] * v; } - else if(y) { + else if (y) { max = cb; - if(get1bit(mp)) + if (get1bit(mp)) *xrpnt++ = -ispow[y] * v; else *xrpnt++ = ispow[y] * v; @@ -904,13 +904,13 @@ /* * short (count1table) values */ - for(;l3 && (part2remain > 0);l3--) { + for (;l3 && (part2remain > 0);l3--) { struct newhuff *h = htc+gr_info->count1table_select; register short *val = h->table,a; - while((a=*val++)<0) { + while ((a=*val++)<0) { part2remain--; - if(part2remain < 0) { + if (part2remain < 0) { part2remain++; a = 0; break; @@ -919,9 +919,9 @@ val -= a; } - for(i=0;i<4;i++) { - if(!(i & 1)) { - if(!mc) { + for (i=0;i<4;i++) { + if (!(i & 1)) { + if (!mc) { mc = *m++; cb = *m++; v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift]; @@ -931,11 +931,11 @@ if ( (a & (0x8>>i)) ) { max = cb; part2remain--; - if(part2remain < 0) { + if (part2remain < 0) { part2remain++; break; } - if(get1bit(mp)) + if (get1bit(mp)) *xrpnt++ = -v; else *xrpnt++ = v; @@ -948,7 +948,7 @@ /* * zero part */ - for(i=(&xr[SBLIMIT][0]-xrpnt)>>1;i;i--) { + for (i=(&xr[SBLIMIT][0]-xrpnt)>>1;i;i--) { *xrpnt++ = 0.0; *xrpnt++ = 0.0; } @@ -957,13 +957,13 @@ gr_info->maxb = (mp->longLimit)[sfreq][gr_info->maxbandl]; } - while( part2remain > 16 ) { + while ( part2remain > 16 ) { getbits(mp, 16); /* Dismiss stuffing Bits */ part2remain -= 16; } - if(part2remain > 0) + if (part2remain > 0) getbits(mp, part2remain); - else if(part2remain < 0) { + else if (part2remain < 0) { ast_log(LOG_WARNING,"mpg123: Can't rewind stream by %d bits!\n",-part2remain); return 1; /* -> error */ } @@ -991,12 +991,12 @@ * we may lose the 'odd' bit here !! * check this later gain */ - if(bv <= region1) { + if (bv <= region1) { l[0] = bv; l[1] = 0; l[2] = 0; } else { l[0] = region1; - if(bv <= region2) { + if (bv <= region2) { l[1] = bv - l[0]; l[2] = 0; } else { @@ -1005,13 +1005,13 @@ } } - if(gr_info->block_type == 2) { + if (gr_info->block_type == 2) { int i,max[4]; int step=0,lwin=0,cb=0; register real v = 0.0; register int *m,mc = 0; - if(gr_info->mixed_block_flag) { + if (gr_info->mixed_block_flag) { max[3] = -1; max[0] = max[1] = max[2] = 2; m = map[sfreq][0]; @@ -1024,19 +1024,19 @@ me = mapend[sfreq][1]; } - for(i=0;i<2;i++) { + for (i=0;i<2;i++) { int lp = l[i]; struct newhuff *h = ht+gr_info->table_select[i]; - for(;lp;lp--,mc--) { + for (;lp;lp--,mc--) { int x,y; - if(!mc) { + if (!mc) { mc = *m++; xrpnt = ((real *) xr[1]) + *m; xr0pnt = ((real *) xr[0]) + *m++; lwin = *m++; cb = *m++; - if(lwin == 3) { + if (lwin == 3) { v = gr_info->pow2gain[(*scf++) << shift]; step = 1; } @@ -1047,7 +1047,7 @@ } { register short *val = h->table; - while((y=*val++)<0) { + while ((y=*val++)<0) { if (get1bit(mp)) val -= y; part2remain--; @@ -1055,11 +1055,11 @@ x = y >> 4; y &= 0xf; } - if(x == 15) { + if (x == 15) { max[lwin] = cb; part2remain -= h->linbits+1; x += getbits(mp, h->linbits); - if(get1bit(mp)) { + if (get1bit(mp)) { real a = ispow[x] * v; *xrpnt = *xr0pnt + a; *xr0pnt -= a; @@ -1070,9 +1070,9 @@ *xr0pnt += a; } } - else if(x) { + else if (x) { max[lwin] = cb; - if(get1bit(mp)) { + if (get1bit(mp)) { real a = ispow[x] * v; *xrpnt = *xr0pnt + a; *xr0pnt -= a; @@ -1089,11 +1089,11 @@ xrpnt += step; xr0pnt += step; - if(y == 15) { + if (y == 15) { max[lwin] = cb; part2remain -= h->linbits+1; y += getbits(mp, h->linbits); - if(get1bit(mp)) { + if (get1bit(mp)) { real a = ispow[y] * v; *xrpnt = *xr0pnt + a; *xr0pnt -= a; @@ -1104,9 +1104,9 @@ *xr0pnt += a; } } - else if(y) { + else if (y) { max[lwin] = cb; - if(get1bit(mp)) { + if (get1bit(mp)) { real a = ispow[y] * v; *xrpnt = *xr0pnt + a; *xr0pnt -= a; @@ -1125,13 +1125,13 @@ } } - for(;l3 && (part2remain > 0);l3--) { + for (;l3 && (part2remain > 0);l3--) { struct newhuff *h = htc+gr_info->count1table_select; register short *val = h->table,a; - while((a=*val++)<0) { + while ((a=*val++)<0) { part2remain--; - if(part2remain < 0) { + if (part2remain < 0) { part2remain++; a = 0; break; @@ -1140,15 +1140,15 @@ val -= a; } - for(i=0;i<4;i++) { - if(!(i & 1)) { - if(!mc) { + for (i=0;i<4;i++) { + if (!(i & 1)) { + if (!mc) { mc = *m++; xrpnt = ((real *) xr[1]) + *m; xr0pnt = ((real *) xr[0]) + *m++; lwin = *m++; cb = *m++; - if(lwin == 3) { + if (lwin == 3) { v = gr_info->pow2gain[(*scf++) << shift]; step = 1; } @@ -1159,14 +1159,14 @@ } mc--; } - if( (a & (0x8>>i)) ) { + if ( (a & (0x8>>i)) ) { max[lwin] = cb; part2remain--; - if(part2remain < 0) { + if (part2remain < 0) { part2remain++; break; } - if(get1bit(mp)) { + if (get1bit(mp)) { *xrpnt = *xr0pnt + v; *xr0pnt -= v; } @@ -1182,12 +1182,12 @@ } } - while( m < me ) { - if(!mc) { + while ( m < me ) { + if (!mc) { mc = *m++; xrpnt = ((real *) xr[1]) + *m; xr0pnt = ((real *) xr[0]) + *m++; - if(*m++ == 3) + if (*m++ == 3) step = 1; else step = 3; @@ -1228,20 +1228,20 @@ me = mapend[sfreq][2]; #endif - for(i=0;i<3;i++) { + for (i=0;i<3;i++) { int lp = l[i]; struct newhuff *h = ht+gr_info->table_select[i]; - for(;lp;lp--,mc--) { + for (;lp;lp--,mc--) { int x,y; - if(!mc) { + if (!mc) { mc = *m++; cb = *m++; v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift]; } { register short *val = h->table; - while((y=*val++)<0) { + while ((y=*val++)<0) { if (get1bit(mp)) val -= y; part2remain--; @@ -1253,7 +1253,7 @@ max = cb; part2remain -= h->linbits+1; x += getbits(mp, h->linbits); - if(get1bit(mp)) { + if (get1bit(mp)) { real a = ispow[x] * v; *xrpnt++ = *xr0pnt + a; *xr0pnt++ -= a; @@ -1264,9 +1264,9 @@ *xr0pnt++ += a; } } - else if(x) { + else if (x) { max = cb; - if(get1bit(mp)) { + if (get1bit(mp)) { real a = ispow[x] * v; *xrpnt++ = *xr0pnt + a; *xr0pnt++ -= a; @@ -1285,7 +1285,7 @@ max = cb; part2remain -= h->linbits+1; y += getbits(mp, h->linbits); - if(get1bit(mp)) { + if (get1bit(mp)) { real a = ispow[y] * v; *xrpnt++ = *xr0pnt + a; *xr0pnt++ -= a; @@ -1296,9 +1296,9 @@ *xr0pnt++ += a; } } - else if(y) { + else if (y) { max = cb; - if(get1bit(mp)) { + if (get1bit(mp)) { real a = ispow[y] * v; *xrpnt++ = *xr0pnt + a; *xr0pnt++ -= a; @@ -1315,13 +1315,13 @@ } } - for(;l3 && (part2remain > 0);l3--) { + for (;l3 && (part2remain > 0);l3--) { struct newhuff *h = htc+gr_info->count1table_select; register short *val = h->table,a; - while((a=*val++)<0) { + while ((a=*val++)<0) { part2remain--; - if(part2remain < 0) { + if (part2remain < 0) { part2remain++; a = 0; break; @@ -1330,9 +1330,9 @@ val -= a; } - for(i=0;i<4;i++) { - if(!(i & 1)) { - if(!mc) { + for (i=0;i<4;i++) { + if (!(i & 1)) { + if (!mc) { mc = *m++; cb = *m++; v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift]; @@ -1342,11 +1342,11 @@ if ( (a & (0x8>>i)) ) { max = cb; part2remain--; - if(part2remain <= 0) { + if (part2remain <= 0) { part2remain++; break; } - if(get1bit(mp)) { + if (get1bit(mp)) { *xrpnt++ = *xr0pnt + v; *xr0pnt++ -= v; } @@ -1359,7 +1359,7 @@ *xrpnt++ = *xr0pnt++; } } - for(i=(&xr[1][SBLIMIT][0]-xrpnt)>>1;i;i--) { + for (i=(&xr[1][SBLIMIT][0]-xrpnt)>>1;i;i--) { *xrpnt++ = *xr0pnt++; *xrpnt++ = *xr0pnt++; } @@ -1372,9 +1372,9 @@ getbits(mp, 16); /* Dismiss stuffing Bits */ part2remain -= 16; } - if(part2remain > 0 ) + if (part2remain > 0 ) getbits(mp, part2remain); - else if(part2remain < 0) { + else if (part2remain < 0) { ast_log(LOG_WARNING,"mpg123_ms: Can't rewind stream by %d bits!\n",-part2remain); return 1; /* -> error */ } @@ -1392,9 +1392,9 @@ struct bandInfoStruct *bi = &bandInfo[sfreq]; real *tab1,*tab2; - if(lsf) { + if (lsf) { int p = gr_info->scalefac_compress & 0x1; - if(ms_stereo) { + if (ms_stereo) { tab1 = pow1_2[p]; tab2 = pow2_2[p]; } else { @@ -1402,7 +1402,7 @@ } } else { - if(ms_stereo) { + if (ms_stereo) { tab1 = tan1_2; tab2 = tan2_2; } else { @@ -1413,20 +1413,20 @@ if (gr_info->block_type == 2) { int lwin,do_l = 0; - if( gr_info->mixed_block_flag ) + if ( gr_info->mixed_block_flag ) do_l = 1; for (lwin=0;lwin<3;lwin++) /* process each window */ { /* get first band with zero values */ int is_p,sb,idx,sfb = gr_info->maxband[lwin]; /* sfb is minimal 3 for mixed mode */ - if(sfb > 3) + if (sfb > 3) do_l = 0; - for(;sfb<12;sfb++) + for (;sfb<12;sfb++) { is_p = scalefac[sfb*3+lwin-gr_info->mixed_block_flag]; /* scale: 0-15 */ - if(is_p != 7) { + if (is_p != 7) { real t1,t2; sb = bi->shortDiff[sfb]; idx = bi->shortIdx[sfb] + lwin; @@ -1451,7 +1451,7 @@ sb = bi->shortDiff[11]; idx = bi->shortIdx[11] + lwin; #endif - if(is_p != 7) + if (is_p != 7) { real t1,t2; t1 = tab1[is_p]; t2 = tab2[is_p]; @@ -1462,7 +1462,7 @@ xr[1][idx] = v * t2; } } - } /* end for(lwin; .. ; . ) */ + } /* end for (lwin; .. ; . ) */ if (do_l) { @@ -1476,7 +1476,7 @@ { int sb = bi->longDiff[sfb]; int is_p = scalefac[sfb]; /* scale: 0-15 */ - if(is_p != 7) { + if (is_p != 7) { real t1,t2; t1 = tab1[is_p]; t2 = tab2[is_p]; for ( ; sb > 0; sb--,idx++) @@ -1499,7 +1499,7 @@ { int sb = bi->longDiff[sfb]; is_p = scalefac[sfb]; /* scale: 0-15 */ - if(is_p != 7) { + if (is_p != 7) { real t1,t2; t1 = tab1[is_p]; t2 = tab2[is_p]; for ( ; sb > 0; sb--,idx++) @@ -1514,7 +1514,7 @@ } is_p = scalefac[20]; /* copy l-band 20 to l-band 21 */ - if(is_p != 7) + if (is_p != 7) { int sb; real t1 = tab1[is_p],t2 = tab2[is_p]; @@ -1533,9 +1533,9 @@ { int sblim; - if(gr_info->block_type == 2) + if (gr_info->block_type == 2) { - if(!gr_info->mixed_block_flag) + if (!gr_info->mixed_block_flag) return; sblim = 1; } @@ -1550,13 +1550,13 @@ int sb; real *xr1=(real *) xr[1]; - for(sb=sblim;sb;sb--,xr1+=10) + for (sb=sblim;sb;sb--,xr1+=10) { int ss; real *cs=aa_cs,*ca=aa_ca; real *xr2 = xr1; - for(ss=7;ss>=0;ss--) + for (ss=7;ss>=0;ss--) { /* upper and lower butterfly inputs */ register real bu = *--xr2,bd = *xr1; *xr2 = (bu * (*cs) ) - (bd * (*ca) ); @@ -1842,7 +1842,7 @@ } - if(gr_info->mixed_block_flag) { + if (gr_info->mixed_block_flag) { sb = 2; dct36(fsIn[0],rawout1,rawout2,win[0],tspnt); dct36(fsIn[1],rawout1+18,rawout2+18,win1[0],tspnt+1); @@ -1850,7 +1850,7 @@ } bt = gr_info->block_type; - if(bt == 2) { + if (bt == 2) { for (; sbmaxb; sb+=2,tspnt+=2,rawout1+=36,rawout2+=36) { dct12(fsIn[sb],rawout1,rawout2,win[2],tspnt); dct12(fsIn[sb+1],rawout1+18,rawout2+18,win1[2],tspnt+1); @@ -1863,9 +1863,9 @@ } } - for(;sb= 0) /* stream is stereo, but force to mono */ + else if (single >= 0) /* stream is stereo, but force to mono */ stereo1 = 1; else stereo1 = 2; - if(fr->mode == MPG_MD_JOINT_STEREO) { + if (fr->mode == MPG_MD_JOINT_STEREO) { ms_stereo = fr->mode_ext & 0x2; i_stereo = fr->mode_ext & 0x1; } else ms_stereo = i_stereo = 0; - if(fr->lsf) { + if (fr->lsf) { granules = 1; if (III_get_side_info_2(mp, &sideinfo,stereo,ms_stereo,sfreq,single)) return (MP3_ERR); @@ -1925,7 +1925,7 @@ #endif } - if(set_pointer(mp, sideinfo.main_data_begin) == MP3_ERR) + if (set_pointer(mp, sideinfo.main_data_begin) == MP3_ERR) return 0; for (gr=0;grlsf) + if (fr->lsf) part2bits = III_get_scale_factors_2(mp, scalefacs,gr_info,0); else { #ifdef MPEG1 @@ -1945,13 +1945,13 @@ ast_log(LOG_WARNING,"Not supported\n"); #endif } - if(III_dequantize_sample(mp, hybridIn[0], scalefacs,gr_info,sfreq,part2bits)) + if (III_dequantize_sample(mp, hybridIn[0], scalefacs,gr_info,sfreq,part2bits)) return (MP3_ERR); } - if(stereo == 2) { + if (stereo == 2) { struct gr_info_s *gr_info = &(sideinfo.ch[1].gr[gr]); long part2bits; - if(fr->lsf) + if (fr->lsf) part2bits = III_get_scale_factors_2(mp, scalefacs,gr_info,i_stereo); else { #ifdef MPEG1 @@ -1961,12 +1961,12 @@ #endif } - if(III_dequantize_sample(mp, hybridIn[1],scalefacs,gr_info,sfreq,part2bits)) + if (III_dequantize_sample(mp, hybridIn[1],scalefacs,gr_info,sfreq,part2bits)) return (MP3_ERR); - if(ms_stereo) { + if (ms_stereo) { int i; - for(i=0;ilsf); - if(ms_stereo || i_stereo || (single == 3) ) { - if(gr_info->maxb > sideinfo.ch[0].gr[gr].maxb) + if (ms_stereo || i_stereo || (single == 3) ) { + if (gr_info->maxb > sideinfo.ch[0].gr[gr].maxb) sideinfo.ch[0].gr[gr].maxb = gr_info->maxb; else gr_info->maxb = sideinfo.ch[0].gr[gr].maxb; } - switch(single) { + switch (single) { case 3: { register int i; register real *in0 = (real *) hybridIn[0],*in1 = (real *) hybridIn[1]; - for(i=0;imaxb;i++,in0++) + for (i=0;imaxb;i++,in0++) *in0 = (*in0 + *in1++); /* *0.5 done by pow-scale */ } break; @@ -1998,21 +1998,21 @@ { register int i; register real *in0 = (real *) hybridIn[0],*in1 = (real *) hybridIn[1]; - for(i=0;imaxb;i++) + for (i=0;imaxb;i++) *in0++ = *in1++; } break; } } - for(ch=0;ch= 0) { + for (ss=0;ss= 0) { clip += synth_ntom_mono(mp,hybridOut[0][ss],pcm_sample,pcm_point); } else { Index: addons/mp3/tabinit.c =================================================================== --- addons/mp3/tabinit.c (revision 228266) +++ addons/mp3/tabinit.c (working copy) @@ -40,11 +40,11 @@ int i,k,kr,divv; real *costab; - for(i=0;i<5;i++) + for (i=0;i<5;i++) { kr=0x10>>i; divv=0x40>>i; costab = pnts[i]; - for(k=0;kdecwin; scaleval = -scaleval; - for(i=0,j=0;i<256;i++,j++,table+=32) + for (i=0,j=0;i<256;i++,j++,table+=32) { - if(table < (mp->decwin)+512+16) + if (table < (mp->decwin)+512+16) table[16] = table[0] = (double) intwinbase[j] / 65536.0 * (double) scaleval; - if(i % 32 == 31) + if (i % 32 == 31) table -= 1023; - if(i % 64 == 63) + if (i % 64 == 63) scaleval = - scaleval; } - for( /* i=256 */ ;i<512;i++,j--,table+=32) + for ( /* i=256 */ ;i<512;i++,j--,table+=32) { - if(table < (mp->decwin)+512+16) + if (table < (mp->decwin)+512+16) table[16] = table[0] = (double) intwinbase[j] / 65536.0 * (double) scaleval; - if(i % 32 == 31) + if (i % 32 == 31) table -= 1023; - if(i % 64 == 63) + if (i % 64 == 63) scaleval = - scaleval; } } Index: addons/ooh323c/src/context.c =================================================================== --- addons/ooh323c/src/context.c (revision 228266) +++ addons/ooh323c/src/context.c (working copy) @@ -148,7 +148,7 @@ ast_mutex_lock(&pctxt->pLock); stat = initContextBuffer (pctxt, bufaddr, bufsiz); ast_mutex_unlock(&pctxt->pLock); - if(stat != ASN_OK) return stat; + if (stat != ASN_OK) return stat; return ASN_OK; Index: addons/ooh323c/src/dlist.c =================================================================== --- addons/ooh323c/src/dlist.c (revision 228266) +++ addons/ooh323c/src/dlist.c (working copy) @@ -120,13 +120,13 @@ /* Remove node from list. Node is not freed */ void dListRemove (DList* pList, DListNode* node) { - if(node->next != 0) { + if (node->next != 0) { node->next->prev = node->prev; } else { /* tail */ pList->tail = node->prev; } - if(node->prev != 0) { + if (node->prev != 0) { node->prev->next = node->next; } else { /* head */ @@ -138,12 +138,12 @@ void dListFindAndRemove(DList* pList, void *data) { DListNode *pNode, *pNextNode; - for(pNode = pList->head; pNode !=0; pNode = pNextNode){ + for (pNode = pList->head; pNode !=0; pNode = pNextNode){ pNextNode = pNode->next; - if(pNode->data == data) /* pointer comparison*/ + if (pNode->data == data) /* pointer comparison*/ break; } - if(pNode) + if (pNode) dListRemove(pList, pNode); } @@ -152,8 +152,8 @@ DListNode* curNode; int i; - if(index >= (int)pList->count) return 0; - for(i = 0, curNode = pList->head; i < index && curNode != 0; i++) { + if (index >= (int)pList->count) return 0; + for (i = 0, curNode = pList->head; i < index && curNode != 0; i++) { curNode = curNode->next; } return curNode; @@ -184,10 +184,10 @@ else if (node == pList->head) { /* insert as head (head case) */ pListNode->next = pList->head; pListNode->prev = (DListNode*) 0; - if(pList->head != 0) { + if (pList->head != 0) { pList->head->prev = pListNode; } - if(pList->tail == 0) { + if (pList->tail == 0) { pList->tail = pListNode; } pList->head = pListNode; Index: addons/ooh323c/src/h323/H323-MESSAGESDec.c =================================================================== --- addons/ooh323c/src/h323/H323-MESSAGESDec.c (revision 228266) +++ addons/ooh323c/src/h323/H323-MESSAGESDec.c (working copy) @@ -3190,7 +3190,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -3513,7 +3513,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -3635,7 +3635,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -5018,7 +5018,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -5545,7 +5545,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -6537,7 +6537,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -6581,7 +6581,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -7008,7 +7008,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -8027,7 +8027,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -8265,7 +8265,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -8948,7 +8948,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -9089,7 +9089,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -9258,7 +9258,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -11988,7 +11988,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -13293,7 +13293,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -14091,7 +14091,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -14653,7 +14653,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -16357,7 +16357,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -16401,7 +16401,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -16478,7 +16478,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -17346,7 +17346,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -18006,7 +18006,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -20914,7 +20914,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -21444,7 +21444,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -24224,7 +24224,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -24268,7 +24268,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -24376,7 +24376,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -24710,7 +24710,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -26711,7 +26711,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); Index: addons/ooh323c/src/h323/MULTIMEDIA-SYSTEM-CONTROLDec.c =================================================================== --- addons/ooh323c/src/h323/MULTIMEDIA-SYSTEM-CONTROLDec.c (revision 228266) +++ addons/ooh323c/src/h323/MULTIMEDIA-SYSTEM-CONTROLDec.c (working copy) @@ -2016,7 +2016,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -3940,7 +3940,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -4071,7 +4071,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -4553,7 +4553,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -4740,7 +4740,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -12421,7 +12421,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -14751,7 +14751,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -15063,7 +15063,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -24799,7 +24799,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -24983,7 +24983,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -32777,7 +32777,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); @@ -35784,7 +35784,7 @@ dListAppendNode (pctxt, pvalue, pdata); } - if(lstat == ASN_OK) break; + if (lstat == ASN_OK) break; } return (stat); Index: addons/ooh323c/src/memheap.c =================================================================== --- addons/ooh323c/src/memheap.c (revision 228266) +++ addons/ooh323c/src/memheap.c (working copy) @@ -418,10 +418,10 @@ if ((pMemLink->blockType & RTMEMRAW) && pMemLink->pMemBlk == mem_p) { - if(pMemLink->pnext != 0) { + if (pMemLink->pnext != 0) { pMemLink->pnext->pprev = pMemLink->pprev; } - if(pMemLink->pprev != 0) { + if (pMemLink->pprev != 0) { pMemLink->pprev->pnext = pMemLink->pnext; } else { /* head */ @@ -536,10 +536,10 @@ pMemHeap->usedUnits -= pMemBlk->nunits; pMemHeap->usedBlocks --; - if(pMemBlk->plink->pnext != 0) { + if (pMemBlk->plink->pnext != 0) { pMemBlk->plink->pnext->pprev = pMemBlk->plink->pprev; } - if(pMemBlk->plink->pprev != 0) { + if (pMemBlk->plink->pprev != 0) { pMemBlk->plink->pprev->pnext = pMemBlk->plink->pnext; } else { /* head */ @@ -1015,10 +1015,10 @@ /* unlink block first */ - if(pMemLink2->pnext != 0) { + if (pMemLink2->pnext != 0) { pMemLink2->pnext->pprev = pMemLink2->pprev; } - if(pMemLink2->pprev != 0) { + if (pMemLink2->pprev != 0) { pMemLink2->pprev->pnext = pMemLink2->pnext; } else { /* head */ Index: addons/ooh323c/src/ooCalls.c =================================================================== --- addons/ooh323c/src/ooCalls.c (revision 228266) +++ addons/ooh323c/src/ooCalls.c (working copy) @@ -41,13 +41,13 @@ OOCTXT *msgctxt=NULL; pctxt = newContext(); - if(!pctxt) + if (!pctxt) { OOTRACEERR1("ERROR:Failed to create OOCTXT for new call\n"); return NULL; } msgctxt = newContext(); - if(!msgctxt) + if (!msgctxt) { OOTRACEERR1("ERROR:Failed to create OOCTXT for new call\n"); return NULL; @@ -56,7 +56,7 @@ /* call = (OOH323CallData*)memAlloc(&gH323ep.ctxt, sizeof(OOH323CallData)); */ call = (OOH323CallData*)memAlloc(pctxt, sizeof(OOH323CallData)); ast_mutex_unlock(&newCallLock); - if(!call) + if (!call) { OOTRACEERR1("ERROR:Memory - ooCreateCall - call\n"); return NULL; @@ -70,7 +70,7 @@ sprintf(call->callToken, "%s", callToken); sprintf(call->callType, "%s", type); call->callReference = 0; - if(gH323ep.callerid) { + if (gH323ep.callerid) { strncpy(call->ourCallerId, gH323ep.callerid, sizeof(call->ourCallerId)-1); call->ourCallerId[sizeof(call->ourCallerId)-1] = '\0'; } @@ -85,9 +85,9 @@ if (OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING)) OO_SETFLAG (call->flags, OO_M_TUNNELING); - if(gH323ep.gkClient) + if (gH323ep.gkClient) { - if(OO_TESTFLAG(gH323ep.flags, OO_M_GKROUTED)) + if (OO_TESTFLAG(gH323ep.flags, OO_M_GKROUTED)) { OO_SETFLAG(call->flags, OO_M_GKROUTED); } @@ -109,19 +109,19 @@ call->callEndReason = OO_REASON_UNKNOWN; call->pCallFwdData = NULL; - if(!strcmp(call->callType, "incoming")) + if (!strcmp(call->callType, "incoming")) { call->callingPartyNumber = NULL; } else{ - if(ooUtilsIsStrEmpty(gH323ep.callingPartyNumber)) + if (ooUtilsIsStrEmpty(gH323ep.callingPartyNumber)) { call->callingPartyNumber = NULL; } else{ call->callingPartyNumber = (char*) memAlloc(call->pctxt, strlen(gH323ep.callingPartyNumber)+1); - if(call->callingPartyNumber) + if (call->callingPartyNumber) { strcpy(call->callingPartyNumber, gH323ep.callingPartyNumber); } @@ -175,7 +175,7 @@ call->callToken); /* Add new call to calllist */ ooAddCallToList (call); - if(gH323ep.h323Callbacks.onNewCallCreated) + if (gH323ep.h323Callbacks.onNewCallCreated) gH323ep.h323Callbacks.onNewCallCreated(call); return call; } @@ -184,7 +184,7 @@ { ast_mutex_lock(&callListLock); - if(!gH323ep.callList) + if (!gH323ep.callList) { gH323ep.callList = call; call->next = NULL; @@ -209,29 +209,29 @@ ooGetCallStateText(call->callState), call->callType, call->callToken); - if(call->callState == OO_CALL_REMOVED) { + if (call->callState == OO_CALL_REMOVED) { OOTRACEINFO2("Call already removed %s\n", call->callToken); return OO_OK; } - if(call->callState == OO_CALL_CLEARED) + if (call->callState == OO_CALL_CLEARED) { ooCleanCall(call); call->callState = OO_CALL_REMOVED; return OO_OK; } - if(call->logicalChans) + if (call->logicalChans) { OOTRACEINFO3("Clearing all logical channels. (%s, %s)\n", call->callType, call->callToken); ooClearAllLogicalChannels(call); } - if(!OO_TESTFLAG(call->flags, OO_M_ENDSESSION_BUILT)) + if (!OO_TESTFLAG(call->flags, OO_M_ENDSESSION_BUILT)) { - if(call->h245SessionState == OO_H245SESSION_ACTIVE || + if (call->h245SessionState == OO_H245SESSION_ACTIVE || call->h245SessionState == OO_H245SESSION_ENDRECVD) { ooSendEndSessionCommand(call); @@ -240,14 +240,14 @@ } - if(!call->pH225Channel || call->pH225Channel->sock ==0) + if (!call->pH225Channel || call->pH225Channel->sock ==0) { call->callState = OO_CALL_CLEARED; } else{ - if(!OO_TESTFLAG(call->flags, OO_M_RELEASE_BUILT)) + if (!OO_TESTFLAG(call->flags, OO_M_RELEASE_BUILT)) { - if(call->callState == OO_CALL_CLEAR || + if (call->callState == OO_CALL_CLEAR || call->callState == OO_CALL_CLEAR_RELEASERECVD) { ooSendReleaseComplete(call); @@ -263,7 +263,7 @@ int ooRemoveCallFromList (OOH323CallData *call) { - if(!call) + if (!call) return OO_OK; ast_mutex_lock(&callListLock); @@ -271,9 +271,9 @@ OOTRACEINFO3("Removing call %lx: %s\n", call, call->callToken); if (!gH323ep.callList) return OO_OK; - if(call == gH323ep.callList) + if (call == gH323ep.callList) { - if(!call->next) + if (!call->next) gH323ep.callList = NULL; else{ call->next->prev = NULL; @@ -282,7 +282,7 @@ } else{ call->prev->next = call->next; - if(call->next) + if (call->next) call->next->prev = call->prev; } @@ -300,14 +300,14 @@ ooGetReasonCodeText (call->callEndReason)); /* First clean all the logical channels, if not already cleaned. */ - if(call->logicalChans) + if (call->logicalChans) ooClearAllLogicalChannels(call); /* Close H.245 connection, if not already closed */ - if(call->h245SessionState != OO_H245SESSION_CLOSED) + if (call->h245SessionState != OO_H245SESSION_CLOSED) ooCloseH245Connection(call); else{ - if(call->pH245Channel && call->pH245Channel->outQueue.count > 0) + if (call->pH245Channel && call->pH245Channel->outQueue.count > 0) { dListFreeAll(call->pctxt, &(call->pH245Channel->outQueue)); memFreePtr(call->pctxt, call->pH245Channel); @@ -315,7 +315,7 @@ } /* Close H.245 listener, if not already closed */ - if(call->h245listener) + if (call->h245listener) { ooCloseH245Listener(call); } @@ -327,12 +327,12 @@ } /* Clean timers */ - if(call->timerList.count > 0) + if (call->timerList.count > 0) { dListFreeAll(call->pctxt, &(call->timerList)); } - if(gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) + if (gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) { ooGkClientCleanCall(gH323ep.gkClient, call); } @@ -341,20 +341,20 @@ OOTRACEINFO3("Removed call (%s, %s) from list\n", call->callType, call->callToken); - if(call->pCallFwdData && call->pCallFwdData->fwdedByRemote) + if (call->pCallFwdData && call->pCallFwdData->fwdedByRemote) { - if(gH323ep.h323Callbacks.onCallForwarded) + if (gH323ep.h323Callbacks.onCallForwarded) gH323ep.h323Callbacks.onCallForwarded(call); - if(ooH323HandleCallFwdRequest(call)!= OO_OK) + if (ooH323HandleCallFwdRequest(call)!= OO_OK) { OOTRACEERR3("Error:Failed to forward call (%s, %s)\n", call->callType, call->callToken); } } else { - if(gH323ep.h323Callbacks.onCallCleared) + if (gH323ep.h323Callbacks.onCallCleared) gH323ep.h323Callbacks.onCallCleared(call); } @@ -382,7 +382,7 @@ int ooCallSetCallerId(OOH323CallData* call, const char* callerid) { - if(!call || !callerid) return OO_FAILED; + if (!call || !callerid) return OO_FAILED; strncpy(call->ourCallerId, callerid, sizeof(call->ourCallerId)-1); call->ourCallerId[sizeof(call->ourCallerId)-1]='\0'; return OO_OK; @@ -390,11 +390,11 @@ int ooCallSetCallingPartyNumber(OOH323CallData *call, const char *number) { - if(call->callingPartyNumber) + if (call->callingPartyNumber) memFreePtr(call->pctxt, call->callingPartyNumber); call->callingPartyNumber = (char*) memAlloc(call->pctxt, strlen(number)+1); - if(call->callingPartyNumber) + if (call->callingPartyNumber) { strcpy(call->callingPartyNumber, number); } @@ -405,7 +405,7 @@ return OO_FAILED; } /* Set dialed digits alias */ - /* if(!strcmp(call->callType, "outgoing")) + /* if (!strcmp(call->callType, "outgoing")) { ooCallAddAliasDialedDigits(call, number); }*/ @@ -414,9 +414,9 @@ int ooCallGetCallingPartyNumber(OOH323CallData *call, char *buffer, int len) { - if(call->callingPartyNumber) + if (call->callingPartyNumber) { - if(len>(int)strlen(call->callingPartyNumber)) + if (len>(int)strlen(call->callingPartyNumber)) { strcpy(buffer, call->callingPartyNumber); return OO_OK; @@ -429,11 +429,11 @@ int ooCallSetCalledPartyNumber(OOH323CallData *call, const char *number) { - if(call->calledPartyNumber) + if (call->calledPartyNumber) memFreePtr(call->pctxt, call->calledPartyNumber); call->calledPartyNumber = (char*) memAlloc(call->pctxt, strlen(number)+1); - if(call->calledPartyNumber) + if (call->calledPartyNumber) { strcpy(call->calledPartyNumber, number); } @@ -448,9 +448,9 @@ int ooCallGetCalledPartyNumber(OOH323CallData *call, char *buffer, int len) { - if(call->calledPartyNumber) + if (call->calledPartyNumber) { - if(len>(int)strlen(call->calledPartyNumber)) + if (len>(int)strlen(call->calledPartyNumber)) { strcpy(buffer, call->calledPartyNumber); return OO_OK; @@ -462,7 +462,7 @@ int ooCallClearAliases(OOH323CallData *call) { - if(call->ourAliases) + if (call->ourAliases) memFreePtr(call->pctxt, call->ourAliases); call->ourAliases = NULL; return OO_OK; @@ -474,7 +474,7 @@ { ooAliases * psNewAlias=NULL; psNewAlias = (ooAliases*)memAlloc(call->pctxt, sizeof(ooAliases)); - if(!psNewAlias) + if (!psNewAlias) { OOTRACEERR3("Error:Memory - ooCallAddAlias - psNewAlias" "(%s, %s)\n", call->callType, call->callToken); @@ -482,7 +482,7 @@ } psNewAlias->type = aliasType; psNewAlias->value = (char*) memAlloc(call->pctxt, strlen(value)+1); - if(!psNewAlias->value) + if (!psNewAlias->value) { OOTRACEERR3("Error:Memory - ooCallAddAlias - psNewAlias->value" " (%s, %s)\n", call->callType, call->callToken); @@ -491,7 +491,7 @@ } strcpy(psNewAlias->value, value); - if(local) + if (local) { psNewAlias->next = call->ourAliases; call->ourAliases = psNewAlias; @@ -738,7 +738,7 @@ OOH323CallData* ooFindCallByToken(const char *callToken) { OOH323CallData *call; - if(!callToken) + if (!callToken) { OOTRACEERR1("ERROR:Invalid call token passed - ooFindCallByToken\n"); return NULL; @@ -746,22 +746,22 @@ ast_mutex_lock(&callListLock); - if(!gH323ep.callList) + if (!gH323ep.callList) { OOTRACEERR1("ERROR: Empty calllist - ooFindCallByToken failed\n"); ast_mutex_unlock(&callListLock); return NULL; } call = gH323ep.callList; - while(call) + while (call) { - if(!strcmp(call->callToken, callToken)) + if (!strcmp(call->callToken, callToken)) break; else call = call->next; } - if(!call) + if (!call) { OOTRACEERR2("ERROR:Call with token %s not found\n", callToken); ast_mutex_unlock(&callListLock); @@ -782,9 +782,9 @@ { OOLogicalChannel * temp = NULL; temp = call->logicalChans; - while(temp) + while (temp) { - if(temp->sessionID == sessionID && + if (temp->sessionID == sessionID && temp->state == OO_LOGICALCHAN_ESTABLISHED && !strcmp(temp->dir, dir) ) return TRUE; @@ -797,14 +797,14 @@ { OOMediaInfo *newMediaInfo=NULL; - if(!call) + if (!call) { OOTRACEERR3("Error:Invalid 'call' param for ooAddMediaInfo.(%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } newMediaInfo = (OOMediaInfo*) memAlloc(call->pctxt, sizeof(OOMediaInfo)); - if(!newMediaInfo) + if (!newMediaInfo) { OOTRACEERR3("Error:Memory - ooAddMediaInfo - newMediaInfo. " "(%s, %s)\n", call->callType, call->callToken); @@ -816,7 +816,7 @@ OOTRACEDBGC4("Configured mediainfo for cap %s (%s, %s)\n", ooGetCapTypeText(mediaInfo.cap), call->callType, call->callToken); - if(!call->mediaInfo) { + if (!call->mediaInfo) { newMediaInfo->next = NULL; call->mediaInfo = newMediaInfo; } @@ -832,14 +832,14 @@ { unsigned sessionID=0; - if(type == OO_CAP_TYPE_AUDIO) + if (type == OO_CAP_TYPE_AUDIO) { - if(!ooGetLogicalChannel(call, 1, dir)) + if (!ooGetLogicalChannel(call, 1, dir)) { sessionID = 1; } else{ - if(call->masterSlaveState == OO_MasterSlave_Master) + if (call->masterSlaveState == OO_MasterSlave_Master) sessionID = call->nextSessionID++; else{ OOTRACEDBGC4("Session id for %s channel of type audio has to be " @@ -850,14 +850,14 @@ } } - if(type == OO_CAP_TYPE_VIDEO) + if (type == OO_CAP_TYPE_VIDEO) { - if(!ooGetLogicalChannel(call, 2, dir)) + if (!ooGetLogicalChannel(call, 2, dir)) { sessionID = 2; } else{ - if(call->masterSlaveState == OO_MasterSlave_Master) + if (call->masterSlaveState == OO_MasterSlave_Master) sessionID = call->nextSessionID++; else{ sessionID = 0; /* Will be assigned by remote */ @@ -867,14 +867,14 @@ } } } - if(type == OO_CAP_TYPE_DATA) + if (type == OO_CAP_TYPE_DATA) { - if(!ooGetLogicalChannel(call, 3, dir)) + if (!ooGetLogicalChannel(call, 3, dir)) { sessionID = 3; } else{ - if(call->masterSlaveState == OO_MasterSlave_Master) + if (call->masterSlaveState == OO_MasterSlave_Master) sessionID = call->nextSessionID++; else{ sessionID = 0; /* Will be assigned by remote */ Index: addons/ooh323c/src/ooCapability.c =================================================================== --- addons/ooh323c/src/ooCapability.c (revision 228266) +++ addons/ooh323c/src/ooCapability.c (working copy) @@ -30,19 +30,19 @@ int ooCapabilityEnableDTMFRFC2833 (OOH323CallData *call, int dynamicRTPPayloadType) { - if(!call) + if (!call) { gH323ep.dtmfmode |= OO_CAP_DTMF_RFC2833; OOTRACEINFO1("Enabled RFC2833 DTMF capability for end-point\n"); /*Dynamic RTP payload type range is from 96 - 127 */ - if(dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127) + if (dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127) giDynamicRTPPayloadType = dynamicRTPPayloadType; } else{ call->dtmfmode |= OO_CAP_DTMF_RFC2833; OOTRACEINFO3("Enabled RFC2833 DTMF capability for (%s, %s) \n", call->callType, call->callToken); - if(dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127) + if (dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127) call->dtmfcodec = dynamicRTPPayloadType; else call->dtmfcodec = giDynamicRTPPayloadType; @@ -55,12 +55,12 @@ int ooCapabilityEnableDTMFCISCO (OOH323CallData *call, int dynamicRTPPayloadType) { - if(!call) + if (!call) { gH323ep.dtmfmode |= OO_CAP_DTMF_CISCO; OOTRACEINFO1("Enabled RTP/CISCO DTMF capability for end-point\n"); /*Dynamic RTP payload type range is from 96 - 127 */ - if(dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127) + if (dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127) gcDynamicRTPPayloadType = dynamicRTPPayloadType; else call->dtmfcodec = dynamicRTPPayloadType; @@ -69,7 +69,7 @@ call->dtmfmode |= OO_CAP_DTMF_CISCO; OOTRACEINFO3("Enabled RTP/CISCO DTMF capability for (%s, %s) \n", call->callType, call->callToken); - if(dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127) + if (dynamicRTPPayloadType >= 96 && dynamicRTPPayloadType <= 127) call->dtmfcodec = dynamicRTPPayloadType; else call->dtmfcodec = gcDynamicRTPPayloadType; @@ -83,7 +83,7 @@ int ooCapabilityDisableDTMFRFC2833(OOH323CallData *call) { - if(!call){ + if (!call){ gH323ep.dtmfmode ^= OO_CAP_DTMF_RFC2833; OOTRACEINFO1("Disabled RFC2833 DTMF capability for end-point\n"); } @@ -98,7 +98,7 @@ int ooCapabilityDisableDTMFCISCO(OOH323CallData *call) { - if(!call){ + if (!call){ gH323ep.dtmfmode ^= OO_CAP_DTMF_CISCO; OOTRACEINFO1("Disabled RTP/CISCO DTMF capability for end-point\n"); } @@ -113,7 +113,7 @@ int ooCapabilityEnableDTMFH245Alphanumeric(OOH323CallData *call) { - if(!call){ + if (!call){ gH323ep.dtmfmode |= OO_CAP_DTMF_H245_alphanumeric; OOTRACEINFO1("Dtmf mode set to H.245(alphanumeric) for endpoint\n"); } @@ -127,7 +127,7 @@ int ooCapabilityDisableDTMFH245Alphanumeric(OOH323CallData *call) { - if(!call){ + if (!call){ gH323ep.dtmfmode ^= OO_CAP_DTMF_H245_alphanumeric; OOTRACEINFO1("Dtmf mode H.245(alphanumeric) disabled for endpoint\n"); } @@ -141,7 +141,7 @@ int ooCapabilityEnableDTMFH245Signal(OOH323CallData *call) { - if(!call){ + if (!call){ gH323ep.dtmfmode |= OO_CAP_DTMF_H245_signal; OOTRACEINFO1("Dtmf mode set to H.245(signal) for endpoint\n"); } @@ -155,7 +155,7 @@ int ooCapabilityDisableDTMFH245Signal(OOH323CallData *call) { - if(!call){ + if (!call){ gH323ep.dtmfmode ^= OO_CAP_DTMF_H245_signal; OOTRACEINFO1("Dtmf mode H.245(signal) disabled for endpoint\n"); } @@ -169,7 +169,7 @@ int ooCapabilityEnableDTMFQ931Keypad(struct OOH323CallData *call) { - if(!call){ + if (!call){ gH323ep.dtmfmode |= OO_CAP_DTMF_Q931; OOTRACEINFO1("Dtmf mode set to Q.931(keypad) for the endpoint\n"); } @@ -183,7 +183,7 @@ int ooCapabilityDisableDTMFQ931Keypad(struct OOH323CallData *call) { - if(!call){ + if (!call){ gH323ep.dtmfmode ^= OO_CAP_DTMF_Q931; OOTRACEINFO1("Dtmf mode Q.931(keypad) disabled for the endpoint\n"); } @@ -206,62 +206,62 @@ OOBOOL remote) { int ret = OO_OK; - if(sqcifMPI>0) + if (sqcifMPI>0) { ret = ooCapabilityAddH263VideoCapability_helper(call, sqcifMPI, 0, 0, 0, 0, maxBitRate, dir, startReceiveChannel, startTransmitChannel, stopReceiveChannel, stopTransmitChannel, remote); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error: Failed to add H263 sqcifMPI capability\n"); return OO_FAILED; } } - if(qcifMPI>0) + if (qcifMPI>0) { ret = ooCapabilityAddH263VideoCapability_helper(call, 0, qcifMPI, 0, 0, 0, maxBitRate, dir, startReceiveChannel, startTransmitChannel, stopReceiveChannel, stopTransmitChannel, remote); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error: Failed to add H263 qcifMPI capability\n"); return OO_FAILED; } } - if(cifMPI>0) + if (cifMPI>0) { ret = ooCapabilityAddH263VideoCapability_helper(call, 0, 0, cifMPI, 0, 0, maxBitRate, dir, startReceiveChannel, startTransmitChannel, stopReceiveChannel, stopTransmitChannel, remote); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error: Failed to add H263 cifMPI capability\n"); return OO_FAILED; } } - if(cif4MPI>0) + if (cif4MPI>0) { ret = ooCapabilityAddH263VideoCapability_helper(call, 0, 0, 0, cif4MPI, 0, maxBitRate, dir, startReceiveChannel, startTransmitChannel, stopReceiveChannel, stopTransmitChannel, remote); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error: Failed to add H263 cif4MPI capability\n"); return OO_FAILED; } } - if(cif16MPI>0) + if (cif16MPI>0) { ret = ooCapabilityAddH263VideoCapability_helper(call, dir, 0, 0, 0, 0, cif16MPI, maxBitRate, startReceiveChannel, startTransmitChannel, stopReceiveChannel, stopTransmitChannel, remote); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error: Failed to add H263 cif16MPI capability\n"); return OO_FAILED; @@ -288,43 +288,43 @@ char *pictureType = NULL; int cap = OO_H263VIDEO; - if(!call) pctxt = &gH323ep.ctxt; + if (!call) pctxt = &gH323ep.ctxt; else pctxt = call->pctxt; epCap = (ooH323EpCapability*)memAllocZ(pctxt, sizeof(ooH323EpCapability)); params = (OOH263CapParams*) memAllocZ(pctxt, sizeof(OOH263CapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR1("Error:Memory - ooCapabilityAddH263Capability - epCap/params" ".\n"); return OO_FAILED; } - if(sqcifMPI>0) + if (sqcifMPI>0) { params->MPI = sqcifMPI; params->picFormat = OO_PICFORMAT_SQCIF; pictureType = "SQCIF"; } - if(qcifMPI>0) + if (qcifMPI>0) { params->MPI = qcifMPI; params->picFormat = OO_PICFORMAT_QCIF; pictureType = "QCIF"; } - if(cifMPI>0) + if (cifMPI>0) { params->MPI = cifMPI; params->picFormat = OO_PICFORMAT_CIF; pictureType = "CIF"; } - if(cif4MPI>0) + if (cif4MPI>0) { params->MPI = cif4MPI; params->picFormat = OO_PICFORMAT_CIF4; pictureType = "CIF4"; } - if(cif16MPI>0) + if (cif16MPI>0) { params->MPI = cif16MPI; params->picFormat = OO_PICFORMAT_CIF16; @@ -334,7 +334,7 @@ params->maxBitRate = maxBitRate; - if(dir & OORXANDTX) + if (dir & OORXANDTX) { epCap->dir = OORX; epCap->dir |= OOTX; @@ -352,28 +352,28 @@ epCap->next = NULL; - if(!call) + if (!call) {/*Add as local capability */ OOTRACEDBGC2("Adding endpoint H263 video capability %s.\n", pictureType); - if(!gH323ep.myCaps) + if (!gH323ep.myCaps) gH323ep.myCaps = epCap; else{ cur = gH323ep.myCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } ooAppendCapToCapPrefs(NULL, cap); gH323ep.noOfCaps++; } else{ - if(remote) + if (remote) { /*Add as remote capability */ - if(!call->remoteCaps) + if (!call->remoteCaps) call->remoteCaps = epCap; else{ cur = call->remoteCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } } @@ -382,12 +382,12 @@ OOTRACEDBGC4("Adding call specific H263 video capability %s. " "(%s, %s)\n", pictureType, call->callType, call->callToken); - if(!call->ourCaps){ + if (!call->ourCaps){ call->ourCaps = epCap; ooResetCapPrefs(call); }else{ cur = call->ourCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } ooAppendCapToCapPrefs(call, cap); @@ -410,12 +410,12 @@ ooH323EpCapability *epCap = NULL, *cur=NULL; OOCapParams *params=NULL; OOCTXT *pctxt=NULL; - if(!call) pctxt = &gH323ep.ctxt; + if (!call) pctxt = &gH323ep.ctxt; else pctxt = call->pctxt; epCap = (ooH323EpCapability*)memAlloc(pctxt, sizeof(ooH323EpCapability)); params = (OOCapParams*) memAlloc(pctxt, sizeof(OOCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR1("ERROR: Memory - ooCapabilityAddSimpleCapability - " "epCap/params\n"); @@ -426,12 +426,12 @@ params->txframes = txframes; params->rxframes = rxframes; /* Ignore silence suppression parameter unless cap is g7231 */ - if(cap == OO_G7231) + if (cap == OO_G7231) params->silenceSuppression = silenceSuppression; else params->silenceSuppression = FALSE; /* Set to false for g711 and g729*/ - if(dir & OORXANDTX) { + if (dir & OORXANDTX) { epCap->dir = OORX; epCap->dir |= OOTX; } @@ -448,32 +448,32 @@ epCap->stopTransmitChannel = stopTransmitChannel; epCap->next = NULL; - if(!call) + if (!call) { /* Add as local capability */ OOTRACEDBGC2("Adding endpoint capability %s. \n", ooGetCapTypeText(epCap->cap)); - if(!gH323ep.myCaps) { + if (!gH323ep.myCaps) { gH323ep.myCaps = epCap; } else{ cur = gH323ep.myCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } ooAppendCapToCapPrefs(NULL, cap); gH323ep.noOfCaps++; } else{ - if(remote) + if (remote) { /* Add as remote capability */ - if(!call->remoteCaps) { + if (!call->remoteCaps) { call->remoteCaps = epCap; } else{ cur = call->remoteCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } } @@ -482,13 +482,13 @@ OOTRACEDBGC4("Adding call specific capability %s. (%s, %s)\n", ooGetCapTypeText(epCap->cap), call->callType, call->callToken); - if(!call->ourCaps){ + if (!call->ourCaps){ call->ourCaps = epCap; ooResetCapPrefs(call); } else{ cur = call->ourCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } ooAppendCapToCapPrefs(call, cap); @@ -527,12 +527,12 @@ OOGSMCapParams *params=NULL; OOCTXT *pctxt = NULL; - if(!call) pctxt = &gH323ep.ctxt; + if (!call) pctxt = &gH323ep.ctxt; else pctxt = call->pctxt; epCap = (ooH323EpCapability*)memAlloc(pctxt, sizeof(ooH323EpCapability)); params = (OOGSMCapParams*) memAlloc(pctxt, sizeof(OOGSMCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR1("Error:Memory - ooCapabilityAddGSMCapability - " "epCap/params\n"); @@ -544,7 +544,7 @@ params->txframes = framesPerPkt; params->comfortNoise = comfortNoise; params->scrambled = scrambled; - if(dir & OORXANDTX) + if (dir & OORXANDTX) { epCap->dir = OORX; epCap->dir |= OOTX; @@ -562,27 +562,27 @@ epCap->next = NULL; /* Add as local capability */ - if(!call) + if (!call) { - if(!gH323ep.myCaps) + if (!gH323ep.myCaps) gH323ep.myCaps = epCap; else{ cur = gH323ep.myCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } ooAppendCapToCapPrefs(NULL, cap); gH323ep.noOfCaps++; } else{ - if(remote) + if (remote) { /*Add as remote capability */ - if(!call->remoteCaps) + if (!call->remoteCaps) call->remoteCaps = epCap; else{ cur = call->remoteCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } } @@ -591,13 +591,13 @@ ooGetCapTypeText(epCap->cap), call->callType, call->callToken); /*Add as our capability */ - if(!call->ourCaps){ + if (!call->ourCaps){ call->ourCaps = epCap; ooResetCapPrefs(call); } else{ cur = call->ourCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } ooAppendCapToCapPrefs(call, cap); @@ -619,20 +619,20 @@ ooH323EpCapability *epCap = NULL, *cur=NULL; OOCapParams *params=NULL; OOCTXT *pctxt=NULL; - if(!call) pctxt = &gH323ep.ctxt; + if (!call) pctxt = &gH323ep.ctxt; else pctxt = call->pctxt; epCap = (ooH323EpCapability*)memAllocZ(pctxt, sizeof(ooH323EpCapability)); params = (OOCapParams*) memAlloc(pctxt, sizeof(OOCapParams)); memset(params, 0 , sizeof(OOCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR1("ERROR: Memory - ooCapabilityAddT38Capability - " "epCap/params\n"); return OO_FAILED; } - if(dir & OORXANDTX) { + if (dir & OORXANDTX) { epCap->dir = OORX; epCap->dir |= OOTX; } @@ -649,32 +649,32 @@ epCap->stopTransmitChannel = stopTransmitChannel; epCap->next = NULL; - if(!call) + if (!call) { /* Add as local capability */ OOTRACEDBGC2("Adding endpoint capability %s. \n", ooGetCapTypeText(epCap->cap)); - if(!gH323ep.myCaps) { + if (!gH323ep.myCaps) { gH323ep.myCaps = epCap; } else{ cur = gH323ep.myCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } ooAppendCapToCapPrefs(NULL, cap); gH323ep.noOfCaps++; } else{ - if(remote) + if (remote) { /* Add as remote capability */ - if(!call->remoteCaps) { + if (!call->remoteCaps) { call->remoteCaps = epCap; } else{ cur = call->remoteCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } call->t38sides |= 2; @@ -684,13 +684,13 @@ OOTRACEDBGC4("Adding call specific capability %s. (%s, %s)\n", ooGetCapTypeText(epCap->cap), call->callType, call->callToken); - if(!call->ourCaps){ + if (!call->ourCaps){ call->ourCaps = epCap; ooResetCapPrefs(call); } else{ cur = call->ourCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } ooAppendCapToCapPrefs(call, cap); @@ -708,21 +708,21 @@ (ooH323EpCapability *epCap, OOCTXT *pctxt, int dir) { - if(!epCap) + if (!epCap) { OOTRACEERR1("Error:Invalid capability parameter passed to " "ooCapabilityCreateVideoCapability.\n"); return NULL; } - if(!(epCap->dir & dir)) + if (!(epCap->dir & dir)) { OOTRACEERR1("Error:Failed to create capability due to direction " "mismatch.\n"); return NULL; } - switch(epCap->cap) + switch (epCap->cap) { case OO_H263VIDEO: return ooCapabilityCreateH263VideoCapability(epCap, pctxt, dir); @@ -746,21 +746,21 @@ (ooH323EpCapability *epCap, OOCTXT *pctxt, int dir) { - if(!epCap) + if (!epCap) { OOTRACEERR1("Error:Invalid capability parameter passed to " "ooCapabilityCreateAudioCapability.\n"); return NULL; } - if(!(epCap->dir & dir)) + if (!(epCap->dir & dir)) { OOTRACEERR1("Error:Failed to create capability due to direction " "mismatch.\n"); return NULL; } - switch(epCap->cap) + switch (epCap->cap) { case OO_G711ALAW64K: case OO_G711ALAW56K: @@ -796,12 +796,12 @@ H245DataApplicationCapability *pCSDTMFCap=NULL; H245UserInputCapability *userInput = NULL; char *events=NULL; - switch(cap) + switch (cap) { case OO_CAP_DTMF_RFC2833: pATECap = (H245AudioTelephonyEventCapability*)memAlloc(pctxt, sizeof(H245AudioTelephonyEventCapability)); - if(!pATECap) + if (!pATECap) { OOTRACEERR1("Error:Memory - ooCapabilityCreateDTMFCapability - pATECap\n"); return NULL; @@ -810,7 +810,7 @@ pATECap->dynamicRTPPayloadType = dtmfcodec; events = (char*)memAlloc(pctxt, strlen("0-16")+1); memset(events, 0, strlen("0-16")+1); - if(!events) + if (!events) { OOTRACEERR1("Error:Memory - ooCapabilityCreateDTMFCapability - events\n"); memFreePtr(pctxt, pATECap); @@ -822,7 +822,7 @@ case OO_CAP_DTMF_CISCO: pCSDTMFCap = (H245DataApplicationCapability*)memAlloc(pctxt, sizeof(H245DataApplicationCapability)); - if(!pCSDTMFCap) + if (!pCSDTMFCap) { OOTRACEERR1("Error:Memory - ooCapabilityCreateDTMFCapability - pCSDTMFCap\n"); return NULL; @@ -856,7 +856,7 @@ case OO_CAP_DTMF_H245_alphanumeric: userInput = (H245UserInputCapability*)memAllocZ(pctxt, sizeof(H245UserInputCapability)); - if(!userInput) + if (!userInput) { OOTRACEERR1("Error:Memory - ooCapabilityCreateDTMFCapability - " "userInput\n"); @@ -867,7 +867,7 @@ case OO_CAP_DTMF_H245_signal: userInput = (H245UserInputCapability*)memAllocZ(pctxt, sizeof(H245UserInputCapability)); - if(!userInput) + if (!userInput) { OOTRACEERR1("Error:Memory - ooCapabilityCreateDTMFCapability - " "userInput\n"); @@ -890,7 +890,7 @@ OOH263CapParams *params=NULL; H245H263VideoCapability *pH263Cap=NULL; - if(!epCap || !epCap->params) + if (!epCap || !epCap->params) { OOTRACEERR1("Error:Invalid capability parameters to " "ooCapabilityCreateH263VideoCapability.\n"); @@ -902,7 +902,7 @@ sizeof(H245VideoCapability)); pH263Cap = (H245H263VideoCapability*) memAllocZ(pctxt, sizeof(H245H263VideoCapability)); - if(!pVideo || !pH263Cap) + if (!pVideo || !pH263Cap) { OOTRACEERR1("ERROR:Memory - ooCapabilityCreateH263VideoCapability - " "pVideo/pH263Cap\n"); @@ -913,23 +913,23 @@ pVideo->u.h263VideoCapability = pH263Cap; - if(params->picFormat == OO_PICFORMAT_SQCIF) { + if (params->picFormat == OO_PICFORMAT_SQCIF) { pH263Cap->m.sqcifMPIPresent = TRUE; pH263Cap->sqcifMPI = params->MPI; } - else if(params->picFormat == OO_PICFORMAT_QCIF) { + else if (params->picFormat == OO_PICFORMAT_QCIF) { pH263Cap->m.qcifMPIPresent = TRUE; pH263Cap->qcifMPI = params->MPI; } - else if(params->picFormat == OO_PICFORMAT_CIF) { + else if (params->picFormat == OO_PICFORMAT_CIF) { pH263Cap->m.cifMPIPresent = TRUE; pH263Cap->cifMPI = params->MPI; } - else if(params->picFormat == OO_PICFORMAT_CIF4) { + else if (params->picFormat == OO_PICFORMAT_CIF4) { pH263Cap->m.cif4MPIPresent = TRUE; pH263Cap->cif4MPI = params->MPI; } - else if(params->picFormat == OO_PICFORMAT_CIF16) { + else if (params->picFormat == OO_PICFORMAT_CIF16) { pH263Cap->m.cif16MPIPresent = TRUE; pH263Cap->cif16MPI = params->MPI; } @@ -957,7 +957,7 @@ { H245AudioCapability *pAudio=NULL; H245GSMAudioCapability *pGSMCap=NULL; - if(!epCap || !epCap->params) + if (!epCap || !epCap->params) { OOTRACEERR1("Error:Invalid capability parameters to " "ooCapabilityCreateGSMFullRateCapability.\n"); @@ -968,7 +968,7 @@ sizeof(H245AudioCapability)); pGSMCap = (H245GSMAudioCapability*)memAlloc(pctxt, sizeof(H245GSMAudioCapability)); - if(!pAudio || !pGSMCap) + if (!pAudio || !pGSMCap) { OOTRACEERR1("ERROR:Memory - ooCapabilityCreateGSMFullRateCapability - " "pAudio/pGSMCap\n"); @@ -985,7 +985,7 @@ pAudio->t = T_H245AudioCapability_gsmFullRate; } pAudio->u.gsmFullRate = pGSMCap; - if(dir & OORX) + if (dir & OORX) pGSMCap->audioUnitSize = ((OOGSMCapParams*)epCap->params)->rxframes*OO_GSMFRAMESIZE; else pGSMCap->audioUnitSize = ((OOGSMCapParams*)epCap->params)->txframes*OO_GSMFRAMESIZE; @@ -1002,7 +1002,7 @@ { H245AudioCapability *pAudio=NULL; OOCapParams *params; - if(!epCap || !epCap->params) + if (!epCap || !epCap->params) { OOTRACEERR1("Error:Invalid capability parameters to " "ooCapabilityCreateSimpleCapability.\n"); @@ -1011,67 +1011,67 @@ params =(OOCapParams*)epCap->params; pAudio = (H245AudioCapability*)memAlloc(pctxt, sizeof(H245AudioCapability)); - if(!pAudio) + if (!pAudio) { OOTRACEERR1("ERROR:Memory - ooCapabilityCreateSimpleCapability - pAudio\n"); return NULL; } - switch(epCap->cap) + switch (epCap->cap) { case OO_G711ALAW64K: pAudio->t = T_H245AudioCapability_g711Alaw64k; - if(dir & OORX) + if (dir & OORX) pAudio->u.g711Alaw64k = params->rxframes; else pAudio->u.g711Alaw64k = params->txframes; return pAudio; case OO_G711ALAW56K: pAudio->t = T_H245AudioCapability_g711Alaw56k; - if(dir & OORX) + if (dir & OORX) pAudio->u.g711Alaw56k = params->rxframes; else pAudio->u.g711Alaw56k = params->txframes; return pAudio; case OO_G711ULAW64K: pAudio->t = T_H245AudioCapability_g711Ulaw64k; - if(dir & OORX) + if (dir & OORX) pAudio->u.g711Ulaw64k = params->rxframes; else pAudio->u.g711Ulaw64k = params->txframes; return pAudio; case OO_G711ULAW56K: pAudio->t = T_H245AudioCapability_g711Ulaw56k; - if(dir & OORX) + if (dir & OORX) pAudio->u.g711Ulaw56k = params->rxframes; else pAudio->u.g711Ulaw64k = params->txframes; return pAudio; case OO_G728: pAudio->t = T_H245AudioCapability_g728; - if(dir & OORX) + if (dir & OORX) pAudio->u.g728 = params->rxframes; else pAudio->u.g728 = params->txframes; return pAudio; case OO_G729: pAudio->t = T_H245AudioCapability_g729; - if(dir & OORX) + if (dir & OORX) pAudio->u.g729 = params->rxframes; else pAudio->u.g729 = params->txframes; return pAudio; case OO_G729A: pAudio->t = T_H245AudioCapability_g729AnnexA; - if(dir & OORX) + if (dir & OORX) pAudio->u.g729AnnexA = params->rxframes; else pAudio->u.g729AnnexA = params->txframes; return pAudio; case OO_G729B: pAudio->t = T_H245AudioCapability_g729wAnnexB; - if(dir & OORX) + if (dir & OORX) pAudio->u.g729AnnexA = params->rxframes; else pAudio->u.g729AnnexA = params->txframes; @@ -1080,14 +1080,14 @@ pAudio->t = T_H245AudioCapability_g7231; pAudio->u.g7231 = (H245AudioCapability_g7231*)memAlloc(pctxt, sizeof(H245AudioCapability_g7231)); - if(!pAudio->u.g7231) + if (!pAudio->u.g7231) { OOTRACEERR1("Error:Memory - ooCapabilityCreateSimpleCapability - g7231\n"); memFreePtr(pctxt, pAudio); return NULL; } pAudio->u.g7231->silenceSuppression = params->silenceSuppression; - if(dir & OORX) + if (dir & OORX) pAudio->u.g7231->maxAl_sduAudioFrames = params->rxframes; else pAudio->u.g7231->maxAl_sduAudioFrames = params->txframes; @@ -1105,7 +1105,7 @@ { H245AudioCapability *pAudio=NULL; OOCapParams *params; - if(!epCap || !epCap->params) + if (!epCap || !epCap->params) { OOTRACEERR1("Error:Invalid capability parameters to " "ooCapabilityCreateSimpleCapability.\n"); @@ -1114,14 +1114,14 @@ params =(OOCapParams*)epCap->params; pAudio = (H245AudioCapability*)memAlloc(pctxt, sizeof(H245AudioCapability)); - if(!pAudio) + if (!pAudio) { OOTRACEERR1("ERROR:Memory - ooCapabilityCreateSimpleCapability - pAudio\n"); return NULL; } - switch(epCap->cap) + switch (epCap->cap) { case OO_AMRNB: case OO_G726: @@ -1130,7 +1130,7 @@ pAudio->t = T_H245AudioCapability_nonStandard; pAudio->u.nonStandard = (H245NonStandardParameter*)memAlloc(pctxt, sizeof(H245NonStandardParameter)); - if(!pAudio->u.nonStandard) + if (!pAudio->u.nonStandard) { OOTRACEERR1("Error:Memory - ooCapabilityCreateSimpleCapability - g726\n"); memFreePtr(pctxt, pAudio); @@ -1230,7 +1230,7 @@ H245DataApplicationCapability *pT38=NULL; OOCapParams *params; H245DataMode_application *pT38app; - if(!epCap || !epCap->params) + if (!epCap || !epCap->params) { OOTRACEERR1("Error:Invalid capability parameters to " "ooCapabilityCreateSimpleCapability.\n"); @@ -1239,7 +1239,7 @@ params =(OOCapParams*)epCap->params; pT38 = (H245DataApplicationCapability*)memAlloc(pctxt, sizeof(H245DataApplicationCapability)); - if(!pT38) + if (!pT38) { OOTRACEERR1("ERROR:Memory - ooCapabilityCreateT38Capability - pT38\n"); return NULL; @@ -1247,7 +1247,7 @@ memset(pT38, 0, sizeof(H245DataApplicationCapability)); pT38app = (void *)&pT38->application; - switch(epCap->cap) + switch (epCap->cap) { case OO_T38: pT38->maxBitRate = 144; @@ -1275,7 +1275,7 @@ OOTRACEDBGC2("Comparing channel with codec type: %d\n", audioCap->t); - switch(audioCap->t) + switch (audioCap->t) { case T_H245AudioCapability_g711Ulaw56k: cap = OO_G711ULAW56K; @@ -1324,14 +1324,14 @@ OOTRACEDBGC3("Comparing codecs: current=%d, requested=%d\n", epCap->cap, cap); - if(cap != epCap->cap) { return FALSE; } + if (cap != epCap->cap) { return FALSE; } /* Can we receive this capability */ - if(dir & OORX) + if (dir & OORX) { OOTRACEDBGC3("Comparing RX frame rate: channel's=%d, requested=%d\n", ((OOCapParams*)epCap->params)->rxframes, noofframes); - if(((OOCapParams*)epCap->params)->rxframes >= noofframes) { + if (((OOCapParams*)epCap->params)->rxframes >= noofframes) { return TRUE; } //else { @@ -1342,11 +1342,11 @@ } /* Can we transmit compatible stream */ - if(dir & OOTX) + if (dir & OOTX) { OOTRACEDBGC3("Comparing TX frame rate: channel's=%d, requested=%d\n", ((OOCapParams*)epCap->params)->txframes, noofframes); - if(((OOCapParams*)epCap->params)->txframes <= noofframes) { + if (((OOCapParams*)epCap->params)->txframes <= noofframes) { return TRUE; } //else { @@ -1403,7 +1403,7 @@ OOTRACEDBGC3("Comparing codecs: current=%d, requested=%d\n", epCap->cap, cap); - if(cap != epCap->cap) { return FALSE; } + if (cap != epCap->cap) { return FALSE; } return TRUE; @@ -1415,7 +1415,7 @@ H245AudioCapability* audioCap, int dir) { unsigned noofframes=0, cap; - switch(audioCap->t) + switch (audioCap->t) { case T_H245AudioCapability_gsmFullRate: cap = OO_GSMFULLRATE; @@ -1433,19 +1433,19 @@ return FALSE; } - if(cap != epCap->cap) { return FALSE; } + if (cap != epCap->cap) { return FALSE; } /* can we receive this capability */ - if(dir & OORX) + if (dir & OORX) { - if(((OOGSMCapParams*)epCap->params)->rxframes >= noofframes) + if (((OOGSMCapParams*)epCap->params)->rxframes >= noofframes) return TRUE; } /* Make sure we transmit compatible stream */ - if(dir & OOTX) + if (dir & OOTX) { - if(((OOGSMCapParams*)epCap->params)->txframes > noofframes){ + if (((OOGSMCapParams*)epCap->params)->txframes > noofframes){ OOTRACEDBGA5("Reducing txframes for GSM from %d to %d to match " "receive capability of remote end.(%s, %s)\n", ((OOGSMCapParams*)epCap->params)->txframes, noofframes, @@ -1463,7 +1463,7 @@ H245DataApplicationCapability* t38Cap, int dir) { unsigned cap = 0; - switch(t38Cap->application.t) + switch (t38Cap->application.t) { case T_H245DataApplicationCapability_application_t38fax: cap = OO_T38; @@ -1472,7 +1472,7 @@ return FALSE; } - if(cap != epCap->cap) { return FALSE; } + if (cap != epCap->cap) { return FALSE; } return TRUE; } @@ -1485,7 +1485,7 @@ H245H263VideoCapability *pH263Cap = NULL; OOH263CapParams *params = epCap->params; - if(!pVideoCap->u.h263VideoCapability) + if (!pVideoCap->u.h263VideoCapability) { OOTRACEERR3("Error:No H263 video capability present in video capability" "structure. (%s, %s)\n", call->callType, call->callToken); @@ -1494,68 +1494,68 @@ pH263Cap = pVideoCap->u.h263VideoCapability; /* can we receive/transmit this capability */ - if(OORX & dir) + if (OORX & dir) { - if(pH263Cap->m.sqcifMPIPresent) + if (pH263Cap->m.sqcifMPIPresent) { - if(params->picFormat != OO_PICFORMAT_SQCIF) + if (params->picFormat != OO_PICFORMAT_SQCIF) { return FALSE; } else{ - if(pH263Cap->sqcifMPI >= params->MPI) + if (pH263Cap->sqcifMPI >= params->MPI) return TRUE; else return FALSE; } } - if(pH263Cap->m.qcifMPIPresent) + if (pH263Cap->m.qcifMPIPresent) { - if(params->picFormat != OO_PICFORMAT_QCIF) + if (params->picFormat != OO_PICFORMAT_QCIF) { return FALSE; } else{ - if(pH263Cap->qcifMPI >= params->MPI) + if (pH263Cap->qcifMPI >= params->MPI) return TRUE; else return FALSE; } } - if(pH263Cap->m.cifMPIPresent) + if (pH263Cap->m.cifMPIPresent) { - if(params->picFormat != OO_PICFORMAT_CIF) + if (params->picFormat != OO_PICFORMAT_CIF) { return FALSE; } else{ - if(pH263Cap->cifMPI >= params->MPI) + if (pH263Cap->cifMPI >= params->MPI) return TRUE; else return FALSE; } } - if(pH263Cap->m.cif4MPIPresent) + if (pH263Cap->m.cif4MPIPresent) { - if(params->picFormat != OO_PICFORMAT_CIF4) + if (params->picFormat != OO_PICFORMAT_CIF4) { return FALSE; } else{ - if(pH263Cap->cif4MPI >= params->MPI) + if (pH263Cap->cif4MPI >= params->MPI) return TRUE; else return FALSE; } } - if(pH263Cap->m.cif16MPIPresent) + if (pH263Cap->m.cif16MPIPresent) { - if(params->picFormat != OO_PICFORMAT_CIF16) + if (params->picFormat != OO_PICFORMAT_CIF16) { return FALSE; } else{ - if(pH263Cap->cif16MPI >= params->MPI) + if (pH263Cap->cif16MPI >= params->MPI) return TRUE; else return FALSE; @@ -1564,68 +1564,68 @@ } /* Can we transmit */ - if(OOTX & dir) + if (OOTX & dir) { - if(pH263Cap->m.sqcifMPIPresent) + if (pH263Cap->m.sqcifMPIPresent) { - if(params->picFormat != OO_PICFORMAT_SQCIF) + if (params->picFormat != OO_PICFORMAT_SQCIF) { return FALSE; } else{ - if(pH263Cap->sqcifMPI <= params->MPI) + if (pH263Cap->sqcifMPI <= params->MPI) return TRUE; else return FALSE; } } - if(pH263Cap->m.qcifMPIPresent) + if (pH263Cap->m.qcifMPIPresent) { - if(params->picFormat != OO_PICFORMAT_QCIF) + if (params->picFormat != OO_PICFORMAT_QCIF) { return FALSE; } else{ - if(pH263Cap->qcifMPI <= params->MPI) + if (pH263Cap->qcifMPI <= params->MPI) return TRUE; else return FALSE; } } - if(pH263Cap->m.cifMPIPresent) + if (pH263Cap->m.cifMPIPresent) { - if(params->picFormat != OO_PICFORMAT_CIF) + if (params->picFormat != OO_PICFORMAT_CIF) { return FALSE; } else{ - if(pH263Cap->cifMPI <= params->MPI) + if (pH263Cap->cifMPI <= params->MPI) return TRUE; else return FALSE; } } - if(pH263Cap->m.cif4MPIPresent) + if (pH263Cap->m.cif4MPIPresent) { - if(params->picFormat != OO_PICFORMAT_CIF4) + if (params->picFormat != OO_PICFORMAT_CIF4) { return FALSE; } else{ - if(pH263Cap->cif4MPI <= params->MPI) + if (pH263Cap->cif4MPI <= params->MPI) return TRUE; else return FALSE; } } - if(pH263Cap->m.cif16MPIPresent) + if (pH263Cap->m.cif16MPIPresent) { - if(params->picFormat != OO_PICFORMAT_CIF16) + if (params->picFormat != OO_PICFORMAT_CIF16) { return FALSE; } else{ - if(pH263Cap->cif16MPI <= params->MPI) + if (pH263Cap->cif16MPI <= params->MPI) return TRUE; else return FALSE; @@ -1643,7 +1643,7 @@ H245AudioCapability* audioCap, int dir) { - switch(audioCap->t) + switch (audioCap->t) { case T_H245AudioCapability_g711Ulaw56k: case T_H245AudioCapability_g711Ulaw64k: @@ -1673,7 +1673,7 @@ (OOH323CallData *call, ooH323EpCapability* epCap, H245VideoCapability* videoCap, int dir) { - switch(videoCap->t) + switch (videoCap->t) { case T_H245VideoCapability_h263VideoCapability: return ooCapabilityCheckCompatibility_H263Video(call, epCap, @@ -1692,20 +1692,20 @@ (struct OOH323CallData *call, ooH323EpCapability* epCap, H245DataType* dataType, int dir) { - switch(dataType->t) + switch (dataType->t) { case T_H245DataType_audioData: - if(epCap->capType == OO_CAP_TYPE_AUDIO) + if (epCap->capType == OO_CAP_TYPE_AUDIO) return ooCapabilityCheckCompatibility_Audio(call, epCap, dataType->u.audioData, dir); break; case T_H245DataType_videoData: - if(epCap->capType == OO_CAP_TYPE_VIDEO) + if (epCap->capType == OO_CAP_TYPE_VIDEO) return ooCapabilityCheckCompatibility_Video(call, epCap, dataType->u.videoData, dir); break; case T_H245DataType_data: - if(epCap->capType == OO_CAP_TYPE_DATA) + if (epCap->capType == OO_CAP_TYPE_DATA) return ooCapabilityCheckCompatibility_T38(call, epCap, dataType->u.data, dir); default: OOTRACEDBGC3("ooCapabilityCheckCompatibility - Unsupported " @@ -1726,13 +1726,13 @@ (OOH323CallData *call, ooH323EpCapability *txCap, ooH323EpCapability *rxCap) { - if(txCap->cap != rxCap->cap) return FALSE; + if (txCap->cap != rxCap->cap) return FALSE; - if(!(txCap->dir & OOTX)) return FALSE; + if (!(txCap->dir & OOTX)) return FALSE; - if(!(rxCap->dir & OORX)) return FALSE; + if (!(rxCap->dir & OORX)) return FALSE; - switch(txCap->cap) + switch (txCap->cap) { case OO_G711ALAW64K: case OO_G711ALAW56K: @@ -1743,7 +1743,7 @@ case OO_G729A: case OO_G729B: case OO_G7231: - if(((OOCapParams*)txCap->params)->txframes <= + if (((OOCapParams*)txCap->params)->txframes <= ((OOCapParams*)rxCap->params)->rxframes) return TRUE; else{ @@ -1755,7 +1755,7 @@ case OO_GSMFULLRATE: case OO_GSMHALFRATE: case OO_GSMENHANCEDFULLRATE: - if(((OOGSMCapParams*)txCap->params)->txframes <= + if (((OOGSMCapParams*)txCap->params)->txframes <= ((OOGSMCapParams*)rxCap->params)->rxframes) return TRUE; else{ @@ -1781,7 +1781,7 @@ ooH323EpCapability *cur = NULL, *epCap=NULL; OOGSMCapParams *params = NULL; - switch(audioCap->t) + switch (audioCap->t) { case T_H245AudioCapability_gsmFullRate: framesPerPkt = (audioCap->u.gsmFullRate->audioUnitSize)/OO_GSMFRAMESIZE; @@ -1807,37 +1807,37 @@ /* If we have call specific caps then we use them, otherwise we use general endpoint caps*/ - if(call->ourCaps) + if (call->ourCaps) cur = call->ourCaps; else cur = gH323ep.myCaps; - while(cur) + while (cur) { OOTRACEDBGC4("Local cap being compared %d. (%s, %s)\n", cur->cap, call->callType, call->callToken); - if(cur->cap == cap && (cur->dir & dir)) + if (cur->cap == cap && (cur->dir & dir)) break; cur = cur->next; } - if(!cur) return NULL; + if (!cur) return NULL; OOTRACEDBGC4("Found matching audio capability type %d. Comparing" " other parameters. (%s, %s)\n", cap, call->callType, call->callToken); /* can we receive this capability */ - if(dir & OORX) + if (dir & OORX) { - if(((OOGSMCapParams*)cur->params)->rxframes < framesPerPkt) + if (((OOGSMCapParams*)cur->params)->rxframes < framesPerPkt) return NULL; else{ epCap = (ooH323EpCapability*)memAlloc(call->pctxt, sizeof(ooH323EpCapability)); params =(OOGSMCapParams*)memAlloc(call->pctxt,sizeof(OOGSMCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR3("Error:Memory - ooIsAudioDataTypeGSMSupported - " "epCap/params (%s, %s)\n", call->callType, @@ -1859,12 +1859,12 @@ } /* Can we transmit compatible stream */ - if(dir & OOTX) + if (dir & OOTX) { epCap = (ooH323EpCapability*)memAlloc(call->pctxt, sizeof(ooH323EpCapability)); params =(OOGSMCapParams*)memAlloc(call->pctxt,sizeof(OOGSMCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR3("Error:Memory - ooIsAudioDataTypeGSMSupported - " "epCap/params (%s, %s)\n", call->callType, @@ -1881,7 +1881,7 @@ epCap->stopTransmitChannel = cur->stopTransmitChannel; epCap->next = NULL; memcpy(epCap->params, cur->params, sizeof(OOGSMCapParams)); - if(params->txframes > framesPerPkt) + if (params->txframes > framesPerPkt) { OOTRACEINFO5("Reducing framesPerPkt for transmission of GSM " "capability from %d to %d to match receive capability of" @@ -1906,7 +1906,7 @@ OOCapParams * params= NULL; /* Find similar capability */ - switch(audioCap->t) + switch (audioCap->t) { case T_H245AudioCapability_g711Alaw64k: framesPerPkt = audioCap->u.g711Alaw64k; @@ -1963,33 +1963,33 @@ /* If we have call specific caps, we use them; otherwise use general endpoint caps */ - if(call->ourCaps) + if (call->ourCaps) cur = call->ourCaps; else cur = gH323ep.myCaps; - while(cur) + while (cur) { OOTRACEDBGC4("Local cap being compared %s. (%s, %s)\n", ooGetCapTypeText(cur->cap),call->callType, call->callToken); - if(cur->cap == cap && (cur->dir & dir)) + if (cur->cap == cap && (cur->dir & dir)) break; cur = cur->next; } - if(!cur) return NULL; + if (!cur) return NULL; OOTRACEDBGC4("Found matching simple audio capability type %s. Comparing" " other parameters. (%s, %s)\n", ooGetCapTypeText(cap), call->callType, call->callToken); /* can we receive this capability */ - if(dir & OORX) + if (dir & OORX) { - if(((OOCapParams*)cur->params)->rxframes < framesPerPkt) + if (((OOCapParams*)cur->params)->rxframes < framesPerPkt) return NULL; - if(((OOCapParams*)cur->params)->rxframes > framesPerPkt) + if (((OOCapParams*)cur->params)->rxframes > framesPerPkt) ((OOCapParams*)cur->params)->rxframes = framesPerPkt; OOTRACEDBGC4("We can receive Simple capability %s. (%s, %s)\n", @@ -1998,7 +1998,7 @@ epCap = (ooH323EpCapability*)memAlloc(call->pctxt, sizeof(ooH323EpCapability)); params=(OOCapParams*)memAlloc(call->pctxt,sizeof(OOCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR3("Error:Memory - ooIsAudioDataTypeSimpleSupported - " "epCap/params (%s, %s)\n", call->callType, @@ -2023,7 +2023,7 @@ } /* Can we transmit compatible stream */ - if(dir & OOTX) + if (dir & OOTX) { OOTRACEDBGC4("We can transmit Simple capability %s. (%s, %s)\n", ooGetCapTypeText(cur->cap), call->callType, @@ -2031,7 +2031,7 @@ epCap = (ooH323EpCapability*)memAlloc(call->pctxt, sizeof(ooH323EpCapability)); params =(OOCapParams*)memAlloc(call->pctxt,sizeof(OOCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR3("Error:Memory - ooIsAudioDataTypeSimpleSupported - " "epCap/params (%s, %s)\n", call->callType, @@ -2048,7 +2048,7 @@ epCap->stopTransmitChannel = cur->stopTransmitChannel; epCap->next = NULL; memcpy(epCap->params, cur->params, sizeof(OOCapParams)); - if(params->txframes > framesPerPkt) + if (params->txframes > framesPerPkt) { OOTRACEINFO5("Reducing framesPerPkt for transmission of Simple " "capability from %d to %d to match receive capability of" @@ -2115,29 +2115,29 @@ /* If we have call specific caps, we use them; otherwise use general endpoint caps */ - if(call->ourCaps) + if (call->ourCaps) cur = call->ourCaps; else cur = gH323ep.myCaps; - while(cur) + while (cur) { OOTRACEDBGC4("Local cap being compared %s. (%s, %s)\n", ooGetCapTypeText(cur->cap),call->callType, call->callToken); - if(cur->cap == cap && (cur->dir & dir)) + if (cur->cap == cap && (cur->dir & dir)) break; cur = cur->next; } - if(!cur) return NULL; + if (!cur) return NULL; OOTRACEDBGC4("Found matching simple audio capability type %s. Comparing" " other parameters. (%s, %s)\n", ooGetCapTypeText(cap), call->callType, call->callToken); /* can we receive this capability */ - if(dir & OORX) + if (dir & OORX) { OOTRACEDBGC4("We can receive Simple capability %s. (%s, %s)\n", ooGetCapTypeText(cur->cap), call->callType, @@ -2145,7 +2145,7 @@ epCap = (ooH323EpCapability*)memAlloc(call->pctxt, sizeof(ooH323EpCapability)); params=(OOCapParams*)memAlloc(call->pctxt,sizeof(OOCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR3("Error:Memory - ooIsAudioDataTypeSimpleSupported - " "epCap/params (%s, %s)\n", call->callType, @@ -2170,7 +2170,7 @@ } /* Can we transmit compatible stream */ - if(dir & OOTX) + if (dir & OOTX) { OOTRACEDBGC4("We can transmit Simple capability %s. (%s, %s)\n", ooGetCapTypeText(cur->cap), call->callType, @@ -2178,7 +2178,7 @@ epCap = (ooH323EpCapability*)memAlloc(call->pctxt, sizeof(ooH323EpCapability)); params =(OOCapParams*)memAlloc(call->pctxt,sizeof(OOCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR3("Error:Memory - ooIsAudioDataTypeSimpleSupported - " "epCap/params (%s, %s)\n", call->callType, @@ -2210,7 +2210,7 @@ (OOH323CallData *call, H245AudioCapability* audioCap, int dir) { /* Find similar capability */ - switch(audioCap->t) + switch (audioCap->t) { case T_H245AudioCapability_g711Alaw64k: case T_H245AudioCapability_g711Alaw56k: @@ -2241,7 +2241,7 @@ ooH323EpCapability *cur=NULL, *epCap=NULL; OOCapParams *params= NULL; /* Find similar capability */ - switch(t38Cap->application.t) + switch (t38Cap->application.t) { case T_H245DataApplicationCapability_application_t38fax: cap = OO_T38; @@ -2250,29 +2250,29 @@ return NULL; } - if(call->ourCaps) + if (call->ourCaps) cur = call->ourCaps; else cur = gH323ep.myCaps; - while(cur) + while (cur) { OOTRACEDBGC4("Local cap being compared %s. (%s, %s)\n", ooGetCapTypeText(cur->cap),call->callType, call->callToken); - if(cur->cap == cap && (cur->dir & dir)) + if (cur->cap == cap && (cur->dir & dir)) break; cur = cur->next; } - if(!cur) return NULL; + if (!cur) return NULL; OOTRACEDBGC4("Found matching t38 capability type %s. Comparing" " other parameters. (%s, %s)\n", ooGetCapTypeText(cap), call->callType, call->callToken); /* can we receive this capability */ - if(dir & OORX) + if (dir & OORX) { OOTRACEDBGC4("We can receive Simple capability %s. (%s, %s)\n", ooGetCapTypeText(cur->cap), call->callType, @@ -2280,7 +2280,7 @@ epCap = (ooH323EpCapability*)memAllocZ(call->pctxt, sizeof(ooH323EpCapability)); params=(OOCapParams*)memAlloc(call->pctxt,sizeof(OOCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR3("Error:Memory - ooIsT38Supported - " "epCap/params (%s, %s)\n", call->callType, @@ -2305,7 +2305,7 @@ } /* Can we transmit compatible stream */ - if(dir & OOTX) + if (dir & OOTX) { OOTRACEDBGC4("We can transmit Simple capability %s. (%s, %s)\n", ooGetCapTypeText(cur->cap), call->callType, @@ -2313,7 +2313,7 @@ epCap = (ooH323EpCapability*)memAlloc(call->pctxt, sizeof(ooH323EpCapability)); params =(OOCapParams*)memAllocZ(call->pctxt,sizeof(OOCapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR3("Error:Memory - ooIsAudioDataTypeSimpleSupported - " "epCap/params (%s, %s)\n", call->callType, @@ -2350,27 +2350,27 @@ unsigned mpi=0; cap = OO_H263VIDEO; - if(picFormat == OO_PICFORMAT_SQCIF && pH263Cap->m.sqcifMPIPresent) + if (picFormat == OO_PICFORMAT_SQCIF && pH263Cap->m.sqcifMPIPresent) { pictureType = "SQCIF"; mpi = pH263Cap->sqcifMPI; } - if(picFormat == OO_PICFORMAT_QCIF && pH263Cap->m.qcifMPIPresent) + if (picFormat == OO_PICFORMAT_QCIF && pH263Cap->m.qcifMPIPresent) { pictureType = "QCIF"; mpi = pH263Cap->qcifMPI; } - if(picFormat == OO_PICFORMAT_CIF && pH263Cap->m.cifMPIPresent) + if (picFormat == OO_PICFORMAT_CIF && pH263Cap->m.cifMPIPresent) { pictureType = "CIF"; mpi = pH263Cap->cifMPI; } - if(picFormat == OO_PICFORMAT_CIF4 && pH263Cap->m.cif4MPIPresent) + if (picFormat == OO_PICFORMAT_CIF4 && pH263Cap->m.cif4MPIPresent) { pictureType = "CIF4"; mpi = pH263Cap->cif4MPI; } - if(picFormat == OO_PICFORMAT_CIF16 && pH263Cap->m.cif16MPIPresent) + if (picFormat == OO_PICFORMAT_CIF16 && pH263Cap->m.cif16MPIPresent) { pictureType = "CIF16"; mpi = pH263Cap->cif16MPI; @@ -2383,39 +2383,39 @@ /* If we have call specific caps, we use them; otherwise use general endpoint caps */ - if(call->ourCaps) + if (call->ourCaps) cur = call->ourCaps; else cur = gH323ep.myCaps; - while(cur) + while (cur) { OOTRACEDBGC4("Local cap being compared %s. (%s, %s)\n", ooGetCapTypeText(cur->cap),call->callType, call->callToken); - if(cur->cap == cap && (cur->dir & dir)) + if (cur->cap == cap && (cur->dir & dir)) { - if(((OOH263CapParams*)cur->params)->picFormat == picFormat) + if (((OOH263CapParams*)cur->params)->picFormat == picFormat) break; } cur = cur->next; } - if(!cur) return NULL; + if (!cur) return NULL; OOTRACEDBGC4("Found matching H.263 video capability type %s. Comparing" " other parameters. (%s, %s)\n", ooGetCapTypeText(cap), call->callType, call->callToken); - if(dir & OORX) + if (dir & OORX) { - if(mpi < ((OOH263CapParams*)cur->params)->MPI) + if (mpi < ((OOH263CapParams*)cur->params)->MPI) return NULL; else{ epCap = (ooH323EpCapability*)memAlloc(call->pctxt, sizeof(ooH323EpCapability)); params = (OOH263CapParams*) memAlloc(call->pctxt, sizeof(OOH263CapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR3("Error:Memory - ooIsVideoDataTypeH263Supported - " "epCap/params. (%s, %s)\n", call->callType, @@ -2438,13 +2438,13 @@ return epCap; } } - if(dir & OOTX) + if (dir & OOTX) { epCap = (ooH323EpCapability*)memAlloc(call->pctxt, sizeof(ooH323EpCapability)); params = (OOH263CapParams*) memAlloc(call->pctxt, sizeof(OOH263CapParams)); - if(!epCap || !params) + if (!epCap || !params) { OOTRACEERR3("Error:Memory - ooIsVideoDataTypeH263Supported - " "epCap/params. (%s, %s)\n", call->callType, @@ -2461,7 +2461,7 @@ epCap->stopTransmitChannel = cur->stopTransmitChannel; epCap->next = NULL; memcpy(epCap->params, cur->params, sizeof(OOH263CapParams)); - if(params->MPI < mpi) + if (params->MPI < mpi) { OOTRACEINFO5("Increasing minimum picture interval for transmission of" " H263 video capability from %d to %d to match receive " @@ -2481,22 +2481,22 @@ ooH323EpCapability* ooIsVideoDataTypeSupported (OOH323CallData *call, H245VideoCapability* pVideoCap, int dir) { - switch(pVideoCap->t) + switch (pVideoCap->t) { case T_H245VideoCapability_h263VideoCapability: - if(pVideoCap->u.h263VideoCapability->m.sqcifMPIPresent) + if (pVideoCap->u.h263VideoCapability->m.sqcifMPIPresent) return ooIsVideoDataTypeH263Supported(call, pVideoCap->u.h263VideoCapability, dir, OO_PICFORMAT_SQCIF); - else if(pVideoCap->u.h263VideoCapability->m.qcifMPIPresent) + else if (pVideoCap->u.h263VideoCapability->m.qcifMPIPresent) return ooIsVideoDataTypeH263Supported(call, pVideoCap->u.h263VideoCapability, dir, OO_PICFORMAT_QCIF); - else if(pVideoCap->u.h263VideoCapability->m.cifMPIPresent) + else if (pVideoCap->u.h263VideoCapability->m.cifMPIPresent) return ooIsVideoDataTypeH263Supported(call, pVideoCap->u.h263VideoCapability, dir, OO_PICFORMAT_CIF); - else if(pVideoCap->u.h263VideoCapability->m.cif4MPIPresent) + else if (pVideoCap->u.h263VideoCapability->m.cif4MPIPresent) return ooIsVideoDataTypeH263Supported(call, pVideoCap->u.h263VideoCapability, dir, OO_PICFORMAT_CIF4); - else if(pVideoCap->u.h263VideoCapability->m.cif16MPIPresent) + else if (pVideoCap->u.h263VideoCapability->m.cif16MPIPresent) return ooIsVideoDataTypeH263Supported(call, pVideoCap->u.h263VideoCapability, dir, OO_PICFORMAT_CIF16); break; @@ -2520,7 +2520,7 @@ OOTRACEDBGC3("Looking for data type support. (%s, %s)\n", call->callType, call->callToken); - switch(data->t) + switch (data->t) { case T_H245DataType_nonStandard: OOTRACEDBGC3("NonStandard data type not supported.(%s, %s)\n", @@ -2564,7 +2564,7 @@ int ooResetCapPrefs(OOH323CallData *call) { OOCapPrefs *capPrefs=NULL; - if(call) + if (call) capPrefs = &call->capPrefs; else capPrefs = &gH323ep.capPrefs; @@ -2576,16 +2576,16 @@ { int i=0, j=0; OOCapPrefs *capPrefs=NULL, oldPrefs; - if(call) + if (call) capPrefs = &call->capPrefs; else capPrefs = &gH323ep.capPrefs; memcpy(&oldPrefs, capPrefs, sizeof(OOCapPrefs)); memset(capPrefs, 0, sizeof(OOCapPrefs)); - for(i=0; iorder[j++] = oldPrefs.order[i]; } capPrefs->index = j; @@ -2596,7 +2596,7 @@ int ooAppendCapToCapPrefs(OOH323CallData *call, int cap) { OOCapPrefs *capPrefs=NULL; - if(call) + if (call) capPrefs = &call->capPrefs; else capPrefs = &gH323ep.capPrefs; @@ -2611,33 +2611,33 @@ OOCapPrefs *capPrefs = NULL; /* Whether to change prefs for call or for endpoint as a whole */ - if(call) + if (call) capPrefs = &call->capPrefs; else capPrefs = &gH323ep.capPrefs; /* check whether cap exists, cap must exist */ - for(i=0; iindex; i++) + for (i=0; iindex; i++) { - if(capPrefs->order[i] == cap) + if (capPrefs->order[i] == cap) break; } - if(i == capPrefs->index) return OO_FAILED; + if (i == capPrefs->index) return OO_FAILED; - if(i==pos) return OO_OK; /* No need to change */ + if (i==pos) return OO_OK; /* No need to change */ /* Decrease Pref order */ - if(i < pos) + if (i < pos) { - for( ; iorder[i] = capPrefs->order[i+1]; capPrefs->order[i]=cap; return OO_OK; } /* Increase Pref order */ - if(i>pos) + if (i>pos) { - for(j=i; j>pos; j--) + for (j=i; j>pos; j--) capPrefs->order[j] = capPrefs->order[j-1]; capPrefs->order[j] = cap; return OO_OK; @@ -2651,7 +2651,7 @@ { int i=0, j=0; OOCapPrefs *capPrefs=NULL, oldPrefs; - if(call) + if (call) capPrefs = &call->capPrefs; else capPrefs = &gH323ep.capPrefs; @@ -2661,9 +2661,9 @@ capPrefs->order[j++] = cap; - for(i=0; iorder[j++] = oldPrefs.order[i]; } capPrefs->index = j; @@ -2672,7 +2672,7 @@ int ooAddRemoteCapability(OOH323CallData *call, H245Capability *cap) { - switch(cap->t) + switch (cap->t) { case T_H245Capability_receiveAudioCapability: return ooAddRemoteAudioCapability(call, cap->u.receiveAudioCapability, @@ -2707,7 +2707,7 @@ H245DataApplicationCapability *dataCap, int dir) { - switch(dataCap->application.t) + switch (dataCap->application.t) { case T_H245DataApplicationCapability_application_t38fax: return ooCapabilityAddT38Capability(call, OO_T38, @@ -2726,11 +2726,11 @@ { int rxframes=0, txframes=0; - switch(audioCap->t) + switch (audioCap->t) { case T_H245AudioCapability_g711Alaw64k: - if(dir&OOTX) txframes = audioCap->u.g711Alaw64k; - else if(dir&OORX) rxframes = audioCap->u.g711Alaw64k; + if (dir&OOTX) txframes = audioCap->u.g711Alaw64k; + else if (dir&OORX) rxframes = audioCap->u.g711Alaw64k; else{ txframes = audioCap->u.g711Alaw64k; rxframes = audioCap->u.g711Alaw64k; @@ -2738,8 +2738,8 @@ return ooCapabilityAddSimpleCapability(call, OO_G711ALAW64K, txframes, rxframes, FALSE, dir, NULL, NULL, NULL, NULL,TRUE); case T_H245AudioCapability_g711Alaw56k: - if(dir&OOTX) txframes = audioCap->u.g711Alaw56k; - else if(dir&OORX) rxframes = audioCap->u.g711Alaw56k; + if (dir&OOTX) txframes = audioCap->u.g711Alaw56k; + else if (dir&OORX) rxframes = audioCap->u.g711Alaw56k; else{ txframes = audioCap->u.g711Alaw56k; rxframes = audioCap->u.g711Alaw56k; @@ -2747,8 +2747,8 @@ return ooCapabilityAddSimpleCapability(call, OO_G711ALAW56K, txframes, rxframes, FALSE, dir, NULL, NULL, NULL, NULL, TRUE); case T_H245AudioCapability_g711Ulaw64k: - if(dir&OOTX) txframes = audioCap->u.g711Ulaw64k; - else if(dir&OORX) rxframes = audioCap->u.g711Ulaw64k; + if (dir&OOTX) txframes = audioCap->u.g711Ulaw64k; + else if (dir&OORX) rxframes = audioCap->u.g711Ulaw64k; else{ txframes = audioCap->u.g711Ulaw64k; rxframes = audioCap->u.g711Ulaw64k; @@ -2756,8 +2756,8 @@ return ooCapabilityAddSimpleCapability(call, OO_G711ULAW64K, txframes, rxframes, FALSE, dir, NULL, NULL, NULL, NULL, TRUE); case T_H245AudioCapability_g711Ulaw56k: - if(dir&OOTX) txframes = audioCap->u.g711Ulaw56k; - else if(dir&OORX) rxframes = audioCap->u.g711Ulaw56k; + if (dir&OOTX) txframes = audioCap->u.g711Ulaw56k; + else if (dir&OORX) rxframes = audioCap->u.g711Ulaw56k; else{ txframes = audioCap->u.g711Ulaw56k; rxframes = audioCap->u.g711Ulaw56k; @@ -2766,8 +2766,8 @@ rxframes, FALSE, dir, NULL, NULL, NULL, NULL, TRUE); /* case T_H245AudioCapability_g726: - if(dir&OOTX) txframes = audioCap->u.g726; - else if(dir&OORX) rxframes = audioCap->u.g726; + if (dir&OOTX) txframes = audioCap->u.g726; + else if (dir&OORX) rxframes = audioCap->u.g726; else{ txframes = audioCap->u.g726; rxframes = audioCap->u.g726; @@ -2814,8 +2814,8 @@ break; case T_H245AudioCapability_g728: - if(dir&OOTX) txframes = audioCap->u.g728; - else if(dir&OORX) rxframes = audioCap->u.g728; + if (dir&OOTX) txframes = audioCap->u.g728; + else if (dir&OORX) rxframes = audioCap->u.g728; else{ txframes = audioCap->u.g728; rxframes = audioCap->u.g728; @@ -2824,8 +2824,8 @@ rxframes, FALSE, dir, NULL, NULL, NULL, NULL, TRUE); case T_H245AudioCapability_g729: - if(dir&OOTX) txframes = audioCap->u.g729; - else if(dir&OORX) rxframes = audioCap->u.g729; + if (dir&OOTX) txframes = audioCap->u.g729; + else if (dir&OORX) rxframes = audioCap->u.g729; else{ txframes = audioCap->u.g729; rxframes = audioCap->u.g729; @@ -2834,8 +2834,8 @@ rxframes, FALSE, dir, NULL, NULL, NULL, NULL, TRUE); case T_H245AudioCapability_g729AnnexA: - if(dir&OOTX) txframes = audioCap->u.g729AnnexA; - else if(dir&OORX) rxframes = audioCap->u.g729AnnexA; + if (dir&OOTX) txframes = audioCap->u.g729AnnexA; + else if (dir&OORX) rxframes = audioCap->u.g729AnnexA; else{ txframes = audioCap->u.g729AnnexA; rxframes = audioCap->u.g729AnnexA; @@ -2844,8 +2844,8 @@ rxframes, FALSE, dir, NULL, NULL, NULL, NULL, TRUE); case T_H245AudioCapability_g729wAnnexB: - if(dir&OOTX) txframes = audioCap->u.g729wAnnexB; - else if(dir&OORX) rxframes = audioCap->u.g729wAnnexB; + if (dir&OOTX) txframes = audioCap->u.g729wAnnexB; + else if (dir&OORX) rxframes = audioCap->u.g729wAnnexB; else{ txframes = audioCap->u.g729wAnnexB; rxframes = audioCap->u.g729wAnnexB; @@ -2854,8 +2854,8 @@ rxframes, FALSE, dir, NULL, NULL, NULL, NULL, TRUE); case T_H245AudioCapability_g7231: - if(dir&OOTX) txframes = audioCap->u.g7231->maxAl_sduAudioFrames; - else if(dir&OORX) rxframes = audioCap->u.g7231->maxAl_sduAudioFrames; + if (dir&OOTX) txframes = audioCap->u.g7231->maxAl_sduAudioFrames; + else if (dir&OORX) rxframes = audioCap->u.g7231->maxAl_sduAudioFrames; else{ txframes = audioCap->u.g7231->maxAl_sduAudioFrames; rxframes = audioCap->u.g7231->maxAl_sduAudioFrames; @@ -2897,7 +2897,7 @@ OOTRACEDBGC3("checking whether we need to add cap to joint capabilities" "(%s, %s)\n", call->callType, call->callToken); - switch(cap->t) + switch (cap->t) { case T_H245Capability_receiveAudioCapability: epCap= ooIsAudioDataTypeSupported(call, cap->u.receiveAudioCapability, @@ -2935,14 +2935,14 @@ case T_H245Capability_receiveUserInputCapability: - if((cap->u.receiveUserInputCapability->t == + if ((cap->u.receiveUserInputCapability->t == T_H245UserInputCapability_basicString) && (call->dtmfmode & OO_CAP_DTMF_H245_alphanumeric)) { call->jointDtmfMode |= OO_CAP_DTMF_H245_alphanumeric; return OO_OK; } - else if((cap->u.receiveUserInputCapability->t == + else if ((cap->u.receiveUserInputCapability->t == T_H245UserInputCapability_dtmf) && (call->dtmfmode & OO_CAP_DTMF_H245_signal)) { @@ -2955,16 +2955,16 @@ call->callType, call->callToken); } - if(epCap) + if (epCap) { OOTRACEDBGC3("Adding cap to joint capabilities(%s, %s)\n",call->callType, call->callToken); /* Note:we add jointCaps in remote endpoints preference order.*/ - if(!call->jointCaps) + if (!call->jointCaps) call->jointCaps = epCap; else { cur = call->jointCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } @@ -2981,7 +2981,7 @@ int ooCapabilityUpdateJointCapabilitiesVideo (OOH323CallData *call, H245VideoCapability *videoCap, int dir) { - switch(videoCap->t) + switch (videoCap->t) { case T_H245VideoCapability_h263VideoCapability: return ooCapabilityUpdateJointCapabilitiesVideoH263(call, @@ -2999,20 +2999,20 @@ (OOH323CallData *call, H245H263VideoCapability *pH263Cap, int dir) { ooH323EpCapability *epCap = NULL, *cur = NULL; - if(pH263Cap->m.sqcifMPIPresent) + if (pH263Cap->m.sqcifMPIPresent) { epCap = ooIsVideoDataTypeH263Supported(call, pH263Cap, dir, OO_PICFORMAT_SQCIF); - if(epCap) + if (epCap) { OOTRACEDBGC3("Adding H263-SQCIF to joint capabilities(%s, %s)\n", call->callType, call->callToken); /* Note:we add jointCaps in remote endpoints preference order.*/ - if(!call->jointCaps) + if (!call->jointCaps) call->jointCaps = epCap; else { cur = call->jointCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } @@ -3021,20 +3021,20 @@ epCap = NULL; - if(pH263Cap->m.qcifMPIPresent) + if (pH263Cap->m.qcifMPIPresent) { epCap = ooIsVideoDataTypeH263Supported(call, pH263Cap, dir, OO_PICFORMAT_QCIF); - if(epCap) + if (epCap) { OOTRACEDBGC3("Adding H263-QCIF to joint capabilities(%s, %s)\n", call->callType, call->callToken); /* Note:we add jointCaps in remote endpoints preference order.*/ - if(!call->jointCaps) + if (!call->jointCaps) call->jointCaps = epCap; else { cur = call->jointCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } @@ -3043,20 +3043,20 @@ epCap = NULL; - if(pH263Cap->m.cifMPIPresent) + if (pH263Cap->m.cifMPIPresent) { epCap = ooIsVideoDataTypeH263Supported(call, pH263Cap, dir, OO_PICFORMAT_CIF); - if(epCap) + if (epCap) { OOTRACEDBGC3("Adding H263-CIF to joint capabilities(%s, %s)\n", call->callType, call->callToken); /* Note:we add jointCaps in remote endpoints preference order.*/ - if(!call->jointCaps) + if (!call->jointCaps) call->jointCaps = epCap; else { cur = call->jointCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } @@ -3065,20 +3065,20 @@ epCap = NULL; - if(pH263Cap->m.cif4MPIPresent) + if (pH263Cap->m.cif4MPIPresent) { epCap = ooIsVideoDataTypeH263Supported(call, pH263Cap, dir, OO_PICFORMAT_CIF4); - if(epCap) + if (epCap) { OOTRACEDBGC3("Adding H263-CIF4 to joint capabilities(%s, %s)\n", call->callType, call->callToken); /* Note:we add jointCaps in remote endpoints preference order.*/ - if(!call->jointCaps) + if (!call->jointCaps) call->jointCaps = epCap; else { cur = call->jointCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } } @@ -3086,20 +3086,20 @@ epCap = NULL; - if(pH263Cap->m.cif16MPIPresent) + if (pH263Cap->m.cif16MPIPresent) { epCap = ooIsVideoDataTypeH263Supported(call, pH263Cap, dir, OO_PICFORMAT_CIF16); - if(epCap) + if (epCap) { OOTRACEDBGC3("Adding H263-CIF16 to joint capabilities(%s, %s)\n", call->callType, call->callToken); /* Note:we add jointCaps in remote endpoints preference order.*/ - if(!call->jointCaps) + if (!call->jointCaps) call->jointCaps = epCap; else { cur = call->jointCaps; - while(cur->next) cur = cur->next; + while (cur->next) cur = cur->next; cur->next = epCap; } Index: addons/ooh323c/src/oochannels.c =================================================================== --- addons/ooh323c/src/oochannels.c (revision 228266) +++ addons/ooh323c/src/oochannels.c (working copy) @@ -59,14 +59,14 @@ int ret=0; OOSOCKET channelSocket=0; OOTRACEINFO1("Creating H245 listener\n"); - if((ret=ooSocketCreate (&channelSocket))!=ASN_OK) + if ((ret=ooSocketCreate (&channelSocket))!=ASN_OK) { OOTRACEERR3("ERROR: Failed to create socket for H245 listener " "(%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } ret = ooBindPort (OOTCP, channelSocket, call->localIP); - if(ret == OO_FAILED) + if (ret == OO_FAILED) { OOTRACEERR3("Error:Unable to bind to a TCP port - H245 listener creation" " (%s, %s)\n", call->callType, call->callToken); @@ -77,7 +77,7 @@ call->h245listener = (OOSOCKET*)memAlloc(call->pctxt, sizeof(OOSOCKET)); *(call->h245listener) = channelSocket; ret = ooSocketListen(*(call->h245listener), 4096); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("Error:Unable to listen on H.245 socket (%s, %s)\n", call->callType, call->callToken); @@ -96,7 +96,7 @@ ooTimerCallback *cbData=NULL; OOTRACEINFO1("Creating H245 Connection\n"); - if((ret=ooSocketCreate (&channelSocket))!=ASN_OK) + if ((ret=ooSocketCreate (&channelSocket))!=ASN_OK) { OOTRACEERR3("ERROR:Failed to create socket for H245 connection " "(%s, %s)\n", call->callType, call->callToken); @@ -114,7 +114,7 @@ implicit bind done by a connect call. */ ret = ooBindPort(OOTCP, channelSocket, call->localIP); - if(ret == OO_FAILED) + if (ret == OO_FAILED) { OOTRACEERR3("Error:Unable to bind to a TCP port - h245 connection " "(%s, %s)\n", call->callType, call->callToken); @@ -128,7 +128,7 @@ "connection %s:%d(%s, %s)\n", call->remoteIP, call->remoteH245Port, call->callType, call->callToken); - if((ret=ooSocketConnect(channelSocket, call->remoteIP, + if ((ret=ooSocketConnect(channelSocket, call->remoteIP, call->remoteH245Port))==ASN_OK) { call->pH245Channel->sock = channelSocket; @@ -139,14 +139,14 @@ /*Start terminal capability exchange and master slave determination */ ret = ooSendTermCapMsg(call); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n", call->callType, call->callToken); return ret; } ret = ooSendMasterSlaveDetermination(call); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Sending Master-slave determination message " "(%s, %s)\n", call->callType, call->callToken); @@ -155,12 +155,12 @@ } else { - if(call->h245ConnectionAttempts >= 3) + if (call->h245ConnectionAttempts >= 3) { OOTRACEERR3("Error:Failed to setup an H245 connection with remote " "destination. (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -175,7 +175,7 @@ cbData = (ooTimerCallback*) memAlloc(call->pctxt, sizeof(ooTimerCallback)); - if(!cbData) + if (!cbData) { OOTRACEERR3("Error:Unable to allocate memory for timer " "callback.(%s, %s)\n", call->callType, @@ -184,7 +184,7 @@ } cbData->call = call; cbData->timerType = OO_H245CONNECT_TIMER; - if(!ooTimerCreate(call->pctxt, &call->timerList, + if (!ooTimerCreate(call->pctxt, &call->timerList, &ooCallH245ConnectionRetryTimerExpired, DEFAULT_H245CONNECTION_RETRYTIMEOUT, cbData, FALSE)) @@ -205,18 +205,18 @@ { int iRet=0; ASN1OCTET * encodebuf; - if(!call) + if (!call) return OO_FAILED; encodebuf = (ASN1OCTET*) memAlloc (call->pctxt, MAXMSGLEN); - if(!encodebuf) + if (!encodebuf) { OOTRACEERR3("Error:Failed to allocate memory for encoding H225 " "message(%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } iRet = ooEncodeH225Message(call, msg, (char *)encodebuf, MAXMSGLEN); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR3("Error:Failed to encode H225 message. (%s, %s)\n", call->callType, call->callToken); @@ -225,7 +225,7 @@ } /* If high priority messages, send immediately.*/ - if(encodebuf[0] == OOReleaseComplete || + if (encodebuf[0] == OOReleaseComplete || (encodebuf[0]==OOFacility && encodebuf[1]==OOEndSessionCommand)) { dListFreeAll(call->pctxt, &call->pH225Channel->outQueue); @@ -247,11 +247,11 @@ int ret=0, i; OOSOCKET channelSocket=0; for (i=0;i<3;i++) { - if((ret=ooSocketCreate (&channelSocket))!=ASN_OK) + if ((ret=ooSocketCreate (&channelSocket))!=ASN_OK) { OOTRACEERR3("Failed to create socket for transmit H2250 channel (%s, %s)" "\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_TRANSPORTFAILURE; @@ -273,11 +273,11 @@ ret = ooBindOSAllocatedPort(channelSocket, call->localIP); #endif - if(ret == OO_FAILED) + if (ret == OO_FAILED) { OOTRACEERR3("Error:Unable to bind to a TCP port (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_TRANSPORTFAILURE; @@ -295,7 +295,7 @@ "H2250 channel (%s, %s)\n", call->remoteIP, call->remotePort, call->callType, call->callToken); - if((ret=ooSocketConnect(channelSocket, call->remoteIP, + if ((ret=ooSocketConnect(channelSocket, call->remoteIP, call->remotePort))==ASN_OK) { call->pH225Channel->sock = channelSocket; @@ -304,19 +304,19 @@ "(%s, %s)\n", call->callType, call->callToken); /* If multihomed, get ip from socket */ - if(!strcmp(call->localIP, "0.0.0.0")) + if (!strcmp(call->localIP, "0.0.0.0")) { OOTRACEDBGA3("Determining IP address for outgoing call in " "multihomed mode. (%s, %s)\n", call->callType, call->callToken); ret = ooSocketGetIpAndPort(channelSocket, call->localIP, 20, &call->pH225Channel->port); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("ERROR:Failed to retrieve local ip and port from " "socket for multihomed mode.(%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { /* transport failure */ call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_TRANSPORTFAILURE; @@ -336,7 +336,7 @@ call->callToken, channelSocket, call->localIP); close(channelSocket); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { /* No one is listening at remote end */ call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_NOUSER; @@ -354,7 +354,7 @@ { if (0 != call->pH225Channel) { - if(call->pH225Channel->sock != 0) + if (call->pH225Channel->sock != 0) ooSocketClose (call->pH225Channel->sock); if (call->pH225Channel->outQueue.count > 0) { @@ -373,13 +373,13 @@ OOIPADDR ipaddrs; /* Create socket */ - if((ret=ooSocketCreate (&channelSocket))!=ASN_OK) + if ((ret=ooSocketCreate (&channelSocket))!=ASN_OK) { OOTRACEERR1("Failed to create socket for H323 Listener\n"); return OO_FAILED; } ret= ooSocketStrToAddr (gH323ep.signallingIP, &ipaddrs); - if((ret=ooSocketBind (channelSocket, ipaddrs, + if ((ret=ooSocketBind (channelSocket, ipaddrs, gH323ep.listenPort))==ASN_OK) { gH323ep.listener = (OOSOCKET*)memAlloc(&gH323ep.ctxt,sizeof(OOSOCKET)); @@ -406,7 +406,7 @@ OOSOCKET h225Channel=0; ret = ooSocketAccept (*(gH323ep.listener), &h225Channel, NULL, NULL); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR1("Error:Accepting h225 connection\n"); return OO_FAILED; @@ -414,7 +414,7 @@ ooGenerateCallToken(callToken, sizeof(callToken)); call = ooCreateCall("incoming", callToken); - if(!call) + if (!call) { OOTRACEERR1("ERROR:Failed to create an incoming call\n"); return OO_FAILED; @@ -427,19 +427,19 @@ call->pH225Channel->sock = h225Channel; /* If multihomed, get ip from socket */ - if(!strcmp(call->localIP, "0.0.0.0")) + if (!strcmp(call->localIP, "0.0.0.0")) { OOTRACEDBGA3("Determining IP address for incoming call in multihomed " "mode (%s, %s)\n", call->callType, call->callToken); ret = ooSocketGetIpAndPort(h225Channel, call->localIP, 20, &call->pH225Channel->port); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("Error:Failed to retrieve local ip and port from " "socket for multihomed mode.(%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { /* transport failure */ call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_TRANSPORTFAILURE; @@ -462,7 +462,7 @@ OOSOCKET h245Channel=0; ret = ooSocketAccept (*(call->h245listener), &h245Channel, NULL, NULL); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR1("Error:Accepting h245 connection\n"); return OO_FAILED; @@ -482,14 +482,14 @@ /* Start terminal capability exchange and master slave determination */ ret = ooSendTermCapMsg(call); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n", call->callType, call->callToken); return ret; } ret = ooSendMasterSlaveDetermination(call); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Sending Master-slave determination message " "(%s, %s)\n", call->callType, call->callToken); @@ -501,7 +501,7 @@ int ooSetCmdFDSETs(struct pollfd *pfds, int *nfds) { - if(gH323ep.cmdSock) + if (gH323ep.cmdSock) { pfds[*nfds].fd = gH323ep.cmdSock; pfds[*nfds].events = POLLIN; @@ -515,9 +515,9 @@ int ooProcessCmdFDSETsAndTimers (struct pollfd *pfds, int nfds, struct timeval *pToMin) { - if(gH323ep.cmdSock) { - if(ooPDRead(pfds, nfds, gH323ep.cmdSock)) { - if(ooReadAndProcessStackCommand() != OO_OK) { + if (gH323ep.cmdSock) { + if (ooPDRead(pfds, nfds, gH323ep.cmdSock)) { + if (ooReadAndProcessStackCommand() != OO_OK) { /* ooReadAndProcessStackCommand prints an error message */ return OO_FAILED; } @@ -531,13 +531,13 @@ int ooSetFDSETs(struct pollfd *pfds, int *nfds) { - if(gH323ep.gkClient && gH323ep.gkClient->rasSocket != 0) + if (gH323ep.gkClient && gH323ep.gkClient->rasSocket != 0) { pfds[*nfds].fd = gH323ep.gkClient->rasSocket; pfds[*nfds].events = POLLIN; (*nfds)++; } - if(gH323ep.listener) + if (gH323ep.listener) { pfds[*nfds].fd = *gH323ep.listener; pfds[*nfds].events = POLLIN; @@ -551,9 +551,9 @@ int ooSetCallFDSETs(OOH323CallData* call, struct pollfd* pfds, int *nfds) { - if(call) { + if (call) { - if(call->cmdSock && call->callState < OO_CALL_CLEAR) { + if (call->cmdSock && call->callState < OO_CALL_CLEAR) { pfds[*nfds].fd = call->cmdSock; pfds[*nfds].events = POLLIN; (*nfds)++; @@ -579,7 +579,7 @@ pfds[*nfds].events |= POLLOUT; (*nfds)++; } - else if(call->h245listener) { + else if (call->h245listener) { OOTRACEINFO3("H.245 Listerner socket being monitored " "(%s, %s)\n", call->callType, call->callToken); pfds[*nfds].fd = *(call->h245listener); @@ -599,22 +599,22 @@ struct timeval toNext; /* Process gatekeeper client timers */ - if(gH323ep.gkClient) + if (gH323ep.gkClient) { ooTimerFireExpired(&gH323ep.gkClient->ctxt, &gH323ep.gkClient->timerList); - if(ooTimerNextTimeout(&gH323ep.gkClient->timerList, &toNext)) + if (ooTimerNextTimeout(&gH323ep.gkClient->timerList, &toNext)) { - if(ooCompareTimeouts(pToMin, &toNext)>0) + if (ooCompareTimeouts(pToMin, &toNext)>0) { pToMin->tv_sec = toNext.tv_sec; pToMin->tv_usec = toNext.tv_usec; } } - if(gH323ep.gkClient->state == GkClientFailed || + if (gH323ep.gkClient->state == GkClientFailed || gH323ep.gkClient->state == GkClientGkErr) { - if(ooGkClientHandleClientOrGkFailure(gH323ep.gkClient)!=OO_OK) + if (ooGkClientHandleClientOrGkFailure(gH323ep.gkClient)!=OO_OK) { //ooStopMonitorCalls(); //Function calling ooProcessFDSETsAndTimers is responsible for this. return OO_FAILED; @@ -624,21 +624,21 @@ /* Manage ready descriptors after select */ - if(0 != gH323ep.gkClient && 0 != gH323ep.gkClient->rasSocket) + if (0 != gH323ep.gkClient && 0 != gH323ep.gkClient->rasSocket) { - if(ooPDRead(pfds, nfds, gH323ep.gkClient->rasSocket) ) + if (ooPDRead(pfds, nfds, gH323ep.gkClient->rasSocket) ) { ooGkClientReceive(gH323ep.gkClient); - if(gH323ep.gkClient->state == GkClientFailed || + if (gH323ep.gkClient->state == GkClientFailed || gH323ep.gkClient->state == GkClientGkErr) { ooGkClientHandleClientOrGkFailure(gH323ep.gkClient); } } } - if(gH323ep.listener) + if (gH323ep.listener) { - if(ooPDRead(pfds, nfds, *(gH323ep.listener))) + if (ooPDRead(pfds, nfds, *(gH323ep.listener))) { OOTRACEDBGA1("New connection at H225 receiver\n"); ooAcceptH225Connection(); @@ -654,13 +654,13 @@ { struct timeval toNext; - if(call) + if (call) { - if(call->cmdSock) { - if(ooPDRead(pfds, nfds, call->cmdSock)) { + if (call->cmdSock) { + if (ooPDRead(pfds, nfds, call->cmdSock)) { ast_mutex_lock(&call->Lock); - if(ooReadAndProcessCallStackCommand(call) != OO_OK) { + if (ooReadAndProcessCallStackCommand(call) != OO_OK) { /* ooReadAndProcessStackCommand prints an error message */ ast_mutex_unlock(&call->Lock); return OO_FAILED; @@ -672,13 +672,13 @@ ooTimerFireExpired(call->pctxt, &call->timerList); if (0 != call->pH225Channel && 0 != call->pH225Channel->sock) { - if(ooPDRead(pfds, nfds, call->pH225Channel->sock)) + if (ooPDRead(pfds, nfds, call->pH225Channel->sock)) { - if(ooH2250Receive(call) != OO_OK) + if (ooH2250Receive(call) != OO_OK) { OOTRACEERR3("ERROR:Failed ooH2250Receive - Clearing call " "(%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -688,20 +688,20 @@ } if (0 != call->pH245Channel && 0 != call->pH245Channel->sock) - if(ooPDRead(pfds, nfds, call->pH245Channel->sock)) + if (ooPDRead(pfds, nfds, call->pH245Channel->sock)) ooH245Receive(call); if (0 != call->pH245Channel && 0 != call->pH245Channel->sock) { - if(call->pH245Channel->outQueue.count>0) + if (call->pH245Channel->outQueue.count>0) { - if(ooPDWrite(pfds, nfds, call->pH245Channel->sock)) + if (ooPDWrite(pfds, nfds, call->pH245Channel->sock)) ooSendMsg(call, OOH245MSG); } } - else if(call->h245listener) + else if (call->h245listener) { - if(ooPDRead(pfds, nfds, *(call->h245listener))) + if (ooPDRead(pfds, nfds, *(call->h245listener))) { OOTRACEDBGC3("Incoming H.245 connection (%s, %s)\n", call->callType, call->callToken); @@ -711,15 +711,15 @@ if (0 != call->pH225Channel && 0 != call->pH225Channel->sock) { - if(ooPDWrite(pfds, nfds, call->pH225Channel->sock)) + if (ooPDWrite(pfds, nfds, call->pH225Channel->sock)) { - if(call->pH225Channel->outQueue.count>0) + if (call->pH225Channel->outQueue.count>0) { OOTRACEDBGC3("Sending H225 message (%s, %s)\n", call->callType, call->callToken); ooSendMsg(call, OOQ931MSG); } - if(call->pH245Channel && + if (call->pH245Channel && call->pH245Channel->outQueue.count>0 && OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { @@ -731,20 +731,20 @@ } } - if(ooTimerNextTimeout(&call->timerList, &toNext)) + if (ooTimerNextTimeout(&call->timerList, &toNext)) { - if(ooCompareTimeouts(pToMin, &toNext) > 0) + if (ooCompareTimeouts(pToMin, &toNext) > 0) { pToMin->tv_sec = toNext.tv_sec; pToMin->tv_usec = toNext.tv_usec; } } - if(call->callState >= OO_CALL_CLEAR && call->callState < OO_CALL_CLEARED) { + if (call->callState >= OO_CALL_CLEAR && call->callState < OO_CALL_CLEARED) { ast_mutex_lock(&call->Lock); ooEndCall(call); ast_mutex_unlock(&call->Lock); - } else if(call->callState == OO_CALL_CLEARED) { + } else if (call->callState == OO_CALL_CLEARED) { ast_mutex_lock(&call->Lock); ooEndCall(call); ast_mutex_unlock(&call->Lock); @@ -767,18 +767,18 @@ toMin.tv_sec = 3; toMin.tv_usec = 0; - while(1) + while (1) { nfds = 0; ooSetCmdFDSETs(pfds, &nfds); - if(!gMonitor) { + if (!gMonitor) { OOTRACEINFO1("Ending Monitor thread\n"); break; } - if(nfds == 0) + if (nfds == 0) #ifdef _WIN32 Sleep(10); #else @@ -791,7 +791,7 @@ else ret = ooSocketPoll(pfds, nfds, toMin.tv_sec * 1000 + toMin.tv_usec / 1000); - if(ret == -1) + if (ret == -1) { OOTRACEERR1("Error in poll ...exiting\n"); @@ -803,7 +803,7 @@ toMin.tv_usec = 100000; /* 100ms*/ ast_mutex_lock(&monitorLock); - if(ooProcessCmdFDSETsAndTimers(pfds, nfds, &toMin) != OO_OK) + if (ooProcessCmdFDSETsAndTimers(pfds, nfds, &toMin) != OO_OK) { /* ooStopMonitorCalls(); */ ast_mutex_unlock(&monitorLock); @@ -811,7 +811,7 @@ } ast_mutex_unlock(&monitorLock); - }/* while(1)*/ + }/* while (1)*/ return OO_OK; } @@ -827,27 +827,27 @@ toMin.tv_usec = 0; ooH323EpPrintConfig(); - if(gH323ep.gkClient) { + if (gH323ep.gkClient) { ooGkClientPrintConfig(gH323ep.gkClient); - if(OO_OK != ooGkClientStart(gH323ep.gkClient)) + if (OO_OK != ooGkClientStart(gH323ep.gkClient)) { OOTRACEERR1("Error:Failed to start Gatekeeper client\n"); ooGkClientDestroy(); } } - while(1) + while (1) { nfds = 0; ooSetFDSETs(pfds, &nfds); - if(!gMonitor) { + if (!gMonitor) { OOTRACEINFO1("Ending Monitor thread\n"); break; } - if(nfds == 0) + if (nfds == 0) #ifdef _WIN32 Sleep(10); #else @@ -860,7 +860,7 @@ else ret = ooSocketPoll(pfds, nfds, toMin.tv_sec * 1000 + toMin.tv_usec / 1000); - if(ret == -1) + if (ret == -1) { OOTRACEERR1("Error in poll ...exiting\n"); @@ -873,16 +873,16 @@ ast_mutex_lock(&monitorLock); ooTimerFireExpired(&gH323ep.ctxt, &g_TimerList); - if(ooTimerNextTimeout(&g_TimerList, &toNext)) + if (ooTimerNextTimeout(&g_TimerList, &toNext)) { - if(ooCompareTimeouts(&toMin, &toNext)>0) + if (ooCompareTimeouts(&toMin, &toNext)>0) { toMin.tv_sec = toNext.tv_sec; toMin.tv_usec = toNext.tv_usec; } } - if(ooProcessFDSETsAndTimers(pfds, nfds, &toMin) != OO_OK) + if (ooProcessFDSETsAndTimers(pfds, nfds, &toMin) != OO_OK) { ast_mutex_unlock(&monitorLock); ooStopMonitorCalls(); @@ -890,7 +890,7 @@ } ast_mutex_unlock(&monitorLock); - }/* while(1)*/ + }/* while (1)*/ return OO_OK; } int ooMonitorCallChannels(OOH323CallData *call) @@ -907,9 +907,9 @@ toMin.tv_sec = 3; toMin.tv_usec = 0; - while(1) + while (1) { - if(!call->Monitor) { + if (!call->Monitor) { OOTRACEINFO1("Ending Call Monitor thread\n"); break; } @@ -918,7 +918,7 @@ ooSetCallFDSETs(call, pfds, &nfds); - if(nfds == 0) + if (nfds == 0) #ifdef _WIN32 Sleep(10); #else @@ -936,7 +936,7 @@ else ret = ooSocketPoll(pfds, nfds, toMin.tv_sec * 1000 + toMin.tv_usec / 1000); - if(ret == -1) + if (ret == -1) { OOTRACEERR2("Error in poll %d ...exiting\n", errno); @@ -952,13 +952,13 @@ toMin.tv_usec = 100000; /* 100ms*/ /*This is for test application. Not part of actual stack */ - if(ooProcessCallFDSETsAndTimers(call, pfds, nfds, &toMin) != OO_OK) + if (ooProcessCallFDSETsAndTimers(call, pfds, nfds, &toMin) != OO_OK) { ooStopMonitorCallChannels(call); continue; } - }/* while(1)*/ + }/* while (1)*/ if (call->cmdSock) ooCloseCallCmdConnection(call); @@ -986,7 +986,7 @@ pmsg = (Q931Message*)memAlloc(pctxt, sizeof(Q931Message)); - if(!pmsg) + if (!pmsg) { OOTRACEERR3("ERROR:Failed to allocate memory for incoming H.2250 message" " (%s, %s)\n", call->callType, call->callToken); @@ -997,9 +997,9 @@ memset(pmsg, 0, sizeof(Q931Message)); /* First read just TPKT header which is four bytes */ recvLen = ooSocketRecv (call->pH225Channel->sock, message, 4); - if(recvLen <= 0) + if (recvLen <= 0) { - if(recvLen == 0) + if (recvLen == 0) OOTRACEWARN3("Warn:RemoteEndpoint closed connection (%s, %s)\n", call->callType, call->callToken); else @@ -1007,9 +1007,9 @@ "message (%s, %s)\n", call->callType, call->callToken); ooCloseH225Connection(call); - if(call->callState < OO_CALL_CLEARED) + if (call->callState < OO_CALL_CLEARED) { - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEARED; @@ -1023,13 +1023,13 @@ message boundary. Has to be done at channel level, as channels know the message formats and can determine boundaries */ - if(recvLen != 4) + if (recvLen != 4) { OOTRACEERR4("Error: Reading TPKT header for H225 message " "recvLen= %d (%s, %s)\n", recvLen, call->callType, call->callToken); ooFreeQ931Message(pctxt, pmsg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1044,14 +1044,14 @@ /* Remaining message length is length - tpkt length */ len = len - 4; - if(len > MAXMSGLEN - 4) + if (len > MAXMSGLEN - 4) { OOTRACEERR4("Error: Invalid TPKT header for H225 message " "Len = %d (%s, %s)\n", len, call->callType, call->callToken); ooCloseH225Connection(call); ooFreeQ931Message(pctxt, pmsg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1066,27 +1066,27 @@ for remaining bytes of the message. If message is not received in 3 seconds, then we have a problem. Report an error and exit. */ - while(total < len) + while (total < len) { struct pollfd pfds; recvLen = ooSocketRecv (call->pH225Channel->sock, message1, len-total); memcpy(message+total, message1, recvLen); total = total + recvLen; - if(total == len) break; /* Complete message is received */ + if (total == len) break; /* Complete message is received */ pfds.fd = call->pH225Channel->sock; pfds.events = POLLIN; timeout.tv_sec = 3; timeout.tv_usec = 0; ret = ooSocketPoll(&pfds, 1, timeout.tv_sec * 1000); - if(ret == -1) + if (ret == -1) { OOTRACEERR3("Error in select while receiving H.2250 message - " "clearing call (%s, %s)\n", call->callType, call->callToken); ooFreeQ931Message(pctxt, pmsg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -1095,12 +1095,12 @@ } /* If remaining part of the message is not received in 3 seconds exit */ - if(!ooPDRead(&pfds, 1, call->pH225Channel->sock)) + if (!ooPDRead(&pfds, 1, call->pH225Channel->sock)) { OOTRACEERR3("Error: Incomplete H.2250 message received - clearing " "call (%s, %s)\n", call->callType, call->callToken); ooFreeQ931Message(pctxt, pmsg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1115,7 +1115,7 @@ initializePrintHandler(&printHandler, "Received H.2250 Message"); setEventHandler (pctxt, &printHandler); ret = ooQ931Decode (call, pmsg, len, message); - if(ret != OO_OK) { + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to decode received H.2250 message. (%s, %s)\n", call->callType, call->callToken); } @@ -1123,7 +1123,7 @@ call->callToken); finishPrint(); removeEventHandler(pctxt); - if(ret == OO_OK) { + if (ret == OO_OK) { ooHandleH2250Message(call, pmsg); } return ret; @@ -1149,9 +1149,9 @@ message boundary. Has to be done at channel level, as channels know the message formats and can determine boundaries */ - if(recvLen<=0 && call->h245SessionState != OO_H245SESSION_PAUSED) + if (recvLen<=0 && call->h245SessionState != OO_H245SESSION_PAUSED) { - if(recvLen == 0) + if (recvLen == 0) OOTRACEINFO3("Closing H.245 channels as remote end point closed H.245" " connection (%s, %s)\n", call->callType, call->callToken); else @@ -1160,14 +1160,14 @@ ooCloseH245Connection(call); ooFreeH245Message(call, pmsg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; } return OO_FAILED; } - if(call->h245SessionState == OO_H245SESSION_PAUSED) + if (call->h245SessionState == OO_H245SESSION_PAUSED) { ooLogicalChannel *temp; @@ -1175,12 +1175,12 @@ " (%s, %s)\n", call->callType, call->callToken); temp = call->logicalChans; - while(temp) + while (temp) { - if(temp->state == OO_LOGICALCHAN_ESTABLISHED) + if (temp->state == OO_LOGICALCHAN_ESTABLISHED) { /* Sending closelogicalchannel only for outgoing channels*/ - if(!strcmp(temp->dir, "transmit")) + if (!strcmp(temp->dir, "transmit")) { ooSendCloseLogicalChannel(call, temp); } @@ -1195,12 +1195,12 @@ call->logicalChans = NULL; } OOTRACEDBGC1("Receiving H245 message\n"); - if(recvLen != 4) + if (recvLen != 4) { OOTRACEERR3("Error: Reading TPKT header for H245 message (%s, %s)\n", call->callType, call->callToken); ooFreeH245Message(call, pmsg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1221,12 +1221,12 @@ seconds, then we have a problem. Report an error and exit. */ - if(len > MAXMSGLEN - 4) + if (len > MAXMSGLEN - 4) { OOTRACEERR4("Error: Invalid TPKT header length %d for H245 message (%s, %s)\n", len, call->callType, call->callToken); ooFreeH245Message(call, pmsg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1234,25 +1234,25 @@ return OO_FAILED; } - while(total < len) + while (total < len) { struct pollfd pfds; recvLen = ooSocketRecv (call->pH245Channel->sock, message1, len-total); memcpy(message+total, message1, recvLen); total = total + recvLen; - if(total == len) break; /* Complete message is received */ + if (total == len) break; /* Complete message is received */ pfds.fd = call->pH245Channel->sock; pfds.events = POLLIN; timeout.tv_sec = 3; timeout.tv_usec = 0; ret = ooSocketPoll(&pfds, 1, timeout.tv_sec * 1000); - if(ret == -1) + if (ret == -1) { OOTRACEERR3("Error in select...H245 Receive-Clearing call (%s, %s)\n", call->callType, call->callToken); ooFreeH245Message(call, pmsg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -1261,12 +1261,12 @@ } /* If remaining part of the message is not received in 3 seconds exit */ - if(!ooPDRead(&pfds, 1, call->pH245Channel->sock)) + if (!ooPDRead(&pfds, 1, call->pH245Channel->sock)) { OOTRACEERR3("Error: Incomplete h245 message received (%s, %s)\n", call->callType, call->callToken); ooFreeH245Message(call, pmsg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -1284,7 +1284,7 @@ setEventHandler (pctxt, &printHandler); ret = asn1PD_H245MultimediaSystemControlMessage(pctxt, &(pmsg->h245Msg)); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("Error decoding H245 message (%s, %s)\n", call->callType, call->callToken); @@ -1335,16 +1335,16 @@ - if(call->callState == OO_CALL_CLEARED) + if (call->callState == OO_CALL_CLEARED) { OOTRACEDBGA3("Warning:Call marked for cleanup. Can not send message." "(%s, %s)\n", call->callType, call->callToken); return OO_OK; } - if(type == OOQ931MSG) + if (type == OOQ931MSG) { - if(call->pH225Channel->outQueue.count == 0) + if (call->pH225Channel->outQueue.count == 0) { OOTRACEWARN3("WARN:No H.2250 message to send. (%s, %s)\n", call->callType, call->callToken); @@ -1357,7 +1357,7 @@ msgptr = (ASN1OCTET*) p_msgNode->data; msgType = msgptr[0]; - if(msgType == OOFacility) + if (msgType == OOFacility) { tunneledMsgType = msgptr[1]; logicalChannelNo = msgptr[2]; @@ -1377,19 +1377,19 @@ /* Remove the message from rtdlist pH225Channel->outQueue */ dListRemove(&(call->pH225Channel->outQueue), p_msgNode); - if(p_msgNode) + if (p_msgNode) memFreePtr(call->pctxt, p_msgNode); /*TODO: This is not required ideally. We will see for some time and if we don't face any problems we will delete this code */ #if 0 /* Check whether connection with remote is alright */ - if(!ooChannelsIsConnectionOK(call, call->pH225Channel->sock)) + if (!ooChannelsIsConnectionOK(call, call->pH225Channel->sock)) { OOTRACEERR3("Error:Transport failure for signalling channel. " "Abandoning message send and marking call for cleanup.(%s" "'%s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEARED; return OO_OK; @@ -1397,7 +1397,7 @@ #endif /* Send message out via TCP */ ret = ooSocketSend(call->pH225Channel->sock, msgToSend, len); - if(ret == ASN_OK) + if (ret == ASN_OK) { memFreePtr (call->pctxt, msgptr); OOTRACEDBGC3("H2250/Q931 Message sent successfully (%s, %s)\n", @@ -1409,7 +1409,7 @@ OOTRACEERR3("H2250Q931 Message send failed (%s, %s)\n", call->callType, call->callToken); memFreePtr (call->pctxt, msgptr); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -1417,9 +1417,9 @@ return OO_FAILED; } }/* end of type==OOQ931MSG */ - if(type == OOH245MSG) + if (type == OOH245MSG) { - if(call->pH245Channel->outQueue.count == 0) + if (call->pH245Channel->outQueue.count == 0) { OOTRACEWARN3("WARN:No H.245 message to send. (%s, %s)\n", call->callType, call->callToken); @@ -1440,7 +1440,7 @@ len = (len | msgptr[4]); /* Remove the message from queue */ dListRemove(&(call->pH245Channel->outQueue), p_msgNode); - if(p_msgNode) + if (p_msgNode) memFreePtr(call->pctxt, p_msgNode); /* Send message out */ @@ -1450,7 +1450,7 @@ "(%s, %s)\n", call->callType, call->callToken); memFreePtr (call->pctxt, msgptr); /*ooCloseH245Session(call);*/ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -1465,7 +1465,7 @@ call->callType, call->callToken); ret = ooSocketSend(call->pH245Channel->sock, msgptr+5, len); - if(ret == ASN_OK) + if (ret == ASN_OK) { memFreePtr (call->pctxt, msgptr); OOTRACEDBGA3("H245 Message sent successfully (%s, %s)\n", @@ -1477,7 +1477,7 @@ memFreePtr (call->pctxt, msgptr); OOTRACEERR3("ERROR:H245 Message send failed (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -1485,7 +1485,7 @@ return OO_FAILED; } } - else if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { + else if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { OOTRACEDBGC4("Sending %s H245 message as a tunneled message." "(%s, %s)\n", ooGetMsgTypeText(msgType), call->callType, call->callToken); @@ -1493,12 +1493,12 @@ ret = ooSendAsTunneledMessage (call, msgptr+5,len,msgType, logicalChannelNo); - if(ret != OO_OK) + if (ret != OO_OK) { memFreePtr (call->pctxt, msgptr); OOTRACEERR3("ERROR:Failed to tunnel H.245 message (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1522,7 +1522,7 @@ if (0 != call->pH245Channel) { - if(0 != call->pH245Channel->sock) + if (0 != call->pH245Channel->sock) ooSocketClose (call->pH245Channel->sock); if (call->pH245Channel->outQueue.count > 0) dListFreeAll(call->pctxt, &(call->pH245Channel->outQueue)); @@ -1540,7 +1540,7 @@ { OOTRACEINFO3("Closing H.245 Listener (%s, %s)\n", call->callType, call->callToken); - if(call->h245listener) + if (call->h245listener) { ooSocketClose(*(call->h245listener)); memFreePtr(call->pctxt, call->h245listener); @@ -1553,7 +1553,7 @@ (OOH323CallData *call, int msgType, int tunneledMsgType, int associatedChan) { ooTimerCallback *cbData=NULL; - switch(msgType) + switch (msgType) { case OOSetup: OOTRACEINFO3("Sent Message - Setup (%s, %s)\n", call->callType, @@ -1561,7 +1561,7 @@ /* Start call establishment timer */ cbData = (ooTimerCallback*) memAlloc(call->pctxt, sizeof(ooTimerCallback)); - if(!cbData) + if (!cbData) { OOTRACEERR3("Error:Unable to allocate memory for timer callback." "(%s, %s)\n", call->callType, call->callToken); @@ -1569,7 +1569,7 @@ } cbData->call = call; cbData->timerType = OO_CALLESTB_TIMER; - if(!ooTimerCreate(call->pctxt, &call->timerList, &ooCallEstbTimerExpired, + if (!ooTimerCreate(call->pctxt, &call->timerList, &ooCallEstbTimerExpired, gH323ep.callEstablishmentTimeout, cbData, FALSE)) { OOTRACEERR3("Error:Unable to create call establishment timer. " @@ -1578,7 +1578,7 @@ return OO_FAILED; } - /* if(gH323ep.h323Callbacks.onOutgoingCall) + /* if (gH323ep.h323Callbacks.onOutgoingCall) gH323ep.h323Callbacks.onOutgoingCall(call); */ break; case OOCallProceeding: @@ -1588,24 +1588,24 @@ case OOAlert: OOTRACEINFO3("Sent Message - Alerting (%s, %s) \n", call->callType, call->callToken); - /* if(gH323ep.h323Callbacks.onAlerting && call->callState < OO_CALL_CLEAR) + /* if (gH323ep.h323Callbacks.onAlerting && call->callState < OO_CALL_CLEAR) gH323ep.h323Callbacks.onAlerting(call); */ break; case OOConnect: OOTRACEINFO3("Sent Message - Connect (%s, %s)\n", call->callType, call->callToken); - if(gH323ep.h323Callbacks.onCallEstablished) + if (gH323ep.h323Callbacks.onCallEstablished) gH323ep.h323Callbacks.onCallEstablished(call); break; case OOReleaseComplete: OOTRACEINFO3("Sent Message - ReleaseComplete (%s, %s)\n", call->callType, call->callToken); - if(call->callState == OO_CALL_CLEAR_RELEASERECVD) + if (call->callState == OO_CALL_CLEAR_RELEASERECVD) call->callState = OO_CALL_CLEARED; else{ call->callState = OO_CALL_CLEAR_RELEASESENT; - if(gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK) && + if (gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK) && gH323ep.gkClient->state == GkClientRegistered){ OOTRACEDBGA3("Sending DRQ after sending ReleaseComplete." "(%s, %s)\n", call->callType, call->callToken); @@ -1615,12 +1615,12 @@ } } - if(call->callState == OO_CALL_CLEAR_RELEASESENT && + if (call->callState == OO_CALL_CLEAR_RELEASESENT && call->h245SessionState == OO_H245SESSION_IDLE) { cbData = (ooTimerCallback*) memAlloc(call->pctxt, sizeof(ooTimerCallback)); - if(!cbData) + if (!cbData) { OOTRACEERR3("Error:Unable to allocate memory for timer callback " "data.(%s, %s)\n", call->callType, call->callToken); @@ -1629,7 +1629,7 @@ cbData->call = call; cbData->timerType = OO_SESSION_TIMER; cbData->channelNumber = 0; - if(!ooTimerCreate(call->pctxt, &call->timerList, + if (!ooTimerCreate(call->pctxt, &call->timerList, &ooSessionTimerExpired, gH323ep.sessionTimeout, cbData, FALSE)) { OOTRACEERR3("Error:Unable to create EndSession timer- " @@ -1640,14 +1640,14 @@ } } - if(call->h245SessionState == OO_H245SESSION_CLOSED) + if (call->h245SessionState == OO_H245SESSION_CLOSED) { call->callState = OO_CALL_CLEARED; } break; case OOFacility: - if(tunneledMsgType == OOFacility) + if (tunneledMsgType == OOFacility) { OOTRACEINFO3("Sent Message - Facility. (%s, %s)\n", call->callType, call->callToken); @@ -1662,7 +1662,7 @@ break; case OOMasterSlaveDetermination: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - MasterSlaveDetermination (%s, %s)\n", call->callType, call->callToken); else @@ -1671,7 +1671,7 @@ /* Start MSD timer */ cbData = (ooTimerCallback*) memAlloc(call->pctxt, sizeof(ooTimerCallback)); - if(!cbData) + if (!cbData) { OOTRACEERR3("Error:Unable to allocate memory for timer callback data." "(%s, %s)\n", call->callType, call->callToken); @@ -1679,7 +1679,7 @@ } cbData->call = call; cbData->timerType = OO_MSD_TIMER; - if(!ooTimerCreate(call->pctxt, &call->timerList, &ooMSDTimerExpired, + if (!ooTimerCreate(call->pctxt, &call->timerList, &ooMSDTimerExpired, gH323ep.msdTimeout, cbData, FALSE)) { OOTRACEERR3("Error:Unable to create MSD timer. " @@ -1690,7 +1690,7 @@ break; case OOMasterSlaveAck: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - MasterSlaveDeterminationAck (%s, %s)" "\n", call->callType, call->callToken); else @@ -1698,7 +1698,7 @@ call->callType, call->callToken); break; case OOMasterSlaveReject: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - MasterSlaveDeterminationReject " "(%s, %s)\n", call->callType, call->callToken); else @@ -1706,7 +1706,7 @@ call->callType, call->callToken); break; case OOMasterSlaveRelease: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - MasterSlaveDeterminationRelease " "(%s, %s)\n", call->callType, call->callToken); else @@ -1714,10 +1714,10 @@ "(%s, %s)\n", call->callType, call->callToken); break; case OOTerminalCapabilitySet: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { /* If session isn't marked active yet, do it. possible in case of tunneling */ - if(call->h245SessionState == OO_H245SESSION_IDLE || + if (call->h245SessionState == OO_H245SESSION_IDLE || call->h245SessionState == OO_H245SESSION_PAUSED) { call->h245SessionState = OO_H245SESSION_ACTIVE; } @@ -1731,7 +1731,7 @@ /* Start TCS timer */ cbData = (ooTimerCallback*) memAlloc(call->pctxt, sizeof(ooTimerCallback)); - if(!cbData) + if (!cbData) { OOTRACEERR3("Error:Unable to allocate memory for timer callback data." "(%s, %s)\n", call->callType, call->callToken); @@ -1739,7 +1739,7 @@ } cbData->call = call; cbData->timerType = OO_TCS_TIMER; - if(!ooTimerCreate(call->pctxt, &call->timerList, &ooTCSTimerExpired, + if (!ooTimerCreate(call->pctxt, &call->timerList, &ooTCSTimerExpired, gH323ep.tcsTimeout, cbData, FALSE)) { OOTRACEERR3("Error:Unable to create TCS timer. " @@ -1751,7 +1751,7 @@ case OOTerminalCapabilitySetAck: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - TerminalCapabilitySetAck (%s, %s)\n", call->callType, call->callToken); else @@ -1759,7 +1759,7 @@ call->callType, call->callToken); break; case OOTerminalCapabilitySetReject: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - TerminalCapabilitySetReject " "(%s, %s)\n", call->callType, call->callToken); else @@ -1767,7 +1767,7 @@ call->callType, call->callToken); break; case OOOpenLogicalChannel: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO4("Tunneled Message - OpenLogicalChannel(%d). (%s, %s)\n", associatedChan, call->callType, call->callToken); else @@ -1776,7 +1776,7 @@ /* Start LogicalChannel timer */ cbData = (ooTimerCallback*) memAlloc(call->pctxt, sizeof(ooTimerCallback)); - if(!cbData) + if (!cbData) { OOTRACEERR3("Error:Unable to allocate memory for timer callback data." "(%s, %s)\n", call->callType, call->callToken); @@ -1785,7 +1785,7 @@ cbData->call = call; cbData->timerType = OO_OLC_TIMER; cbData->channelNumber = associatedChan; - if(!ooTimerCreate(call->pctxt, &call->timerList, + if (!ooTimerCreate(call->pctxt, &call->timerList, &ooOpenLogicalChannelTimerExpired, gH323ep.logicalChannelTimeout, cbData, FALSE)) { @@ -1797,7 +1797,7 @@ break; case OOOpenLogicalChannelAck: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO4("Tunneled Message - OpenLogicalChannelAck(%d) (%s,%s)\n", associatedChan, call->callType, call->callToken); else @@ -1805,7 +1805,7 @@ associatedChan, call->callType, call->callToken); break; case OOOpenLogicalChannelReject: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO4("Tunneled Message - OpenLogicalChannelReject(%d)" "(%s, %s)\n", associatedChan, call->callType, call->callToken); @@ -1814,19 +1814,19 @@ associatedChan, call->callType, call->callToken); break; case OOEndSessionCommand: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - EndSessionCommand(%s, %s)\n", call->callType, call->callToken); else OOTRACEINFO3("Sent Message - EndSessionCommand (%s, %s)\n", call->callType, call->callToken); - if((call->h245SessionState == OO_H245SESSION_ACTIVE)) + if ((call->h245SessionState == OO_H245SESSION_ACTIVE)) { /* Start EndSession timer */ call->h245SessionState = OO_H245SESSION_ENDSENT; cbData = (ooTimerCallback*) memAlloc(call->pctxt, sizeof(ooTimerCallback)); - if(!cbData) + if (!cbData) { OOTRACEERR3("Error:Unable to allocate memory for timer callback " "data.(%s, %s)\n", call->callType, call->callToken); @@ -1835,7 +1835,7 @@ cbData->call = call; cbData->timerType = OO_SESSION_TIMER; cbData->channelNumber = 0; - if(!ooTimerCreate(call->pctxt, &call->timerList, + if (!ooTimerCreate(call->pctxt, &call->timerList, &ooSessionTimerExpired, gH323ep.sessionTimeout, cbData, FALSE)) { OOTRACEERR3("Error:Unable to create EndSession timer. " @@ -1849,7 +1849,7 @@ } break; case OOCloseLogicalChannel: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - CloseLogicalChannel (%s, %s)\n", call->callType, call->callToken); else @@ -1858,7 +1858,7 @@ /* Start LogicalChannel timer */ cbData = (ooTimerCallback*) memAlloc(call->pctxt, sizeof(ooTimerCallback)); - if(!cbData) + if (!cbData) { OOTRACEERR3("Error:Unable to allocate memory for timer callback data." "(%s, %s)\n", call->callType, call->callToken); @@ -1867,7 +1867,7 @@ cbData->call = call; cbData->timerType = OO_CLC_TIMER; cbData->channelNumber = associatedChan; - if(!ooTimerCreate(call->pctxt, &call->timerList, + if (!ooTimerCreate(call->pctxt, &call->timerList, &ooCloseLogicalChannelTimerExpired, gH323ep.logicalChannelTimeout, cbData, FALSE)) { @@ -1879,7 +1879,7 @@ break; case OOCloseLogicalChannelAck: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - CloseLogicalChannelAck (%s, %s)\n", call->callType, call->callToken); else @@ -1887,7 +1887,7 @@ call->callType, call->callToken); break; case OORequestChannelClose: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - RequestChannelClose (%s, %s)\n", call->callType, call->callToken); else @@ -1896,7 +1896,7 @@ /* Start RequestChannelClose timer */ cbData = (ooTimerCallback*) memAlloc(call->pctxt, sizeof(ooTimerCallback)); - if(!cbData) + if (!cbData) { OOTRACEERR3("Error:Unable to allocate memory for timer callback data." "(%s, %s)\n", call->callType, call->callToken); @@ -1905,7 +1905,7 @@ cbData->call = call; cbData->timerType = OO_RCC_TIMER; cbData->channelNumber = associatedChan; - if(!ooTimerCreate(call->pctxt, &call->timerList, + if (!ooTimerCreate(call->pctxt, &call->timerList, &ooRequestChannelCloseTimerExpired, gH323ep.logicalChannelTimeout, cbData, FALSE)) { @@ -1916,7 +1916,7 @@ } break; case OORequestChannelCloseAck: - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) OOTRACEINFO3("Tunneled Message - RequestChannelCloseAck (%s, %s)\n", call->callType, call->callToken); else @@ -1940,19 +1940,19 @@ int ooStopMonitorCalls() { OOH323CallData * call; - if(gMonitor) + if (gMonitor) { OOTRACEINFO1("Doing ooStopMonitorCalls\n"); - if(gH323ep.cmdSock) + if (gH323ep.cmdSock) { ooCloseCmdConnection(); } - if(gH323ep.callList) + if (gH323ep.callList) { OOTRACEWARN1("Warn:Abruptly ending calls as stack going down\n"); call = gH323ep.callList; - while(call) + while (call) { OOTRACEWARN3("Clearing call (%s, %s)\n", call->callType, call->callToken); @@ -1964,7 +1964,7 @@ gH323ep.callList = NULL; } OOTRACEINFO1("Stopping listener for incoming calls\n"); - if(gH323ep.listener) + if (gH323ep.listener) { ooSocketClose(*(gH323ep.listener)); memFreePtr(&gH323ep.ctxt, gH323ep.listener); @@ -1988,28 +1988,28 @@ FD_ZERO(&readfds); FD_SET(sock, &readfds); - if(nfds < (int)sock) + if (nfds < (int)sock) nfds = (int)sock; nfds++; ret = ooSocketSelect(nfds, &readfds, NULL, NULL, &to); - if(ret == -1) + if (ret == -1) { OOTRACEERR3("Error in select ...broken pipe check(%s, %s)\n", call->callType, call->callToken ); return FALSE; } - if(FD_ISSET(sock, &readfds)) + if (FD_ISSET(sock, &readfds)) { char buf[2]; - if(ooSocketRecvPeek(sock, (ASN1OCTET*) buf, 2) == 0) + if (ooSocketRecvPeek(sock, (ASN1OCTET*) buf, 2) == 0) { OOTRACEWARN3("Broken pipe detected. (%s, %s)", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEARED; return FALSE; Index: addons/ooh323c/src/ooCmdChannel.c =================================================================== --- addons/ooh323c/src/ooCmdChannel.c (revision 228266) +++ addons/ooh323c/src/ooCmdChannel.c (working copy) @@ -158,26 +158,26 @@ ast_mutex_lock(&gCmdChanLock); recvLen = read(gH323ep.cmdSock, buffer, MAXMSGLEN); ast_mutex_unlock(&gCmdChanLock); - if(recvLen <= 0) + if (recvLen <= 0) { OOTRACEERR1("Error:Failed to read CMD message\n"); return OO_FAILED; } - for(i=0; (int)(i+sizeof(OOStackCommand)) <= recvLen; i += sizeof(OOStackCommand)) + for (i=0; (int)(i+sizeof(OOStackCommand)) <= recvLen; i += sizeof(OOStackCommand)) { memcpy(&cmd, buffer+i, sizeof(OOStackCommand)); - if(cmd.type == OO_CMD_NOOP) + if (cmd.type == OO_CMD_NOOP) continue; - if(gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered) + if (gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered) { OOTRACEINFO1("Ignoring stack command as Gk Client is not registered" " yet\n"); } else { - switch(cmd.type) { + switch (cmd.type) { case OO_CMD_MAKECALL: OOTRACEINFO2("Processing MakeCall command %s\n", (char*)cmd.param2); @@ -187,7 +187,7 @@ case OO_CMD_MANUALPROGRESS: pCall = ooFindCallByToken((char*)cmd.param1); - if(!pCall) { + if (!pCall) { OOTRACEINFO2("Call \"%s\" does not exist\n", (char*)cmd.param1); OOTRACEINFO1("Call migth be cleared/closed\n"); @@ -198,17 +198,17 @@ break; case OO_CMD_MANUALRINGBACK: - if(OO_TESTFLAG(gH323ep.flags, OO_M_MANUALRINGBACK)) + if (OO_TESTFLAG(gH323ep.flags, OO_M_MANUALRINGBACK)) { pCall = ooFindCallByToken((char*)cmd.param1); - if(!pCall) { + if (!pCall) { OOTRACEINFO2("Call \"%s\" does not exist\n", (char*)cmd.param1); OOTRACEINFO1("Call migth be cleared/closed\n"); } else { ooSendAlerting(ooFindCallByToken((char*)cmd.param1)); - if(OO_TESTFLAG(gH323ep.flags, OO_M_AUTOANSWER)) { + if (OO_TESTFLAG(gH323ep.flags, OO_M_AUTOANSWER)) { ooSendConnect(ooFindCallByToken((char*)cmd.param1)); } } @@ -217,7 +217,7 @@ case OO_CMD_ANSCALL: pCall = ooFindCallByToken((char*)cmd.param1); - if(!pCall) { + if (!pCall) { OOTRACEINFO2("Call \"%s\" does not exist\n", (char*)cmd.param1); OOTRACEINFO1("Call might be cleared/closed\n"); @@ -244,16 +244,16 @@ case OO_CMD_SENDDIGIT: pCall = ooFindCallByToken((char*)cmd.param1); - if(!pCall) { + if (!pCall) { OOTRACEERR2("ERROR:Invalid calltoken %s\n", (char*)cmd.param1); break; } - if(pCall->jointDtmfMode & OO_CAP_DTMF_H245_alphanumeric) { + if (pCall->jointDtmfMode & OO_CAP_DTMF_H245_alphanumeric) { ooSendH245UserInputIndication_alphanumeric( pCall, (const char*)cmd.param2); } - else if(pCall->jointDtmfMode & OO_CAP_DTMF_H245_signal) { + else if (pCall->jointDtmfMode & OO_CAP_DTMF_H245_signal) { ooSendH245UserInputIndication_signal( pCall, (const char*)cmd.param2); } @@ -271,9 +271,9 @@ default: OOTRACEERR1("ERROR:Unknown command\n"); } } - if(cmd.param1) free(cmd.param1); - if(cmd.param2) free(cmd.param2); - if(cmd.param3) free(cmd.param3); + if (cmd.param1) free(cmd.param1); + if (cmd.param2) free(cmd.param2); + if (cmd.param3) free(cmd.param3); } @@ -293,7 +293,7 @@ } else { recvLen = read(call->cmdSock, buffer, MAXMSGLEN); } - if(recvLen <= 0) + if (recvLen <= 0) { OOTRACEERR1("Error:Failed to read CMD message\n"); return OO_FAILED; @@ -332,16 +332,16 @@ bPoint += cmd.plen3; } - if(cmd.type == OO_CMD_NOOP) + if (cmd.type == OO_CMD_NOOP) continue; - if(gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered) + if (gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered) { OOTRACEINFO1("Ignoring stack command as Gk Client is not registered" " yet\n"); } else { - switch(cmd.type) { + switch (cmd.type) { case OO_CMD_MAKECALL: OOTRACEINFO2("Processing MakeCall command %s\n", (char*)cmd.param2); @@ -355,10 +355,10 @@ break; case OO_CMD_MANUALRINGBACK: - if(OO_TESTFLAG(gH323ep.flags, OO_M_MANUALRINGBACK)) + if (OO_TESTFLAG(gH323ep.flags, OO_M_MANUALRINGBACK)) { ooSendAlerting(call); - if(OO_TESTFLAG(gH323ep.flags, OO_M_AUTOANSWER)) { + if (OO_TESTFLAG(gH323ep.flags, OO_M_AUTOANSWER)) { ooSendConnect(call); } } @@ -382,11 +382,11 @@ break; case OO_CMD_SENDDIGIT: - if(call->jointDtmfMode & OO_CAP_DTMF_H245_alphanumeric) { + if (call->jointDtmfMode & OO_CAP_DTMF_H245_alphanumeric) { ooSendH245UserInputIndication_alphanumeric( call, (const char*)cmd.param2); } - else if(call->jointDtmfMode & OO_CAP_DTMF_H245_signal) { + else if (call->jointDtmfMode & OO_CAP_DTMF_H245_signal) { ooSendH245UserInputIndication_signal( call, (const char*)cmd.param2); } @@ -405,9 +405,9 @@ default: OOTRACEERR1("ERROR:Unknown command\n"); } } - if(cmd.param1) free(cmd.param1); - if(cmd.param2) free(cmd.param2); - if(cmd.param3) free(cmd.param3); + if (cmd.param1) free(cmd.param1); + if (cmd.param2) free(cmd.param2); + if (cmd.param3) free(cmd.param3); } Index: addons/ooh323c/src/ooGkClient.c =================================================================== --- addons/ooh323c/src/ooGkClient.c (revision 228266) +++ addons/ooh323c/src/ooGkClient.c (working copy) @@ -54,7 +54,7 @@ OOInterface *cur=NULL; pGkClient = (ooGkClient*) memAlloc(&gH323ep.ctxt, sizeof(ooGkClient)); - if(!pGkClient) + if (!pGkClient) { OOTRACEERR1("Error: Failed to allocate memory to Gatekeeper Client.\n"); return OO_FAILED; @@ -70,24 +70,24 @@ strcpy(pGkClient->localRASIP, gH323ep.signallingIP); #ifndef _WIN32 - if(!strcmp(pGkClient->localRASIP, "0.0.0.0") || + if (!strcmp(pGkClient->localRASIP, "0.0.0.0") || !strcmp(pGkClient->localRASIP, "127.0.0.1")) { - if(!gH323ep.ifList) + if (!gH323ep.ifList) { - if(ooSocketGetInterfaceList(&gH323ep.ctxt, &gH323ep.ifList)!= ASN_OK) + if (ooSocketGetInterfaceList(&gH323ep.ctxt, &gH323ep.ifList)!= ASN_OK) { OOTRACEERR1("Error:Failed to retrieve interface addresses\n"); return OO_FAILED; } } - for(cur = gH323ep.ifList; cur; cur = cur->next) + for (cur = gH323ep.ifList; cur; cur = cur->next) { - if(!strcmp(cur->name, "lo") || !strcmp(cur->addr, "127.0.0.1")) + if (!strcmp(cur->name, "lo") || !strcmp(cur->addr, "127.0.0.1")) continue; break; } - if(cur) + if (cur) { OOTRACEINFO2("Using local RAS Ip address %s\n", cur->addr); strcpy(pGkClient->localRASIP, cur->addr); @@ -98,7 +98,7 @@ } } #endif - if(OO_OK != ooGkClientSetGkMode(pGkClient, eGkMode, szGkAddr, iGkPort)) + if (OO_OK != ooGkClientSetGkMode(pGkClient, eGkMode, szGkAddr, iGkPort)) { OOTRACEERR1("Error:Failed to set Gk mode\n"); memReset(&gH323ep.ctxt); @@ -153,13 +153,13 @@ void ooGkClientPrintConfig(ooGkClient *pGkClient) { OOTRACEINFO1("Gatekeeper Client Configuration:\n"); - if(pGkClient->gkMode == RasUseSpecificGatekeeper) + if (pGkClient->gkMode == RasUseSpecificGatekeeper) { OOTRACEINFO1("\tGatekeeper mode - UseSpecificGatekeeper\n"); OOTRACEINFO3("\tGatekeeper To Use - %s:%d\n", pGkClient->gkRasIP, pGkClient->gkRasPort); } - else if(pGkClient->gkMode == RasDiscoverGatekeeper) { + else if (pGkClient->gkMode == RasDiscoverGatekeeper) { OOTRACEINFO1("\tGatekeeper mode - RasDiscoverGatekeeper\n"); } else { @@ -169,12 +169,12 @@ int ooGkClientDestroy(void) { - if(gH323ep.gkClient) + if (gH323ep.gkClient) { - if(gH323ep.gkClient->state == GkClientRegistered) + if (gH323ep.gkClient->state == GkClientRegistered) { OOTRACEINFO1("Unregistering from Gatekeeper\n"); - if(ooGkClientSendURQ(gH323ep.gkClient, NULL)!=OO_OK) + if (ooGkClientSendURQ(gH323ep.gkClient, NULL)!=OO_OK) OOTRACEERR1("Error:Failed to send URQ to gatekeeper\n"); } OOTRACEINFO1("Destroying Gatekeeper Client\n"); @@ -195,7 +195,7 @@ int iRet=0; iRet = ooGkClientCreateChannel(pGkClient); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error: GkClient Channel Creation failed\n"); return OO_FAILED; @@ -204,7 +204,7 @@ ast_mutex_lock(&pGkClient->Lock); pGkClient->discoveryComplete = FALSE; iRet = ooGkClientSendGRQ(pGkClient); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error:Failed to send GRQ message\n"); pGkClient->state = GkClientFailed; @@ -220,19 +220,19 @@ char *szGkAddr, int iGkPort ) { pGkClient->gkMode = eGkMode; - if(eGkMode == RasUseSpecificGatekeeper) + if (eGkMode == RasUseSpecificGatekeeper) { OOTRACEINFO1("Gatekeeper Mode - RasUseSpecificGatekeeper\n"); - if(szGkAddr) + if (szGkAddr) { - if(strlen(szGkAddr)>MAX_IP_LEN) + if (strlen(szGkAddr)>MAX_IP_LEN) { OOTRACEERR2("Error:Invalid IP address specified - %s\n", szGkAddr); return OO_FAILED; } strcpy(pGkClient->gkRasIP, szGkAddr); } - if(iGkPort) + if (iGkPort) pGkClient->gkRasPort = iGkPort; else pGkClient->gkRasPort = DEFAULT_GKPORT; @@ -240,10 +240,10 @@ OOTRACEINFO3("Gatekeeper IP:port set to - %s:%d\n", szGkAddr, pGkClient->gkRasPort); } - else if(eGkMode == RasDiscoverGatekeeper) { + else if (eGkMode == RasDiscoverGatekeeper) { OOTRACEINFO1("Gatekeeper Mode - RasDiscoverGatekeeper\n"); } - else if(eGkMode == RasNoGatekeeper) { + else if (eGkMode == RasNoGatekeeper) { OOTRACEINFO1("Gatekeeper Mode - RasNoGatekeeper\n"); } @@ -261,16 +261,16 @@ int ret=0; OOIPADDR ipaddrs; /* Create socket */ - if((ret=ooSocketCreateUDP(&pGkClient->rasSocket))!=ASN_OK) + if ((ret=ooSocketCreateUDP(&pGkClient->rasSocket))!=ASN_OK) { OOTRACEERR1("Failed to create RAS socket\n"); pGkClient->state = GkClientFailed; return OO_FAILED; } - if(pGkClient->localRASPort) + if (pGkClient->localRASPort) { ret= ooSocketStrToAddr (pGkClient->localRASIP, &ipaddrs); - if( (ret=ooSocketBind( pGkClient->rasSocket, ipaddrs, + if ( (ret=ooSocketBind( pGkClient->rasSocket, ipaddrs, pGkClient->localRASPort))!=ASN_OK ) { OOTRACEERR1("ERROR:Failed to create RAS channel\n"); @@ -280,7 +280,7 @@ } else { ret = ooBindPort (OOUDP, pGkClient->rasSocket, pGkClient->localRASIP); - if(ret == OO_FAILED) + if (ret == OO_FAILED) { OOTRACEERR1("ERROR: Failed to bind port to RAS socket\n"); pGkClient->state = GkClientFailed; @@ -290,13 +290,13 @@ } /* Test Code NOTE- This doesn't work..:(( Have to fix this */ /* If multihomed, get ip from socket */ - if(!strcmp(pGkClient->localRASIP, "0.0.0.0")) + if (!strcmp(pGkClient->localRASIP, "0.0.0.0")) { OOTRACEDBGA1("Determining ip address for RAS channel " "multihomed mode. \n"); ret = ooSocketGetIpAndPort(pGkClient->rasSocket, pGkClient->localRASIP, 20, &pGkClient->localRASPort); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR1("Error:Failed to retrieve local ip and port from " "socket for RAS channel(multihomed).\n"); @@ -316,10 +316,10 @@ int ooGkClientCloseChannel(ooGkClient *pGkClient) { int ret; - if(pGkClient->rasSocket != 0) + if (pGkClient->rasSocket != 0) { ret = ooSocketClose(pGkClient->rasSocket); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR1("Error: failed to close RAS channel\n"); pGkClient->rasSocket = 0; @@ -343,7 +343,7 @@ pVendor->vendor.t35Extension = gH323ep.t35Extension; pVendor->vendor.manufacturerCode = gH323ep.manufacturerCode; pVendor->enterpriseNumber.numids=0; - if(gH323ep.productID) + if (gH323ep.productID) { pVendor->m.productIdPresent = TRUE; pVendor->productId.numocts = ASN1MIN(strlen(gH323ep.productID), @@ -351,7 +351,7 @@ memcpy(pVendor->productId.data, gH323ep.productID, pVendor->productId.numocts); } - if(gH323ep.versionID) + if (gH323ep.versionID) { pVendor->m.versionIdPresent = 1; pVendor->versionId.numocts = ASN1MIN(strlen(gH323ep.versionID), @@ -377,7 +377,7 @@ recvLen = ooSocketRecvFrom(pGkClient->rasSocket, recvBuf, 1024, remoteHost, 32, &iFromPort); - if(recvLen <0) + if (recvLen <0) { OOTRACEERR1("Error:Failed to receive RAS message\n"); ast_mutex_unlock(&pGkClient->Lock); @@ -386,9 +386,9 @@ OOTRACEDBGA1("GkClient Received RAS Message\n"); /* Verify the gk */ - if(pGkClient->discoveryComplete) + if (pGkClient->discoveryComplete) { - if((strncmp(pGkClient->gkRasIP, remoteHost,strlen(pGkClient->gkRasIP)))|| + if ((strncmp(pGkClient->gkRasIP, remoteHost,strlen(pGkClient->gkRasIP)))|| (pGkClient->gkRasPort!= iFromPort) ) { OOTRACEWARN3("WARN:Ignoring message received from unknown gatekeeper " @@ -398,7 +398,7 @@ } } - if(ASN_OK != setPERBuffer (pctxt, recvBuf, recvLen, TRUE ) ) + if (ASN_OK != setPERBuffer (pctxt, recvBuf, recvLen, TRUE ) ) { OOTRACEERR1("Error:Failed to set PER buffer for RAS message decoding\n"); memReset(pctxt); @@ -407,7 +407,7 @@ return OO_FAILED; } pRasMsg = (H225RasMessage*)memAlloc(pctxt, sizeof(H225RasMessage)); - if(!pRasMsg) + if (!pRasMsg) { OOTRACEERR1("Error: Failed to allocate memory for RAS message\n"); memReset(pctxt); @@ -420,14 +420,14 @@ /* Add event handler to list */ setEventHandler (pctxt, &printHandler); #endif - if(ASN_OK == asn1PD_H225RasMessage(pctxt, pRasMsg)) + if (ASN_OK == asn1PD_H225RasMessage(pctxt, pRasMsg)) { #ifndef _COMPACT finishPrint(); removeEventHandler(pctxt); #endif iRet=ooGkClientHandleRASMessage( pGkClient, pRasMsg ); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error: Failed to handle received RAS message\n"); //pGkClient->state = GkClientFailed; @@ -458,7 +458,7 @@ int ooGkClientHandleRASMessage(ooGkClient *pGkClient, H225RasMessage *pRasMsg) { int iRet = OO_OK; - switch( pRasMsg->t) + switch ( pRasMsg->t) { case T_H225RasMessage_gatekeeperConfirm: OOTRACEINFO1("Gatekeeper Confirmed (GCF) message received.\n"); @@ -547,7 +547,7 @@ setEventHandler(&ctxt, &printHandler); ret = asn1PD_H225RasMessage(&ctxt, &rasMsg); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR1("Error: Failed to decode RAS message\n"); } @@ -579,19 +579,19 @@ msgPtr = encodeGetMsgPtr( pctxt, &iLen ); /* If gatekeeper specified or have been discovered */ - if(pGkClient->gkMode == RasUseSpecificGatekeeper || + if (pGkClient->gkMode == RasUseSpecificGatekeeper || pGkClient->discoveryComplete) { - if(ASN_OK != ooSocketSendTo( pGkClient->rasSocket, msgPtr, iLen, + if (ASN_OK != ooSocketSendTo( pGkClient->rasSocket, msgPtr, iLen, pGkClient->gkRasIP, pGkClient->gkRasPort)) { OOTRACEERR1("Error sending RAS message\n"); return OO_FAILED; } } - else if(pGkClient->gkMode == RasDiscoverGatekeeper && + else if (pGkClient->gkMode == RasDiscoverGatekeeper && !pGkClient->discoveryComplete) { - if(ASN_OK != ooSocketSendTo(pGkClient->rasSocket, msgPtr, iLen, + if (ASN_OK != ooSocketSendTo(pGkClient->rasSocket, msgPtr, iLen, MULTICAST_GKADDRESS, MULTICAST_GKPORT)) { OOTRACEERR1("Error sending multicast RAS message\n" ); @@ -623,7 +623,7 @@ /* Allocate memory for RAS message */ pRasMsg = (H225RasMessage*)memAlloc(pctxt, sizeof(H225RasMessage)); - if(!pRasMsg) + if (!pRasMsg) { OOTRACEERR1("Error: Memory allocation for GRQ RAS message failed\n"); pGkClient->state = GkClientFailed; @@ -633,7 +633,7 @@ pGkReq = (H225GatekeeperRequest*)memAlloc(pctxt, sizeof(H225GatekeeperRequest)); - if(!pGkReq) + if (!pGkReq) { OOTRACEERR1("Error:Memory allocation for GRQ failed\n"); memReset(pctxt); @@ -655,7 +655,7 @@ pGkReq->rasAddress.t=T_H225TransportAddress_ipAddress; /* IPv4 address */ pRasAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!pRasAddress) + if (!pRasAddress) { OOTRACEERR1("Error: Memory allocation for Ras Address of GRQ message " "failed\n"); @@ -673,7 +673,7 @@ pGkReq->rasAddress.u.ipAddress = pRasAddress; /* Pose as gateway or terminal as per config */ - if(gH323ep.isGateway) + if (gH323ep.isGateway) pGkReq->endpointType.m.gatewayPresent = TRUE; else pGkReq->endpointType.m.terminalPresent = TRUE; @@ -685,7 +685,7 @@ pGkReq->m.endpointAliasPresent=TRUE; - if(OO_OK != ooPopulateAliasList(&pGkClient->msgCtxt, gH323ep.aliases, + if (OO_OK != ooPopulateAliasList(&pGkClient->msgCtxt, gH323ep.aliases, &pGkReq->endpointAlias)) { OOTRACEERR1("Error Failed to fill alias information for GRQ message\n"); @@ -695,7 +695,7 @@ return OO_FAILED; } iRet = ooGkClientSendMsg(pGkClient, pRasMsg); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error: Failed to send GRQ message\n"); memReset(&pGkClient->msgCtxt); @@ -706,7 +706,7 @@ OOTRACEINFO1("Sent GRQ message\n"); cbData = (ooGkClientTimerCb*) memAlloc (&pGkClient->ctxt, sizeof(ooGkClientTimerCb)); - if(!cbData) + if (!cbData) { OOTRACEERR1("Error:Failed to allocate memory to GRQ timer callback\n"); pGkClient->state = GkClientFailed; @@ -715,7 +715,7 @@ } cbData->timerType = OO_GRQ_TIMER; cbData->pGkClient = pGkClient; - if(!ooTimerCreate(&pGkClient->ctxt, &pGkClient->timerList, + if (!ooTimerCreate(&pGkClient->ctxt, &pGkClient->timerList, &ooGkClientGRQTimerExpired, pGkClient->grqTimeout, cbData, FALSE)) { @@ -736,14 +736,14 @@ DListNode *pNode = NULL; OOTimer *pTimer = NULL; - if(pGkClient->gkMode == RasUseSpecificGatekeeper) + if (pGkClient->gkMode == RasUseSpecificGatekeeper) { /* delete the corresponding GRQ timer */ - for(x=0; xtimerList.count; x++) + for (x=0; xtimerList.count; x++) { pNode = dListFindByIndex(&pGkClient->timerList, x); pTimer = (OOTimer*)pNode->data; - if(((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_GRQ_TIMER) + if (((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_GRQ_TIMER) { memFreePtr(&pGkClient->ctxt, pTimer->cbData); ooTimerDelete(&pGkClient->ctxt, &pGkClient->timerList, pTimer); @@ -753,7 +753,7 @@ } pGkClient->state = GkClientGkErr; - switch(pGatekeeperReject->rejectReason.t) + switch (pGatekeeperReject->rejectReason.t) { case T_H225GatekeeperRejectReason_resourceUnavailable: OOTRACEERR1("Error: Gatekeeper Reject - Resource Unavailable\n"); @@ -800,18 +800,18 @@ OOTimer *pTimer = NULL; H225TransportAddress_ipAddress *pRasAddress; - if(pGkClient->discoveryComplete) + if (pGkClient->discoveryComplete) { OOTRACEDBGB1("Ignoring GKConfirm as Gatekeeper has been discovered\n"); return OO_OK; } - if(pGatekeeperConfirm->m.gatekeeperIdentifierPresent) + if (pGatekeeperConfirm->m.gatekeeperIdentifierPresent) { pGkClient->gkId.nchars = pGatekeeperConfirm->gatekeeperIdentifier.nchars; pGkClient->gkId.data = (ASN116BITCHAR*)memAlloc(&pGkClient->ctxt, sizeof(ASN116BITCHAR)*pGkClient->gkId.nchars); - if(!pGkClient->gkId.data) + if (!pGkClient->gkId.data) { OOTRACEERR1("Error:Failed to allocate memory for GK ID data\n"); pGkClient->state = GkClientFailed; @@ -830,7 +830,7 @@ } /* Extract Gatekeeper's RAS address */ - if(pGatekeeperConfirm->rasAddress.t != T_H225TransportAddress_ipAddress) + if (pGatekeeperConfirm->rasAddress.t != T_H225TransportAddress_ipAddress) { OOTRACEERR1("ERROR:Unsupported RAS address type in received Gk Confirm" " message.\n"); @@ -850,11 +850,11 @@ /* Delete the corresponding GRQ timer */ - for(x=0; xtimerList.count; x++) + for (x=0; xtimerList.count; x++) { pNode = dListFindByIndex(&pGkClient->timerList, x); pTimer = (OOTimer*)pNode->data; - if(((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_GRQ_TIMER) + if (((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_GRQ_TIMER) { memFreePtr(&pGkClient->ctxt, pTimer->cbData); ooTimerDelete(&pGkClient->ctxt, &pGkClient->timerList, pTimer); @@ -864,7 +864,7 @@ } iRet = ooGkClientSendRRQ(pGkClient, FALSE); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error:Failed to send initial RRQ\n"); return OO_FAILED; @@ -893,7 +893,7 @@ pctxt = &pGkClient->msgCtxt; pRasMsg = (H225RasMessage*)memAlloc(pctxt, sizeof(H225RasMessage)); - if(!pRasMsg) + if (!pRasMsg) { OOTRACEERR1("Error: Memory allocation for RRQ RAS message failed\n"); pGkClient->state = GkClientFailed; @@ -903,7 +903,7 @@ pRegReq = (H225RegistrationRequest*)memAlloc(pctxt, sizeof(H225RegistrationRequest)); - if(!pRegReq) + if (!pRegReq) { OOTRACEERR1("Error:Memory allocation for RRQ failed\n"); memReset(pctxt); @@ -922,7 +922,7 @@ sizeof(H225TransportAddress)); pIpAddress = (H225TransportAddress_ipAddress*) memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!pTransportAddress || !pIpAddress) + if (!pTransportAddress || !pIpAddress) { OOTRACEERR1("Error:Failed to allocate memory for signalling address of " "RRQ message\n"); @@ -948,7 +948,7 @@ sizeof(H225TransportAddress)); pIpAddress = (H225TransportAddress_ipAddress*) memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!pTransportAddress || !pIpAddress) + if (!pTransportAddress || !pIpAddress) { OOTRACEERR1("Error:Failed to allocate memory for RAS address of " "RRQ message\n"); @@ -971,7 +971,7 @@ (void*)pTransportAddress); /* Pose as gateway or terminal as per config */ - if(gH323ep.isGateway) + if (gH323ep.isGateway) pRegReq->terminalType.m.gatewayPresent = TRUE; else pRegReq->terminalType.m.terminalPresent = TRUE; @@ -984,7 +984,7 @@ pProtocol = (H225SupportedProtocols*) memAlloc(pctxt, sizeof(H225SupportedProtocols)); pVoiceCaps = (H225VoiceCaps*) memAlloc(pctxt, sizeof(H225VoiceCaps)); - if(!pProtocol || !pVoiceCaps) { + if (!pProtocol || !pVoiceCaps) { OOTRACEERR1("Error:Failed to allocate memory for protocol info of " "RRQ message\n"); memReset(pctxt); @@ -1009,7 +1009,7 @@ } pRegReq->m.terminalAliasPresent=TRUE; - if(OO_OK != ooPopulateAliasList(pctxt, gH323ep.aliases, + if (OO_OK != ooPopulateAliasList(pctxt, gH323ep.aliases, &pRegReq->terminalAlias)) { OOTRACEERR1("Error filling alias for RRQ\n"); memReset(pctxt); @@ -1022,7 +1022,7 @@ pRegReq->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars; pRegReq->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc (pctxt, pGkClient->gkId.nchars*sizeof(ASN116BITCHAR)); - if(!pRegReq->gatekeeperIdentifier.data) + if (!pRegReq->gatekeeperIdentifier.data) { OOTRACEERR1("Error: Failed to allocate memory for GKIdentifier in RRQ " "message.\n"); @@ -1040,7 +1040,7 @@ pRegReq->willSupplyUUIEs=FALSE; pRegReq->requestSeqNum = pGkClient->requestSeqNum++; - if(!pRegReq->requestSeqNum) + if (!pRegReq->requestSeqNum) pRegReq->requestSeqNum = pGkClient->requestSeqNum++; pRegReq->discoveryComplete= pGkClient->discoveryComplete; @@ -1057,7 +1057,7 @@ * GK will ignore all other params if KeepAlive is set. * */ - if(keepAlive) { + if (keepAlive) { /* KeepAlive, re-registration message... allocate storage for endpoint-identifier, and populate it from what the GK told us from the previous RCF. Only allocate on the first pass thru here */ @@ -1082,7 +1082,7 @@ pRegReq->timeToLive = pGkClient->regTimeout; iRet = ooGkClientSendMsg(pGkClient, pRasMsg); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error: Failed to send RRQ message\n"); memReset(pctxt); @@ -1094,7 +1094,7 @@ /* Start RRQ Timer */ cbData = (ooGkClientTimerCb*) memAlloc (&pGkClient->ctxt, sizeof(ooGkClientTimerCb)); - if(!cbData) + if (!cbData) { OOTRACEERR1("Error:Failed to allocate memory to RRQ timer callback\n"); pGkClient->state = GkClientFailed; @@ -1103,7 +1103,7 @@ } cbData->timerType = OO_RRQ_TIMER; cbData->pGkClient = pGkClient; - if(!ooTimerCreate(&pGkClient->ctxt, &pGkClient->timerList, + if (!ooTimerCreate(&pGkClient->ctxt, &pGkClient->timerList, &ooGkClientRRQTimerExpired, pGkClient->rrqTimeout, cbData, FALSE)) { @@ -1139,7 +1139,7 @@ pRegistrationConfirm->endpointIdentifier.nchars; pGkClient->endpointId.data = (ASN116BITCHAR*)memAlloc(&pGkClient->ctxt, sizeof(ASN116BITCHAR)*pGkClient->endpointId.nchars); - if(!pGkClient->endpointId.data) + if (!pGkClient->endpointId.data) { OOTRACEERR1("Error:Failed to allocate memory for endpoint Id.\n"); pGkClient->state = GkClientFailed; @@ -1151,17 +1151,17 @@ sizeof(ASN116BITCHAR)*pGkClient->endpointId.nchars); /* Extract CallSignalling Address */ - for(i=0; i<(int)pRegistrationConfirm->callSignalAddress.count; i++) + for (i=0; i<(int)pRegistrationConfirm->callSignalAddress.count; i++) { pNode = dListFindByIndex(&pRegistrationConfirm->callSignalAddress, i); - if(!pNode) + if (!pNode) { OOTRACEERR1("Error:Invalid Registration confirmed message\n"); OOTRACEINFO1("Ignoring RCF, will retransmit RRQ after timeout\n"); return OO_FAILED; } pCallSigAddr = (H225TransportAddress*)pNode->data; - if(pCallSigAddr->t != T_H225TransportAddress_ipAddress) + if (pCallSigAddr->t != T_H225TransportAddress_ipAddress) continue; sprintf(pGkClient->gkCallSignallingIP, "%d.%d.%d.%d", pCallSigAddr->u.ipAddress->ip.data[0], @@ -1172,7 +1172,7 @@ } /* Update list of registered aliases*/ - if(pRegistrationConfirm->m.terminalAliasPresent) + if (pRegistrationConfirm->m.terminalAliasPresent) { ooGkClientUpdateRegisteredAliases(pGkClient, &pRegistrationConfirm->terminalAlias, TRUE); @@ -1182,20 +1182,20 @@ } /* Is keepAlive supported */ - if(pRegistrationConfirm->m.timeToLivePresent) + if (pRegistrationConfirm->m.timeToLivePresent) { pGkClient->regTimeout = pRegistrationConfirm->timeToLive; OOTRACEINFO2("Gatekeeper supports KeepAlive, Registration TTL is %d\n", pRegistrationConfirm->timeToLive); - if(pGkClient->regTimeout > DEFAULT_TTL_OFFSET) + if (pGkClient->regTimeout > DEFAULT_TTL_OFFSET) regTTL = pGkClient->regTimeout - DEFAULT_TTL_OFFSET; else regTTL = pGkClient->regTimeout; cbData = (ooGkClientTimerCb*) memAlloc (&pGkClient->ctxt, sizeof(ooGkClientTimerCb)); - if(!cbData) + if (!cbData) { OOTRACEERR1("Error:Failed to allocate memory for Regisration timer." "\n"); @@ -1204,7 +1204,7 @@ } cbData->timerType = OO_REG_TIMER; cbData->pGkClient = pGkClient; - if(!ooTimerCreate(&pGkClient->ctxt, &pGkClient->timerList, + if (!ooTimerCreate(&pGkClient->ctxt, &pGkClient->timerList, &ooGkClientREGTimerExpired, regTTL, cbData, FALSE)) { @@ -1220,7 +1220,7 @@ OOTRACEINFO1("Gatekeeper does not support KeepAlive.\n"); } /* Extract Pre-Granted ARQ */ - if(pRegistrationConfirm->m.preGrantedARQPresent) + if (pRegistrationConfirm->m.preGrantedARQPresent) { memcpy(&pGkClient->gkInfo.preGrantedARQ, &pRegistrationConfirm->preGrantedARQ, @@ -1230,11 +1230,11 @@ /* First delete the corresponding RRQ timer */ pNode = NULL; - for(x=0; xtimerList.count; x++) + for (x=0; xtimerList.count; x++) { pNode = dListFindByIndex(&pGkClient->timerList, x); pTimer = (OOTimer*)pNode->data; - if(((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_RRQ_TIMER) + if (((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_RRQ_TIMER) { memFreePtr(&pGkClient->ctxt, pTimer->cbData); ooTimerDelete(&pGkClient->ctxt, &pGkClient->timerList, pTimer); @@ -1243,7 +1243,7 @@ } } pGkClient->state = GkClientRegistered; - if(pGkClient->callbacks.onReceivedRegistrationConfirm) + if (pGkClient->callbacks.onReceivedRegistrationConfirm) pGkClient->callbacks.onReceivedRegistrationConfirm(pRegistrationConfirm, gH323ep.aliases); return OO_OK; @@ -1257,11 +1257,11 @@ DListNode *pNode = NULL; OOTimer *pTimer = NULL; /* First delete the corresponding RRQ timer */ - for(x=0; xtimerList.count; x++) + for (x=0; xtimerList.count; x++) { pNode = dListFindByIndex(&pGkClient->timerList, x); pTimer = (OOTimer*)pNode->data; - if(((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_RRQ_TIMER) + if (((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_RRQ_TIMER) { memFreePtr(&pGkClient->ctxt, pTimer->cbData); ooTimerDelete(&pGkClient->ctxt, &pGkClient->timerList, pTimer); @@ -1270,7 +1270,7 @@ } } - switch(pRegistrationReject->rejectReason.t) + switch (pRegistrationReject->rejectReason.t) { case T_H225RegistrationRejectReason_discoveryRequired: OOTRACEINFO1("RRQ Rejected - Discovery Required\n"); @@ -1279,7 +1279,7 @@ pGkClient->state = GkClientIdle; pGkClient->rrqRetries = 0; pGkClient->grqRetries = 0; - if(OO_OK != ooGkClientSendGRQ(pGkClient)) + if (OO_OK != ooGkClientSendGRQ(pGkClient)) { OOTRACEERR1("Error:Failed to send GRQ message\n"); return OO_FAILED; @@ -1323,7 +1323,7 @@ pGkClient->state = GkClientDiscovered; pGkClient->rrqRetries = 0; iRet = ooGkClientSendRRQ(pGkClient, 0); /* No keepAlive */ - if(iRet != OO_OK){ + if (iRet != OO_OK){ OOTRACEERR1("\nError: Full Registration transmission failed\n"); return OO_FAILED; } @@ -1366,7 +1366,7 @@ OOTRACEDBGA1("Building Unregistration Request message\n"); pRasMsg = (H225RasMessage*)memAlloc(pctxt, sizeof(H225RasMessage)); - if(!pRasMsg) + if (!pRasMsg) { OOTRACEERR1("Error: Memory allocation for URQ RAS message failed\n"); pGkClient->state = GkClientFailed; @@ -1376,7 +1376,7 @@ pUnregReq = (H225UnregistrationRequest*)memAlloc(pctxt, sizeof(H225UnregistrationRequest)); - if(!pUnregReq) + if (!pUnregReq) { OOTRACEERR1("Error:Memory allocation for URQ failed\n"); memReset(pctxt); @@ -1389,7 +1389,7 @@ pRasMsg->u.unregistrationRequest = pUnregReq; pUnregReq->requestSeqNum = pGkClient->requestSeqNum++; - if(!pUnregReq->requestSeqNum) + if (!pUnregReq->requestSeqNum) pUnregReq->requestSeqNum = pGkClient->requestSeqNum++; @@ -1399,7 +1399,7 @@ sizeof(H225TransportAddress)); pIpAddress = (H225TransportAddress_ipAddress*) memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!pTransportAddress || !pIpAddress) + if (!pTransportAddress || !pIpAddress) { OOTRACEERR1("Error:Failed to allocate memory for signalling address of " "RRQ message\n"); @@ -1423,7 +1423,7 @@ pUnregReq->endpointIdentifier.nchars = pGkClient->endpointId.nchars; pUnregReq->endpointIdentifier.data = (ASN116BITCHAR*)memAlloc(pctxt, sizeof(ASN116BITCHAR)*pGkClient->endpointId.nchars); - if(!pUnregReq->endpointIdentifier.data) + if (!pUnregReq->endpointIdentifier.data) { OOTRACEERR1("Error: Failed to allocate memory for EndPoint Id in URQ " "message.\n"); @@ -1441,7 +1441,7 @@ pUnregReq->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars; pUnregReq->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc(pctxt, sizeof(ASN116BITCHAR)*pGkClient->gkId.nchars); - if(!pUnregReq->gatekeeperIdentifier.data) + if (!pUnregReq->gatekeeperIdentifier.data) { OOTRACEERR1("Error:Failed to allocate memory for GKID of URQ message\n"); memReset(pctxt); @@ -1454,7 +1454,7 @@ sizeof(ASN116BITCHAR)*pGkClient->gkId.nchars); /* Check whether specific aliases are to be unregistered*/ - if(aliases) + if (aliases) { pUnregReq->m.endpointAliasPresent = TRUE; ooPopulateAliasList(pctxt, aliases, &pUnregReq->endpointAlias); @@ -1462,7 +1462,7 @@ iRet = ooGkClientSendMsg(pGkClient, pRasMsg); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error:Failed to send UnregistrationRequest message\n"); memReset(pctxt); @@ -1488,7 +1488,7 @@ ooGkClientSendUnregistrationConfirm(pGkClient, punregistrationRequest->requestSeqNum); - if(punregistrationRequest->m.endpointAliasPresent) + if (punregistrationRequest->m.endpointAliasPresent) { OOTRACEINFO1("Gatekeeper requested a list of aliases be unregistered\n"); ooGkClientUpdateRegisteredAliases(pGkClient, @@ -1506,7 +1506,7 @@ pGkClient->state = GkClientDiscovered; iRet = ooGkClientSendRRQ(pGkClient, 0); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error: Failed to send RRQ message\n"); return OO_FAILED; @@ -1514,7 +1514,7 @@ } - if(pGkClient->callbacks.onReceivedUnregistrationRequest) + if (pGkClient->callbacks.onReceivedUnregistrationRequest) pGkClient->callbacks.onReceivedUnregistrationRequest( punregistrationRequest, gH323ep.aliases); return OO_OK; @@ -1532,7 +1532,7 @@ pRasMsg = (H225RasMessage*)memAlloc(pctxt, sizeof(H225RasMessage)); pUCF = (H225UnregistrationConfirm*)memAlloc(pctxt, sizeof(H225UnregistrationConfirm)); - if(!pRasMsg || !pUCF) + if (!pRasMsg || !pUCF) { OOTRACEERR1("Error: Memory allocation for UCF RAS message failed\n"); pGkClient->state = GkClientFailed; @@ -1546,7 +1546,7 @@ pUCF->requestSeqNum = reqNo; iRet = ooGkClientSendMsg(pGkClient, pRasMsg); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error:Failed to send UnregistrationConfirm message\n"); memReset(pctxt); @@ -1584,7 +1584,7 @@ OOTRACEDBGA3("Building Admission Request for call (%s, %s)\n", call->callType, call->callToken); pRasMsg = (H225RasMessage*)memAlloc(pctxt, sizeof(H225RasMessage)); - if(!pRasMsg) + if (!pRasMsg) { OOTRACEERR3("Error:Memory - ooGkClientSendAdmissionRequest - " "pRasMsg(%s, %s)\n", call->callType, call->callToken); @@ -1595,7 +1595,7 @@ pRasMsg->t = T_H225RasMessage_admissionRequest; pAdmReq = (H225AdmissionRequest*) memAlloc(pctxt, sizeof(H225AdmissionRequest)); - if(!pAdmReq) + if (!pAdmReq) { OOTRACEERR3("Error:Memory - ooGkClientSendAdmissionRequest - " "pAdmReq(%s, %s)\n", call->callType, call->callToken); @@ -1610,11 +1610,11 @@ /* Populate call signalling addresses */ pIpAddressLocal = (H225TransportAddress_ipAddress*)memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!ooUtilsIsStrEmpty(call->remoteIP)) + if (!ooUtilsIsStrEmpty(call->remoteIP)) pIpAddressRemote = (H225TransportAddress_ipAddress*)memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!pIpAddressLocal || (!ooUtilsIsStrEmpty(call->remoteIP) && (!pIpAddressRemote))) + if (!pIpAddressLocal || (!ooUtilsIsStrEmpty(call->remoteIP) && (!pIpAddressRemote))) { OOTRACEERR1("Error:Failed to allocate memory for Call Signalling " "Addresses of ARQ message\n"); @@ -1628,19 +1628,19 @@ pIpAddressLocal->ip.numocts = 4; pIpAddressLocal->port = gH323ep.listenPort; - if(!ooUtilsIsStrEmpty(call->remoteIP)) + if (!ooUtilsIsStrEmpty(call->remoteIP)) { ooSocketConvertIpToNwAddr(call->remoteIP, pIpAddressRemote->ip.data); pIpAddressRemote->ip.numocts = 4; pIpAddressRemote->port = call->remotePort; } - if(!strcmp(call->callType, "incoming")) + if (!strcmp(call->callType, "incoming")) { pAdmReq->m.destCallSignalAddressPresent = TRUE; pAdmReq->destCallSignalAddress.t = T_H225TransportAddress_ipAddress; pAdmReq->destCallSignalAddress.u.ipAddress = pIpAddressLocal; - if(!ooUtilsIsStrEmpty(call->remoteIP)) + if (!ooUtilsIsStrEmpty(call->remoteIP)) { pAdmReq->m.srcCallSignalAddressPresent = TRUE; pAdmReq->srcCallSignalAddress.t = T_H225TransportAddress_ipAddress; @@ -1651,7 +1651,7 @@ pAdmReq->m.srcCallSignalAddressPresent = TRUE; pAdmReq->srcCallSignalAddress.t = T_H225TransportAddress_ipAddress; pAdmReq->srcCallSignalAddress.u.ipAddress = pIpAddressLocal; - if(!ooUtilsIsStrEmpty(call->remoteIP)) + if (!ooUtilsIsStrEmpty(call->remoteIP)) { pAdmReq->m.destCallSignalAddressPresent = TRUE; pAdmReq->destCallSignalAddress.t = T_H225TransportAddress_ipAddress; @@ -1661,7 +1661,7 @@ /* Populate seq number */ pAdmReq->requestSeqNum = pGkClient->requestSeqNum++; - if(!pAdmReq->requestSeqNum) + if (!pAdmReq->requestSeqNum) pAdmReq->requestSeqNum = pGkClient->requestSeqNum++; /* Populate call type - For now only PointToPoint supported*/ @@ -1669,7 +1669,7 @@ /* Add call model to message*/ pAdmReq->m.callModelPresent = 1; - if(OO_TESTFLAG(call->flags, OO_M_GKROUTED)) + if (OO_TESTFLAG(call->flags, OO_M_GKROUTED)) pAdmReq->callModel.t = T_H225CallModel_gatekeeperRouted; else pAdmReq->callModel.t = T_H225CallModel_direct; @@ -1678,7 +1678,7 @@ pAdmReq->endpointIdentifier.nchars = pGkClient->endpointId.nchars; pAdmReq->endpointIdentifier.data = (ASN116BITCHAR*)memAlloc(pctxt, sizeof(ASN116BITCHAR)*pGkClient->endpointId.nchars); - if(!pAdmReq->endpointIdentifier.data) + if (!pAdmReq->endpointIdentifier.data) { OOTRACEERR3("Error:Memory - ooGkClientSendAdmissionRequest - " "endpointIdentifier.data(%s, %s)\n", call->callType, @@ -1693,9 +1693,9 @@ sizeof(ASN116BITCHAR)*pGkClient->endpointId.nchars); /* Get Destination And source aliases for call - */ - if(!strcmp(call->callType, "incoming")) + if (!strcmp(call->callType, "incoming")) { - if(call->ourAliases) + if (call->ourAliases) destAliases = call->ourAliases; else destAliases = gH323ep.aliases; @@ -1703,7 +1703,7 @@ srcAliases = call->remoteAliases; } else { - if(call->ourAliases) + if (call->ourAliases) srcAliases = call->ourAliases; else srcAliases = gH323ep.aliases; @@ -1712,10 +1712,10 @@ } /* Populate destination info */ - if(destAliases) + if (destAliases) { pAdmReq->m.destinationInfoPresent = 1; - if(OO_OK != ooPopulateAliasList(&pGkClient->msgCtxt, destAliases, + if (OO_OK != ooPopulateAliasList(&pGkClient->msgCtxt, destAliases, &pAdmReq->destinationInfo)) { OOTRACEERR1("Error:Failed to populate destination aliases - " @@ -1728,11 +1728,11 @@ } /* Populate Source Info */ - if(srcAliases) + if (srcAliases) { iRet = ooPopulateAliasList(&pGkClient->msgCtxt, srcAliases, &pAdmReq->srcInfo); - if(OO_OK != iRet) + if (OO_OK != iRet) { OOTRACEERR1("Error:Failed to populate source aliases -ARQ message\n"); memReset(pctxt); @@ -1751,7 +1751,7 @@ memcpy((void*)&pAdmReq->conferenceID, (void*)&call->confIdentifier, sizeof(H225ConferenceIdentifier)); /*populate answerCall */ - if(!strcmp(call->callType, "incoming")) + if (!strcmp(call->callType, "incoming")) pAdmReq->answerCall = TRUE; else pAdmReq->answerCall = FALSE; @@ -1770,7 +1770,7 @@ pAdmReq->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars; pAdmReq->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc(pctxt, sizeof(ASN116BITCHAR)*pGkClient->gkId.nchars); - if(!pAdmReq->gatekeeperIdentifier.data) + if (!pAdmReq->gatekeeperIdentifier.data) { OOTRACEERR1("Error:Failed to allocate memory for GKID of ARQ message\n"); memReset(pctxt); @@ -1786,11 +1786,11 @@ pAdmReq->willSupplyUUIEs = FALSE; /* Create RasCallAdmissionInfo */ - if(!retransmit) + if (!retransmit) { pCallAdmInfo = (RasCallAdmissionInfo*)memAlloc(&pGkClient->ctxt, sizeof(RasCallAdmissionInfo)); - if(!pCallAdmInfo) + if (!pCallAdmInfo) { OOTRACEERR1("Error: Failed to allocate memory for new CallAdmission" " Info entry\n"); @@ -1806,11 +1806,11 @@ dListAppend(&pGkClient->ctxt, &pGkClient->callsPendingList,pCallAdmInfo); } else{ - for(x=0; xcallsPendingList.count; x++) + for (x=0; xcallsPendingList.count; x++) { pNode = dListFindByIndex(&pGkClient->callsPendingList, x); pCallAdmInfo = (RasCallAdmissionInfo*)pNode->data; - if(pCallAdmInfo->call->callReference == call->callReference) + if (pCallAdmInfo->call->callReference == call->callReference) { pCallAdmInfo->requestSeqNum = pAdmReq->requestSeqNum; break; @@ -1819,7 +1819,7 @@ } iRet = ooGkClientSendMsg(pGkClient, pRasMsg); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error:Failed to send AdmissionRequest message\n"); memReset(pctxt); @@ -1834,7 +1834,7 @@ /* Add ARQ timer */ cbData = (ooGkClientTimerCb*) memAlloc (&pGkClient->ctxt, sizeof(ooGkClientTimerCb)); - if(!cbData) + if (!cbData) { OOTRACEERR1("Error:Failed to allocate memory for Regisration timer." "\n"); @@ -1845,7 +1845,7 @@ cbData->timerType = OO_ARQ_TIMER; cbData->pGkClient = pGkClient; cbData->pAdmInfo = pCallAdmInfo; - if(!ooTimerCreate(&pGkClient->ctxt, &pGkClient->timerList, + if (!ooTimerCreate(&pGkClient->ctxt, &pGkClient->timerList, &ooGkClientARQTimerExpired, pGkClient->arqTimeout, cbData, FALSE)) { @@ -1875,17 +1875,17 @@ char ip[20]; /* Search call in pending calls list */ - for(x=0 ; xcallsPendingList.count; x++) + for (x=0 ; xcallsPendingList.count; x++) { pNode = dListFindByIndex(&pGkClient->callsPendingList, x); pCallAdmInfo = (RasCallAdmissionInfo*) pNode->data; - if(pCallAdmInfo->requestSeqNum == pAdmissionConfirm->requestSeqNum) + if (pCallAdmInfo->requestSeqNum == pAdmissionConfirm->requestSeqNum) { OOTRACEDBGC3("Found Pending call(%s, %s)\n", pCallAdmInfo->call->callType, pCallAdmInfo->call->callToken); /* Populate Remote IP */ - if(pAdmissionConfirm->destCallSignalAddress.t != + if (pAdmissionConfirm->destCallSignalAddress.t != T_H225TransportAddress_ipAddress) { OOTRACEERR1("Error:Destination Call Signal Address provided by" @@ -1900,13 +1900,13 @@ ipAddress->ip.data[1], ipAddress->ip.data[2], ipAddress->ip.data[3]); - if(strcmp(ip, "0.0.0.0")) + if (strcmp(ip, "0.0.0.0")) strcpy(pCallAdmInfo->call->remoteIP, ip); pCallAdmInfo->call->remotePort = ipAddress->port; /* Update call model */ - if(pAdmissionConfirm->callModel.t == T_H225CallModel_direct) + if (pAdmissionConfirm->callModel.t == T_H225CallModel_direct) { - if(OO_TESTFLAG(pCallAdmInfo->call->flags, OO_M_GKROUTED)) + if (OO_TESTFLAG(pCallAdmInfo->call->flags, OO_M_GKROUTED)) { OOTRACEINFO3("Gatekeeper changed call model from GkRouted to " "direct. (%s, %s)\n", pCallAdmInfo->call->callType, @@ -1915,9 +1915,9 @@ } } - if(pAdmissionConfirm->callModel.t == T_H225CallModel_gatekeeperRouted) + if (pAdmissionConfirm->callModel.t == T_H225CallModel_gatekeeperRouted) { - if(!OO_TESTFLAG(pCallAdmInfo->call->flags, OO_M_GKROUTED)) + if (!OO_TESTFLAG(pCallAdmInfo->call->flags, OO_M_GKROUTED)) { OOTRACEINFO3("Gatekeeper changed call model from direct to " "GkRouted. (%s, %s)\n", @@ -1928,13 +1928,13 @@ } /* Delete ARQ timer */ - for(y=0; ytimerList.count; y++) + for (y=0; ytimerList.count; y++) { pNode1 = dListFindByIndex(&pGkClient->timerList, y); pTimer = (OOTimer*)pNode1->data; - if(((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_ARQ_TIMER) + if (((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_ARQ_TIMER) { - if(((ooGkClientTimerCb*)pTimer->cbData)->pAdmInfo == + if (((ooGkClientTimerCb*)pTimer->cbData)->pAdmInfo == pCallAdmInfo) { memFreePtr(&pGkClient->ctxt, pTimer->cbData); @@ -1981,17 +1981,17 @@ OOTimer *pTimer = NULL; /* Search call in pending calls list */ - for(x=0 ; xcallsPendingList.count; x++) + for (x=0 ; xcallsPendingList.count; x++) { pNode = dListFindByIndex(&pGkClient->callsPendingList, x); pCallAdmInfo = (RasCallAdmissionInfo*) pNode->data; - if(pCallAdmInfo->requestSeqNum == pAdmissionReject->requestSeqNum) + if (pCallAdmInfo->requestSeqNum == pAdmissionReject->requestSeqNum) break; pNode = NULL; pCallAdmInfo = NULL; } - if(!pCallAdmInfo) + if (!pCallAdmInfo) { OOTRACEWARN2("Received admission reject with request number %d can not" " be matched with any pending call.\n", @@ -2006,13 +2006,13 @@ } /* Delete ARQ timer */ - for(y=0; ytimerList.count; y++) + for (y=0; ytimerList.count; y++) { pNode1 = dListFindByIndex(&pGkClient->timerList, y); pTimer = (OOTimer*)pNode1->data; - if(((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_ARQ_TIMER) + if (((ooGkClientTimerCb*)pTimer->cbData)->timerType & OO_ARQ_TIMER) { - if(((ooGkClientTimerCb*)pTimer->cbData)->pAdmInfo == + if (((ooGkClientTimerCb*)pTimer->cbData)->pAdmInfo == pCallAdmInfo) { memFreePtr(&pGkClient->ctxt, pTimer->cbData); @@ -2029,7 +2029,7 @@ call->callState = OO_CALL_CLEAR; - switch(pAdmissionReject->rejectReason.t) + switch (pAdmissionReject->rejectReason.t) { case T_H225AdmissionRejectReason_calledPartyNotRegistered: call->callEndReason = OO_REASON_GK_NOCALLEDUSER; @@ -2092,7 +2092,7 @@ OOTRACEDBGA3("Building Info Request Resp for call (%s, %s)\n", call->callType, call->callToken); pRasMsg = (H225RasMessage*)memAlloc(pctxt, sizeof(H225RasMessage)); - if(!pRasMsg) + if (!pRasMsg) { OOTRACEERR3("Error:Memory - ooGkClientSendIRR - " "pRasMsg(%s, %s)\n", call->callType, call->callToken); @@ -2103,7 +2103,7 @@ pRasMsg->t = T_H225RasMessage_infoRequestResponse; pIRR = (H225InfoRequestResponse*) memAlloc(pctxt, sizeof(H225InfoRequestResponse)); - if(!pIRR) + if (!pIRR) { OOTRACEERR3("Error:Memory - ooGkClientSendIRR - " "pIRR(%s, %s)\n", call->callType, call->callToken); @@ -2120,7 +2120,7 @@ sizeof(H225TransportAddress_ipAddress)); pTransportAddress = (H225TransportAddress*) memAlloc(pctxt, sizeof(H225TransportAddress)); - if(!pIpAddressLocal || !pTransportAddress) + if (!pIpAddressLocal || !pTransportAddress) { OOTRACEERR1("Error:Failed to allocate memory for Call Signalling " "Addresses of IRR message\n"); @@ -2143,12 +2143,12 @@ /* Populate seq number */ pIRR->requestSeqNum = pGkClient->requestSeqNum++; - if(!pIRR->requestSeqNum) + if (!pIRR->requestSeqNum) pIRR->requestSeqNum = pGkClient->requestSeqNum++; pIpRasAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!pIpRasAddress) + if (!pIpRasAddress) { OOTRACEERR1("Error: Memory allocation for Ras Address of IRR message " "failed\n"); @@ -2166,7 +2166,7 @@ pIRR->rasAddress.t=T_H225TransportAddress_ipAddress; /* IPv4 address */ /* Pose as gateway or terminal as per config */ - if(gH323ep.isGateway) + if (gH323ep.isGateway) pIRR->endpointType.m.gatewayPresent = TRUE; else pIRR->endpointType.m.terminalPresent = TRUE; @@ -2179,7 +2179,7 @@ pIRR->endpointIdentifier.nchars = pGkClient->endpointId.nchars; pIRR->endpointIdentifier.data = (ASN116BITCHAR*)memAlloc(pctxt, sizeof(ASN116BITCHAR)*pGkClient->endpointId.nchars); - if(!pIRR->endpointIdentifier.data) + if (!pIRR->endpointIdentifier.data) { OOTRACEERR3("Error:Memory - ooGkClientSendIRR - " "endpointIdentifier.data(%s, %s)\n", call->callType, @@ -2195,17 +2195,17 @@ /* Populate call aliases */ - if(call->ourAliases) + if (call->ourAliases) srcAliases = call->ourAliases; else srcAliases = gH323ep.aliases; /* Populate Source Info */ - if(srcAliases) + if (srcAliases) { iRet = ooPopulateAliasList(&pGkClient->msgCtxt, srcAliases, &pIRR->endpointAlias); - if(OO_OK != iRet) + if (OO_OK != iRet) { OOTRACEERR1("Error:Failed to populate source aliases -ARQ message\n"); memReset(pctxt); @@ -2231,7 +2231,7 @@ sizeof(H225InfoRequestResponse_perCallInfo_element)); memset(perCallInfo, 0, sizeof(H225InfoRequestResponse_perCallInfo_element)); - if(!perCallInfo) + if (!perCallInfo) { OOTRACEERR3("Error:Memory - ooGkClientSendIRR - " "perCallInfo for (%s, %s)\n", call->callType, @@ -2249,7 +2249,7 @@ sizeof(H225TransportAddress_ipAddress)); pRemoteAddr = (H225TransportAddress_ipAddress*) memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!pLocalAddr || !pRemoteAddr) + if (!pLocalAddr || !pRemoteAddr) { OOTRACEERR1("Error:Failed to allocate memory for Call Signalling " "Addresses of IRR message\n"); @@ -2293,7 +2293,7 @@ /* Populate call type & call model */ perCallInfo->callType.t = T_H225CallType_pointToPoint; /* Add call model to message*/ - if(OO_TESTFLAG(call->flags, OO_M_GKROUTED)) + if (OO_TESTFLAG(call->flags, OO_M_GKROUTED)) perCallInfo->callModel.t = T_H225CallModel_gatekeeperRouted; else perCallInfo->callModel.t = T_H225CallModel_direct; @@ -2315,7 +2315,7 @@ (void*)perCallInfo); iRet = ooGkClientSendMsg(pGkClient, pRasMsg); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error:Failed to send IRR message\n"); memReset(pctxt); @@ -2356,7 +2356,7 @@ call->callType, call->callToken); pRasMsg = (H225RasMessage*)memAlloc(pctxt, sizeof(H225RasMessage)); - if(!pRasMsg) + if (!pRasMsg) { OOTRACEERR1("Error: Memory allocation for DRQ RAS message failed\n"); pGkClient->state = GkClientFailed; @@ -2367,7 +2367,7 @@ pRasMsg->t = T_H225RasMessage_disengageRequest; pDRQ = (H225DisengageRequest*) memAlloc(pctxt, sizeof(H225DisengageRequest)); - if(!pDRQ) + if (!pDRQ) { OOTRACEERR1("Error: Failed to allocate memory for DRQ message\n"); memReset(pctxt); @@ -2380,14 +2380,14 @@ pRasMsg->u.disengageRequest = pDRQ; pDRQ->requestSeqNum = pGkClient->requestSeqNum++; - if(!pDRQ->requestSeqNum ) + if (!pDRQ->requestSeqNum ) pDRQ->requestSeqNum = pGkClient->requestSeqNum++; pDRQ->endpointIdentifier.nchars = pGkClient->endpointId.nchars; pDRQ->endpointIdentifier.data = (ASN116BITCHAR*)memAlloc(pctxt, sizeof(ASN116BITCHAR)*pGkClient->endpointId.nchars); - if(!pDRQ->endpointIdentifier.data) + if (!pDRQ->endpointIdentifier.data) { OOTRACEERR1("Error: Failed to allocate memory for EndPoint Id in DRQ " "message.\n"); @@ -2408,7 +2408,7 @@ pDRQ->disengageReason.t = T_H225DisengageReason_normalDrop; pDRQ->m.answeredCallPresent = 1; - if(!strcmp(call->callType, "incoming")) + if (!strcmp(call->callType, "incoming")) pDRQ->answeredCall = 1; else pDRQ->answeredCall = 0; @@ -2420,7 +2420,7 @@ pDRQ->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars; pDRQ->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc (pctxt, pGkClient->gkId.nchars*sizeof(ASN116BITCHAR)); - if(!pDRQ->gatekeeperIdentifier.data) + if (!pDRQ->gatekeeperIdentifier.data) { OOTRACEERR1("Error:Failed to allocate memory for GKId in DRQ.\n"); memReset(pctxt); @@ -2436,7 +2436,7 @@ pDRQ->terminationCause.u.releaseCompleteCauseIE = (H225CallTerminationCause_releaseCompleteCauseIE*)memAlloc(pctxt, sizeof(H225CallTerminationCause_releaseCompleteCauseIE)); - if(!pDRQ->terminationCause.u.releaseCompleteCauseIE) + if (!pDRQ->terminationCause.u.releaseCompleteCauseIE) { OOTRACEERR1("Error: Failed to allocate memory for cause ie in DRQ.\n"); memReset(pctxt); @@ -2467,7 +2467,7 @@ pDRQ->m.usageInformationPresent = TRUE; iRet = ooGkClientSendMsg(pGkClient, pRasMsg); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR1("Error: Failed to send DRQ message\n"); pGkClient->state = GkClientFailed; @@ -2476,11 +2476,11 @@ /* Search call in admitted calls list */ - for(x=0 ; xcallsAdmittedList.count ; x++) + for (x=0 ; xcallsAdmittedList.count ; x++) { pNode = (DListNode*)dListFindByIndex(&pGkClient->callsAdmittedList, x); pCallAdmInfo = (RasCallAdmissionInfo*) pNode->data; - if(pCallAdmInfo->call->callReference == call->callReference) + if (pCallAdmInfo->call->callReference == call->callReference) { dListRemove( &pGkClient->callsAdmittedList, pNode); memFreePtr(&pGkClient->ctxt, pNode->data); @@ -2506,10 +2506,10 @@ ooGkClient *pGkClient = cbData->pGkClient; OOTRACEDBGA1("Gatekeeper client RRQ timer expired.\n"); - if(pGkClient->rrqRetries < OO_MAX_RRQ_RETRIES) + if (pGkClient->rrqRetries < OO_MAX_RRQ_RETRIES) { ret = ooGkClientSendRRQ(pGkClient, 0); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error:Failed to send RRQ message\n"); @@ -2535,10 +2535,10 @@ memFreePtr(&pGkClient->ctxt, cbData); - if(pGkClient->grqRetries < OO_MAX_GRQ_RETRIES) + if (pGkClient->grqRetries < OO_MAX_GRQ_RETRIES) { ret = ooGkClientSendGRQ(pGkClient); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error:Failed to send GRQ message\n"); pGkClient->state = GkClientFailed; @@ -2561,7 +2561,7 @@ OOTRACEDBGA1("Gatekeeper client additive registration timer expired\n"); memFreePtr(&pGkClient->ctxt, cbData); ret = ooGkClientSendRRQ(pGkClient, TRUE); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error:Failed to send Additive RRQ message\n"); pGkClient->state = GkClientFailed; @@ -2580,13 +2580,13 @@ OOTRACEDBGA1("Gatekeeper client ARQ timer expired.\n"); memFreePtr(&pGkClient->ctxt, cbData); - if(!pAdmInfo) + if (!pAdmInfo) return OO_OK; - if(pAdmInfo->retries < OO_MAX_ARQ_RETRIES) + if (pAdmInfo->retries < OO_MAX_ARQ_RETRIES) { ret = ooGkClientSendAdmissionRequest(pGkClient, pAdmInfo->call, TRUE); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error:Failed to send ARQ message\n"); return OO_FAILED; @@ -2611,11 +2611,11 @@ ast_mutex_lock(&pGkClient->Lock); - for(x=0; xcallsAdmittedList.count; x++) + for (x=0; xcallsAdmittedList.count; x++) { pNode = dListFindByIndex(&pGkClient->callsAdmittedList, x); pAdmInfo = (RasCallAdmissionInfo*)pNode->data; - if(pAdmInfo->call->callReference == call->callReference) + if (pAdmInfo->call->callReference == call->callReference) { dListRemove(&pGkClient->callsAdmittedList, pNode); memFreePtr(&pGkClient->ctxt, pAdmInfo); @@ -2625,12 +2625,12 @@ } - for(x=0; xtimerList.count; x++) + for (x=0; xtimerList.count; x++) { pNode = dListFindByIndex(&pGkClient->timerList, x); pTimer = (OOTimer*)pNode->data; cbData = (ooGkClientTimerCb*)pTimer->cbData; - if(cbData->timerType & OO_ARQ_TIMER && + if (cbData->timerType & OO_ARQ_TIMER && cbData->pAdmInfo->call->callReference == call->callReference) { memFreePtr(&pGkClient->ctxt, pTimer->cbData); @@ -2639,11 +2639,11 @@ } } - for(x=0; xcallsPendingList.count; x++) + for (x=0; xcallsPendingList.count; x++) { pNode = dListFindByIndex(&pGkClient->callsPendingList, x); pAdmInfo = (RasCallAdmissionInfo*)pNode->data; - if(pAdmInfo->call->callReference == call->callReference) + if (pAdmInfo->call->callReference == call->callReference) { dListRemove(&pGkClient->callsPendingList, pNode); memFreePtr(&pGkClient->ctxt, pAdmInfo); @@ -2665,17 +2665,17 @@ */ int ooGkClientHandleClientOrGkFailure(ooGkClient *pGkClient) { - if(pGkClient->state == GkClientFailed) + if (pGkClient->state == GkClientFailed) { OOTRACEERR1("Error: Internal Failure in GkClient. Closing " "GkClient\n"); ooGkClientDestroy(); return OO_FAILED; } - else if(pGkClient->state == GkClientGkErr) { + else if (pGkClient->state == GkClientGkErr) { OOTRACEERR1("Error: Gatekeeper error. Either Gk not responding or " "Gk sending invalid messages\n"); - if(pGkClient->gkMode == RasUseSpecificGatekeeper) + if (pGkClient->gkMode == RasUseSpecificGatekeeper) { OOTRACEERR1("Error: Gatekeeper error detected. Closing GkClient as " "Gk mode is UseSpecifcGatekeeper\n"); @@ -2714,12 +2714,12 @@ char value[MAXFILENAME]; OOBOOL bAdd = FALSE; - if(!pAddresses) + if (!pAddresses) { /* All aliases registered/unregistsred */ pAlias = gH323ep.aliases; - while(pAlias) + while (pAlias) { pAlias->registered = registered?TRUE:FALSE; pAlias = pAlias->next; @@ -2728,13 +2728,13 @@ } /* Mark aliases as registered/unregistered*/ - if(pAddresses->count<=0) + if (pAddresses->count<=0) return OO_FAILED; - for(i=0; i<(int)pAddresses->count; i++) + for (i=0; i<(int)pAddresses->count; i++) { pNode = dListFindByIndex (pAddresses, i); - if(!pNode) + if (!pNode) { OOTRACEERR1("Error:Invalid alias list passed to " "ooGkClientUpdateRegisteredAliases\n"); @@ -2742,19 +2742,19 @@ } pAliasAddress = (H225AliasAddress*)pNode->data; - if(!pAliasAddress){ + if (!pAliasAddress){ OOTRACEERR1("Error:Invalid alias list passed to " "ooGkClientUpdateRegisteredAliases\n"); continue; } - switch(pAliasAddress->t) + switch (pAliasAddress->t) { case T_H225AliasAddress_dialedDigits: pAlias = ooH323GetAliasFromList(gH323ep.aliases, T_H225AliasAddress_dialedDigits, (char*)pAliasAddress->u.dialedDigits); - if(pAlias) + if (pAlias) { pAlias->registered = registered?TRUE:FALSE; } @@ -2763,9 +2763,9 @@ } break; case T_H225AliasAddress_h323_ID: - for(j=0, k=0; j<(int)pAliasAddress->u.h323_ID.nchars && (ku.h323_ID.nchars && (ku.h323_ID.data[j] < 256) + if (pAliasAddress->u.h323_ID.data[j] < 256) { value[k++] = (char) pAliasAddress->u.h323_ID.data[j]; } @@ -2774,7 +2774,7 @@ pAlias = ooH323GetAliasFromList(gH323ep.aliases, T_H225AliasAddress_h323_ID, value); - if(pAlias) + if (pAlias) { pAlias->registered = registered?TRUE:FALSE; } @@ -2786,7 +2786,7 @@ pAlias = ooH323GetAliasFromList(gH323ep.aliases, T_H225AliasAddress_url_ID, (char*)pAliasAddress->u.url_ID); - if(pAlias) + if (pAlias) { pAlias->registered = registered?TRUE:FALSE; } @@ -2796,7 +2796,7 @@ break; case T_H225AliasAddress_transportID: pTransportAddrss = pAliasAddress->u.transportID; - if(pTransportAddrss->t != T_H225TransportAddress_ipAddress) + if (pTransportAddrss->t != T_H225TransportAddress_ipAddress) { OOTRACEERR1("Error:Alias transportID not IP address\n"); break; @@ -2812,7 +2812,7 @@ pAlias = ooH323GetAliasFromList(gH323ep.aliases, T_H225AliasAddress_transportID, value); - if(pAlias) + if (pAlias) { pAlias->registered = registered?TRUE:FALSE; } @@ -2824,7 +2824,7 @@ pAlias = ooH323GetAliasFromList(gH323ep.aliases, T_H225AliasAddress_email_ID, (char*) pAliasAddress->u.email_ID); - if(pAlias) + if (pAlias) { pAlias->registered = registered?TRUE:FALSE; } @@ -2836,11 +2836,11 @@ OOTRACEERR1("Error:Unhandled alias type found in registered " "aliases\n"); } - if(bAdd) + if (bAdd) { pAlias = ooH323AddAliasToList(&gH323ep.aliases, &gH323ep.ctxt, pAliasAddress); - if(pAlias){ + if (pAlias){ pAlias->registered = registered?TRUE:FALSE; } else{ Index: addons/ooh323c/src/ooh245.c =================================================================== --- addons/ooh323c/src/ooh245.c (revision 228266) +++ addons/ooh323c/src/ooh245.c (working copy) @@ -42,7 +42,7 @@ *pph245msg = (H245Message*) memAlloc (pctxt, sizeof(H245Message)); - if(!(*pph245msg)) + if (!(*pph245msg)) { OOTRACEERR1("ERROR:Failed to allocate memory for h245 message\n"); return OO_FAILED; @@ -51,7 +51,7 @@ { (*pph245msg)->h245Msg.t = type; (*pph245msg)->logicalChannelNo = 0; - switch(type) + switch (type) { case T_H245MultimediaSystemControlMessage_request: (*pph245msg)->h245Msg.u.request = (H245RequestMessage*) @@ -59,7 +59,7 @@ /*Check for successful mem allocation, and if successful initialize mem to zero*/ - if(!(*pph245msg)->h245Msg.u.request) + if (!(*pph245msg)->h245Msg.u.request) { OOTRACEERR1("ERROR:Memory allocation for H.245 request" " message failed\n"); @@ -73,7 +73,7 @@ /*Check for successful mem allocation, and if successful initialize mem to zero*/ - if(!(*pph245msg)->h245Msg.u.response) + if (!(*pph245msg)->h245Msg.u.response) { OOTRACEERR1("ERROR:Memory allocation for H.245 response" " message failed\n"); @@ -87,7 +87,7 @@ /*Check for successful mem allocation, and if successful initialize mem to zero*/ - if(!(*pph245msg)->h245Msg.u.command) + if (!(*pph245msg)->h245Msg.u.command) { OOTRACEERR1("ERROR:Memory allocation for H.245 command" " message failed\n"); @@ -101,7 +101,7 @@ /*Check for successful mem allocation, and if successful initialize mem to zero*/ - if(!(*pph245msg)->h245Msg.u.indication) + if (!(*pph245msg)->h245Msg.u.indication) { OOTRACEERR1("ERROR:Memory allocation for H.245 indication" " message failed\n"); @@ -122,7 +122,7 @@ /* In case of tunneling, memory is freed when corresponding Q931 message is freed.*/ OOTRACEDBGC1("msgCtxt Reset?"); if (0 != pmsg) { - if(!OO_TESTFLAG (call->flags, OO_M_TUNNELING)){ + if (!OO_TESTFLAG (call->flags, OO_M_TUNNELING)){ /* memReset (&gH323ep.msgctxt); */ memReset (call->msgctxt); OOTRACEDBGC3(" Done (%s, %s)\n", call->callType, call->callToken); @@ -151,7 +151,7 @@ setEventHandler (&ctxt, &printHandler); ret = asn1PD_H245MultimediaSystemControlMessage(&ctxt, &mmMsg); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("Error decoding H245 message (%s, %s)\n", call->callType, call->callToken); @@ -173,7 +173,7 @@ OOCTXT *pctxt = call->msgctxt; multimediaMsg = &(ph245Msg->h245Msg); - if(!msgbuf || size<200) + if (!msgbuf || size<200) { OOTRACEERR3("Error: Invalid message buffer/size for " "ooEncodeH245Message. (%s, %s)\n", @@ -188,7 +188,7 @@ msgbuf[i++] = 0; msgbuf[i++] = 0; - if(!OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (!OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { /* Populate message buffer to be returned */ len = 4; @@ -218,7 +218,7 @@ len +=encodeLen; msgbuf[3] = (len>>8); msgbuf[4] = len; - if(!OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (!OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { msgbuf[7] = len>>8; msgbuf[8] = len; @@ -235,11 +235,11 @@ ASN1OCTET * encodebuf; - if(!call) + if (!call) return OO_FAILED; encodebuf = (ASN1OCTET*) memAlloc (call->pctxt, MAXMSGLEN); - if(!encodebuf) + if (!encodebuf) { OOTRACEERR3("Error:Failed to allocate memory for encoding H245 " "message(%s, %s)\n", call->callType, call->callToken); @@ -247,18 +247,18 @@ } iRet = ooEncodeH245Message(call, msg, (char*) encodebuf, MAXMSGLEN); - if(iRet != OO_OK) + if (iRet != OO_OK) { OOTRACEERR3("Error:Failed to encode H245 message. (%s, %s)\n", call->callType, call->callToken); memFreePtr (call->pctxt, encodebuf); return OO_FAILED; } - if(!call->pH245Channel) + if (!call->pH245Channel) { call->pH245Channel = (OOH323Channel*) memAllocZ (call->pctxt, sizeof(OOH323Channel)); - if(!call->pH245Channel) + if (!call->pH245Channel) { OOTRACEERR3("Error:Failed to allocate memory for H245Channel " "structure. (%s, %s)\n", call->callType, call->callToken); @@ -268,8 +268,8 @@ } /* We need to send EndSessionCommand immediately.*/ - if(!OO_TESTFLAG(call->flags, OO_M_TUNNELING)){ - if(encodebuf[0]== OOEndSessionCommand) /* High priority message */ + if (!OO_TESTFLAG(call->flags, OO_M_TUNNELING)){ + if (encodebuf[0]== OOEndSessionCommand) /* High priority message */ { dListFreeAll(call->pctxt, &call->pH245Channel->outQueue); dListAppend (call->pctxt, &call->pH245Channel->outQueue, encodebuf); @@ -296,12 +296,12 @@ iRet = ooSendAsTunneledMessage (call, encodebuf+5,len,msgType, logicalChannelNo); - if(iRet != OO_OK) + if (iRet != OO_OK) { memFreePtr (call->pctxt, encodebuf); OOTRACEERR3("ERROR:Failed to tunnel H.245 message (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -333,7 +333,7 @@ H245VideoCapability *videoCap=NULL; int i=0,k=0; - if(call->localTermCapState == OO_LocalTermCapSetSent) + if (call->localTermCapState == OO_LocalTermCapSetSent) { OOTRACEINFO3("TerminalCapabilitySet exchange procedure already in " "progress. (%s, %s)\n", call->callType, call->callToken); @@ -343,7 +343,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_request); - if(ret == OO_FAILED) + if (ret == OO_FAILED) { OOTRACEERR3("Error:Failed to create H245 message for Terminal " "CapabilitySet (%s, %s)\n", call->callType,call->callToken); @@ -356,7 +356,7 @@ pctxt = call->msgctxt; ph245msg->msgType = OOTerminalCapabilitySet; memset(request, 0, sizeof(H245RequestMessage)); - if(request == NULL) + if (request == NULL) { OOTRACEERR3("ERROR: No memory allocated for request message (%s, %s)\n", call->callType, call->callToken); @@ -381,7 +381,7 @@ memAlloc(pctxt, sizeof(H245AlternativeCapabilitySet)); altSetDtmf = (H245AlternativeCapabilitySet*) memAlloc(pctxt, sizeof(H245AlternativeCapabilitySet)); - if(!altSetAudio || !altSetVideo || !altSetDtmf) + if (!altSetAudio || !altSetVideo || !altSetDtmf) { OOTRACEERR3("Error:Memory - ooSendTermCapMsg - altSet." "(%s, %s)\n", call->callType, call->callToken); @@ -395,39 +395,39 @@ /* Add audio Capabilities */ dListInit(&(termCap->capabilityTable)); - for(k=0; k<(int)call->capPrefs.index; k++) + for (k=0; k<(int)call->capPrefs.index; k++) { - if(call->ourCaps) + if (call->ourCaps) epCap = call->ourCaps; else epCap = gH323ep.myCaps; - while(epCap) { - if(epCap->cap == call->capPrefs.order[k]) + while (epCap) { + if (epCap->cap == call->capPrefs.order[k]) break; epCap = epCap->next; } - if(!epCap) + if (!epCap) { OOTRACEWARN4("WARN:Preferred capability %d not supported.(%s, %s)\n", call->capPrefs.order[k],call->callType, call->callToken); continue; } - if(epCap->capType == OO_CAP_TYPE_AUDIO) + if (epCap->capType == OO_CAP_TYPE_AUDIO) { /* Create audio capability. If capability supports receive, we only add it as receive capability in TCS. However, if it supports only transmit, we add it as transmit capability in TCS. */ - if((epCap->dir & OORX)) + if ((epCap->dir & OORX)) { OOTRACEDBGC4("Sending receive capability %s in TCS.(%s, %s)\n", ooGetCapTypeText(epCap->cap), call->callType, call->callToken); audioCap = ooCapabilityCreateAudioCapability(epCap, pctxt, OORX); - if(!audioCap) + if (!audioCap) { OOTRACEWARN4("WARN:Failed to create audio capability %s " "(%s, %s)\n", ooGetCapTypeText(epCap->cap), @@ -435,12 +435,12 @@ continue; } } - else if(epCap->dir & OOTX) + else if (epCap->dir & OOTX) { OOTRACEDBGC4("Sending transmit capability %s in TCS.(%s, %s)\n", ooGetCapTypeText(epCap->cap), call->callType, call->callToken); audioCap = ooCapabilityCreateAudioCapability(epCap, pctxt, OOTX); - if(!audioCap) + if (!audioCap) { OOTRACEWARN4("WARN:Failed to create audio capability %s " "(%s, %s)\n", ooGetCapTypeText(epCap->cap), @@ -457,7 +457,7 @@ /* Add Capabilities to Capability Table */ entry = (H245CapabilityTableEntry*) memAlloc(pctxt, sizeof(H245CapabilityTableEntry)); - if(!entry) + if (!entry) { OOTRACEERR3("Error:Memory - ooSendTermCapMsg - entry(audio Cap)." "(%s, %s)\n", call->callType, call->callToken); @@ -465,7 +465,7 @@ } memset(entry, 0, sizeof(H245CapabilityTableEntry)); entry->m.capabilityPresent = 1; - if((epCap->dir & OORX)) + if ((epCap->dir & OORX)) { entry->capability.t = T_H245Capability_receiveAudioCapability; entry->capability.u.receiveAudioCapability = audioCap; @@ -480,21 +480,21 @@ altSetAudio->n++; i++; } - else if(epCap->capType == OO_CAP_TYPE_DATA) + else if (epCap->capType == OO_CAP_TYPE_DATA) { /* Create t.38 capability. If capability supports receive, we only add it as receive capability in TCS. However, if it supports only transmit, we add it as transmit capability in TCS. */ - if((epCap->dir & OORX) && !(epCap->dir & OOTX)) + if ((epCap->dir & OORX) && !(epCap->dir & OOTX)) { OOTRACEDBGC3("Sending receive capability t38 in TCS.(%s, %s)\n", call->callType, call->callToken); t38Cap = ooCapabilityCreateT38Capability(epCap, pctxt, OORX); - if(!t38Cap) + if (!t38Cap) { OOTRACEWARN3("WARN:Failed to create t38 capability for" "%s, %s\n", @@ -502,12 +502,12 @@ continue; } } - else if((epCap->dir & OOTX) && !(epCap->dir & OORX)) + else if ((epCap->dir & OOTX) && !(epCap->dir & OORX)) { OOTRACEDBGC3("Sending transmit capability t38 in TCS.(%s, %s)\n", call->callType, call->callToken); t38Cap = ooCapabilityCreateT38Capability(epCap, pctxt, OOTX); - if(!t38Cap) + if (!t38Cap) { OOTRACEWARN3("WARN:Failed to create capability t38 " "(%s, %s)\n", @@ -519,7 +519,7 @@ OOTRACEDBGC3("Sending transmit&recevie capability t38 in TCS.(%s, %s)\n", call->callType, call->callToken); t38Cap = ooCapabilityCreateT38Capability(epCap, pctxt, OOTX&OORX); - if(!t38Cap) + if (!t38Cap) { OOTRACEWARN3("WARN:Failed to create capability t38 " "(%s, %s)\n", @@ -530,7 +530,7 @@ /* Add Capabilities to Capability Table */ entry = (H245CapabilityTableEntry*) memAlloc(pctxt, sizeof(H245CapabilityTableEntry)); - if(!entry) + if (!entry) { OOTRACEERR3("Error:Memory - ooSendTermCapMsg - entry(audio Cap)." "(%s, %s)\n", call->callType, call->callToken); @@ -538,10 +538,10 @@ } memset(entry, 0, sizeof(H245CapabilityTableEntry)); entry->m.capabilityPresent = 1; - if((epCap->dir & OORX) && (epCap->dir & OOTX)) { + if ((epCap->dir & OORX) && (epCap->dir & OOTX)) { entry->capability.t = T_H245Capability_receiveAndTransmitDataApplicationCapability; entry->capability.u.receiveAndTransmitDataApplicationCapability = t38Cap; - } else if((epCap->dir & OORX)) { + } else if ((epCap->dir & OORX)) { entry->capability.t = T_H245Capability_receiveDataApplicationCapability; entry->capability.u.receiveDataApplicationCapability = t38Cap; }else{ @@ -554,14 +554,14 @@ altSetAudio->n++; i++; } - else if(epCap->capType == OO_CAP_TYPE_VIDEO) + else if (epCap->capType == OO_CAP_TYPE_VIDEO) { - if((epCap->dir & OORX)) + if ((epCap->dir & OORX)) { OOTRACEDBGC4("Sending receive capability %s in TCS.(%s, %s)\n", ooGetCapTypeText(epCap->cap), call->callType, call->callToken); videoCap = ooCapabilityCreateVideoCapability(epCap, pctxt, OORX); - if(!videoCap) + if (!videoCap) { OOTRACEWARN4("WARN:Failed to create Video capability %s " "(%s, %s)\n", ooGetCapTypeText(epCap->cap), @@ -569,12 +569,12 @@ continue; } } - else if(epCap->dir & OOTX) + else if (epCap->dir & OOTX) { OOTRACEDBGC4("Sending transmit capability %s in TCS.(%s, %s)\n", ooGetCapTypeText(epCap->cap), call->callType, call->callToken); videoCap = ooCapabilityCreateVideoCapability(epCap, pctxt, OOTX); - if(!videoCap) + if (!videoCap) { OOTRACEWARN4("WARN:Failed to create video capability %s " "(%s, %s)\n", ooGetCapTypeText(epCap->cap), @@ -591,7 +591,7 @@ /* Add Video capabilities to Capability Table */ entry = (H245CapabilityTableEntry*) memAlloc(pctxt, sizeof(H245CapabilityTableEntry)); - if(!entry) + if (!entry) { OOTRACEERR3("Error:Memory - ooSendTermCapMsg - entry(video Cap)." "(%s, %s)\n", call->callType, call->callToken); @@ -599,7 +599,7 @@ } memset(entry, 0, sizeof(H245CapabilityTableEntry)); entry->m.capabilityPresent = 1; - if((epCap->dir & OORX)) + if ((epCap->dir & OORX)) { entry->capability.t = T_H245Capability_receiveVideoCapability; entry->capability.u.receiveVideoCapability = videoCap; @@ -616,11 +616,11 @@ } } /* Add dtmf capability, if any */ - if(call->dtmfmode & OO_CAP_DTMF_RFC2833) + if (call->dtmfmode & OO_CAP_DTMF_RFC2833) { ateCap = (H245AudioTelephonyEventCapability*) ooCapabilityCreateDTMFCapability(OO_CAP_DTMF_RFC2833, call->dtmfcodec, pctxt); - if(!ateCap) + if (!ateCap) { OOTRACEWARN3("WARN:Failed to add RFC2833 cap to TCS(%s, %s)\n", call->callType, call->callToken); @@ -628,7 +628,7 @@ else { entry = (H245CapabilityTableEntry*) memAlloc(pctxt, sizeof(H245CapabilityTableEntry)); - if(!entry) + if (!entry) { OOTRACEERR3("Error:Failed to allocate memory for new capability " "table entry. (%s, %s)\n", call->callType, @@ -652,11 +652,11 @@ } } - if(call->dtmfmode & OO_CAP_DTMF_CISCO) + if (call->dtmfmode & OO_CAP_DTMF_CISCO) { rtdCap = (H245DataApplicationCapability*) ooCapabilityCreateDTMFCapability(OO_CAP_DTMF_CISCO, call->dtmfcodec, pctxt); - if(!rtdCap) + if (!rtdCap) { OOTRACEWARN3("WARN:Failed to add RTP/CISCO DTMF cap to TCS(%s, %s)\n", call->callType, call->callToken); @@ -664,7 +664,7 @@ else { entry = (H245CapabilityTableEntry*) memAlloc(pctxt, sizeof(H245CapabilityTableEntry)); - if(!entry) + if (!entry) { OOTRACEERR3("Error:Failed to allocate memory for new capability " "table entry. (%s, %s)\n", call->callType, @@ -688,11 +688,11 @@ } } - if(call->dtmfmode & OO_CAP_DTMF_H245_alphanumeric) + if (call->dtmfmode & OO_CAP_DTMF_H245_alphanumeric) { userInputCap = (H245UserInputCapability*)ooCapabilityCreateDTMFCapability (OO_CAP_DTMF_H245_alphanumeric, 0, pctxt); - if(!userInputCap) + if (!userInputCap) { OOTRACEWARN3("WARN:Failed to add H245(alphanumeric) cap to " "TCS(%s, %s)\n", call->callType, call->callToken); @@ -700,7 +700,7 @@ else { entry = (H245CapabilityTableEntry*) memAlloc(pctxt, sizeof(H245CapabilityTableEntry)); - if(!entry) + if (!entry) { OOTRACEERR3("Error:Failed to allocate memory for new capability " "table entry. (%s, %s)\n", call->callType, @@ -724,11 +724,11 @@ } } userInputCap = NULL; - if(call->dtmfmode & OO_CAP_DTMF_H245_signal) + if (call->dtmfmode & OO_CAP_DTMF_H245_signal) { userInputCap = (H245UserInputCapability*)ooCapabilityCreateDTMFCapability (OO_CAP_DTMF_H245_signal, 0, pctxt); - if(!userInputCap) + if (!userInputCap) { OOTRACEWARN3("WARN:Failed to add H245(signal) cap to " "TCS(%s, %s)\n", call->callType, call->callToken); @@ -736,7 +736,7 @@ else { entry = (H245CapabilityTableEntry*) memAlloc(pctxt, sizeof(H245CapabilityTableEntry)); - if(!entry) + if (!entry) { OOTRACEERR3("Error:Failed to allocate memory for new capability " "table entry. (%s, %s)\n", call->callType, @@ -762,7 +762,7 @@ /*TODO:Add Video and Data capabilities, if required*/ - if(i==0) + if (i==0) { OOTRACEERR3("Error:No capabilities found to send in TCS message." " (%s, %s)\n", call->callType, call->callToken); @@ -782,7 +782,7 @@ alternate capabilities set. Need a way for application developer to specify the alternative capability sets. */ - /* for(j=0; jcallType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue TCS message to outbound queue. " "(%s, %s)\n", call->callType, call->callToken); @@ -847,7 +847,7 @@ H245MasterSlaveDeterminationAck *masterSlaveAck; ASN1UINT statusDeterminationNumber, moduloDiff; - switch(msgType) + switch (msgType) { case OOMasterSlaveDetermination: OOTRACEINFO3("Master Slave Determination received (%s, %s)\n", @@ -855,7 +855,7 @@ masterSlave = (H245MasterSlaveDetermination*)pmsg; - if(call->masterSlaveState != OO_MasterSlave_DetermineSent && + if (call->masterSlaveState != OO_MasterSlave_DetermineSent && OO_TESTFLAG(gH323ep.flags, OO_M_TRYBEMASTER)) { ooSendMasterSlaveDeterminationAck(call, "slave"); @@ -864,7 +864,7 @@ call->callType, call->callToken); return OO_OK; } - if(masterSlave->terminalType < gH323ep.termType) + if (masterSlave->terminalType < gH323ep.termType) { ooSendMasterSlaveDeterminationAck(call, "slave"); call->masterSlaveState = OO_MasterSlave_Master; @@ -872,7 +872,7 @@ call->callType, call->callToken); return OO_OK; } - if(masterSlave->terminalType > gH323ep.termType) + if (masterSlave->terminalType > gH323ep.termType) { ooSendMasterSlaveDeterminationAck(call, "master"); call->masterSlaveState = OO_MasterSlave_Slave; @@ -886,7 +886,7 @@ OOTRACEDBGA3("Determining master-slave based on StatusDetermination" "Number (%s, %s)\n", call->callType, call->callToken); - if(call->masterSlaveState == OO_MasterSlave_DetermineSent) + if (call->masterSlaveState == OO_MasterSlave_DetermineSent) statusDeterminationNumber = call->statusDeterminationNumber; else if (OO_TESTFLAG(gH323ep.flags, OO_M_TRYBEMASTER)) @@ -897,7 +897,7 @@ moduloDiff = (masterSlave->statusDeterminationNumber - statusDeterminationNumber) &0xffffff; - /* if(masterSlave->statusDeterminationNumber > + /* if (masterSlave->statusDeterminationNumber > statusDeterminationNumber) */ if (moduloDiff < 0x800000 && moduloDiff != 0) { @@ -907,7 +907,7 @@ call->callType, call->callToken); return OO_OK; } - /* if(masterSlave->statusDeterminationNumber < + /* if (masterSlave->statusDeterminationNumber < statusDeterminationNumber) */ if (moduloDiff > 0x800000) { @@ -917,7 +917,7 @@ call->callType, call->callToken); return OO_OK; } - /* if(masterSlave->statusDeterminationNumber == + /* if (masterSlave->statusDeterminationNumber == statusDeterminationNumber) */ if (moduloDiff == 0 || moduloDiff == 0x800000) { @@ -930,9 +930,9 @@ case OOMasterSlaveAck: masterSlaveAck = (H245MasterSlaveDeterminationAck*)pmsg; - if(call->masterSlaveState == OO_MasterSlave_DetermineSent) + if (call->masterSlaveState == OO_MasterSlave_DetermineSent) { - if(masterSlaveAck->decision.t == + if (masterSlaveAck->decision.t == T_H245MasterSlaveDeterminationAck_decision_master) { ooSendMasterSlaveDeterminationAck(call, "slave"); @@ -951,19 +951,19 @@ call->msAckStatus = OO_msAck_remoteReceived; - if(call->localTermCapState == OO_LocalTermCapSetAckRecvd && + if (call->localTermCapState == OO_LocalTermCapSetAckRecvd && call->remoteTermCapState == OO_RemoteTermCapSetAckSent) { /*Since Cap exchange and MasterSlave Procedures are done */ - if(gH323ep.h323Callbacks.openLogicalChannels) + if (gH323ep.h323Callbacks.openLogicalChannels) gH323ep.h323Callbacks.openLogicalChannels(call); else{ - if(!ooGetTransmitLogicalChannel(call)) + if (!ooGetTransmitLogicalChannel(call)) ooOpenLogicalChannels(call); } #if 0 - if(!call->logicalChans){ - if(!gH323ep.h323Callbacks.openLogicalChannels) + if (!call->logicalChans){ + if (!gH323ep.h323Callbacks.openLogicalChannels) ooOpenLogicalChannels(call); else gH323ep.h323Callbacks.openLogicalChannels(call); @@ -991,7 +991,7 @@ H245MasterSlaveDetermination* pMasterSlave; /* Check whether Master Slave Determination already in progress */ - if(call->masterSlaveState != OO_MasterSlave_Idle) + if (call->masterSlaveState != OO_MasterSlave_Idle) { OOTRACEINFO3("MasterSlave determination already in progress (%s, %s)\n", call->callType, call->callToken); @@ -1000,7 +1000,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_request); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: creating H245 message - MasterSlave Determination " "(%s, %s)\n", call->callType, call->callToken); @@ -1024,7 +1024,7 @@ call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue MasterSlaveDetermination message to" " outbound queue. (%s, %s)\n", call->callType, @@ -1049,7 +1049,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_response); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:H245 message creation failed for - MasterSlave " "Determination Ack (%s, %s)\n",call->callType, @@ -1064,7 +1064,7 @@ ASN1MALLOC(pctxt, sizeof(H245MasterSlaveDeterminationAck)); memset(response->u.masterSlaveDeterminationAck, 0, sizeof(H245MasterSlaveDeterminationAck)); - if(!strcmp("master", status)) + if (!strcmp("master", status)) response->u.masterSlaveDeterminationAck->decision.t = T_H245MasterSlaveDeterminationAck_decision_master; else @@ -1074,7 +1074,7 @@ OOTRACEDBGA3("Built MasterSlave determination Ack (%s, %s)\n", call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue MasterSlaveDeterminationAck message" " to outbound queue. (%s, %s)\n", call->callType, @@ -1158,7 +1158,7 @@ (H245MasterSlaveDeterminationRelease*) memAlloc (pctxt, sizeof(H245MasterSlaveDeterminationRelease)); - if(!indication->u.masterSlaveDeterminationRelease) + if (!indication->u.masterSlaveDeterminationRelease) { OOTRACEERR3("Error: Failed to allocate memory for MSDRelease message." " (%s, %s)\n", call->callType, call->callToken); @@ -1184,7 +1184,7 @@ int ooHandleMasterSlaveReject (OOH323CallData *call, H245MasterSlaveDeterminationReject* reject) { - if(call->msdRetries < DEFAULT_MAX_RETRIES) + if (call->msdRetries < DEFAULT_MAX_RETRIES) { call->msdRetries++; OOTRACEDBGA3("Retrying MasterSlaveDetermination. (%s, %s)\n", @@ -1195,7 +1195,7 @@ } OOTRACEERR3("Error:Failed to complete MasterSlaveDetermination - " "Ending call. (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -1215,7 +1215,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_response); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:H245 message creation failed for - RequestMode " "Ack (%s, %s)\n",call->callType, @@ -1238,7 +1238,7 @@ OOTRACEDBGA3("Built RequestModeAck (%s, %s)\n", call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue RequestModeAck message" " to outbound queue. (%s, %s)\n", call->callType, @@ -1259,7 +1259,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_response); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:H245 message creation failed for - RequstMode " "Reject (%s, %s)\n",call->callType, @@ -1282,7 +1282,7 @@ OOTRACEDBGA3("Built RequestModeReject (%s, %s)\n", call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue RequestModeReject message" " to outbound queue. (%s, %s)\n", call->callType, @@ -1310,7 +1310,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_request); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:H245 message creation failed for - RequstMode " "(%s, %s)\n",call->callType, @@ -1364,7 +1364,7 @@ dListAppend(pctxt, &(request->u.requestMode->requestedModes), &pModeDesc); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue RequestMode message" " to outbound queue. (%s, %s)\n", call->callType, @@ -1394,7 +1394,7 @@ call->reqFlags = 0; /* don't handle duplicate ack packet */ ooCloseAllLogicalChannels(call, "transmit"); - if(gH323ep.h323Callbacks.onModeChanged) { + if (gH323ep.h323Callbacks.onModeChanged) { OOTRACEDBGA3("Handle RequestModeAck: (%s, %s), calling " "callback onModeChanged\n", call->callType, call->callToken); gH323ep.h323Callbacks.onModeChanged(call, t38mode); @@ -1425,7 +1425,7 @@ OO_CLRFLAG(call->flags, OO_M_AUDIOSESSION); OO_SETFLAG(call->flags, OO_M_DATASESSION); - if(gH323ep.h323Callbacks.onModeChanged) { + if (gH323ep.h323Callbacks.onModeChanged) { OOTRACEDBGA3("Handle RequestMode: (%s, %s), calling " "callback onModeChanged\n", call->callType, call->callToken); gH323ep.h323Callbacks.onModeChanged(call, 1); @@ -1441,7 +1441,7 @@ OO_CLRFLAG(call->flags, OO_M_DATASESSION); OO_SETFLAG(call->flags, OO_M_AUDIOSESSION); - if(gH323ep.h323Callbacks.onModeChanged) { + if (gH323ep.h323Callbacks.onModeChanged) { OOTRACEDBGA3("Handle RequestMode: (%s, %s), calling " "callback onModeChanged\n", call->callType, call->callToken); gH323ep.h323Callbacks.onModeChanged(call, 0); @@ -1463,14 +1463,14 @@ &(olc->forwardLogicalChannelParameters); #if 0 - if(!call->logicalChans) + if (!call->logicalChans) ooOpenLogicalChannels(call); #endif /* Check whether channel type is supported. Only supported channel type for now is g711ulaw audio channel. */ - switch(flcp->dataType.t) + switch (flcp->dataType.t) { case T_H245DataType_nonStandard: OOTRACEWARN3("Warn:Media channel data type " @@ -1567,7 +1567,7 @@ H245OpenLogicalChannel_forwardLogicalChannelParameters *flcp = &(olc->forwardLogicalChannelParameters); - if(!flcp || flcp->multiplexParameters.t != T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) + if (!flcp || flcp->multiplexParameters.t != T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) { OOTRACEERR3("Error:ooHandleOpenLogicalChannel_helper - invalid forward " "logical channel parameters. (%s, %s)\n", call->callType, @@ -1579,7 +1579,7 @@ h2250lcp = flcp->multiplexParameters.u.h2250LogicalChannelParameters; - if(!(epCap=ooIsDataTypeSupported(call, &flcp->dataType, OORX))) + if (!(epCap=ooIsDataTypeSupported(call, &flcp->dataType, OORX))) { OOTRACEERR3("ERROR:HandleOpenLogicalChannel_helper - capability not " "supported (%s, %s)\n", call->callType, call->callToken); @@ -1590,7 +1590,7 @@ /* Generate an Ack for the open channel request */ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_response); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: H245 message creation failed for - " "OpenLogicalChannel Ack (%s, %s)\n", call->callType, @@ -1627,7 +1627,7 @@ h2250lcap->m.mediaControlChannelPresent = 1; h2250lcap->m.sessionIDPresent = 1; - if(h2250lcp->sessionID == 0) + if (h2250lcp->sessionID == 0) h2250lcap->sessionID = ooCallGenerateSessionID(call, epCap->capType, "receive"); else h2250lcap->sessionID = h2250lcp->sessionID; @@ -1648,7 +1648,7 @@ pLogicalChannel = ooAddNewLogicalChannel(call, olc->forwardLogicalChannelNumber, h2250lcap->sessionID, "receive", epCap); - if(!pLogicalChannel) + if (!pLogicalChannel) { OOTRACEERR3("ERROR:Failed to add new logical channel entry to call " "(%s, %s)\n", call->callType, call->callToken); @@ -1681,7 +1681,7 @@ OOTRACEDBGA3("Built OpenLogicalChannelAck (%s, %s)\n", call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue OpenLogicalChannelAck message to " "outbound queue. (%s, %s)\n", call->callType, @@ -1690,7 +1690,7 @@ ooFreeH245Message(call, ph245msg); - if(epCap->startReceiveChannel) + if (epCap->startReceiveChannel) { epCap->startReceiveChannel(call, pLogicalChannel); OOTRACEINFO6("Receive channel of type %s started at %s:%d(%s, %s)\n", @@ -1734,7 +1734,7 @@ (H245OpenLogicalChannelReject*) memAlloc (pctxt, sizeof(H245OpenLogicalChannelReject)); - if(!response->u.openLogicalChannelReject) + if (!response->u.openLogicalChannelReject) { OOTRACEERR3("Error: Failed to allocate memory for OpenLogicalChannel" "Reject message. (%s, %s)\n", call->callType, @@ -1776,7 +1776,7 @@ H245UnicastAddress *unicastAddr1; H245UnicastAddress_iPAddress *iPAddress1 = NULL; - if(!((olcAck->m.forwardMultiplexAckParametersPresent == 1) && + if (!((olcAck->m.forwardMultiplexAckParametersPresent == 1) && (olcAck->forwardMultiplexAckParameters.t == T_H245OpenLogicalChannelAck_forwardMultiplexAckParameters_h2250LogicalChannelAckParameters))) { @@ -1789,13 +1789,13 @@ h2250lcap = olcAck->forwardMultiplexAckParameters.u.h2250LogicalChannelAckParameters; /* Extract media channel address */ - if(h2250lcap->m.mediaChannelPresent != 1) + if (h2250lcap->m.mediaChannelPresent != 1) { OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media channel " "absent (%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } - if(h2250lcap->mediaChannel.t != T_H245TransportAddress_unicastAddress) + if (h2250lcap->mediaChannel.t != T_H245TransportAddress_unicastAddress) { OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media channel " "address type is not unicast (%s, %s)\n", call->callType, @@ -1804,7 +1804,7 @@ } unicastAddr = h2250lcap->mediaChannel.u.unicastAddress; - if(unicastAddr->t != T_H245UnicastAddress_iPAddress) + if (unicastAddr->t != T_H245UnicastAddress_iPAddress) { OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media channel " "address type is not IP (%s, %s)\n", call->callType, @@ -1819,8 +1819,8 @@ iPAddress->network.data[3]); /* Extract media control channel address */ - if(h2250lcap->m.mediaControlChannelPresent == 1) { - if(h2250lcap->mediaControlChannel.t != + if (h2250lcap->m.mediaControlChannelPresent == 1) { + if (h2250lcap->mediaControlChannel.t != T_H245TransportAddress_unicastAddress) { OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media control " @@ -1830,7 +1830,7 @@ } unicastAddr1 = h2250lcap->mediaControlChannel.u.unicastAddress; - if(unicastAddr1->t != T_H245UnicastAddress_iPAddress) { + if (unicastAddr1->t != T_H245UnicastAddress_iPAddress) { OOTRACEERR3("Error: Processing OpenLogicalChannelAck - media control " "channel address type is not IP (%s, %s)\n", call->callType, call->callToken); @@ -1848,7 +1848,7 @@ /* Start channel here */ pLogicalChannel = ooFindLogicalChannelByLogicalChannelNo(call,olcAck->forwardLogicalChannelNumber); - if(!pLogicalChannel) + if (!pLogicalChannel) { OOTRACEERR4("ERROR:Logical channel %d not found in the channel list for " "call (%s, %s)\n", olcAck->forwardLogicalChannelNumber, @@ -1858,7 +1858,7 @@ /* Update session id if we were waiting for remote to assign one and remote did assign one. */ - if(pLogicalChannel->sessionID == 0 && h2250lcap->m.sessionIDPresent) + if (pLogicalChannel->sessionID == 0 && h2250lcap->m.sessionIDPresent) pLogicalChannel->sessionID = h2250lcap->sessionID; /* Populate ports &ip for channel */ @@ -1876,7 +1876,7 @@ if (iPAddress1) pLogicalChannel->remoteMediaControlPort = iPAddress1->tsapIdentifier; - if(pLogicalChannel->chanCap->startTransmitChannel) + if (pLogicalChannel->chanCap->startTransmitChannel) { pLogicalChannel->chanCap->startTransmitChannel(call, pLogicalChannel); OOTRACEINFO4("TransmitLogical Channel of type %s started (%s, %s)\n", @@ -1895,7 +1895,7 @@ int ooOnReceivedOpenLogicalChannelRejected(OOH323CallData *call, H245OpenLogicalChannelReject *olcReject) { - switch(olcReject->cause.t) + switch (olcReject->cause.t) { case T_H245OpenLogicalChannelReject_cause_unspecified: OOTRACEINFO4("Open logical channel %d rejected - unspecified (%s, %s)\n", @@ -1982,7 +1982,7 @@ olcReject->forwardLogicalChannelNumber, call->callType, call->callToken); } - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_LOCAL_CLEARED; @@ -2001,7 +2001,7 @@ H245Message *ph245msg=NULL; ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_command); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: H245 message creation failed for - End Session " "Command (%s, %s)\n", call->callType, call->callToken); @@ -2021,7 +2021,7 @@ OOTRACEDBGA3("Built EndSession Command (%s, %s)\n", call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue EndSession message to outbound " "queue.(%s, %s)\n", call->callType, call->callToken); @@ -2039,19 +2039,19 @@ OOTimer *pTimer = NULL; OOTRACEDBGC3("Handling H.245 command message. (%s, %s)\n", call->callType, call->callToken); - switch(command->t) + switch (command->t) { case T_H245CommandMessage_endSessionCommand: OOTRACEINFO3("Received EndSession command (%s, %s)\n", call->callType, call->callToken); - if(call->h245SessionState == OO_H245SESSION_ENDSENT) + if (call->h245SessionState == OO_H245SESSION_ENDSENT) { /* Disable Session timer */ - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if(((ooTimerCallback*)pTimer->cbData)->timerType & + if (((ooTimerCallback*)pTimer->cbData)->timerType & OO_SESSION_TIMER) { ASN1MEMFREEPTR(call->pctxt, pTimer->cbData); @@ -2067,10 +2067,10 @@ call->h245SessionState = OO_H245SESSION_ENDRECVD; #if 0 - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) call->callState = OO_CALL_CLEAR; #else - if(call->logicalChans) + if (call->logicalChans) { OOTRACEINFO3("In response to received EndSessionCommand - " "Clearing all logical channels. (%s, %s)\n", @@ -2105,22 +2105,22 @@ int ooOnReceivedTerminalCapabilitySetAck(OOH323CallData* call) { call->localTermCapState = OO_LocalTermCapSetAckRecvd; - if(call->remoteTermCapState != OO_RemoteTermCapSetAckSent) + if (call->remoteTermCapState != OO_RemoteTermCapSetAckSent) return OO_OK; - if((call->masterSlaveState == OO_MasterSlave_Master || + if ((call->masterSlaveState == OO_MasterSlave_Master || call->masterSlaveState == OO_MasterSlave_Slave) && (call->msAckStatus == OO_msAck_remoteReceived)) { - if(gH323ep.h323Callbacks.openLogicalChannels) + if (gH323ep.h323Callbacks.openLogicalChannels) gH323ep.h323Callbacks.openLogicalChannels(call); else{ - if(!ooGetTransmitLogicalChannel(call)) + if (!ooGetTransmitLogicalChannel(call)) ooOpenLogicalChannels(call); } #if 0 - if(!call->logicalChans){ - if(!gH323ep.h323Callbacks.openLogicalChannels) + if (!call->logicalChans){ + if (!gH323ep.h323Callbacks.openLogicalChannels) ooOpenLogicalChannels(call); else gH323ep.h323Callbacks.openLogicalChannels(call); @@ -2136,13 +2136,13 @@ ooLogicalChannel *temp; temp = call->logicalChans; - while(temp) + while (temp) { - if(temp->state == OO_LOGICALCHAN_ESTABLISHED && + if (temp->state == OO_LOGICALCHAN_ESTABLISHED && (dir == NULL || !strcmp(temp->dir,dir))) { /* Sending closelogicalchannel only for outgoing channels*/ - if(!strcmp(temp->dir, "transmit")) + if (!strcmp(temp->dir, "transmit")) { ooSendCloseLogicalChannel(call, temp); } @@ -2165,7 +2165,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_request); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Failed to create H245 message for closeLogicalChannel" " message (%s, %s)\n", call->callType, call->callToken); @@ -2180,7 +2180,7 @@ request->t = T_H245RequestMessage_closeLogicalChannel; request->u.closeLogicalChannel = (H245CloseLogicalChannel*)ASN1MALLOC(pctxt, sizeof(H245CloseLogicalChannel)); - if(!request->u.closeLogicalChannel) + if (!request->u.closeLogicalChannel) { OOTRACEERR3("ERROR:Memory allocation for CloseLogicalChannel failed " "(%s, %s)\n", call->callType, call->callToken); @@ -2198,7 +2198,7 @@ OOTRACEDBGA4("Built close logical channel for %d (%s, %s)\n", logicalChan->channelNo, call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue CloseLogicalChannel to outbound queue.(%s, %s)\n", call->callType, call->callToken); @@ -2211,13 +2211,13 @@ clc->forwardLogicalChannelNumber, call->callType, call->callToken); ret = ooClearLogicalChannel(call, clc->forwardLogicalChannelNumber); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR4("ERROR:Failed to close logical channel %d (%s, %s)\n", clc->forwardLogicalChannelNumber, call->callType, call->callToken); return OO_FAILED; } - if(error) return OO_FAILED; + if (error) return OO_FAILED; return ret; } @@ -2233,7 +2233,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_request); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Failed to create H245 message for " "requestCloseLogicalChannel message (%s, %s)\n", @@ -2249,7 +2249,7 @@ request->t = T_H245RequestMessage_requestChannelClose; request->u.requestChannelClose = (H245RequestChannelClose*)ASN1MALLOC(pctxt, sizeof(H245RequestChannelClose)); - if(!request->u.requestChannelClose) + if (!request->u.requestChannelClose) { OOTRACEERR3("ERROR:Memory allocation for RequestCloseLogicalChannel " " failed (%s, %s)\n", call->callType, call->callToken); @@ -2267,7 +2267,7 @@ OOTRACEDBGA4("Built RequestCloseChannel for %d (%s, %s)\n", logicalChan->channelNo, call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue the RequestCloseChannel to outbound" " queue (%s, %s)\n", call->callType, @@ -2287,7 +2287,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_indication); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Failed to create H245 message for " "RequestChannelCloseRelease message (%s, %s)\n", @@ -2302,7 +2302,7 @@ indication->t = T_H245IndicationMessage_requestChannelCloseRelease; indication->u.requestChannelCloseRelease = (H245RequestChannelCloseRelease*) ASN1MALLOC(pctxt, sizeof(H245RequestChannelCloseRelease)); - if(!indication->u.requestChannelCloseRelease) + if (!indication->u.requestChannelCloseRelease) { OOTRACEERR3("Error:Failed to allocate memory for " "RequestChannelCloseRelease message. (%s, %s)\n", @@ -2316,7 +2316,7 @@ OOTRACEDBGA4("Built RequestChannelCloseRelease for %d (%s, %s)\n", channelNum, call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue the RequestChannelCloseRelease to " "outbound queue (%s, %s)\n", call->callType, call->callToken); @@ -2341,7 +2341,7 @@ */ lChannel = ooFindLogicalChannelByLogicalChannelNo(call, rclc->forwardLogicalChannelNumber); - if(!lChannel) + if (!lChannel) { OOTRACEERR4("ERROR:Channel %d requested to be closed not found " "(%s, %s)\n", rclc->forwardLogicalChannelNumber, @@ -2349,7 +2349,7 @@ return OO_FAILED; } else{ - if(strcmp(lChannel->dir, "transmit")) + if (strcmp(lChannel->dir, "transmit")) { OOTRACEERR4("ERROR:Channel %d requested to be closed, Not a forward " "channel (%s, %s)\n", rclc->forwardLogicalChannelNumber, @@ -2359,7 +2359,7 @@ } ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_response); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Memory allocation for RequestChannelCloseAck message " "failed (%s, %s)\n", call->callType, call->callToken); @@ -2373,7 +2373,7 @@ response->t = T_H245ResponseMessage_requestChannelCloseAck; response->u.requestChannelCloseAck = (H245RequestChannelCloseAck*)ASN1MALLOC (pctxt, sizeof(H245RequestChannelCloseAck)); - if(!response->u.requestChannelCloseAck) + if (!response->u.requestChannelCloseAck) { OOTRACEERR3("ERROR:Failed to allocate memory for RequestChannelCloseAck " "message (%s, %s)\n", call->callType, call->callToken); @@ -2386,7 +2386,7 @@ OOTRACEDBGA3("Built RequestCloseChannelAck message (%s, %s)\n", call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue RequestCloseChannelAck to outbound queue. (%s, %s)\n", call->callType, call->callToken); @@ -2397,14 +2397,14 @@ /* Send Close Logical Channel*/ ret = ooSendCloseLogicalChannel(call, lChannel); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Failed to build CloseLgicalChannel message(%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } - if(error) return OO_FAILED; + if (error) return OO_FAILED; return ret; } @@ -2426,7 +2426,7 @@ int ret=OO_OK; /* Remote endpoint is ok to close channel. So let's do it */ ret = ooClearLogicalChannel(call, rccAck->forwardLogicalChannelNumber); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR4("Error:Failed to clear logical channel %d. (%s, %s)\n", rccAck->forwardLogicalChannelNumber, call->callType, @@ -2440,7 +2440,7 @@ (OOH323CallData *call, H245RequestChannelCloseReject *rccReject) { int ret =0; - switch(rccReject->cause.t) + switch (rccReject->cause.t) { case T_H245RequestChannelCloseReject_cause_unspecified: OOTRACEDBGA4("Remote endpoint has rejected request to close logical " @@ -2464,7 +2464,7 @@ rccReject->forwardLogicalChannelNumber, call->callType, call->callToken); ret = ooClearLogicalChannel(call, rccReject->forwardLogicalChannelNumber); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR4("Error: failed to clear logical channel %d.(%s, %s)\n", rccReject->forwardLogicalChannelNumber, call->callType, @@ -2487,7 +2487,7 @@ clc->forwardLogicalChannelNumber, call->callType, call->callToken); ret = ooClearLogicalChannel(call, clc->forwardLogicalChannelNumber); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR4("ERROR:Failed to close logical channel %d (%s, %s)\n", clc->forwardLogicalChannelNumber, call->callType, call->callToken); @@ -2496,7 +2496,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_response); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Failed to create H245 message for " "closeLogicalChannelAck (%s, %s)\n", call->callType, @@ -2512,7 +2512,7 @@ response->u.closeLogicalChannelAck = (H245CloseLogicalChannelAck*) ASN1MALLOC(pctxt, sizeof(H245CloseLogicalChannelAck)); clcAck = response->u.closeLogicalChannelAck; - if(!clcAck) + if (!clcAck) { OOTRACEERR3("ERROR:Failed to allocate memory for closeLogicalChannelAck " "(%s, %s)\n", call->callType, call->callToken); @@ -2524,7 +2524,7 @@ OOTRACEDBGA3("Built CloseLogicalChannelAck message (%s, %s)\n", call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue CloseLogicalChannelAck message to " "outbound queue.(%s, %s)\n", call->callType, call->callToken); @@ -2559,21 +2559,21 @@ OOTRACEDBGC3("Handling H245 message. (%s, %s)\n", call->callType, call->callToken); - switch(pH245->h245Msg.t) + switch (pH245->h245Msg.t) { /* H.245 Request message is received */ case (T_H245MultimediaSystemControlMessage_request): request = pH245->h245Msg.u.request; - switch(request->t) + switch (request->t) { case T_H245RequestMessage_terminalCapabilitySet: /* If session isn't marked active yet, do it. possible in case of tunneling */ - if(call->h245SessionState == OO_H245SESSION_IDLE) + if (call->h245SessionState == OO_H245SESSION_IDLE) call->h245SessionState = OO_H245SESSION_ACTIVE; ooOnReceivedTerminalCapabilitySet(call, pH245); - if(call->localTermCapState == OO_LocalTermCapExchange_Idle) + if (call->localTermCapState == OO_LocalTermCapExchange_Idle) ooSendTermCapMsg(call); break; case T_H245RequestMessage_masterSlaveDetermination: @@ -2584,7 +2584,7 @@ case T_H245RequestMessage_openLogicalChannel: ooHandleOpenLogicalChannel(call, request->u.openLogicalChannel); - if(!ooGetTransmitLogicalChannel(call)) + if (!ooGetTransmitLogicalChannel(call)) ooOpenLogicalChannels(call); break; case T_H245RequestMessage_requestMode: @@ -2616,15 +2616,15 @@ /* H.245 Response message is received */ case (T_H245MultimediaSystemControlMessage_response): response = pH245->h245Msg.u.response; - switch(response->t) + switch (response->t) { case T_H245ResponseMessage_masterSlaveDeterminationAck: /* Disable MSD timer */ - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if(((ooTimerCallback*)pTimer->cbData)->timerType & OO_MSD_TIMER) + if (((ooTimerCallback*)pTimer->cbData)->timerType & OO_MSD_TIMER) { ASN1MEMFREEPTR(call->pctxt, pTimer->cbData); ooTimerDelete(call->pctxt, &call->timerList, pTimer); @@ -2640,11 +2640,11 @@ break; case T_H245ResponseMessage_masterSlaveDeterminationReject: /* Disable MSD timer */ - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if(((ooTimerCallback*)pTimer->cbData)->timerType & OO_MSD_TIMER) + if (((ooTimerCallback*)pTimer->cbData)->timerType & OO_MSD_TIMER) { ASN1MEMFREEPTR(call->pctxt, pTimer->cbData); ooTimerDelete(call->pctxt, &call->timerList, pTimer); @@ -2658,11 +2658,11 @@ break; case T_H245ResponseMessage_terminalCapabilitySetAck: /* Disable TCS timer */ - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if(((ooTimerCallback*)pTimer->cbData)->timerType & OO_TCS_TIMER) + if (((ooTimerCallback*)pTimer->cbData)->timerType & OO_TCS_TIMER) { ASN1MEMFREEPTR(call->pctxt, pTimer->cbData); ooTimerDelete(call->pctxt, &call->timerList, pTimer); @@ -2676,7 +2676,7 @@ case T_H245ResponseMessage_terminalCapabilitySetReject: OOTRACEINFO3("TerminalCapabilitySetReject message received." " (%s, %s)\n", call->callType, call->callToken); - if(response->u.terminalCapabilitySetReject->sequenceNumber != + if (response->u.terminalCapabilitySetReject->sequenceNumber != call->localTermCapSeqNo) { OOTRACEINFO5("Ignoring TCSReject with mismatched seqno %d " @@ -2686,11 +2686,11 @@ break; } /* Disable TCS timer */ - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if(((ooTimerCallback*)pTimer->cbData)->timerType & OO_TCS_TIMER) + if (((ooTimerCallback*)pTimer->cbData)->timerType & OO_TCS_TIMER) { ASN1MEMFREEPTR(call->pctxt, pTimer->cbData); ooTimerDelete(call->pctxt, &call->timerList, pTimer); @@ -2699,7 +2699,7 @@ break; } } - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_NOCOMMON_CAPABILITIES; @@ -2714,18 +2714,18 @@ case T_H245ResponseMessage_requestModeReject: OOTRACEDBGC3("Received requestModeReject, clearing call (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_REMOTE_REJECTED; } break; case T_H245ResponseMessage_openLogicalChannelAck: - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if((((ooTimerCallback*)pTimer->cbData)->timerType & OO_OLC_TIMER) && + if ((((ooTimerCallback*)pTimer->cbData)->timerType & OO_OLC_TIMER) && ((ooTimerCallback*)pTimer->cbData)->channelNumber == response->u.openLogicalChannelAck->forwardLogicalChannelNumber) { @@ -2743,11 +2743,11 @@ case T_H245ResponseMessage_openLogicalChannelReject: OOTRACEINFO3("Open Logical Channel Reject received (%s, %s)\n", call->callType, call->callToken); - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if((((ooTimerCallback*)pTimer->cbData)->timerType & OO_OLC_TIMER) && + if ((((ooTimerCallback*)pTimer->cbData)->timerType & OO_OLC_TIMER) && ((ooTimerCallback*)pTimer->cbData)->channelNumber == response->u.openLogicalChannelAck->forwardLogicalChannelNumber) { @@ -2766,11 +2766,11 @@ OOTRACEINFO4("CloseLogicalChannelAck received for %d (%s, %s)\n", response->u.closeLogicalChannelAck->forwardLogicalChannelNumber, call->callType, call->callToken); - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if((((ooTimerCallback*)pTimer->cbData)->timerType & OO_CLC_TIMER) && + if ((((ooTimerCallback*)pTimer->cbData)->timerType & OO_CLC_TIMER) && ((ooTimerCallback*)pTimer->cbData)->channelNumber == response->u.closeLogicalChannelAck->forwardLogicalChannelNumber) { @@ -2784,18 +2784,18 @@ } ooOnReceivedCloseChannelAck(call, response->u.closeLogicalChannelAck); - if(!ooGetTransmitLogicalChannel(call)) + if (!ooGetTransmitLogicalChannel(call)) ooOpenLogicalChannels(call); break; case T_H245ResponseMessage_requestChannelCloseAck: OOTRACEINFO4("RequestChannelCloseAck received - %d (%s, %s)\n", response->u.requestChannelCloseAck->forwardLogicalChannelNumber, call->callType, call->callToken); - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if((((ooTimerCallback*)pTimer->cbData)->timerType & OO_RCC_TIMER) && + if ((((ooTimerCallback*)pTimer->cbData)->timerType & OO_RCC_TIMER) && ((ooTimerCallback*)pTimer->cbData)->channelNumber == response->u.requestChannelCloseAck->forwardLogicalChannelNumber) { @@ -2814,11 +2814,11 @@ OOTRACEINFO4("RequestChannelCloseReject received - %d (%s, %s)\n", response->u.requestChannelCloseReject->forwardLogicalChannelNumber, call->callType, call->callToken); - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if((((ooTimerCallback*)pTimer->cbData)->timerType & OO_RCC_TIMER) && + if ((((ooTimerCallback*)pTimer->cbData)->timerType & OO_RCC_TIMER) && ((ooTimerCallback*)pTimer->cbData)->channelNumber == response->u.requestChannelCloseReject->forwardLogicalChannelNumber) { @@ -2845,7 +2845,7 @@ /* H.245 Indication message received */ case (T_H245MultimediaSystemControlMessage_indication): indication = pH245->h245Msg.u.indication; - switch(indication->t) + switch (indication->t) { case T_H245IndicationMessage_userInput: ooOnReceivedUserInputIndication(call, indication->u.userInput); @@ -2867,18 +2867,18 @@ int ooOnReceivedUserInputIndication (OOH323CallData *call, H245UserInputIndication *indication) { - if((indication->t == T_H245UserInputIndication_alphanumeric) && + if ((indication->t == T_H245UserInputIndication_alphanumeric) && (call->dtmfmode & OO_CAP_DTMF_H245_alphanumeric)) { - if(gH323ep.h323Callbacks.onReceivedDTMF) + if (gH323ep.h323Callbacks.onReceivedDTMF) gH323ep.h323Callbacks.onReceivedDTMF(call,indication->u.alphanumeric); } - else if((indication->t == T_H245UserInputIndication_signal) && + else if ((indication->t == T_H245UserInputIndication_signal) && (call->dtmfmode & OO_CAP_DTMF_H245_signal)) { - if(call->lastDTMF && indication->u.signal->signalType[0] == call->lastDTMF && + if (call->lastDTMF && indication->u.signal->signalType[0] == call->lastDTMF && call->nextDTMFstamp && indication->u.signal->m.rtpPresent && indication->u.signal->rtp.m.timestampPresent) { - if(call->nextDTMFstamp > indication->u.signal->rtp.timestamp) { + if (call->nextDTMFstamp > indication->u.signal->rtp.timestamp) { OOTRACEERR4("ERROR:Duplicate dtmf %c on ((%s, %s)\n", call->lastDTMF, call->callType, call->callToken); return OO_OK; @@ -2893,7 +2893,7 @@ call->nextDTMFstamp = 0; call->lastDTMF = 0; } - if(gH323ep.h323Callbacks.onReceivedDTMF) + if (gH323ep.h323Callbacks.onReceivedDTMF) gH323ep.h323Callbacks.onReceivedDTMF(call, indication->u.signal->signalType); } @@ -2912,7 +2912,7 @@ H245CapabilityTableEntry *capEntry = NULL; tcs = pmsg->h245Msg.u.request->u.terminalCapabilitySet; - if(call->remoteTermCapSeqNo > tcs->sequenceNumber) + if (call->remoteTermCapSeqNo > tcs->sequenceNumber) { OOTRACEINFO4("Rejecting TermCapSet message with SeqNo %d, as already " "acknowledged message with this SeqNo (%s, %s)\n", @@ -2928,11 +2928,11 @@ we can accept new capability set only. We must remember also that new join caps will be previously joined caps with new cap set. */ - if(call->remoteTermCapSeqNo == tcs->sequenceNumber) + if (call->remoteTermCapSeqNo == tcs->sequenceNumber) call->localTermCapState = OO_LocalTermCapExchange_Idle; } - if(!tcs->m.capabilityTablePresent) + if (!tcs->m.capabilityTablePresent) { // OOTRACEWARN3("Warn:Ignoring TCS as no capability table present(%s, %s)\n", OOTRACEWARN3("Empty TCS found. Pausing call...(%s, %s)\n", @@ -2944,18 +2944,18 @@ } call->remoteTermCapSeqNo = tcs->sequenceNumber; - if(tcs->m.capabilityTablePresent) { - for(k=0; k<(int)tcs->capabilityTable.count; k++) + if (tcs->m.capabilityTablePresent) { + for (k=0; k<(int)tcs->capabilityTable.count; k++) { pNode = dListFindByIndex(&tcs->capabilityTable, k); - if(pNode) + if (pNode) { OOTRACEDBGC4("Processing CapabilityTable Entry %d (%s, %s)\n", k, call->callType, call->callToken); capEntry = (H245CapabilityTableEntry*) pNode->data; - if(capEntry->m.capabilityPresent){ + if (capEntry->m.capabilityPresent){ ret = ooAddRemoteCapability(call, &capEntry->capability); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR4("Error:Failed to process remote capability in " "capability table at index %d. (%s, %s)\n", @@ -2980,10 +2980,10 @@ ooH245AcknowledgeTerminalCapabilitySet(call); /* If we haven't yet send TCS then send it now */ - if(call->localTermCapState == OO_LocalTermCapExchange_Idle) + if (call->localTermCapState == OO_LocalTermCapExchange_Idle) { ret = ooSendTermCapMsg(call); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n", call->callType, call->callToken); @@ -2991,27 +2991,27 @@ } } - if(call->remoteTermCapState != OO_RemoteTermCapSetAckSent || + if (call->remoteTermCapState != OO_RemoteTermCapSetAckSent || call->localTermCapState != OO_LocalTermCapSetAckRecvd) return OO_OK; /* Check MasterSlave procedure has finished */ - if(call->masterSlaveState != OO_MasterSlave_Master && + if (call->masterSlaveState != OO_MasterSlave_Master && call->masterSlaveState != OO_MasterSlave_Slave) return OO_OK; /* As both MasterSlave and TerminalCapabilitySet procedures have finished, OpenLogicalChannels */ - if(gH323ep.h323Callbacks.openLogicalChannels) + if (gH323ep.h323Callbacks.openLogicalChannels) gH323ep.h323Callbacks.openLogicalChannels(call); else{ - if(!ooGetTransmitLogicalChannel(call)) + if (!ooGetTransmitLogicalChannel(call)) ooOpenLogicalChannels(call); } #if 0 - if(!call->logicalChans){ - if(!gH323ep.h323Callbacks.openLogicalChannels) + if (!call->logicalChans){ + if (!gH323ep.h323Callbacks.openLogicalChannels) ret = ooOpenLogicalChannels(call); else gH323ep.h323Callbacks.openLogicalChannels(call); @@ -3028,7 +3028,7 @@ OOCTXT *pctxt=NULL; int ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_response); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("ERROR:H245 message creation failed for - " "TerminalCapabilitySetReject\n"); @@ -3053,7 +3053,7 @@ call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue TCSReject to outbound queue. " "(%s, %s)\n", call->callType, call->callToken); @@ -3072,7 +3072,7 @@ OOCTXT *pctxt=NULL; int ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_response); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("ERROR:H245 message creation failed for - " "TerminalCapability Set Ack\n"); @@ -3096,7 +3096,7 @@ call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue TCSAck to outbound queue. (%s, %s)\n", call->callType, call->callToken); } @@ -3134,7 +3134,7 @@ (H245TerminalCapabilitySetRelease*) memAlloc (pctxt, sizeof(H245TerminalCapabilitySetRelease)); - if(!indication->u.terminalCapabilitySetRelease) + if (!indication->u.terminalCapabilitySetRelease) { OOTRACEERR3("Error: Failed to allocate memory for TCSRelease message." " (%s, %s)\n", call->callType, call->callToken); @@ -3184,7 +3184,7 @@ (H245UserInputIndication*) memAllocZ (pctxt, sizeof(H245UserInputIndication)); - if(!indication->u.userInput) + if (!indication->u.userInput) { OOTRACEERR3("Error: Memory - ooH245UserInputIndication_alphanumeric - " " userInput (%s, %s)\n", call->callType, call->callToken); @@ -3194,7 +3194,7 @@ indication->u.userInput->t = T_H245UserInputIndication_alphanumeric; indication->u.userInput->u.alphanumeric = (ASN1GeneralString) memAlloc(pctxt, strlen(data)+1); - if(!indication->u.userInput->u.alphanumeric) + if (!indication->u.userInput->u.alphanumeric) { OOTRACEERR3("Error: Memory - ooH245UserInputIndication-alphanumeric - " "alphanumeric (%s, %s).\n", call->callType, call->callToken); @@ -3244,7 +3244,7 @@ (H245UserInputIndication*) memAllocZ (pctxt, sizeof(H245UserInputIndication)); - if(!indication->u.userInput) + if (!indication->u.userInput) { OOTRACEERR3("Error: Memory - ooH245UserInputIndication_signal - " " userInput (%s, %s)\n", call->callType, call->callToken); @@ -3256,7 +3256,7 @@ memAllocZ(pctxt, sizeof(H245UserInputIndication_signal)); indication->u.userInput->u.signal->signalType = (ASN1IA5String) memAlloc(pctxt, strlen(data)+1); - if(!indication->u.userInput->u.signal || + if (!indication->u.userInput->u.signal || !indication->u.userInput->u.signal->signalType) { OOTRACEERR3("Error: Memory - ooH245UserInputIndication_signal - " @@ -3289,7 +3289,7 @@ call->callToken); /* Audio channels */ - if(gH323ep.callMode == OO_CALLMODE_AUDIOCALL || + if (gH323ep.callMode == OO_CALLMODE_AUDIOCALL || gH323ep.callMode == OO_CALLMODE_AUDIOTX) { if (OO_TESTFLAG (call->flags, OO_M_AUDIOSESSION)) { @@ -3297,7 +3297,7 @@ } else if (OO_TESTFLAG (call->flags, OO_M_DATASESSION)) { ret = ooOpenLogicalChannel(call, OO_CAP_TYPE_DATA); } - if(ret != OO_OK) { + if (ret != OO_OK) { OOTRACEERR3("ERROR:Failed to open audio/data channels. Clearing call." "(%s, %s)\n", call->callType, call->callToken); if (call->callState < OO_CALL_CLEAR) { @@ -3308,16 +3308,16 @@ } } - if(gH323ep.callMode == OO_CALLMODE_VIDEOCALL) + if (gH323ep.callMode == OO_CALLMODE_VIDEOCALL) { /* if (!OO_TESTFLAG (call->flags, OO_M_AUDIOSESSION)) {*/ ret = ooOpenLogicalChannel(call, OO_CAP_TYPE_AUDIO); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Failed to open audio channel. Clearing call." "(%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -3325,14 +3325,14 @@ return ret; } //} - /* if(!OO_TESTFLAG(call->flags, OO_M_VIDEOSESSION)) + /* if (!OO_TESTFLAG(call->flags, OO_M_VIDEOSESSION)) {*/ ret = ooOpenLogicalChannel(call, OO_CAP_TYPE_VIDEO); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Failed to open video channel. Clearing call." "(%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -3351,7 +3351,7 @@ int k=0; /* Check whether local endpoint has audio capability */ - if(gH323ep.myCaps == 0 && call->ourCaps == 0) + if (gH323ep.myCaps == 0 && call->ourCaps == 0) { OOTRACEERR3("ERROR:Local endpoint does not have any audio capabilities" " (%s, %s)\n", call->callType, call->callToken); @@ -3364,27 +3364,27 @@ OOTRACEINFO3("Looking for matching capabilities. (%s, %s)\n", call->callType, call->callToken); /* May */ - if(call->masterSlaveState == OO_MasterSlave_Master) + if (call->masterSlaveState == OO_MasterSlave_Master) { - for(k=0; kcapPrefs.index; k++) + for (k=0; kcapPrefs.index; k++) { /*Search for audio caps only */ - if(capType == OO_CAP_TYPE_AUDIO && + if (capType == OO_CAP_TYPE_AUDIO && call->capPrefs.order[k] > OO_CAP_VIDEO_BASE) continue; /* Search for video caps only */ - if(capType == OO_CAP_TYPE_VIDEO && + if (capType == OO_CAP_TYPE_VIDEO && call->capPrefs.order[k] <= OO_CAP_VIDEO_BASE) continue; epCap = call->jointCaps; - while(epCap){ - if(epCap->cap == call->capPrefs.order[k] && (epCap->dir & OOTX)) + while (epCap){ + if (epCap->cap == call->capPrefs.order[k] && (epCap->dir & OOTX)) break; epCap = epCap->next; } - if(!epCap) + if (!epCap) { OOTRACEDBGA4("Prefereed capability %d is not a local transmit " "capability(%s, %s)\n", call->capPrefs.order[k], @@ -3393,7 +3393,7 @@ } break; } - if(!epCap) + if (!epCap) { OOTRACEERR4("ERROR:Incompatible capabilities - Can not open " "%s channel (%s, %s)\n", @@ -3407,11 +3407,11 @@ { epCap = call->jointCaps; - while(epCap){ - if(epCap->capType == capType && epCap->dir & OOTX) { break; } + while (epCap){ + if (epCap->capType == capType && epCap->dir & OOTX) { break; } epCap = epCap->next; } - if(!epCap) + if (!epCap) { OOTRACEERR4("ERROR:Incompatible audio capabilities - Can not open " "%s channel (%s, %s)\n", @@ -3422,7 +3422,7 @@ } - switch(epCap->cap) + switch (epCap->cap) { case OO_G711ALAW64K: case OO_G711ALAW56K: @@ -3475,7 +3475,7 @@ ret = ooCreateH245Message(call, &ph245msg, T_H245MultimediaSystemControlMessage_request); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR4("Error: H245 message creation failed for - Open %s" "channel (%s, %s)\n", ooGetCapTypeText(epCap->cap), @@ -3486,7 +3486,7 @@ ph245msg->msgType = OOOpenLogicalChannel; ph245msg->logicalChannelNo = call->logicalChanNoCur++; - if(call->logicalChanNoCur > call->logicalChanNoMax) + if (call->logicalChanNoCur > call->logicalChanNoMax) call->logicalChanNoCur = call->logicalChanNoBase; request = ph245msg->h245Msg.u.request; @@ -3497,7 +3497,7 @@ request->t = T_H245RequestMessage_openLogicalChannel; request->u.openLogicalChannel = (H245OpenLogicalChannel*) memAlloc(pctxt, sizeof(H245OpenLogicalChannel)); - if(!request->u.openLogicalChannel) + if (!request->u.openLogicalChannel) { OOTRACEERR3("Error:Memory - ooOpenChannel - openLogicalChannel." "(%s, %s)\n", call->callType, call->callToken); @@ -3517,7 +3517,7 @@ request->u.openLogicalChannel->forwardLogicalChannelNumber, session_id, "transmit", epCap); - if(!pLogicalChannel) + if (!pLogicalChannel) { OOTRACEERR3("ERROR:Failed to add new logical channel entry (%s, %s)\n", call->callType, call->callToken); @@ -3531,12 +3531,12 @@ flcp->m.replacementForPresent = 0; /* data type of channel */ - if(epCap->capType == OO_CAP_TYPE_AUDIO) + if (epCap->capType == OO_CAP_TYPE_AUDIO) { flcp->dataType.t = T_H245DataType_audioData; /* set audio capability for channel */ audioCap = ooCapabilityCreateAudioCapability(epCap,pctxt, OOTX); - if(!audioCap) + if (!audioCap) { OOTRACEERR4("Error:Failed to create duplicate audio capability in " "ooOpenChannel- %s (%s, %s)\n", @@ -3548,11 +3548,11 @@ flcp->dataType.u.audioData = audioCap; } - else if(epCap->capType == OO_CAP_TYPE_VIDEO) + else if (epCap->capType == OO_CAP_TYPE_VIDEO) { flcp->dataType.t = T_H245DataType_videoData; videoCap = ooCapabilityCreateVideoCapability(epCap, pctxt, OOTX); - if(!videoCap) + if (!videoCap) { OOTRACEERR4("Error:Failed to create duplicate video capability in " "ooOpenChannel- %s (%s, %s)\n", @@ -3564,12 +3564,12 @@ flcp->dataType.u.videoData = videoCap; } - else if(epCap->capType == OO_CAP_TYPE_DATA) + else if (epCap->capType == OO_CAP_TYPE_DATA) { flcp->dataType.t = T_H245DataType_data; /* set audio capability for channel */ t38Cap = ooCapabilityCreateT38Capability(epCap,pctxt, OOTX); - if(!t38Cap) + if (!t38Cap) { OOTRACEERR4("Error:Failed to create duplicate T38 capability in " "ooOpenChannel- %s (%s, %s)\n", @@ -3624,7 +3624,7 @@ ooGetCapTypeText(epCap->cap), call->callType, call->callToken); ret = ooSendH245Msg(call, ph245msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue OpenLogicalChannel to outbound " "queue. (%s, %s)\n", call->callType, @@ -3655,10 +3655,10 @@ ooLogicalChannel *pLogicalChannel = NULL; int outgoing=FALSE; - if(!strcmp(call->callType, "outgoing")) + if (!strcmp(call->callType, "outgoing")) outgoing = TRUE; - if(dir & OORX) + if (dir & OORX) { OOTRACEDBGA3("Building OpenLogicalChannel for Receive Capability " "(%s, %s)\n", call->callType, call->callToken); @@ -3666,12 +3666,12 @@ pLogicalChannel = ooAddNewLogicalChannel(call, olc->forwardLogicalChannelNumber, session_id, "receive", epCap); - if(outgoing) + if (outgoing) reverse = TRUE; else forward = TRUE; } - else if(dir & OOTX) + else if (dir & OOTX) { OOTRACEDBGA3("Building OpenLogicalChannel for transmit Capability " "(%s, %s)\n", call->callType, call->callToken); @@ -3679,12 +3679,12 @@ pLogicalChannel = ooAddNewLogicalChannel(call, olc->forwardLogicalChannelNumber, session_id, "transmit", epCap); - if(outgoing) + if (outgoing) forward = TRUE; else reverse = TRUE; } - else if(dir & OORXTX) + else if (dir & OORXTX) { OOTRACEDBGA3("Building OpenLogicalChannel for ReceiveAndTransmit " "Capability (%s, %s)\n", call->callType, call->callToken); @@ -3695,7 +3695,7 @@ return OO_FAILED; } - if(forward) + if (forward) { OOTRACEDBGC3("Building forward olc. (%s, %s)\n", call->callType, call->callToken); @@ -3703,13 +3703,13 @@ memset(flcp, 0, sizeof(H245OpenLogicalChannel_forwardLogicalChannelParameters)); - if(epCap->capType == OO_CAP_TYPE_AUDIO) { + if (epCap->capType == OO_CAP_TYPE_AUDIO) { sessionID =1; flcp->dataType.t = T_H245DataType_audioData; flcp->dataType.u.audioData = ooCapabilityCreateAudioCapability(epCap, pctxt, dir); } - else if(epCap->capType == OO_CAP_TYPE_VIDEO) { + else if (epCap->capType == OO_CAP_TYPE_VIDEO) { sessionID = 2; flcp->dataType.t = T_H245DataType_videoData; flcp->dataType.u.videoData = ooCapabilityCreateVideoCapability(epCap, @@ -3724,7 +3724,7 @@ flcp->multiplexParameters.u.h2250LogicalChannelParameters = pH2250lcp1; pH2250lcp1->sessionID = sessionID; - if(!outgoing) + if (!outgoing) { pH2250lcp1->m.mediaChannelPresent = 1; pH2250lcp1->mediaChannel.t = @@ -3763,9 +3763,9 @@ pIpAddrs->network.numocts = 4; pIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort; - if(!outgoing) + if (!outgoing) { - if(epCap->startReceiveChannel) + if (epCap->startReceiveChannel) { epCap->startReceiveChannel(call, pLogicalChannel); OOTRACEINFO4("Receive channel of type %s started (%s, %s)\n", @@ -3782,7 +3782,7 @@ } } - if(reverse) + if (reverse) { OOTRACEDBGC3("Building reverse olc. (%s, %s)\n", call->callType, call->callToken); @@ -3793,14 +3793,14 @@ olc->m.reverseLogicalChannelParametersPresent = 1; rlcp = &(olc->reverseLogicalChannelParameters); memset(rlcp, 0, sizeof(H245OpenLogicalChannel_reverseLogicalChannelParameters)); - if(epCap->capType == OO_CAP_TYPE_AUDIO) { + if (epCap->capType == OO_CAP_TYPE_AUDIO) { sessionID = 1; rlcp->dataType.t = T_H245DataType_audioData; rlcp->dataType.u.audioData = ooCapabilityCreateAudioCapability(epCap, pctxt, dir); } - else if(epCap->capType == OO_CAP_TYPE_VIDEO) { + else if (epCap->capType == OO_CAP_TYPE_VIDEO) { sessionID = 2; rlcp->dataType.t = T_H245DataType_videoData; @@ -3815,7 +3815,7 @@ memset(pH2250lcp2, 0, sizeof(H245H2250LogicalChannelParameters)); pH2250lcp2->sessionID = sessionID; - if(outgoing) + if (outgoing) { pH2250lcp2->m.mediaChannelPresent = 1; @@ -3862,9 +3862,9 @@ receive all the media types proposed in the fast connect, before the actual call is established. */ - if(outgoing) + if (outgoing) { - if(epCap->startReceiveChannel) + if (epCap->startReceiveChannel) { epCap->startReceiveChannel(call, pLogicalChannel); OOTRACEINFO4("Receive channel of type %s started (%s, %s)\n", @@ -3884,7 +3884,7 @@ /* State of logical channel. for out going calls, as we are sending setup, state of all channels are proposed, for incoming calls, state is established. */ - if(!outgoing) { + if (!outgoing) { pLogicalChannel->state = OO_LOGICALCHAN_ESTABLISHED; } else { @@ -3906,7 +3906,7 @@ call->callToken); ASN1MEMFREEPTR(call->pctxt, cbData); ooSendMasterSlaveDeterminationRelease(call); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_LOCAL_CLEARED; @@ -3923,7 +3923,7 @@ call->callType, call->callToken); ASN1MEMFREEPTR(call->pctxt, cbData); ooSendTerminalCapabilitySetRelease(call); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_LOCAL_CLEARED; @@ -3941,10 +3941,10 @@ call->callToken); pChannel = ooFindLogicalChannelByLogicalChannelNo(call, cbData->channelNumber); - if(pChannel) + if (pChannel) ooSendCloseLogicalChannel(call, pChannel); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_LOCAL_CLEARED; @@ -3963,7 +3963,7 @@ ooClearLogicalChannel(call, cbData->channelNumber); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_LOCAL_CLEARED; @@ -3984,20 +3984,20 @@ pChannel = ooFindLogicalChannelByLogicalChannelNo(call, cbData->channelNumber); - if(pChannel) + if (pChannel) ooSendRequestChannelCloseRelease(call, cbData->channelNumber); else return OO_OK; ret = ooClearLogicalChannel(call, cbData->channelNumber); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR4("Error:Failed to clear logical channel %d. (%s, %s)\n", cbData->channelNumber, call->callType, call->callToken); } - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_LOCAL_CLEARED; @@ -4015,13 +4015,13 @@ OOTRACEINFO3("SessionTimer expired. (%s, %s)\n", call->callType, call->callToken); - if(call->h245SessionState != OO_H245SESSION_IDLE && + if (call->h245SessionState != OO_H245SESSION_IDLE && call->h245SessionState != OO_H245SESSION_CLOSED && call->h245SessionState != OO_H245SESSION_PAUSED) { ret = ooCloseH245Connection(call); - if(ret != OO_OK) { + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to close H.245 connection (%s, %s)\n", call->callType, call->callToken); } @@ -4029,7 +4029,7 @@ memFreePtr(call->pctxt, cbData); - if(call->callState == OO_CALL_CLEAR_RELEASESENT) + if (call->callState == OO_CALL_CLEAR_RELEASESENT) call->callState = OO_CALL_CLEARED; return OO_OK; @@ -4044,7 +4044,7 @@ H245UnicastAddress_iPAddress *ipAddress = NULL; regmatch_t pmatch[1]; - if(h245Address->t != T_H245TransportAddress_unicastAddress) + if (h245Address->t != T_H245TransportAddress_unicastAddress) { OOTRACEERR3("ERROR:Unsupported H245 address type " "(%s, %s)\n", call->callType, call->callToken); @@ -4052,7 +4052,7 @@ } unicastAddress = h245Address->u.unicastAddress; - if(unicastAddress->t != T_H245UnicastAddress_iPAddress) + if (unicastAddress->t != T_H245UnicastAddress_iPAddress) { OOTRACEERR3("ERROR:H245 Address type is not IP" "(%s, %s)\n", call->callType, call->callToken); @@ -4091,7 +4091,7 @@ unsigned session_id = 0; ooLogicalChannel *pLogicalChannel = NULL; - if(dir & OORX) + if (dir & OORX) { OOTRACEDBGA3("ooPrepareFastStartResponseOLC for Receive Capability " "(%s, %s)\n", call->callType, call->callToken); @@ -4101,7 +4101,7 @@ "receive", epCap); forward = TRUE; } - else if(dir & OOTX) + else if (dir & OOTX) { OOTRACEDBGA3("ooPrepareFastStartResponseOLC for transmit Capability " "(%s, %s)\n", call->callType, call->callToken); @@ -4111,7 +4111,7 @@ "transmit", epCap); reverse = TRUE; } - else if(dir & OORXTX) + else if (dir & OORXTX) { OOTRACEDBGA3("ooPrepareFastStartResponseOLC for ReceiveAndTransmit " "Capability (%s, %s)\n", call->callType, call->callToken); @@ -4122,7 +4122,7 @@ return OO_FAILED; } - if(forward) + if (forward) { OOTRACEDBGC3("Preparing olc for receive channel. (%s, %s)\n", call->callType, call->callToken); @@ -4137,7 +4137,7 @@ sizeof(H245UnicastAddress)); pUniIpAddrs = (H245UnicastAddress_iPAddress*) memAlloc(pctxt, sizeof(H245UnicastAddress_iPAddress)); - if(!pUniAddrs || !pUniIpAddrs) + if (!pUniAddrs || !pUniIpAddrs) { OOTRACEERR3("Error:Memory - ooPrepareFastStartResponseOLC - pUniAddrs" "/pUniIpAddrs (%s, %s)\n", call->callType, @@ -4162,7 +4162,7 @@ sizeof(H245UnicastAddress)); pIpAddrs = (H245UnicastAddress_iPAddress*) memAlloc(pctxt, sizeof(H245UnicastAddress_iPAddress)); - if(!pUnicastAddrs || !pIpAddrs) + if (!pUnicastAddrs || !pIpAddrs) { OOTRACEERR3("Error:Memory - ooPrepareFastStartResponseOLC - " "pUnicastAddrs/pIpAddrs (%s, %s)\n", call->callType, @@ -4182,7 +4182,7 @@ pIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort; } - if(reverse) + if (reverse) { OOTRACEDBGC3("Building reverse olc. (%s, %s)\n", call->callType, call->callToken); @@ -4200,7 +4200,7 @@ sizeof(H245UnicastAddress)); pUniIpAddrs = (H245UnicastAddress_iPAddress*) memAlloc(pctxt, sizeof(H245UnicastAddress_iPAddress)); - if(!pUniAddrs || !pUniIpAddrs) + if (!pUniAddrs || !pUniIpAddrs) { OOTRACEERR3("Error:Memory - ooPrepareFastStartResponseOLC - " "pUniAddrs/pUniIpAddrs (%s, %s)\n", call->callType, Index: addons/ooh323c/src/ooh323.c =================================================================== --- addons/ooh323c/src/ooh323.c (revision 228266) +++ addons/ooh323c/src/ooh323.c (working copy) @@ -48,9 +48,9 @@ int i=0, ret=0; /* Handle fast-start */ - if(OO_TESTFLAG (call->flags, OO_M_FASTSTART)) + if (OO_TESTFLAG (call->flags, OO_M_FASTSTART)) { - if(facility->m.fastStartPresent) + if (facility->m.fastStartPresent) { /* For printing the decoded message to log, initialize handler. */ initializePrintHandler(&printHandler, "FastStart Elements"); @@ -58,18 +58,18 @@ /* Set print handler */ setEventHandler (call->pctxt, &printHandler); - for(i=0; i<(int)facility->fastStart.n; i++) + for (i=0; i<(int)facility->fastStart.n; i++) { olc = NULL; olc = (H245OpenLogicalChannel*)memAlloc(call->pctxt, sizeof(H245OpenLogicalChannel)); - if(!olc) + if (!olc) { OOTRACEERR3("ERROR:Memory - ooHandleFastStart - olc" "(%s, %s)\n", call->callType, call->callToken); /*Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -82,12 +82,12 @@ setPERBuffer(call->pctxt, msgbuf, facility->fastStart.elem[i].numocts, 1); ret = asn1PD_H245OpenLogicalChannel(call->pctxt, olc); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("ERROR:Failed to decode fast start olc element " "(%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -98,7 +98,7 @@ dListAppend(call->pctxt, &call->remoteFastStartOLCs, olc); pChannel = ooFindLogicalChannelByOLC(call, olc); - if(!pChannel) + if (!pChannel) { OOTRACEERR4("ERROR: Logical Channel %d not found, fast start. " "(%s, %s)\n", @@ -106,7 +106,7 @@ call->callToken); return OO_FAILED; } - if(pChannel->channelNo != olc->forwardLogicalChannelNumber) + if (pChannel->channelNo != olc->forwardLogicalChannelNumber) { OOTRACEINFO5("Remote endpoint changed forwardLogicalChannel" "Number from %d to %d (%s, %s)\n", @@ -115,10 +115,10 @@ call->callToken); pChannel->channelNo = olc->forwardLogicalChannelNumber; } - if(!strcmp(pChannel->dir, "transmit")) + if (!strcmp(pChannel->dir, "transmit")) { - if(olc->forwardLogicalChannelParameters.multiplexParameters.t != + if (olc->forwardLogicalChannelParameters.multiplexParameters.t != T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) { OOTRACEERR4("ERROR:Unknown multiplex parameter type for " @@ -130,14 +130,14 @@ /* Extract the remote media endpoint address */ h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters; - if(!h2250lcp) + if (!h2250lcp) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "forward Logical Channel Parameters found. " "(%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } - if(!h2250lcp->m.mediaChannelPresent) + if (!h2250lcp->m.mediaChannelPresent) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "reverse media channel information found." @@ -148,9 +148,9 @@ &h2250lcp->mediaChannel, pChannel->remoteIP, &pChannel->remoteMediaPort); - if(ret != OO_OK) + if (ret != OO_OK) { - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -160,7 +160,7 @@ return OO_FAILED; } - if(!pChannel->chanCap->startTransmitChannel) + if (!pChannel->chanCap->startTransmitChannel) { OOTRACEERR3("ERROR:No callback registered to start transmit " "channel (%s, %s)\n",call->callType, @@ -181,7 +181,7 @@ } - if(facility->m.h245AddressPresent) + if (facility->m.h245AddressPresent) { if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { @@ -193,28 +193,28 @@ ret = ooH323GetIpPortFromH225TransportAddress(call, &facility->h245Address, call->remoteIP, &call->remoteH245Port); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: Unknown H245 address type in received " "CallProceeding message (%s, %s)", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; } return OO_FAILED; } - if(call->remoteH245Port != 0 && !call->pH245Channel) { + if (call->remoteH245Port != 0 && !call->pH245Channel) { /* Create an H.245 connection. */ - if(ooCreateH245Connection(call)== OO_FAILED) + if (ooCreateH245Connection(call)== OO_FAILED) { OOTRACEERR3("Error: H.245 channel creation failed (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -240,7 +240,7 @@ unsigned reasonCode=T_H225ReleaseCompleteReason_undefinedReason; enum Q931CauseValues cause= Q931ErrorInCauseIE; - if(q931Msg->causeIE) + if (q931Msg->causeIE) { cause = q931Msg->causeIE->data[1]; /* Get rid of the extension bit.For more info, check ooQ931SetCauseIE */ @@ -250,11 +250,11 @@ } /* Remove session timer, if active*/ - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if(((ooTimerCallback*)pTimer->cbData)->timerType & + if (((ooTimerCallback*)pTimer->cbData)->timerType & OO_SESSION_TIMER) { memFreePtr(call->pctxt, pTimer->cbData); @@ -266,7 +266,7 @@ } - if(!q931Msg->userInfo) + if (!q931Msg->userInfo) { OOTRACEERR3("ERROR:No User-User IE in received ReleaseComplete message " "(%s, %s)\n", call->callType, call->callToken); @@ -274,7 +274,7 @@ } releaseComplete = q931Msg->userInfo->h323_uu_pdu.h323_message_body.u.releaseComplete; - if(!releaseComplete) + if (!releaseComplete) { OOTRACEWARN3("WARN: ReleaseComplete UUIE not found in received " "ReleaseComplete message - %s " @@ -282,7 +282,7 @@ } else{ - if(releaseComplete->m.reasonPresent) + if (releaseComplete->m.reasonPresent) { OOTRACEINFO4("Release complete reason code %d. (%s, %s)\n", releaseComplete->reason.t, call->callType, call->callToken); @@ -290,7 +290,7 @@ } } - if(call->callEndReason == OO_REASON_UNKNOWN) + if (call->callEndReason == OO_REASON_UNKNOWN) call->callEndReason = ooGetCallClearReasonFromCauseAndReasonCode(cause, reasonCode); call->q931cause = cause; @@ -307,17 +307,17 @@ " (%s, %s)\n", call->callType, call->callToken); } #endif - if(call->h245SessionState != OO_H245SESSION_IDLE && + if (call->h245SessionState != OO_H245SESSION_IDLE && call->h245SessionState != OO_H245SESSION_CLOSED) { ooCloseH245Connection(call); } - if(call->callState != OO_CALL_CLEAR_RELEASESENT) + if (call->callState != OO_CALL_CLEAR_RELEASESENT) { - if(gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) + if (gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) { - if(gH323ep.gkClient->state == GkClientRegistered){ + if (gH323ep.gkClient->state == GkClientRegistered){ OOTRACEDBGA3("Sending DRQ after received ReleaseComplete." "(%s, %s)\n", call->callType, call->callToken); ooGkClientSendDisengageRequest(gH323ep.gkClient, call); @@ -341,14 +341,14 @@ call->callReference = q931Msg->callReference; - if(!q931Msg->userInfo) + if (!q931Msg->userInfo) { OOTRACEERR3("ERROR:No User-User IE in received SETUP message (%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } setup = q931Msg->userInfo->h323_uu_pdu.h323_message_body.u.setup; - if(!setup) + if (!setup) { OOTRACEERR3("Error: Setup UUIE not found in received setup message - %s " "%s\n", call->callType, call->callToken); @@ -364,29 +364,29 @@ /* check for display ie */ pDisplayIE = ooQ931GetIE(q931Msg, Q931DisplayIE); - if(pDisplayIE) + if (pDisplayIE) { call->remoteDisplayName = (char *) memAlloc(call->pctxt, pDisplayIE->length*sizeof(ASN1OCTET)+1); strcpy(call->remoteDisplayName, (char *)pDisplayIE->data); } /*Extract Remote Aliases, if present*/ - if(setup->m.sourceAddressPresent) + if (setup->m.sourceAddressPresent) { - if(setup->sourceAddress.count>0) + if (setup->sourceAddress.count>0) { ooH323RetrieveAliases(call, &setup->sourceAddress, &call->remoteAliases); pAlias = call->remoteAliases; - while(pAlias) + while (pAlias) { - if(pAlias->type == T_H225AliasAddress_dialedDigits) + if (pAlias->type == T_H225AliasAddress_dialedDigits) { - if(!call->callingPartyNumber) + if (!call->callingPartyNumber) { call->callingPartyNumber = (char*)memAlloc(call->pctxt, strlen(pAlias->value)*+1); - if(call->callingPartyNumber) + if (call->callingPartyNumber) { strcpy(call->callingPartyNumber, pAlias->value); } @@ -401,22 +401,22 @@ Populate calledPartyNumber from dialedDigits, if not yet populated using calledPartyNumber Q931 IE. */ - if(setup->m.destinationAddressPresent) + if (setup->m.destinationAddressPresent) { - if(setup->destinationAddress.count>0) + if (setup->destinationAddress.count>0) { ooH323RetrieveAliases(call, &setup->destinationAddress, &call->ourAliases); pAlias = call->ourAliases; - while(pAlias) + while (pAlias) { - if(pAlias->type == T_H225AliasAddress_dialedDigits) + if (pAlias->type == T_H225AliasAddress_dialedDigits) { - if(!call->calledPartyNumber) + if (!call->calledPartyNumber) { call->calledPartyNumber = (char*)memAlloc(call->pctxt, strlen(pAlias->value)*+1); - if(call->calledPartyNumber) + if (call->calledPartyNumber) { strcpy(call->calledPartyNumber, pAlias->value); } @@ -429,16 +429,16 @@ } /* Check for tunneling */ - if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent) + if (q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent) { /* Tunneling enabled only when tunneling is set to true and h245 address is absent. In the presence of H.245 address in received SETUP message, tunneling is disabled, irrespective of tunneling flag in the setup message*/ - if(q931Msg->userInfo->h323_uu_pdu.h245Tunneling && + if (q931Msg->userInfo->h323_uu_pdu.h245Tunneling && !setup->m.h245AddressPresent) { - if(OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING)) + if (OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING)) { OO_SETFLAG (call->flags, OO_M_TUNNELING); OOTRACEINFO3("Call has tunneling active (%s,%s)\n", call->callType, @@ -450,7 +450,7 @@ call->callType, call->callToken); } else { - if(OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING)) + if (OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING)) { OOTRACEINFO3("Tunneling disabled by remote endpoint. (%s, %s)\n", call->callType, call->callToken); @@ -459,7 +459,7 @@ } } else { - if(OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING)) + if (OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING)) { OOTRACEINFO3("Tunneling disabled by remote endpoint. (%s, %s)\n", call->callType, call->callToken); @@ -468,14 +468,14 @@ } /* Extract Remote IP address */ - if(!setup->m.sourceCallSignalAddressPresent) + if (!setup->m.sourceCallSignalAddressPresent) { OOTRACEWARN3("WARNING:Missing source call signal address in received " "setup (%s, %s)\n", call->callType, call->callToken); } else{ - if(setup->sourceCallSignalAddress.t != T_H225TransportAddress_ipAddress) + if (setup->sourceCallSignalAddress.t != T_H225TransportAddress_ipAddress) { OOTRACEERR3("ERROR: Source call signalling address type not ip " "(%s, %s)\n", call->callType, call->callToken); @@ -490,15 +490,15 @@ /* check for fast start */ - if(setup->m.fastStartPresent) + if (setup->m.fastStartPresent) { - if(!OO_TESTFLAG(gH323ep.flags, OO_M_FASTSTART)) + if (!OO_TESTFLAG(gH323ep.flags, OO_M_FASTSTART)) { OOTRACEINFO3("Local endpoint does not support fastStart. Ignoring " "fastStart. (%s, %s)\n", call->callType, call->callToken); OO_CLRFLAG (call->flags, OO_M_FASTSTART); } - else if(setup->fastStart.n == 0) + else if (setup->fastStart.n == 0) { OOTRACEINFO3("Empty faststart element received. Ignoring fast start. " "(%s, %s)\n", call->callType, call->callToken); @@ -519,18 +519,18 @@ /* Set print handler */ setEventHandler (call->pctxt, &printHandler); - for(i=0; i<(int)setup->fastStart.n; i++) + for (i=0; i<(int)setup->fastStart.n; i++) { olc = NULL; /* memset(msgbuf, 0, sizeof(msgbuf));*/ olc = (H245OpenLogicalChannel*)memAlloc(call->pctxt, sizeof(H245OpenLogicalChannel)); - if(!olc) + if (!olc) { OOTRACEERR3("ERROR:Memory - ooOnReceivedSetup - olc (%s, %s)\n", call->callType, call->callToken); /*Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -544,12 +544,12 @@ setPERBuffer(call->pctxt, msgbuf, setup->fastStart.elem[i].numocts, 1); ret = asn1PD_H245OpenLogicalChannel(call->pctxt, olc); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("ERROR:Failed to decode fast start olc element " "(%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -578,7 +578,7 @@ H245H2250LogicalChannelParameters * h2250lcp = NULL; int i=0, ret=0; - if(!q931Msg->userInfo) + if (!q931Msg->userInfo) { OOTRACEERR3("ERROR:No User-User IE in received CallProceeding message." " (%s, %s)\n", call->callType, call->callToken); @@ -586,13 +586,13 @@ } callProceeding = q931Msg->userInfo->h323_uu_pdu.h323_message_body.u.callProceeding; - if(callProceeding == NULL) + if (callProceeding == NULL) { OOTRACEERR3("Error: Received CallProceeding message does not have " "CallProceeding UUIE (%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -601,9 +601,9 @@ } /* Handle fast-start */ - if(OO_TESTFLAG (call->flags, OO_M_FASTSTART)) + if (OO_TESTFLAG (call->flags, OO_M_FASTSTART)) { - if(callProceeding->m.fastStartPresent) + if (callProceeding->m.fastStartPresent) { /* For printing the decoded message to log, initialize handler. */ initializePrintHandler(&printHandler, "FastStart Elements"); @@ -611,18 +611,18 @@ /* Set print handler */ setEventHandler (call->pctxt, &printHandler); - for(i=0; i<(int)callProceeding->fastStart.n; i++) + for (i=0; i<(int)callProceeding->fastStart.n; i++) { olc = NULL; olc = (H245OpenLogicalChannel*)memAlloc(call->pctxt, sizeof(H245OpenLogicalChannel)); - if(!olc) + if (!olc) { OOTRACEERR3("ERROR:Memory - ooOnReceivedCallProceeding - olc" "(%s, %s)\n", call->callType, call->callToken); /*Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -635,12 +635,12 @@ setPERBuffer(call->pctxt, msgbuf, callProceeding->fastStart.elem[i].numocts, 1); ret = asn1PD_H245OpenLogicalChannel(call->pctxt, olc); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("ERROR:Failed to decode fast start olc element " "(%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -651,7 +651,7 @@ dListAppend(call->pctxt, &call->remoteFastStartOLCs, olc); pChannel = ooFindLogicalChannelByOLC(call, olc); - if(!pChannel) + if (!pChannel) { OOTRACEERR4("ERROR: Logical Channel %d not found, fast start. " "(%s, %s)\n", @@ -659,7 +659,7 @@ call->callToken); return OO_FAILED; } - if(pChannel->channelNo != olc->forwardLogicalChannelNumber) + if (pChannel->channelNo != olc->forwardLogicalChannelNumber) { OOTRACEINFO5("Remote endpoint changed forwardLogicalChannel" "Number from %d to %d (%s, %s)\n", @@ -668,9 +668,9 @@ call->callToken); pChannel->channelNo = olc->forwardLogicalChannelNumber; } - if(!strcmp(pChannel->dir, "transmit")) + if (!strcmp(pChannel->dir, "transmit")) { - if(olc->forwardLogicalChannelParameters.multiplexParameters.t != + if (olc->forwardLogicalChannelParameters.multiplexParameters.t != T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) { OOTRACEERR4("ERROR:Unknown multiplex parameter type for " @@ -682,14 +682,14 @@ /* Extract the remote media endpoint address */ h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters; - if(!h2250lcp) + if (!h2250lcp) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "forward Logical Channel Parameters found. " "(%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } - if(!h2250lcp->m.mediaChannelPresent) + if (!h2250lcp->m.mediaChannelPresent) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "reverse media channel information found." @@ -700,9 +700,9 @@ &h2250lcp->mediaChannel, pChannel->remoteIP, &pChannel->remoteMediaPort); - if(ret != OO_OK) + if (ret != OO_OK) { - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -712,7 +712,7 @@ return OO_FAILED; } - if(!pChannel->chanCap->startTransmitChannel) + if (!pChannel->chanCap->startTransmitChannel) { OOTRACEERR3("ERROR:No callback registered to start transmit " "channel (%s, %s)\n",call->callType, @@ -734,14 +734,14 @@ } /* Retrieve the H.245 control channel address from the connect msg */ - if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && + if (q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && q931Msg->userInfo->h323_uu_pdu.h245Tunneling && callProceeding->m.h245AddressPresent) { OOTRACEINFO3("Tunneling and h245address provided." "Using Tunneling for H.245 messages (%s, %s)\n", call->callType, call->callToken); } - else if(callProceeding->m.h245AddressPresent) + else if (callProceeding->m.h245AddressPresent) { if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { @@ -753,28 +753,28 @@ ret = ooH323GetIpPortFromH225TransportAddress(call, &callProceeding->h245Address, call->remoteIP, &call->remoteH245Port); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: Unknown H245 address type in received " "CallProceeding message (%s, %s)", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; } return OO_FAILED; } - if(call->remoteH245Port != 0 && !call->pH245Channel) { + if (call->remoteH245Port != 0 && !call->pH245Channel) { /* Create an H.245 connection. */ - if(ooCreateH245Connection(call)== OO_FAILED) + if (ooCreateH245Connection(call)== OO_FAILED) { OOTRACEERR3("Error: H.245 channel creation failed (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -801,20 +801,20 @@ int i=0, ret=0; - if(!q931Msg->userInfo) + if (!q931Msg->userInfo) { OOTRACEERR3("ERROR:No User-User IE in received Alerting message." " (%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } alerting = q931Msg->userInfo->h323_uu_pdu.h323_message_body.u.alerting; - if(alerting == NULL) + if (alerting == NULL) { OOTRACEERR3("Error: Received Alerting message does not have " "alerting UUIE (%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -822,10 +822,10 @@ return OO_FAILED; } /*Handle fast-start */ - if(OO_TESTFLAG (call->flags, OO_M_FASTSTART) && + if (OO_TESTFLAG (call->flags, OO_M_FASTSTART) && !OO_TESTFLAG(call->flags, OO_M_FASTSTARTANSWERED)) { - if(alerting->m.fastStartPresent) + if (alerting->m.fastStartPresent) { /* For printing the decoded message to log, initialize handler. */ initializePrintHandler(&printHandler, "FastStart Elements"); @@ -833,18 +833,18 @@ /* Set print handler */ setEventHandler (call->pctxt, &printHandler); - for(i=0; i<(int)alerting->fastStart.n; i++) + for (i=0; i<(int)alerting->fastStart.n; i++) { olc = NULL; olc = (H245OpenLogicalChannel*)memAlloc(call->pctxt, sizeof(H245OpenLogicalChannel)); - if(!olc) + if (!olc) { OOTRACEERR3("ERROR:Memory - ooOnReceivedAlerting - olc" "(%s, %s)\n", call->callType, call->callToken); /*Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -857,12 +857,12 @@ setPERBuffer(call->pctxt, msgbuf, alerting->fastStart.elem[i].numocts, 1); ret = asn1PD_H245OpenLogicalChannel(call->pctxt, olc); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("ERROR:Failed to decode fast start olc element " "(%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -873,7 +873,7 @@ dListAppend(call->pctxt, &call->remoteFastStartOLCs, olc); pChannel = ooFindLogicalChannelByOLC(call, olc); - if(!pChannel) + if (!pChannel) { OOTRACEERR4("ERROR: Logical Channel %d not found, fast start. " "(%s, %s)\n", @@ -881,7 +881,7 @@ call->callToken); return OO_FAILED; } - if(pChannel->channelNo != olc->forwardLogicalChannelNumber) + if (pChannel->channelNo != olc->forwardLogicalChannelNumber) { OOTRACEINFO5("Remote endpoint changed forwardLogicalChannel" "Number from %d to %d (%s, %s)\n", @@ -890,9 +890,9 @@ call->callToken); pChannel->channelNo = olc->forwardLogicalChannelNumber; } - if(!strcmp(pChannel->dir, "transmit")) + if (!strcmp(pChannel->dir, "transmit")) { - if(olc->forwardLogicalChannelParameters.multiplexParameters.t != + if (olc->forwardLogicalChannelParameters.multiplexParameters.t != T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) { OOTRACEERR4("ERROR:Unknown multiplex parameter type for " @@ -904,14 +904,14 @@ /* Extract the remote media endpoint address */ h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters; - if(!h2250lcp) + if (!h2250lcp) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "forward Logical Channel Parameters found. " "(%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } - if(!h2250lcp->m.mediaChannelPresent) + if (!h2250lcp->m.mediaChannelPresent) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "reverse media channel information found." @@ -922,9 +922,9 @@ &h2250lcp->mediaChannel, pChannel->remoteIP, &pChannel->remoteMediaPort); - if(ret != OO_OK) + if (ret != OO_OK) { - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -934,7 +934,7 @@ return OO_FAILED; } - if(!pChannel->chanCap->startTransmitChannel) + if (!pChannel->chanCap->startTransmitChannel) { OOTRACEERR3("ERROR:No callback registered to start transmit " "channel (%s, %s)\n",call->callType, @@ -956,14 +956,14 @@ } /* Retrieve the H.245 control channel address from the connect msg */ - if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && + if (q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && q931Msg->userInfo->h323_uu_pdu.h245Tunneling && alerting->m.h245AddressPresent) { OOTRACEINFO3("Tunneling and h245address provided." "Giving preference to Tunneling (%s, %s)\n", call->callType, call->callToken); } - else if(alerting->m.h245AddressPresent) + else if (alerting->m.h245AddressPresent) { if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { @@ -975,28 +975,28 @@ ret = ooH323GetIpPortFromH225TransportAddress(call, &alerting->h245Address, call->remoteIP, &call->remoteH245Port); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: Unknown H245 address type in received " "Alerting message (%s, %s)", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; } return OO_FAILED; } - if(call->remoteH245Port != 0 && !call->pH245Channel) { + if (call->remoteH245Port != 0 && !call->pH245Channel) { /* Create an H.245 connection. */ - if(ooCreateH245Connection(call)== OO_FAILED) + if (ooCreateH245Connection(call)== OO_FAILED) { OOTRACEERR3("Error: H.245 channel creation failed (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -1024,20 +1024,20 @@ int i=0, ret=0; - if(!q931Msg->userInfo) + if (!q931Msg->userInfo) { OOTRACEERR3("ERROR:No User-User IE in received Progress message." " (%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } progress = q931Msg->userInfo->h323_uu_pdu.h323_message_body.u.progress; - if(progress == NULL) + if (progress == NULL) { OOTRACEERR3("Error: Received Progress message does not have " "progress UUIE (%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1045,10 +1045,10 @@ return OO_FAILED; } /*Handle fast-start */ - if(OO_TESTFLAG (call->flags, OO_M_FASTSTART) && + if (OO_TESTFLAG (call->flags, OO_M_FASTSTART) && !OO_TESTFLAG(call->flags, OO_M_FASTSTARTANSWERED)) { - if(progress->m.fastStartPresent) + if (progress->m.fastStartPresent) { /* For printing the decoded message to log, initialize handler. */ initializePrintHandler(&printHandler, "FastStart Elements"); @@ -1056,18 +1056,18 @@ /* Set print handler */ setEventHandler (call->pctxt, &printHandler); - for(i=0; i<(int)progress->fastStart.n; i++) + for (i=0; i<(int)progress->fastStart.n; i++) { olc = NULL; olc = (H245OpenLogicalChannel*)memAlloc(call->pctxt, sizeof(H245OpenLogicalChannel)); - if(!olc) + if (!olc) { OOTRACEERR3("ERROR:Memory - ooOnReceivedProgress - olc" "(%s, %s)\n", call->callType, call->callToken); /*Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -1080,12 +1080,12 @@ setPERBuffer(call->pctxt, msgbuf, progress->fastStart.elem[i].numocts, 1); ret = asn1PD_H245OpenLogicalChannel(call->pctxt, olc); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("ERROR:Failed to decode fast start olc element " "(%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1096,7 +1096,7 @@ dListAppend(call->pctxt, &call->remoteFastStartOLCs, olc); pChannel = ooFindLogicalChannelByOLC(call, olc); - if(!pChannel) + if (!pChannel) { OOTRACEERR4("ERROR: Logical Channel %d not found, fast start. " "(%s, %s)\n", @@ -1104,7 +1104,7 @@ call->callToken); return OO_FAILED; } - if(pChannel->channelNo != olc->forwardLogicalChannelNumber) + if (pChannel->channelNo != olc->forwardLogicalChannelNumber) { OOTRACEINFO5("Remote endpoint changed forwardLogicalChannel" "Number from %d to %d (%s, %s)\n", @@ -1113,9 +1113,9 @@ call->callToken); pChannel->channelNo = olc->forwardLogicalChannelNumber; } - if(!strcmp(pChannel->dir, "transmit")) + if (!strcmp(pChannel->dir, "transmit")) { - if(olc->forwardLogicalChannelParameters.multiplexParameters.t != + if (olc->forwardLogicalChannelParameters.multiplexParameters.t != T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) { OOTRACEERR4("ERROR:Unknown multiplex parameter type for " @@ -1127,14 +1127,14 @@ /* Extract the remote media endpoint address */ h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters; - if(!h2250lcp) + if (!h2250lcp) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "forward Logical Channel Parameters found. " "(%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } - if(!h2250lcp->m.mediaChannelPresent) + if (!h2250lcp->m.mediaChannelPresent) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "reverse media channel information found." @@ -1145,9 +1145,9 @@ &h2250lcp->mediaChannel, pChannel->remoteIP, &pChannel->remoteMediaPort); - if(ret != OO_OK) + if (ret != OO_OK) { - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1157,7 +1157,7 @@ return OO_FAILED; } - if(!pChannel->chanCap->startTransmitChannel) + if (!pChannel->chanCap->startTransmitChannel) { OOTRACEERR3("ERROR:No callback registered to start transmit " "channel (%s, %s)\n",call->callType, @@ -1179,14 +1179,14 @@ } /* Retrieve the H.245 control channel address from the connect msg */ - if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && + if (q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && q931Msg->userInfo->h323_uu_pdu.h245Tunneling && progress->m.h245AddressPresent) { OOTRACEINFO3("Tunneling and h245address provided." "Giving preference to Tunneling (%s, %s)\n", call->callType, call->callToken); } - else if(progress->m.h245AddressPresent) + else if (progress->m.h245AddressPresent) { if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { @@ -1198,28 +1198,28 @@ ret = ooH323GetIpPortFromH225TransportAddress(call, &progress->h245Address, call->remoteIP, &call->remoteH245Port); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: Unknown H245 address type in received " "Progress message (%s, %s)", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; } return OO_FAILED; } - if(call->remoteH245Port != 0 && !call->pH245Channel) { + if (call->remoteH245Port != 0 && !call->pH245Channel) { /* Create an H.245 connection. */ - if(ooCreateH245Connection(call)== OO_FAILED) + if (ooCreateH245Connection(call)== OO_FAILED) { OOTRACEERR3("Error: H.245 channel creation failed (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -1246,12 +1246,12 @@ ooLogicalChannel * pChannel = NULL; H245H2250LogicalChannelParameters * h2250lcp = NULL; - if(!q931Msg->userInfo) + if (!q931Msg->userInfo) { OOTRACEERR3("Error: UUIE not found in received H.225 Connect message" " (%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1260,12 +1260,12 @@ } /* Retrieve the connect message from the user-user IE & Q.931 header */ connect = q931Msg->userInfo->h323_uu_pdu.h323_message_body.u.connect; - if(connect == NULL) + if (connect == NULL) { OOTRACEERR3("Error: Received Connect message does not have Connect UUIE" " (%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1274,10 +1274,10 @@ } /*Handle fast-start */ - if(OO_TESTFLAG (call->flags, OO_M_FASTSTART) && + if (OO_TESTFLAG (call->flags, OO_M_FASTSTART) && !OO_TESTFLAG (call->flags, OO_M_FASTSTARTANSWERED)) { - if(!connect->m.fastStartPresent) + if (!connect->m.fastStartPresent) { OOTRACEINFO3("Remote endpoint has rejected fastStart. (%s, %s)\n", call->callType, call->callToken); @@ -1296,18 +1296,18 @@ /* Set print handler */ setEventHandler (call->pctxt, &printHandler); - for(i=0; i<(int)connect->fastStart.n; i++) + for (i=0; i<(int)connect->fastStart.n; i++) { olc = NULL; /* memset(msgbuf, 0, sizeof(msgbuf));*/ olc = (H245OpenLogicalChannel*)memAlloc(call->pctxt, sizeof(H245OpenLogicalChannel)); - if(!olc) + if (!olc) { OOTRACEERR3("ERROR:Memory - ooOnReceivedSignalConnect - olc" "(%s, %s)\n", call->callType, call->callToken); /*Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -1322,12 +1322,12 @@ setPERBuffer(call->pctxt, msgbuf, connect->fastStart.elem[i].numocts, 1); ret = asn1PD_H245OpenLogicalChannel(call->pctxt, olc); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("ERROR:Failed to decode fast start olc element " "(%s, %s)\n", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1340,7 +1340,7 @@ dListAppend(call->pctxt, &call->remoteFastStartOLCs, olc); pChannel = ooFindLogicalChannelByOLC(call, olc); - if(!pChannel) + if (!pChannel) { OOTRACEERR4("ERROR: Logical Channel %d not found, fasts start " "answered. (%s, %s)\n", @@ -1350,7 +1350,7 @@ removeEventHandler(call->pctxt); return OO_FAILED; } - if(pChannel->channelNo != olc->forwardLogicalChannelNumber) + if (pChannel->channelNo != olc->forwardLogicalChannelNumber) { OOTRACEINFO5("Remote endpoint changed forwardLogicalChannelNumber" "from %d to %d (%s, %s)\n", pChannel->channelNo, @@ -1358,9 +1358,9 @@ call->callToken); pChannel->channelNo = olc->forwardLogicalChannelNumber; } - if(!strcmp(pChannel->dir, "transmit")) + if (!strcmp(pChannel->dir, "transmit")) { - if(olc->forwardLogicalChannelParameters.multiplexParameters.t != + if (olc->forwardLogicalChannelParameters.multiplexParameters.t != T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) { OOTRACEERR4("ERROR:Unknown multiplex parameter type for channel" @@ -1371,7 +1371,7 @@ /* Extract the remote media endpoint address */ h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters; - if(!h2250lcp) + if (!h2250lcp) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "forward Logical Channel Parameters found. (%s, %s)" @@ -1380,7 +1380,7 @@ removeEventHandler(call->pctxt); return OO_FAILED; } - if(!h2250lcp->m.mediaChannelPresent) + if (!h2250lcp->m.mediaChannelPresent) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "reverse media channel information found. (%s, %s)" @@ -1393,9 +1393,9 @@ ret = ooGetIpPortFromH245TransportAddress(call, &h2250lcp->mediaChannel, pChannel->remoteIP, &pChannel->remoteMediaPort); - if(ret != OO_OK) + if (ret != OO_OK) { - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1406,7 +1406,7 @@ removeEventHandler(call->pctxt); return OO_FAILED; } - if(!pChannel->chanCap->startTransmitChannel) + if (!pChannel->chanCap->startTransmitChannel) { OOTRACEERR3("ERROR:No callback registered to start transmit " "channel (%s, %s)\n",call->callType, call->callToken); @@ -1427,14 +1427,14 @@ } /* Retrieve the H.245 control channel address from the CONNECT msg */ - if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && + if (q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && q931Msg->userInfo->h323_uu_pdu.h245Tunneling && connect->m.h245AddressPresent) { OOTRACEINFO3("Tunneling and h245address provided." "Giving preference to Tunneling (%s, %s)\n", call->callType, call->callToken); } - else if(connect->m.h245AddressPresent) + else if (connect->m.h245AddressPresent) { if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { @@ -1445,12 +1445,12 @@ } ret = ooH323GetIpPortFromH225TransportAddress(call, &connect->h245Address, call->remoteIP, &call->remoteH245Port); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: Unknown H245 address type in received Connect " "message (%s, %s)", call->callType, call->callToken); /* Mark call for clearing */ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_INVALIDMESSAGE; call->callState = OO_CALL_CLEAR; @@ -1459,16 +1459,16 @@ } } - if(call->remoteH245Port != 0 && !call->pH245Channel) + if (call->remoteH245Port != 0 && !call->pH245Channel) { /* Create an H.245 connection. */ - if(ooCreateH245Connection(call)== OO_FAILED) + if (ooCreateH245Connection(call)== OO_FAILED) { OOTRACEERR3("Error: H.245 channel creation failed (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_TRANSPORTFAILURE; call->callState = OO_CALL_CLEAR; @@ -1477,7 +1477,7 @@ } } - if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent) + if (q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent) { if (!q931Msg->userInfo->h323_uu_pdu.h245Tunneling) { @@ -1503,21 +1503,21 @@ started. This will be true only when separate h245 connection is not established and tunneling is being used. */ - if(call->localTermCapState == OO_LocalTermCapExchange_Idle) + if (call->localTermCapState == OO_LocalTermCapExchange_Idle) { /*Start terminal capability exchange and master slave determination */ ret = ooSendTermCapMsg(call); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n", call->callType, call->callToken); return ret; } } - if(call->masterSlaveState == OO_MasterSlave_Idle) + if (call->masterSlaveState == OO_MasterSlave_Idle) { ret = ooSendMasterSlaveDetermination(call); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Sending Master-slave determination message " "(%s, %s)\n", call->callType, call->callToken); @@ -1537,7 +1537,7 @@ OOTimer *pTimer=NULL; int type = q931Msg->messageType; struct timespec ts; - switch(type) + switch (type) { case Q931SetupMsg: /* SETUP message is received */ OOTRACEINFO3("Received SETUP message (%s, %s)\n", call->callType, @@ -1545,7 +1545,7 @@ ooOnReceivedSetup(call, q931Msg); /* H225 message callback */ - if(gH323ep.h225Callbacks.onReceivedSetup) + if (gH323ep.h225Callbacks.onReceivedSetup) ret = gH323ep.h225Callbacks.onReceivedSetup(call, q931Msg); /* Free up the mem used by the received message, as it's processing @@ -1560,9 +1560,9 @@ application. Very useful in pbx applications where gk is used only when call is to or from outside pbx domian */ - if(gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) + if (gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) { - if(gH323ep.gkClient->state == GkClientRegistered) + if (gH323ep.gkClient->state == GkClientRegistered) { call->callState = OO_CALL_WAITING_ADMISSION; ast_mutex_lock(&call->Lock); @@ -1608,7 +1608,7 @@ call->alertingTime = (H235TimeStamp) time(NULL); ooOnReceivedAlerting(call, q931Msg); - if(gH323ep.h323Callbacks.onAlerting && call->callStatecallStatemsgctxt, q931Msg); break; @@ -1620,7 +1620,7 @@ ooOnReceivedProgress(call, q931Msg); - if(gH323ep.h323Callbacks.onProgress && call->callStatecallStatemsgctxt, q931Msg); break; @@ -1633,11 +1633,11 @@ call->connectTime = (H235TimeStamp) time(NULL); /* Disable call establishment timer */ - for(i = 0; itimerList.count; i++) + for (i = 0; itimerList.count; i++) { pNode = dListFindByIndex(&call->timerList, i); pTimer = (OOTimer*)pNode->data; - if(((ooTimerCallback*)pTimer->cbData)->timerType & + if (((ooTimerCallback*)pTimer->cbData)->timerType & OO_CALLESTB_TIMER) { memFreePtr(call->pctxt, pTimer->cbData); @@ -1648,21 +1648,21 @@ } } ret = ooOnReceivedSignalConnect(call, q931Msg); - if(ret != OO_OK) + if (ret != OO_OK) OOTRACEERR3("Error:Invalid Connect message received. (%s, %s)\n", call->callType, call->callToken); else{ /* H225 message callback */ - if(gH323ep.h225Callbacks.onReceivedConnect) + if (gH323ep.h225Callbacks.onReceivedConnect) gH323ep.h225Callbacks.onReceivedConnect(call, q931Msg); - if(gH323ep.h323Callbacks.onCallEstablished) + if (gH323ep.h323Callbacks.onCallEstablished) gH323ep.h323Callbacks.onCallEstablished(call); } ooFreeQ931Message(call->msgctxt, q931Msg); - if(gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) { - if(gH323ep.gkClient->state == GkClientRegistered) { + if (gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) { + if (gH323ep.gkClient->state == GkClientRegistered) { ooGkClientSendIRR(gH323ep.gkClient, call); } } @@ -1728,26 +1728,26 @@ OOTRACEDBGC3("Received Facility Message.(%s, %s)\n", call->callType, call->callToken); /* Get Reference to H323_UU_PDU */ - if(!pQ931Msg->userInfo) + if (!pQ931Msg->userInfo) { OOTRACEERR3("Error: UserInfo not found in received H.225 Facility " "message (%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } pH323UUPdu = &pQ931Msg->userInfo->h323_uu_pdu; - if(!pH323UUPdu) + if (!pH323UUPdu) { OOTRACEERR1("ERROR: H225H323_UU_PDU absent in incoming facility " "message\n"); return OO_FAILED; } facility = pH323UUPdu->h323_message_body.u.facility; - if(facility) + if (facility) { /* Depending on the reason of facility message handle the message */ - if(facility->reason.t == T_H225FacilityReason_transportedInformation) + if (facility->reason.t == T_H225FacilityReason_transportedInformation) { - if(OO_TESTFLAG (call->flags, OO_M_TUNNELING)) + if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) { OOTRACEDBGB3("Handling tunneled messages in Facility. (%s, %s)\n", call->callType, call->callToken); @@ -1763,30 +1763,30 @@ return OO_FAILED; } } - else if(facility->reason.t == T_H225FacilityReason_startH245) + else if (facility->reason.t == T_H225FacilityReason_startH245) { OOTRACEINFO3("Remote wants to start a separate H.245 Channel " "(%s, %s)\n", call->callType, call->callToken); /*start H.245 channel*/ ret = ooHandleStartH245FacilityMessage(call, facility); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR: Handling startH245 facility message " "(%s, %s)\n", call->callType, call->callToken); return ret; } } - else if(facility->reason.t == T_H225FacilityReason_callForwarded) + else if (facility->reason.t == T_H225FacilityReason_callForwarded) { OOTRACEINFO3("Call Forward Facility message received. (%s, %s)\n", call->callType, call->callToken); - if(!facility->m.alternativeAddressPresent && + if (!facility->m.alternativeAddressPresent && !facility->m.alternativeAliasAddressPresent) { OOTRACEERR3("Error:No alternative address provided in call forward" "facility message.(%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_INVALIDMESSAGE; @@ -1795,7 +1795,7 @@ } call->pCallFwdData = (OOCallFwdData *) memAlloc(call->pctxt, sizeof(OOCallFwdData)); - if(!call->pCallFwdData) + if (!call->pCallFwdData) { OOTRACEERR3("Error:Memory - ooOnReceivedFacility - pCallFwdData " "(%s, %s)\n", call->callType, call->callToken); @@ -1804,9 +1804,9 @@ call->pCallFwdData->fwdedByRemote = TRUE; call->pCallFwdData->ip[0]='\0'; call->pCallFwdData->aliases = NULL; - if(facility->m.alternativeAddressPresent) + if (facility->m.alternativeAddressPresent) { - if(facility->alternativeAddress.t != + if (facility->alternativeAddress.t != T_H225TransportAddress_ipAddress) { OOTRACEERR3("ERROR: Source call signalling address type not ip " @@ -1822,14 +1822,14 @@ facility->alternativeAddress.u.ipAddress->port; } - if(facility->m.alternativeAliasAddressPresent) + if (facility->m.alternativeAliasAddressPresent) { ooH323RetrieveAliases(call, &facility->alternativeAliasAddress, &call->pCallFwdData->aliases); } /* Now we have to clear the current call and make a new call to fwded location*/ - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_REMOTE_FWDED; @@ -1840,13 +1840,13 @@ return OO_OK; } } - else if(facility->reason.t == T_H225FacilityReason_forwardedElements) + else if (facility->reason.t == T_H225FacilityReason_forwardedElements) { OOTRACEINFO3("Handling fast start in forwardedElem facility for " "(%s, %s)\n", call->callType, call->callToken); /*start H.245 channel*/ ret = ooHandleFastStart(call, facility); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR: Handling transportedInformation facility message " "(%s, %s)\n", call->callType, call->callToken); @@ -1879,20 +1879,20 @@ int ret; /* Extract H245 address */ - if(!facility->m.h245AddressPresent) + if (!facility->m.h245AddressPresent) { OOTRACEERR3("ERROR: startH245 facility message received with no h245 " "address (%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } - if(facility->h245Address.t != T_H225TransportAddress_ipAddress) + if (facility->h245Address.t != T_H225TransportAddress_ipAddress) { OOTRACEERR3("ERROR:Unknown H245 address type in received startH245 " "facility message (%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } ipAddress = facility->h245Address.u.ipAddress; - if(!ipAddress) + if (!ipAddress) { OOTRACEERR3("ERROR:Invalid startH245 facility message. No H245 ip " "address found. (%s, %s)\n", call->callType, call->callToken); @@ -1910,7 +1910,7 @@ /*Establish an H.245 connection */ ret = ooCreateH245Connection(call); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR: Failed to establish an H.245 connection with remote" " endpoint (%s, %s)\n", call->callType, call->callToken); @@ -1930,20 +1930,20 @@ call->callType, call->callToken); /* Check whether there are tunneled messages */ - if(pH323UUPdu->m.h245TunnelingPresent) + if (pH323UUPdu->m.h245TunnelingPresent) { - if(pH323UUPdu->h245Tunneling) + if (pH323UUPdu->h245Tunneling) { OOTRACEDBGB4("Total number of tunneled H245 messages are %d.(%s, %s)" "\n", (int)pH323UUPdu->h245Control.n, call->callType, call->callToken); - for(i=0; i< (int)pH323UUPdu->h245Control.n; i++) + for (i=0; i< (int)pH323UUPdu->h245Control.n; i++) { OOTRACEDBGC5("Retrieving %d of %d tunneled H.245 messages." "(%s, %s)\n",i+1, pH323UUPdu->h245Control.n, call->callType, call->callToken); pmsg = (H245Message*)memAlloc(pctxt, sizeof(H245Message)); - if(!pmsg) + if (!pmsg) { OOTRACEERR3("Error:Memory - ooHandleH245TunneledMessages - pmsg" "(%s, %s)\n", call->callType, call->callToken); @@ -1962,7 +1962,7 @@ i+1, call->callType, call->callToken); ret = asn1PD_H245MultimediaSystemControlMessage(pctxt, &(pmsg->h245Msg)); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("Error decoding H245 message (%s, %s)\n", call->callType, call->callToken); @@ -1975,7 +1975,7 @@ memFreePtr(pctxt, pmsg); pmsg = NULL; }/* End of For loop */ - }/* End of if(h245Tunneling) */ + }/* End of if (h245Tunneling) */ } return OO_OK; } @@ -1990,43 +1990,43 @@ OOAliases *newAlias=NULL; H225TransportAddress *pTransportAddrss=NULL; - if(!pAddresses) + if (!pAddresses) { OOTRACEWARN3("Warn:No Aliases present (%s, %s)\n", call->callType, call->callToken); return OO_OK; } /* check for aliases */ - if(pAddresses->count<=0) + if (pAddresses->count<=0) return OO_OK; - for(i=0; i<(int)pAddresses->count; i++) + for (i=0; i<(int)pAddresses->count; i++) { pNode = dListFindByIndex (pAddresses, i); - if(!pNode) + if (!pNode) continue; pAliasAddress = (H225AliasAddress*)pNode->data; - if(!pAliasAddress) + if (!pAliasAddress) continue; newAlias = (OOAliases*)memAlloc(call->pctxt, sizeof(OOAliases)); - if(!newAlias) + if (!newAlias) { OOTRACEERR3("ERROR:Memory - ooH323RetrieveAliases - newAlias " "(%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } memset(newAlias, 0, sizeof(OOAliases)); - switch(pAliasAddress->t) + switch (pAliasAddress->t) { case T_H225AliasAddress_dialedDigits: newAlias->type = T_H225AliasAddress_dialedDigits; newAlias->value = (char*) memAlloc(call->pctxt, strlen(pAliasAddress->u.dialedDigits)*sizeof(char)+1); - if(!newAlias->value) + if (!newAlias->value) { OOTRACEERR3("ERROR:Memory - ooH323RetrieveAliases - " "newAlias->value(dialedDigits) (%s, %s)\n", @@ -2043,7 +2043,7 @@ newAlias->type = T_H225AliasAddress_h323_ID; newAlias->value = (char*)memAlloc(call->pctxt, (pAliasAddress->u.h323_ID.nchars+1)*sizeof(char)+1); - if(!newAlias->value) + if (!newAlias->value) { OOTRACEERR3("ERROR:Memory - ooH323RetrieveAliases - " "newAlias->value(h323id) (%s, %s)\n", call->callType, @@ -2052,9 +2052,9 @@ return OO_FAILED; } - for(j=0, k=0; j<(int)pAliasAddress->u.h323_ID.nchars; j++) + for (j=0, k=0; j<(int)pAliasAddress->u.h323_ID.nchars; j++) { - if(pAliasAddress->u.h323_ID.data[j] < 256) + if (pAliasAddress->u.h323_ID.data[j] < 256) { newAlias->value[k++] = (char) pAliasAddress->u.h323_ID.data[j]; } @@ -2065,7 +2065,7 @@ newAlias->type = T_H225AliasAddress_url_ID; newAlias->value = (char*)memAlloc(call->pctxt, strlen(pAliasAddress->u.url_ID)*sizeof(char)+1); - if(!newAlias->value) + if (!newAlias->value) { OOTRACEERR3("ERROR:Memory - ooH323RetrieveAliases - " "newAlias->value(urlid) (%s, %s)\n", call->callType, @@ -2081,7 +2081,7 @@ case T_H225AliasAddress_transportID: newAlias->type = T_H225AliasAddress_transportID; pTransportAddrss = pAliasAddress->u.transportID; - if(pTransportAddrss->t != T_H225TransportAddress_ipAddress) + if (pTransportAddrss->t != T_H225TransportAddress_ipAddress) { OOTRACEERR3("Error:Alias transportID not an IP address" "(%s, %s)\n", call->callType, call->callToken); @@ -2103,7 +2103,7 @@ newAlias->type = T_H225AliasAddress_email_ID; newAlias->value = (char*)memAlloc(call->pctxt, strlen(pAliasAddress->u.email_ID)*sizeof(char)+1); - if(!newAlias->value) + if (!newAlias->value) { OOTRACEERR3("ERROR:Memory - ooH323RetrieveAliases - " "newAlias->value(emailid) (%s, %s)\n", call->callType, @@ -2143,25 +2143,25 @@ ASN1BOOL bValid=FALSE; dListInit(pPrefixList); - if(pAliases) + if (pAliases) { pAlias = pAliases; - while(pAlias) + while (pAlias) { pPrefixEntry = NULL; - switch(pAlias->type) + switch (pAlias->type) { case T_H225AliasAddress_dialedDigits: pPrefixEntry = (H225SupportedPrefix *)memAlloc(pctxt, sizeof(H225SupportedPrefix)); - if(!pPrefixEntry) { + if (!pPrefixEntry) { OOTRACEERR1("ERROR:Memory - ooPopulatePrefixList - pAliasEntry\n"); return OO_FAILED; } pPrefixEntry->prefix.t = T_H225AliasAddress_dialedDigits; pPrefixEntry->prefix.u.dialedDigits = (ASN1IA5String)memAlloc(pctxt, strlen(pAlias->value)+1); - if(!pPrefixEntry->prefix.u.dialedDigits) { + if (!pPrefixEntry->prefix.u.dialedDigits) { OOTRACEERR1("ERROR:Memory - ooPopulatePrefixList - " "dialedDigits\n"); memFreePtr(pctxt, pPrefixEntry); @@ -2174,7 +2174,7 @@ bValid = FALSE; } - if(bValid) + if (bValid) dListAppend( pctxt, pPrefixList, (void*)pPrefixEntry ); pAlias = pAlias->next; @@ -2191,10 +2191,10 @@ int i = 0; dListInit(pAliasList); - if(pAliases) + if (pAliases) { pAlias = pAliases; - while(pAlias) + while (pAlias) { if (pAlias->value[0] == 0) { pAlias = pAlias->next; @@ -2202,18 +2202,18 @@ } pAliasEntry = (H225AliasAddress*)memAlloc(pctxt, sizeof(H225AliasAddress)); - if(!pAliasEntry) + if (!pAliasEntry) { OOTRACEERR1("ERROR:Memory - ooPopulateAliasList - pAliasEntry\n"); return OO_FAILED; } - switch(pAlias->type) + switch (pAlias->type) { case T_H225AliasAddress_dialedDigits: pAliasEntry->t = T_H225AliasAddress_dialedDigits; pAliasEntry->u.dialedDigits = (ASN1IA5String)memAlloc(pctxt, strlen(pAlias->value)+1); - if(!pAliasEntry->u.dialedDigits) + if (!pAliasEntry->u.dialedDigits) { OOTRACEERR1("ERROR:Memory - ooPopulateAliasList - " "dialedDigits\n"); @@ -2229,13 +2229,13 @@ pAliasEntry->u.h323_ID.data = (ASN116BITCHAR*)memAllocZ (pctxt, strlen(pAlias->value)*sizeof(ASN116BITCHAR)); - if(!pAliasEntry->u.h323_ID.data) + if (!pAliasEntry->u.h323_ID.data) { OOTRACEERR1("ERROR:Memory - ooPopulateAliasList - h323_id\n"); memFreePtr(pctxt, pAliasEntry); return OO_FAILED; } - for(i=0; *(pAlias->value+i) != '\0'; i++) + for (i=0; *(pAlias->value+i) != '\0'; i++) pAliasEntry->u.h323_ID.data[i] =(ASN116BITCHAR)pAlias->value[i]; bValid = TRUE; break; @@ -2243,7 +2243,7 @@ pAliasEntry->t = T_H225AliasAddress_url_ID; pAliasEntry->u.url_ID = (ASN1IA5String)memAlloc(pctxt, strlen(pAlias->value)+1); - if(!pAliasEntry->u.url_ID) + if (!pAliasEntry->u.url_ID) { OOTRACEERR1("ERROR:Memory - ooPopulateAliasList - url_id\n"); memFreePtr(pctxt, pAliasEntry); @@ -2256,7 +2256,7 @@ pAliasEntry->t = T_H225AliasAddress_email_ID; pAliasEntry->u.email_ID = (ASN1IA5String)memAlloc(pctxt, strlen(pAlias->value)+1); - if(!pAliasEntry->u.email_ID) + if (!pAliasEntry->u.email_ID) { OOTRACEERR1("ERROR: Failed to allocate memory for EmailID " "alias entry \n"); @@ -2270,7 +2270,7 @@ bValid = FALSE; } - if(bValid) + if (bValid) dListAppend( pctxt, pAliasList, (void*)pAliasEntry ); else memFreePtr(pctxt, pAliasEntry); @@ -2287,7 +2287,7 @@ OOAliases *pAlias = NULL; - if(!aliasList) + if (!aliasList) { OOTRACEDBGC1("No alias List to search\n"); return NULL; @@ -2295,20 +2295,20 @@ pAlias = aliasList; - while(pAlias) + while (pAlias) { - if(type != 0 && value) { /* Search by type and value */ - if(pAlias->type == type && !strcmp(pAlias->value, value)) + if (type != 0 && value) { /* Search by type and value */ + if (pAlias->type == type && !strcmp(pAlias->value, value)) { return pAlias; } } - else if(type != 0 && !value) {/* search by type */ - if(pAlias->type == type) + else if (type != 0 && !value) {/* search by type */ + if (pAlias->type == type) return pAlias; } - else if(type == 0 && value) {/* search by value */ - if(!strcmp(pAlias->value, value)) + else if (type == 0 && value) {/* search by value */ + if (!strcmp(pAlias->value, value)) return pAlias; } else { @@ -2329,14 +2329,14 @@ H225TransportAddress *pTransportAddrss=NULL; newAlias = (OOAliases*) memAlloc(pctxt, sizeof(OOAliases)); - if(!newAlias) + if (!newAlias) { OOTRACEERR1("Error: Failed to allocate memory for new alias to be added to the alias list\n"); return NULL; } memset(newAlias, 0, sizeof(OOAliases)); - switch(pAliasAddress->t) + switch (pAliasAddress->t) { case T_H225AliasAddress_dialedDigits: newAlias->type = T_H225AliasAddress_dialedDigits; @@ -2348,9 +2348,9 @@ newAlias->value = (char*)memAlloc(pctxt, (pAliasAddress->u.h323_ID.nchars+1)*sizeof(char)+1); - for(j=0, k=0; j<(int)pAliasAddress->u.h323_ID.nchars; j++) + for (j=0, k=0; j<(int)pAliasAddress->u.h323_ID.nchars; j++) { - if(pAliasAddress->u.h323_ID.data[j] < 256) + if (pAliasAddress->u.h323_ID.data[j] < 256) { newAlias->value[k++] = (char) pAliasAddress->u.h323_ID.data[j]; } @@ -2367,7 +2367,7 @@ case T_H225AliasAddress_transportID: newAlias->type = T_H225AliasAddress_transportID; pTransportAddrss = pAliasAddress->u.transportID; - if(pTransportAddrss->t != T_H225TransportAddress_ipAddress) + if (pTransportAddrss->t != T_H225TransportAddress_ipAddress) { OOTRACEERR1("Error:Alias transportID not an IP address\n"); memFreePtr(pctxt, newAlias); @@ -2405,7 +2405,7 @@ int ooH323GetIpPortFromH225TransportAddress(struct OOH323CallData *call, H225TransportAddress *h225Address, char *ip, int *port) { - if(h225Address->t != T_H225TransportAddress_ipAddress) + if (h225Address->t != T_H225TransportAddress_ipAddress) { OOTRACEERR3("Error: Unknown H225 address type. (%s, %s)", call->callType, call->callToken); Index: addons/ooh323c/src/ooh323ep.c =================================================================== --- addons/ooh323c/src/ooh323ep.c (revision 228266) +++ addons/ooh323c/src/ooh323ep.c (working copy) @@ -42,9 +42,9 @@ initContext(&(gH323ep.ctxt)); initContext(&(gH323ep.msgctxt)); - if(tracefile) + if (tracefile) { - if(strlen(tracefile)>= MAXFILENAME) + if (strlen(tracefile)>= MAXFILENAME) { printf("Error:File name longer than allowed maximum %d\n", MAXFILENAME-1); @@ -57,7 +57,7 @@ } gH323ep.fptraceFile = fopen(gH323ep.traceFile, "w"); - if(gH323ep.fptraceFile == NULL) + if (gH323ep.fptraceFile == NULL) { printf("Error:Failed to open trace file %s for write.\n", gH323ep.traceFile); @@ -159,13 +159,13 @@ int ooH323EpSetLocalAddress(const char* localip, int listenport) { - if(localip) + if (localip) { strcpy(gH323ep.signallingIP, localip); OOTRACEINFO2("Signalling IP address is set to %s\n", localip); } - if(listenport) + if (listenport) { gH323ep.listenPort = listenport; OOTRACEINFO2("Listen port number is set to %d\n", listenport); @@ -177,7 +177,7 @@ { ooAliases * psNewAlias=NULL; psNewAlias = (ooAliases*)memAlloc(&gH323ep.ctxt, sizeof(ooAliases)); - if(!psNewAlias) + if (!psNewAlias) { OOTRACEERR1("Error: Failed to allocate memory for new H323-ID alias\n"); return OO_FAILED; @@ -185,7 +185,7 @@ psNewAlias->type = T_H225AliasAddress_h323_ID; psNewAlias->registered = FALSE; psNewAlias->value = (char*) memAlloc(&gH323ep.ctxt, strlen(h323id)+1); - if(!psNewAlias->value) + if (!psNewAlias->value) { OOTRACEERR1("Error: Failed to allocate memory for the new H323-ID alias " "value\n"); @@ -203,7 +203,7 @@ { ooAliases * psNewAlias=NULL; psNewAlias = (ooAliases*)memAlloc(&gH323ep.ctxt, sizeof(ooAliases)); - if(!psNewAlias) + if (!psNewAlias) { OOTRACEERR1("Error: Failed to allocate memory for new DialedDigits " "alias\n"); @@ -212,7 +212,7 @@ psNewAlias->type = T_H225AliasAddress_dialedDigits; psNewAlias->registered = FALSE; psNewAlias->value = (char*) memAlloc(&gH323ep.ctxt, strlen(dialedDigits)+1); - if(!psNewAlias->value) + if (!psNewAlias->value) { OOTRACEERR1("Error: Failed to allocate memory for the new DialedDigits" " alias value\n"); @@ -230,7 +230,7 @@ { ooAliases * psNewAlias=NULL; psNewAlias = (ooAliases*)memAlloc(&gH323ep.ctxt, sizeof(ooAliases)); - if(!psNewAlias) + if (!psNewAlias) { OOTRACEERR1("Error: Failed to allocate memory for new URL-ID alias\n"); return OO_FAILED; @@ -238,7 +238,7 @@ psNewAlias->type = T_H225AliasAddress_url_ID; psNewAlias->registered = FALSE; psNewAlias->value = (char*) memAlloc(&gH323ep.ctxt, strlen(url)+1); - if(!psNewAlias->value) + if (!psNewAlias->value) { OOTRACEERR1("Error: Failed to allocate memory for the new URL-ID alias" " value\n"); @@ -256,7 +256,7 @@ { ooAliases * psNewAlias=NULL; psNewAlias = (ooAliases*)memAlloc(&gH323ep.ctxt, sizeof(ooAliases)); - if(!psNewAlias) + if (!psNewAlias) { OOTRACEERR1("Error: Failed to allocate memory for new Email-ID alias\n"); return OO_FAILED; @@ -264,7 +264,7 @@ psNewAlias->type = T_H225AliasAddress_email_ID; psNewAlias->registered = FALSE; psNewAlias->value = (char*) memAlloc(&gH323ep.ctxt, strlen(email)+1); - if(!psNewAlias->value) + if (!psNewAlias->value) { OOTRACEERR1("Error: Failed to allocate memory for the new Email-ID alias" " value\n"); @@ -282,7 +282,7 @@ { ooAliases * psNewAlias=NULL; psNewAlias = (ooAliases*)memAlloc(&gH323ep.ctxt, sizeof(ooAliases)); - if(!psNewAlias) + if (!psNewAlias) { OOTRACEERR1("Error: Failed to allocate memory for new Transport-ID " "alias\n"); @@ -291,7 +291,7 @@ psNewAlias->type = T_H225AliasAddress_transportID; psNewAlias->registered = FALSE; psNewAlias->value = (char*) memAlloc(&gH323ep.ctxt, strlen(ipaddress)+1); - if(!psNewAlias->value) + if (!psNewAlias->value) { OOTRACEERR1("Error: Failed to allocate memory for the new Transport-ID " "alias value\n"); @@ -308,10 +308,10 @@ int ooH323EpClearAllAliases(void) { ooAliases *pAlias = NULL, *pTemp; - if(gH323ep.aliases) + if (gH323ep.aliases) { pAlias = gH323ep.aliases; - while(pAlias) + while (pAlias) { pTemp = pAlias; pAlias = pAlias->next; @@ -355,13 +355,13 @@ close trace file free context structure */ OOH323CallData * cur, *temp; - if(OO_TESTFLAG(gH323ep.flags, OO_M_ENDPOINTCREATED)) + if (OO_TESTFLAG(gH323ep.flags, OO_M_ENDPOINTCREATED)) { OOTRACEINFO1("Destroying H323 Endpoint\n"); - if(gH323ep.callList) + if (gH323ep.callList) { cur = gH323ep.callList; - while(cur) + while (cur) { temp = cur; cur = cur->next; @@ -372,7 +372,7 @@ } - if(gH323ep.listener) + if (gH323ep.listener) { ooSocketClose(*(gH323ep.listener)); gH323ep.listener = NULL; @@ -380,7 +380,7 @@ ooGkClientDestroy(); - if(gH323ep.fptraceFile) + if (gH323ep.fptraceFile) { fclose(gH323ep.fptraceFile); gH323ep.fptraceFile = NULL; @@ -487,7 +487,7 @@ if (0 != productID) { char* pstr = (char*) memAlloc (&gH323ep.ctxt, strlen(productID)+1); strcpy (pstr, productID); - if(gH323ep.productID) + if (gH323ep.productID) memFreePtr(&gH323ep.ctxt, gH323ep.productID); gH323ep.productID = pstr; return OO_OK; @@ -500,7 +500,7 @@ if (0 != versionID) { char* pstr = (char*) memAlloc (&gH323ep.ctxt, strlen(versionID)+1); strcpy (pstr, versionID); - if(gH323ep.versionID) + if (gH323ep.versionID) memFreePtr(&gH323ep.ctxt, gH323ep.versionID); gH323ep.versionID = pstr; return OO_OK; @@ -513,7 +513,7 @@ if (0 != callerID) { char* pstr = (char*) memAlloc (&gH323ep.ctxt, strlen(callerID)+1); strcpy (pstr, callerID); - if(gH323ep.callerid) + if (gH323ep.callerid) memFreePtr(&gH323ep.ctxt, gH323ep.callerid); gH323ep.callerid = pstr; return OO_OK; @@ -524,7 +524,7 @@ int ooH323EpSetCallingPartyNumber(const char* number) { int ret=OO_OK; - if(number) + if (number) { strncpy(gH323ep.callingPartyNumber, number, sizeof(gH323ep.callingPartyNumber)-1); @@ -546,7 +546,7 @@ OOTRACEINFO2("\tTrace File: %s\n", gH323ep.traceFile); - if(!OO_TESTFLAG(gH323ep.flags, OO_M_FASTSTART)) + if (!OO_TESTFLAG(gH323ep.flags, OO_M_FASTSTART)) { OOTRACEINFO1("\tFastStart - disabled\n"); } @@ -554,7 +554,7 @@ OOTRACEINFO1("\tFastStart - enabled\n"); } - if(!OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING)) + if (!OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING)) { OOTRACEINFO1("\tH245 Tunneling - disabled\n"); } @@ -562,7 +562,7 @@ OOTRACEINFO1("\tH245 Tunneling - enabled\n"); } - if(!OO_TESTFLAG(gH323ep.flags, OO_M_MEDIAWAITFORCONN)) + if (!OO_TESTFLAG(gH323ep.flags, OO_M_MEDIAWAITFORCONN)) { OOTRACEINFO1("\tMediaWaitForConnect - disabled\n"); } @@ -570,7 +570,7 @@ OOTRACEINFO1("\tMediaWaitForConnect - enabled\n"); } - if(OO_TESTFLAG(gH323ep.flags, OO_M_AUTOANSWER)) + if (OO_TESTFLAG(gH323ep.flags, OO_M_AUTOANSWER)) OOTRACEINFO1("\tAutoAnswer - enabled\n"); else OOTRACEINFO1("\tAutoAnswer - disabled\n"); @@ -782,7 +782,7 @@ int ooH323EpSetGkClientCallbacks(OOGKCLIENTCALLBACKS gkClientCallbacks) { - if(gH323ep.gkClient) + if (gH323ep.gkClient) { return ooGkClientSetCallbacks(gH323ep.gkClient, gkClientCallbacks); } @@ -798,16 +798,16 @@ /* 0-1024 are reserved for well known services */ int ooH323EpSetTCPPortRange(int base, int max) { - if(base <= 1024) + if (base <= 1024) gH323ep.tcpPorts.start = 1025; else gH323ep.tcpPorts.start = base; - if(max > 65500) + if (max > 65500) gH323ep.tcpPorts.max = 65500; else gH323ep.tcpPorts.max = max; - if(gH323ep.tcpPorts.max 65500) + if (max > 65500) gH323ep.udpPorts.max = 65500; else gH323ep.udpPorts.max = max; - if(gH323ep.udpPorts.max 65500) + if (max > 65500) gH323ep.rtpPorts.max = 65500; else gH323ep.rtpPorts.max = max; - if(gH323ep.rtpPorts.maxpctxt, sizeof(OOLogicalChannel)); - if(!pNewChannel) + if (!pNewChannel) { OOTRACEERR3("ERROR:Memory - ooAddNewLogicalChannel - pNewChannel " "(%s, %s)\n", call->callType, call->callToken); @@ -59,12 +59,12 @@ Hence we first search for existing media ports for same session and use them. This should take care of all cases. */ - if(call->mediaInfo) + if (call->mediaInfo) { pMediaInfo = call->mediaInfo; - while(pMediaInfo) + while (pMediaInfo) { - if(!strcmp(pMediaInfo->dir, dir) && + if (!strcmp(pMediaInfo->dir, dir) && (pMediaInfo->cap == epCap->cap)) { break; @@ -73,7 +73,7 @@ } } - if(pMediaInfo) + if (pMediaInfo) { OOTRACEDBGC3("Using configured media info (%s, %s)\n", call->callType, call->callToken); @@ -82,7 +82,7 @@ /* If user application has not specified a specific ip and is using multihomed mode, substitute appropriate ip. */ - if(!strcmp(pMediaInfo->lMediaIP, "0.0.0.0")) + if (!strcmp(pMediaInfo->lMediaIP, "0.0.0.0")) strcpy(pNewChannel->localIP, call->localIP); else strcpy(pNewChannel->localIP, pMediaInfo->lMediaIP); @@ -93,7 +93,7 @@ pNewChannel->localRtpPort = ooGetNextPort (OORTP); /* Ensures that RTP port is an even one */ - if((pNewChannel->localRtpPort & 1) == 1) + if ((pNewChannel->localRtpPort & 1) == 1) pNewChannel->localRtpPort = ooGetNextPort (OORTP); pNewChannel->localRtcpPort = ooGetNextPort (OORTP); @@ -102,12 +102,12 @@ /* Add new channel to the list */ pNewChannel->next = NULL; - if(!call->logicalChans) { + if (!call->logicalChans) { call->logicalChans = pNewChannel; } else{ pChannel = call->logicalChans; - while(pChannel->next) pChannel = pChannel->next; + while (pChannel->next) pChannel = pChannel->next; pChannel->next = pNewChannel; } @@ -122,7 +122,7 @@ int ChannelNo) { OOLogicalChannel *pLogicalChannel=NULL; - if(!call->logicalChans) + if (!call->logicalChans) { OOTRACEERR3("ERROR: No Open LogicalChannels - Failed " "FindLogicalChannelByChannelNo (%s, %s\n", call->callType, @@ -130,9 +130,9 @@ return NULL; } pLogicalChannel = call->logicalChans; - while(pLogicalChannel) + while (pLogicalChannel) { - if(pLogicalChannel->channelNo == ChannelNo) + if (pLogicalChannel->channelNo == ChannelNo) break; else pLogicalChannel = pLogicalChannel->next; @@ -148,13 +148,13 @@ H245H2250LogicalChannelParameters * pslcp=NULL; OOTRACEDBGC4("ooFindLogicalChannel by olc %d (%s, %s)\n", olc->forwardLogicalChannelNumber, call->callType, call->callToken); - if(olc->m.reverseLogicalChannelParametersPresent) + if (olc->m.reverseLogicalChannelParametersPresent) { OOTRACEDBGC3("Finding receive channel (%s,%s)\n", call->callType, call->callToken); psDataType = &olc->reverseLogicalChannelParameters.dataType; /* Only H2250LogicalChannelParameters are supported */ - if(olc->reverseLogicalChannelParameters.multiplexParameters.t != + if (olc->reverseLogicalChannelParameters.multiplexParameters.t != T_H245OpenLogicalChannel_reverseLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters){ OOTRACEERR4("Error:Invalid olc %d received (%s, %s)\n", olc->forwardLogicalChannelNumber, call->callType, call->callToken); @@ -169,7 +169,7 @@ call->callToken); psDataType = &olc->forwardLogicalChannelParameters.dataType; /* Only H2250LogicalChannelParameters are supported */ - if(olc->forwardLogicalChannelParameters.multiplexParameters.t != + if (olc->forwardLogicalChannelParameters.multiplexParameters.t != T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) { OOTRACEERR4("Error:Invalid olc %d received (%s, %s)\n", @@ -186,26 +186,26 @@ { OOLogicalChannel * pChannel = NULL; pChannel = call->logicalChans; - while(pChannel) + while (pChannel) { OOTRACEDBGC3("ooFindLogicalChannel, checking channel: %d:%s\n", pChannel->sessionID, pChannel->dir); - if(pChannel->sessionID == sessionID || pChannel->sessionID == 0) + if (pChannel->sessionID == sessionID || pChannel->sessionID == 0) { - if(!strcmp(pChannel->dir, dir)) + if (!strcmp(pChannel->dir, dir)) { OOTRACEDBGC3("ooFindLogicalChannel, comparing channel: %d:%s\n", pChannel->channelNo, pChannel->dir); - if(!strcmp(dir, "receive")) + if (!strcmp(dir, "receive")) { - if(ooCapabilityCheckCompatibility(call, pChannel->chanCap, + if (ooCapabilityCheckCompatibility(call, pChannel->chanCap, dataType, OORX)) { return pChannel; } } - else if(!strcmp(dir, "transmit")) + else if (!strcmp(dir, "transmit")) { - if(ooCapabilityCheckCompatibility(call, pChannel->chanCap, + if (ooCapabilityCheckCompatibility(call, pChannel->chanCap, dataType, OOTX)) { return pChannel; } @@ -223,9 +223,9 @@ { OOLogicalChannel * pChannel = NULL; pChannel = call->logicalChans; - while(pChannel) + while (pChannel) { - if(pChannel->sessionID == sessionID && !strcmp(pChannel->dir, dir)) + if (pChannel->sessionID == sessionID && !strcmp(pChannel->dir, dir)) return pChannel; else pChannel = pChannel->next; @@ -240,12 +240,12 @@ { OOLogicalChannel * pChannel = NULL; pChannel = call->logicalChans; - while(pChannel) + while (pChannel) { OOTRACEINFO6("Listing logical channel %d cap %d state %d for (%s, %s)\n", pChannel->channelNo, pChannel->chanCap->cap, pChannel->state, call->callType, call->callToken); - if(!strcmp(pChannel->dir, "transmit") && pChannel->state != OO_LOGICALCHAN_IDLE && + if (!strcmp(pChannel->dir, "transmit") && pChannel->state != OO_LOGICALCHAN_IDLE && pChannel->state != OO_LOGICALCHAN_PROPOSEDFS) return pChannel; else @@ -262,7 +262,7 @@ call->callToken); temp = call->logicalChans; - while(temp) + while (temp) { prev = temp; temp = temp->next; @@ -284,7 +284,7 @@ call->callType, call->callToken); pLogicalChannel = ooFindLogicalChannelByLogicalChannelNo(call,channelNo); - if(!pLogicalChannel) + if (!pLogicalChannel) { OOTRACEWARN4("Logical Channel %d doesn't exist, in clearLogicalChannel." " (%s, %s)\n", @@ -293,9 +293,9 @@ } epCap = (ooH323EpCapability*) pLogicalChannel->chanCap; - if(!strcmp(pLogicalChannel->dir, "receive")) + if (!strcmp(pLogicalChannel->dir, "receive")) { - if(epCap->stopReceiveChannel) + if (epCap->stopReceiveChannel) { epCap->stopReceiveChannel(call, pLogicalChannel); OOTRACEINFO4("Stopped Receive channel %d (%s, %s)\n", @@ -308,9 +308,9 @@ } else { - if(pLogicalChannel->state == OO_LOGICALCHAN_ESTABLISHED) + if (pLogicalChannel->state == OO_LOGICALCHAN_ESTABLISHED) { - if(epCap->stopTransmitChannel) + if (epCap->stopTransmitChannel) { epCap->stopTransmitChannel(call, pLogicalChannel); OOTRACEINFO4("Stopped Transmit channel %d (%s, %s)\n", @@ -332,7 +332,7 @@ int ooRemoveLogicalChannel(OOH323CallData *call, int ChannelNo) { OOLogicalChannel * temp = NULL, *prev=NULL; - if(!call->logicalChans) + if (!call->logicalChans) { OOTRACEERR4("ERROR:Remove Logical Channel - Channel %d not found " "Empty channel List(%s, %s)\n", ChannelNo, call->callType, @@ -341,11 +341,11 @@ } temp = call->logicalChans; - while(temp) + while (temp) { - if(temp->channelNo == ChannelNo) + if (temp->channelNo == ChannelNo) { - if(!prev) call->logicalChans = temp->next; + if (!prev) call->logicalChans = temp->next; else prev->next = temp->next; memFreePtr(call->pctxt, temp->chanCap); memFreePtr(call->pctxt, temp); @@ -378,9 +378,9 @@ call->callType, call->callToken); pChannel->state = OO_LOGICALCHAN_ESTABLISHED; temp = call->logicalChans; - while(temp) + while (temp) { - if(temp->channelNo != pChannel->channelNo && + if (temp->channelNo != pChannel->channelNo && temp->sessionID == pChannel->sessionID && !strcmp(temp->dir, pChannel->dir) ) { Index: addons/ooh323c/src/ooports.c =================================================================== --- addons/ooh323c/src/ooports.c (revision 228266) +++ addons/ooh323c/src/ooports.c (working copy) @@ -28,9 +28,9 @@ /* Get the next port of type TCP/UDP/RTP */ int ooGetNextPort (OOH323PortType type) { - if(type==OOTCP) + if (type==OOTCP) { - if(gH323ep.tcpPorts.current <= gH323ep.tcpPorts.max) + if (gH323ep.tcpPorts.current <= gH323ep.tcpPorts.max) return gH323ep.tcpPorts.current++; else { @@ -38,9 +38,9 @@ return gH323ep.tcpPorts.current++; } } - if(type==OOUDP) + if (type==OOUDP) { - if(gH323ep.udpPorts.current <= gH323ep.udpPorts.max) + if (gH323ep.udpPorts.current <= gH323ep.udpPorts.max) return gH323ep.udpPorts.current++; else { @@ -48,9 +48,9 @@ return gH323ep.udpPorts.current++; } } - if(type==OORTP) + if (type==OORTP) { - if(gH323ep.rtpPorts.current <= gH323ep.rtpPorts.max) + if (gH323ep.rtpPorts.current <= gH323ep.rtpPorts.max) return gH323ep.rtpPorts.current++; else { @@ -73,9 +73,9 @@ ret= ooSocketStrToAddr (ip, &ipAddrs); - while(1) + while (1) { - if((ret=ooSocketBind(socket, ipAddrs, bindPort))==0) + if ((ret=ooSocketBind(socket, ipAddrs, bindPort))==0) { ast_mutex_unlock(&bindPortLock); return bindPort; @@ -96,11 +96,11 @@ struct sockaddr_in name; size = sizeof(struct sockaddr_in); ret= ooSocketStrToAddr (ip, &ipAddrs); - if((ret=ooSocketBind(socket, ipAddrs, + if ((ret=ooSocketBind(socket, ipAddrs, 0))==ASN_OK) { ret = ooSocketGetSockName(socket, &name, &size); - if(ret == ASN_OK) + if (ret == ASN_OK) { return name.sin_port; Index: addons/ooh323c/src/ooq931.c =================================================================== --- addons/ooh323c/src/ooq931.c (revision 228266) +++ addons/ooh323c/src/ooq931.c (working copy) @@ -70,7 +70,7 @@ OOTRACEDBGB2(" callReference = %d\n", msg->callReference); msg->fromDestination = (data[2] & 0x80) != 0; - if(msg->fromDestination) + if (msg->fromDestination) OOTRACEDBGB1(" from = destination\n"); else OOTRACEDBGB1(" from = originator\n"); @@ -123,7 +123,7 @@ ie = (Q931InformationElement*) memAlloc (pctxt, sizeof(*ie) - sizeof(ie->data) + alen); - if(!ie) + if (!ie) { OOTRACEERR3("Error:Memory - ooQ931Decode - ie(%s, %s)\n", call->callType, call->callToken); @@ -139,7 +139,7 @@ else { ie = (Q931InformationElement*) memAlloc (pctxt, sizeof(*ie) - sizeof(ie->data)); - if(!ie) + if (!ie) { OOTRACEERR3("Error:Memory - ooQ931Decode - ie(%s, %s)\n", call->callType, call->callToken); @@ -149,48 +149,48 @@ ie->offset = offset; ie->length = 0; } - if(ie->discriminator == Q931BearerCapabilityIE) + if (ie->discriminator == Q931BearerCapabilityIE) { OOTRACEDBGB1(" Bearer-Capability IE = {\n"); - for(x=0; xlength; x++) + for (x=0; xlength; x++) { - if(x==0) + if (x==0) OOTRACEDBGB2(" %x", ie->data[x]); else OOTRACEDBGB2(", %x", ie->data[x]); } OOTRACEDBGB1(" }\n"); } - if(ie->discriminator == Q931DisplayIE) + if (ie->discriminator == Q931DisplayIE) { OOTRACEDBGB1(" Display IE = {\n"); OOTRACEDBGB2(" %s\n", ie->data); OOTRACEDBGB1(" }\n"); } - if(ie->discriminator == Q931KeypadIE) + if (ie->discriminator == Q931KeypadIE) { OOTRACEDBGB1(" Keypad IE = {\n"); OOTRACEDBGB2(" %s\n", ie->data); OOTRACEDBGB1(" }\n"); - if(gH323ep.h323Callbacks.onReceivedDTMF) + if (gH323ep.h323Callbacks.onReceivedDTMF) { gH323ep.h323Callbacks.onReceivedDTMF(call, (char *)ie->data); } } /* Extract calling party number TODO:Give respect to presentation and screening indicators ;-) */ - if(ie->discriminator == Q931CallingPartyNumberIE) + if (ie->discriminator == Q931CallingPartyNumberIE) { OOTRACEDBGB1(" CallingPartyNumber IE = {\n"); - if(ie->length < OO_MAX_NUMBER_LENGTH) + if (ie->length < OO_MAX_NUMBER_LENGTH) { int numoffset=1; - if(!(0x80 & ie->data[0])) numoffset = 2; + if (!(0x80 & ie->data[0])) numoffset = 2; memcpy(number, ie->data+numoffset,ie->length-numoffset); number[ie->length-numoffset]='\0'; OOTRACEDBGB2(" %s\n", number); - if(!call->callingPartyNumber) + if (!call->callingPartyNumber) ooCallSetCallingPartyNumber(call, number); } else{ @@ -201,15 +201,15 @@ } /* Extract called party number */ - if(ie->discriminator == Q931CalledPartyNumberIE) + if (ie->discriminator == Q931CalledPartyNumberIE) { OOTRACEDBGB1(" CalledPartyNumber IE = {\n"); - if(ie->length < OO_MAX_NUMBER_LENGTH) + if (ie->length < OO_MAX_NUMBER_LENGTH) { memcpy(number, ie->data+1,ie->length-1); number[ie->length-1]='\0'; OOTRACEDBGB2(" %s\n", number); - if(!call->calledPartyNumber) + if (!call->calledPartyNumber) ooCallSetCalledPartyNumber(call, number); } else{ @@ -220,7 +220,7 @@ } /* Handle Cause ie */ - if(ie->discriminator == Q931CauseIE) + if (ie->discriminator == Q931CauseIE) { msg->causeIE = ie; OOTRACEDBGB1(" Cause IE = {\n"); @@ -237,7 +237,7 @@ /*cisco router sends Q931Notify without UU ie, we just ignore notify message as of now as handling is optional for end point*/ - if(msg->messageType != Q931NotifyMsg) + if (msg->messageType != Q931NotifyMsg) rv = ooDecodeUUIE(pctxt, msg); return rv; } @@ -248,7 +248,7 @@ DListNode* curNode; unsigned int i; - for(i = 0, curNode = q931msg->ies.head; i < q931msg->ies.count; i++) { + for (i = 0, curNode = q931msg->ies.head; i < q931msg->ies.count; i++) { Q931InformationElement *ie = (Q931InformationElement*) curNode->data; if (ie->discriminator == ieCode) { return ie; @@ -360,7 +360,7 @@ ooQ931GetMessageTypeName(q931msg->messageType, buf), q931msg->messageType); - for(i = 0, curNode = q931msg->ies.head; i < q931msg->ies.count; i++) { + for (i = 0, curNode = q931msg->ies.head; i < q931msg->ies.count; i++) { Q931InformationElement *ie = (Q931InformationElement*) curNode->data; int length = (ie->length >= 0) ? ie->length : -ie->length; printf(" IE[%i] (offset 0x%X):\n", i, ie->offset); @@ -379,7 +379,7 @@ *q931msg = (Q931Message*)memAllocZ(pctxt, sizeof(Q931Message)); - if(!*q931msg) + if (!*q931msg) { OOTRACEERR1("Error:Memory - ooCreateQ931Message - q931msg\n"); return OO_FAILED; @@ -435,7 +435,7 @@ ASN1USINT newCallRef=0; - if(lastCallRef == 0) + if (lastCallRef == 0) { /* Generate a new random callRef */ srand((unsigned)time(0)); @@ -447,7 +447,7 @@ /* Note callReference can be at the most 15 bits that is from 0 to 32767. if we generate number bigger than that, bring it in range. */ - if(lastCallRef>=32766) + if (lastCallRef>=32766) lastCallRef=1; newCallRef = lastCallRef; @@ -492,7 +492,7 @@ int ooFreeQ931Message(OOCTXT* pctxt, Q931Message *q931Msg) { - if(!q931Msg) + if (!q931Msg) { /* memReset(&gH323ep.msgctxt); */ memReset(pctxt); @@ -509,13 +509,13 @@ Q931InformationElement* ie=NULL; /* OOCTXT *pctxt = &gH323ep.msgctxt; */ memset(msgbuf, 0, sizeof(msgbuf)); - if(!q931msg) + if (!q931msg) { OOTRACEERR1("ERROR: Invalid Q931 message in add user-user IE\n"); return OO_FAILED; } - if(!q931msg->userInfo) + if (!q931msg->userInfo) { OOTRACEERR1("ERROR: No User-User IE to encode\n"); return OO_FAILED; @@ -523,7 +523,7 @@ setPERBuffer(pctxt, msgbuf, sizeof(msgbuf), aligned); - if(asn1PE_H225H323_UserInformation (pctxt, + if (asn1PE_H225H323_UserInformation (pctxt, q931msg->userInfo)==ASN_OK) { OOTRACEDBGC1("UserInfo encoding - successful\n"); @@ -537,7 +537,7 @@ /* Allocate memory to hold complete UserUser Information */ ie = (Q931InformationElement*)memAlloc (pctxt, sizeof(*ie) - sizeof(ie->data) + len); - if(ie == NULL) + if (ie == NULL) { OOTRACEERR1("Error: Memory - ooEncodeUUIE - ie\n"); return OO_FAILED; @@ -549,7 +549,7 @@ THEIR DISCRIMINATOR AS PER SPEC. */ dListInit (&(q931msg->ies)); - if((dListAppend (pctxt, + if ((dListAppend (pctxt, &(q931msg->ies), ie)) == NULL) { OOTRACEERR1("Error: Failed to add UUIE in outgoing message\n"); @@ -567,21 +567,21 @@ int stat; Q931InformationElement *ie; /* OOCTXT *pctxt = &gH323ep.msgctxt; */ - if(q931Msg ==NULL) + if (q931Msg ==NULL) { OOTRACEERR1("Error: ooDecodeUUIE failed - NULL q931 message\n"); return OO_FAILED; } /* Search for UserUser IE */ - for(i = 0, curNode = q931Msg->ies.head; i < q931Msg->ies.count; + for (i = 0, curNode = q931Msg->ies.head; i < q931Msg->ies.count; i++, curNode = curNode->next) { ie = (Q931InformationElement*) curNode->data; - if(ie && ie->discriminator == Q931UserUserIE) + if (ie && ie->discriminator == Q931UserUserIE) break; } - if(i == q931Msg->ies.count) + if (i == q931Msg->ies.count) { OOTRACEERR1("No UserUser IE found in ooDecodeUUIE\n"); return OO_FAILED; @@ -590,7 +590,7 @@ /* Decode user-user ie */ q931Msg->userInfo = (H225H323_UserInformation *) memAlloc(pctxt, sizeof(H225H323_UserInformation)); - if(!q931Msg->userInfo) + if (!q931Msg->userInfo) { OOTRACEERR1("ERROR:Memory - ooDecodeUUIE - userInfo\n"); return OO_FAILED; @@ -600,7 +600,7 @@ setPERBuffer (pctxt, ie->data, ie->length, aligned); stat = asn1PD_H225H323_UserInformation (pctxt, q931Msg->userInfo); - if(stat != ASN_OK) + if (stat != ASN_OK) { OOTRACEERR1("Error: UserUser IE decode failed\n"); return OO_FAILED; @@ -627,7 +627,7 @@ setPERBuffer (pctxt, msgbuf, msglen, TRUE); ret = ooQ931Decode (call, &q931Msg, msglen, msgbuf); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed decoding Q931 message. (%s, %s)\n", call->callType, call->callToken); @@ -647,33 +647,33 @@ int stat=0; DListNode* curNode=NULL; - if(!msgbuf || size<200) + if (!msgbuf || size<200) { OOTRACEERR3("Error: Invalid message buffer/size for ooEncodeH245Message." " (%s, %s)\n", call->callType, call->callToken); return OO_FAILED; } - if(pq931Msg->messageType == Q931SetupMsg){ + if (pq931Msg->messageType == Q931SetupMsg){ msgbuf[i++] = OOSetup; } - else if(pq931Msg->messageType == Q931ConnectMsg){ + else if (pq931Msg->messageType == Q931ConnectMsg){ msgbuf[i++] = OOConnect; } - else if(pq931Msg->messageType == Q931CallProceedingMsg){ + else if (pq931Msg->messageType == Q931CallProceedingMsg){ msgbuf[i++] = OOCallProceeding; } - else if(pq931Msg->messageType == Q931AlertingMsg || + else if (pq931Msg->messageType == Q931AlertingMsg || pq931Msg->messageType == Q931ProgressMsg){ msgbuf[i++] = OOAlert; } - else if(pq931Msg->messageType == Q931ReleaseCompleteMsg){ + else if (pq931Msg->messageType == Q931ReleaseCompleteMsg){ msgbuf[i++] = OOReleaseComplete; } - else if(pq931Msg->messageType == Q931InformationMsg){ + else if (pq931Msg->messageType == Q931InformationMsg){ msgbuf[i++] = OOInformationMessage; } - else if(pq931Msg->messageType == Q931FacilityMsg){ + else if (pq931Msg->messageType == Q931FacilityMsg){ msgbuf[i++] = OOFacility; msgbuf[i++] = pq931Msg->tunneledMsgType; msgbuf[i++] = pq931Msg->logicalChannelNo>>8; @@ -686,7 +686,7 @@ } stat = ooEncodeUUIE(call->msgctxt, pq931Msg); - if(stat != OO_OK) + if (stat != OO_OK) { OOTRACEERR3("Error:Failed to encode uuie. (%s, %s)\n", call->callType, call->callToken); @@ -703,7 +703,7 @@ msgbuf[i++] = pq931Msg->protocolDiscriminator; msgbuf[i++] = 2; /* length of call ref is two octets */ msgbuf[i] = (pq931Msg->callReference >> 8); /* populate 1st octet */ - if(!strcmp(call->callType, "incoming")) + if (!strcmp(call->callType, "incoming")) msgbuf[i++] |= 0x80; /* fromDestination*/ else i++; /* fromOriginator*/ @@ -716,7 +716,7 @@ ascending order of ie codes. */ /* Add bearer IE */ - if(pq931Msg->bearerCapabilityIE) + if (pq931Msg->bearerCapabilityIE) { msgbuf[i++] = Q931BearerCapabilityIE; /* ie discriminator */ msgbuf[i++] = pq931Msg->bearerCapabilityIE->length; @@ -726,7 +726,7 @@ } /* Add cause IE */ - if(pq931Msg->causeIE) + if (pq931Msg->causeIE) { msgbuf[i++] = Q931CauseIE; msgbuf[i++] = pq931Msg->causeIE->length; @@ -735,7 +735,7 @@ } /*Add progress indicator IE - if(pq931Msg->messageType == Q931AlertingMsg || pq931Msg->messageType == Q931CallProceedingMsg) + if (pq931Msg->messageType == Q931AlertingMsg || pq931Msg->messageType == Q931CallProceedingMsg) { msgbuf[i++] = Q931ProgressIndicatorIE; msgbuf[i++] = 2; //Length is 2 octet @@ -744,7 +744,7 @@ }*/ /*Add display ie. */ - if(!ooUtilsIsStrEmpty(call->ourCallerId)) + if (!ooUtilsIsStrEmpty(call->ourCallerId)) { msgbuf[i++] = Q931DisplayIE; ieLen = strlen(call->ourCallerId)+1; @@ -755,7 +755,7 @@ } /* Add calling Party ie */ - if(pq931Msg->callingPartyNumberIE) + if (pq931Msg->callingPartyNumberIE) { msgbuf[i++] = Q931CallingPartyNumberIE; msgbuf[i++] = pq931Msg->callingPartyNumberIE->length; @@ -765,7 +765,7 @@ } /* Add called Party ie */ - if(pq931Msg->calledPartyNumberIE) + if (pq931Msg->calledPartyNumberIE) { msgbuf[i++] = Q931CalledPartyNumberIE; msgbuf[i++] = pq931Msg->calledPartyNumberIE->length; @@ -775,7 +775,7 @@ } /* Add keypad ie */ - if(pq931Msg->keypadIE) + if (pq931Msg->keypadIE) { msgbuf[i++] = Q931KeypadIE; msgbuf[i++] = pq931Msg->keypadIE->length; @@ -787,7 +787,7 @@ Right now we only put UUIE in ie list. Can be easily removed. */ - for(j = 0, curNode = pq931Msg->ies.head; j < (int)pq931Msg->ies.count; j++) + for (j = 0, curNode = pq931Msg->ies.head; j < (int)pq931Msg->ies.count; j++) { Q931InformationElement *ie = (Q931InformationElement*) curNode->data; @@ -819,7 +819,7 @@ /* Tpkt length octets populated with total length of the message */ - if(msgbuf[0] != OOFacility) + if (msgbuf[0] != OOFacility) { len = i-1; msgbuf[3] = (len >> 8); @@ -832,7 +832,7 @@ } #ifndef _COMPACT - if(msgbuf[0] != OOFacility) + if (msgbuf[0] != OOFacility) ooQ931PrintMessage (call, (unsigned char *)msgbuf+5, len-4); else ooQ931PrintMessage (call, (unsigned char *)msgbuf+8, len-4); @@ -855,7 +855,7 @@ ooLogicalChannel* pChannel; - if(pCall->pFastStartRes) { + if (pCall->pFastStartRes) { ASN1UINT k = 0; ASN1OCTET* pData; @@ -864,7 +864,7 @@ *fsElem = (ASN1DynOctStr*) memAlloc(pctxt, pCall->pFastStartRes->n * sizeof(ASN1DynOctStr)); - for(k = 0; k < pCall->pFastStartRes->n; k ++) { + for (k = 0; k < pCall->pFastStartRes->n; k ++) { (*fsElem)[k].numocts = pCall->pFastStartRes->elem[k].numocts; pData = (ASN1OCTET*) memAlloc( pctxt, (*fsElem)[k].numocts * sizeof(ASN1OCTET)); @@ -879,12 +879,12 @@ /* If fast start supported and remote endpoint has sent faststart element */ - if(OO_TESTFLAG(pCall->flags, OO_M_FASTSTART) && + if (OO_TESTFLAG(pCall->flags, OO_M_FASTSTART) && pCall->remoteFastStartOLCs.count>0) { pFS = (ASN1DynOctStr*)memAlloc(pctxt, pCall->remoteFastStartOLCs.count*sizeof(ASN1DynOctStr)); - if(!pFS) + if (!pFS) { OOTRACEERR3("Error:Memory - ooSetFastStartResponse - pFS (%s, %s)\n", pCall->callType, pCall->callToken); @@ -893,14 +893,14 @@ memset(pFS, 0, pCall->remoteFastStartOLCs.count*sizeof(ASN1DynOctStr)); /* Go though all the proposed channels */ - for(i=0, j=0; i<(int)pCall->remoteFastStartOLCs.count; i++) + for (i=0, j=0; i<(int)pCall->remoteFastStartOLCs.count; i++) { pNode = dListFindByIndex(&pCall->remoteFastStartOLCs, i); olc = (H245OpenLogicalChannel*)pNode->data; /* Don't support both direction channel */ - if(olc->forwardLogicalChannelParameters.dataType.t != + if (olc->forwardLogicalChannelParameters.dataType.t != T_H245DataType_nullData && olc->m.reverseLogicalChannelParametersPresent) { @@ -910,7 +910,7 @@ } /* Check forward logic channel */ - if(olc->forwardLogicalChannelParameters.dataType.t != + if (olc->forwardLogicalChannelParameters.dataType.t != T_H245DataType_nullData) { /* Forward Channel - remote transmits - local receives */ @@ -922,10 +922,10 @@ &olc->forwardLogicalChannelParameters.dataType, OORX); - if(!epCap) { continue; } /* Not Supported Channel */ + if (!epCap) { continue; } /* Not Supported Channel */ OOTRACEINFO1("Receive Channel data type supported\n"); - if(olc->forwardLogicalChannelParameters.multiplexParameters.t != + if (olc->forwardLogicalChannelParameters.multiplexParameters.t != T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) { OOTRACEERR4("ERROR:Unknown multiplex parameter type for " @@ -939,7 +939,7 @@ h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters; /* Check session is Not already established */ - if(ooIsSessionEstablished(pCall, olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters->sessionID, "receive")) + if (ooIsSessionEstablished(pCall, olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters->sessionID, "receive")) { OOTRACEINFO4("Receive channel with sessionID %d already " @@ -951,9 +951,9 @@ } /* Extract mediaControlChannel info, if supplied */ - if(h2250lcp->m.mediaControlChannelPresent) + if (h2250lcp->m.mediaControlChannelPresent) { - if(OO_OK != ooGetIpPortFromH245TransportAddress(pCall, + if (OO_OK != ooGetIpPortFromH245TransportAddress(pCall, &h2250lcp->mediaControlChannel, remoteMediaControlIP, &remoteMediaControlPort)) { @@ -966,7 +966,7 @@ } } /* Check reverse logical channel */ - else if(olc->m.reverseLogicalChannelParametersPresent) + else if (olc->m.reverseLogicalChannelParametersPresent) { /* Reverse channel - remote receives - local transmits */ OOTRACEDBGC4("Processing received reverse olc %d (%s, %s)\n", @@ -977,11 +977,11 @@ &olc->reverseLogicalChannelParameters.dataType, OOTX); - if(!epCap) { continue; } /* Capability not supported */ + if (!epCap) { continue; } /* Capability not supported */ OOTRACEINFO1("Transmit Channel data type supported\n"); - if(olc->reverseLogicalChannelParameters.multiplexParameters.t != + if (olc->reverseLogicalChannelParameters.multiplexParameters.t != T_H245OpenLogicalChannel_reverseLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters) { OOTRACEERR4("ERROR:Unknown multiplex parameter type for " @@ -994,7 +994,7 @@ } /* Check session is not established */ - if(ooIsSessionEstablished(pCall, olc->reverseLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters->sessionID, "transmit")) + if (ooIsSessionEstablished(pCall, olc->reverseLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters->sessionID, "transmit")) { OOTRACEINFO4("Transmit session with sessionID %d already " @@ -1007,7 +1007,7 @@ /* Extract the remote media endpoint address */ h2250lcp = olc->reverseLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters; - if(!h2250lcp) + if (!h2250lcp) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "reverse Logical Channel Parameters found. " @@ -1018,7 +1018,7 @@ } /* Reverse Channel info will be always present, crash proof */ - if(!h2250lcp->m.mediaChannelPresent) + if (!h2250lcp->m.mediaChannelPresent) { OOTRACEERR3("ERROR:Invalid OLC received in fast start. No " "reverse media channel information found. " @@ -1029,7 +1029,7 @@ } /* Get IP, PORT of reverse channel */ - if(OO_OK != ooGetIpPortFromH245TransportAddress(pCall, + if (OO_OK != ooGetIpPortFromH245TransportAddress(pCall, &h2250lcp->mediaChannel, remoteMediaIP, &remoteMediaPort)) { @@ -1041,9 +1041,9 @@ } /* Extract mediaControlChannel info, if supplied */ - if(h2250lcp->m.mediaControlChannelPresent) + if (h2250lcp->m.mediaControlChannelPresent) { - if(OO_OK != ooGetIpPortFromH245TransportAddress(pCall, + if (OO_OK != ooGetIpPortFromH245TransportAddress(pCall, &h2250lcp->mediaControlChannel, remoteMediaControlIP, &remoteMediaControlPort)) { @@ -1056,14 +1056,14 @@ } } - if(dir & OOTX) + if (dir & OOTX) { /* According to the spec if we are accepting olc for transmission from called endpoint to calling endpoint, called endpoint should insert a unqiue forwardLogicalChannelNumber into olc */ olc->forwardLogicalChannelNumber = pCall->logicalChanNoCur++; - if(pCall->logicalChanNoCur > pCall->logicalChanNoMax) + if (pCall->logicalChanNoCur > pCall->logicalChanNoMax) pCall->logicalChanNoCur = pCall->logicalChanNoBase; } @@ -1074,11 +1074,11 @@ (pCall, olc->forwardLogicalChannelNumber); /* start receive and tramsmit channel listening */ - if(dir & OORX) + if (dir & OORX) { strcpy(pChannel->remoteIP, remoteMediaControlIP); pChannel->remoteMediaControlPort = remoteMediaControlPort; - if(epCap->startReceiveChannel) + if (epCap->startReceiveChannel) { epCap->startReceiveChannel(pCall, pChannel); OOTRACEINFO4("Receive channel of type %s started (%s, %s)\n", @@ -1093,13 +1093,13 @@ return OO_FAILED; } } - if(dir & OOTX) + if (dir & OOTX) { pChannel->remoteMediaPort = remoteMediaPort; strcpy(pChannel->remoteIP, remoteMediaIP); pChannel->remoteMediaControlPort = remoteMediaControlPort; - if(epCap->startTransmitChannel) + if (epCap->startTransmitChannel) { epCap->startTransmitChannel(pCall, pChannel); OOTRACEINFO3("Transmit channel of type audio started " @@ -1116,12 +1116,12 @@ /* Encode fast start element */ setPERBuffer(pctxt, NULL, 0, 1); - if(asn1PE_H245OpenLogicalChannel(pctxt, olc) != ASN_OK) + if (asn1PE_H245OpenLogicalChannel(pctxt, olc) != ASN_OK) { OOTRACEERR3("ERROR:Encoding of olc failed for faststart " "(%s, %s)\n", pCall->callType, pCall->callToken); ooFreeQ931Message(pctxt, pQ931msg); - if(pCall->callState < OO_CALL_CLEAR) + if (pCall->callState < OO_CALL_CLEAR) { pCall->callEndReason = OO_REASON_LOCAL_CLEARED; pCall->callState = OO_CALL_CLEAR; @@ -1137,12 +1137,12 @@ setEventHandler (pctxt, &printHandler); memset(&printOlc, 0, sizeof(printOlc)); ret = asn1PD_H245OpenLogicalChannel(pctxt, &(printOlc)); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("Error: Failed decoding FastStart Element (%s, %s)\n", pCall->callType, pCall->callToken); ooFreeQ931Message(pctxt, pQ931msg); - if(pCall->callState < OO_CALL_CLEAR) + if (pCall->callState < OO_CALL_CLEAR) { pCall->callEndReason = OO_REASON_LOCAL_CLEARED; pCall->callState = OO_CALL_CLEAR; @@ -1159,7 +1159,7 @@ } OOTRACEDBGA4("Added %d fast start elements to message " "(%s, %s)\n", j, pCall->callType, pCall->callToken); - if(j != 0) + if (j != 0) { ASN1UINT k = 0; ASN1OCTET* pData; @@ -1174,7 +1174,7 @@ pCall->pFastStartRes->elem = (ASN1DynOctStr*) memAlloc(pCall->pctxt, pCall->pFastStartRes->n * sizeof(ASN1DynOctStr)); - for(k = 0; k < pCall->pFastStartRes->n; k ++) { + for (k = 0; k < pCall->pFastStartRes->n; k ++) { pCall->pFastStartRes->elem[k].numocts = (*fsElem)[k].numocts; pData = (ASN1OCTET*) memAlloc(pCall->pctxt, pCall->pFastStartRes->elem[k].numocts * sizeof(ASN1OCTET)); @@ -1204,17 +1204,17 @@ int ooSendTCSandMSD(OOH323CallData *call) { int ret; - if(call->localTermCapState == OO_LocalTermCapExchange_Idle) { + if (call->localTermCapState == OO_LocalTermCapExchange_Idle) { ret = ooSendTermCapMsg(call); - if(ret != OO_OK) { + if (ret != OO_OK) { OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n", call->callType, call->callToken); return ret; } } - if(call->masterSlaveState == OO_MasterSlave_Idle) { + if (call->masterSlaveState == OO_MasterSlave_Idle) { ret = ooSendMasterSlaveDetermination(call); - if(ret != OO_OK) { + if (ret != OO_OK) { OOTRACEERR3("ERROR:Sending Master-slave determination message " "(%s, %s)\n", call->callType, call->callToken); return ret; @@ -1241,7 +1241,7 @@ OOTRACEDBGC3("Building CallProceeding (%s, %s)\n", call->callType, call->callToken); ret = ooCreateQ931Message(pctxt, &q931msg, Q931CallProceedingMsg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error: In allocating memory for - H225 Call " "Proceeding message\n"); @@ -1252,7 +1252,7 @@ q931msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt, sizeof(H225H323_UserInformation)); - if(!q931msg->userInfo) + if (!q931msg->userInfo) { OOTRACEERR1("ERROR:Memory - ooSendCallProceeding - userInfo\n"); return OO_FAILED; @@ -1266,7 +1266,7 @@ callProceeding = (H225CallProceeding_UUIE*)memAlloc(pctxt, sizeof(H225CallProceeding_UUIE)); - if(!callProceeding) + if (!callProceeding) { OOTRACEERR1("ERROR:Memory - ooSendCallProceeding - callProceeding\n"); return OO_FAILED; @@ -1287,14 +1287,14 @@ callProceeding->protocolIdentifier = gProtocolID; /* Pose as Terminal or Gateway */ - if(gH323ep.isGateway) + if (gH323ep.isGateway) callProceeding->destinationInfo.m.gatewayPresent = TRUE; else callProceeding->destinationInfo.m.terminalPresent = TRUE; callProceeding->destinationInfo.m.vendorPresent = 1; vendor = &callProceeding->destinationInfo.vendor; - if(gH323ep.productID) + if (gH323ep.productID) { vendor->m.productIdPresent = 1; vendor->productId.numocts = ASN1MIN(strlen(gH323ep.productID), @@ -1302,7 +1302,7 @@ strncpy((char *)vendor->productId.data, gH323ep.productID, vendor->productId.numocts); } - if(gH323ep.versionID) + if (gH323ep.versionID) { vendor->m.versionIdPresent = 1; vendor->versionId.numocts = ASN1MIN(strlen(gH323ep.versionID), @@ -1318,7 +1318,7 @@ OOTRACEDBGA3("Built Call Proceeding(%s, %s)\n", call->callType, call->callToken); ret = ooSendH225Msg(call, q931msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue CallProceeding message to outbound queue.(%s, %s)\n", call->callType, call->callToken); } @@ -1339,7 +1339,7 @@ OOCTXT *pctxt = call->msgctxt; ret = ooCreateQ931Message(pctxt, &q931msg, Q931AlertingMsg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error: In allocating memory for - H225 " "Alerting message\n"); @@ -1352,7 +1352,7 @@ q931msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt, sizeof(H225H323_UserInformation)); - if(!q931msg->userInfo) + if (!q931msg->userInfo) { OOTRACEERR1("ERROR:Memory - ooSendAlerting - userInfo\n"); return OO_FAILED; @@ -1366,7 +1366,7 @@ alerting = (H225Alerting_UUIE*)memAlloc(pctxt, sizeof(H225Alerting_UUIE)); - if(!alerting) + if (!alerting) { OOTRACEERR1("ERROR:Memory - ooSendAlerting - alerting\n"); return OO_FAILED; @@ -1380,13 +1380,13 @@ /*Populate aliases */ alerting->m.alertingAddressPresent = TRUE; - if(call->ourAliases) + if (call->ourAliases) ret = ooPopulateAliasList(pctxt, call->ourAliases, &alerting->alertingAddress); else ret = ooPopulateAliasList(pctxt, gH323ep.aliases, &alerting->alertingAddress); - if(OO_OK != ret) + if (OO_OK != ret) { OOTRACEERR1("Error:Failed to populate alias list in Alert message\n"); memReset(pctxt); @@ -1409,14 +1409,14 @@ alerting->protocolIdentifier = gProtocolID; /* Pose as Terminal or Gateway */ - if(gH323ep.isGateway) + if (gH323ep.isGateway) alerting->destinationInfo.m.gatewayPresent = TRUE; else alerting->destinationInfo.m.terminalPresent = TRUE; alerting->destinationInfo.m.vendorPresent = 1; vendor = &alerting->destinationInfo.vendor; - if(gH323ep.productID) + if (gH323ep.productID) { vendor->m.productIdPresent = 1; vendor->productId.numocts = ASN1MIN(strlen(gH323ep.productID), @@ -1424,7 +1424,7 @@ strncpy((char *)vendor->productId.data, gH323ep.productID, vendor->productId.numocts); } - if(gH323ep.versionID) + if (gH323ep.versionID) { vendor->m.versionIdPresent = 1; vendor->versionId.numocts = ASN1MIN(strlen(gH323ep.versionID), @@ -1440,8 +1440,8 @@ if (!call->fsSent) { ret = ooSetFastStartResponse(call, q931msg, &alerting->fastStart.n, &alerting->fastStart.elem); - if(ret != ASN_OK) { return ret; } - if(alerting->fastStart.n > 0) { + if (ret != ASN_OK) { return ret; } + if (alerting->fastStart.n > 0) { alerting->m.fastStartPresent = TRUE; call->fsSent = TRUE; } else @@ -1453,7 +1453,7 @@ OOTRACEDBGA3("Built Alerting (%s, %s)\n", call->callType, call->callToken); ret = ooSendH225Msg(call, q931msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: Failed to enqueue Alerting message to outbound queue. (%s, %s)\n", call->callType, call->callToken); } @@ -1474,7 +1474,7 @@ OOCTXT *pctxt = call->msgctxt; ret = ooCreateQ931Message(pctxt, &q931msg, Q931ProgressMsg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error: In allocating memory for - H225 " "Alerting message\n"); @@ -1485,7 +1485,7 @@ q931msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt, sizeof(H225H323_UserInformation)); - if(!q931msg->userInfo) + if (!q931msg->userInfo) { OOTRACEERR1("ERROR:Memory - ooSendAlerting - userInfo\n"); return OO_FAILED; @@ -1499,7 +1499,7 @@ progress = (H225Progress_UUIE*)memAlloc(pctxt, sizeof(H225Progress_UUIE)); - if(!progress) + if (!progress) { OOTRACEERR1("ERROR:Memory - ooSendProgress- alerting\n"); return OO_FAILED; @@ -1519,14 +1519,14 @@ progress->protocolIdentifier = gProtocolID; /* Pose as Terminal or Gateway */ - if(gH323ep.isGateway) + if (gH323ep.isGateway) progress->destinationInfo.m.gatewayPresent = TRUE; else progress->destinationInfo.m.terminalPresent = TRUE; progress->destinationInfo.m.vendorPresent = 1; vendor = &progress->destinationInfo.vendor; - if(gH323ep.productID) + if (gH323ep.productID) { vendor->m.productIdPresent = 1; vendor->productId.numocts = ASN1MIN(strlen(gH323ep.productID), @@ -1534,7 +1534,7 @@ strncpy((char *)vendor->productId.data, gH323ep.productID, vendor->productId.numocts); } - if(gH323ep.versionID) + if (gH323ep.versionID) { vendor->m.versionIdPresent = 1; vendor->versionId.numocts = ASN1MIN(strlen(gH323ep.versionID), @@ -1550,8 +1550,8 @@ if (!call->fsSent) { ret = ooSetFastStartResponse(call, q931msg, &progress->fastStart.n, &progress->fastStart.elem); - if(ret != ASN_OK) { return ret; } - if(progress->fastStart.n > 0) { + if (ret != ASN_OK) { return ret; } + if (progress->fastStart.n > 0) { progress->m.fastStartPresent = TRUE; call->fsSent = TRUE; } else @@ -1572,7 +1572,7 @@ h245IpAddr = (H225TransportAddress_ipAddress*) memAllocZ (pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!h245IpAddr) + if (!h245IpAddr) { OOTRACEERR3("Error:Memory - ooAcceptCall - h245IpAddr" "(%s, %s)\n", call->callType, call->callToken); @@ -1587,7 +1587,7 @@ OOTRACEDBGA3("Built Progress (%s, %s)\n", call->callType, call->callToken); ret = ooSendH225Msg(call, q931msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: Failed to enqueue Alerting message to outbound queue. (%s, %s)\n", call->callType, call->callToken); } @@ -1611,7 +1611,7 @@ OOTRACEDBGA3("Building Facility message (%s, %s)\n", call->callType, call->callToken); ret = ooCreateQ931Message(pctxt, &pQ931Msg, Q931FacilityMsg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3 ("ERROR: In allocating memory for facility message (%s, %s)\n", @@ -1623,7 +1623,7 @@ pQ931Msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt, sizeof(H225H323_UserInformation)); - if(!pQ931Msg->userInfo) + if (!pQ931Msg->userInfo) { OOTRACEERR3("ERROR:Memory - ooSendFacility - userInfo(%s, %s)\n", call->callType, call->callToken); @@ -1641,7 +1641,7 @@ facility = (H225Facility_UUIE*) memAllocZ (pctxt, sizeof(H225Facility_UUIE)); - if(!facility) + if (!facility) { OOTRACEERR3("ERROR:Memory - ooSendFacility - facility (%s, %s)" "\n", call->callType, call->callToken); @@ -1671,7 +1671,7 @@ h245IpAddr = (H225TransportAddress_ipAddress*) memAllocZ (pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!h245IpAddr) { + if (!h245IpAddr) { OOTRACEERR3("Error:Memory - ooSendFacility - h245IpAddr" "(%s, %s)\n", call->callType, call->callToken); return OO_FAILED; @@ -1685,7 +1685,7 @@ call->callToken); ret = ooSendH225Msg(call, pQ931Msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3 ("Error:Failed to enqueue Facility message to outbound " @@ -1709,11 +1709,11 @@ OOTRACEDBGA3("Building Release Complete message to send(%s, %s)\n", call->callType, call->callToken); ret = ooCreateQ931Message(pctxt, &q931msg, Q931ReleaseCompleteMsg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: In ooCreateQ931Message - H225 Release Complete " "message(%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -1725,7 +1725,7 @@ q931msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt, sizeof(H225H323_UserInformation)); - if(!q931msg->userInfo) + if (!q931msg->userInfo) { OOTRACEERR1("ERROR:Memory - ooSendReleaseComplete - userInfo\n"); return OO_FAILED; @@ -1734,7 +1734,7 @@ releaseComplete = (H225ReleaseComplete_UUIE*)memAlloc(pctxt, sizeof(H225ReleaseComplete_UUIE)); - if(!releaseComplete) + if (!releaseComplete) { OOTRACEERR3("Error:Memory - ooSendReleaseComplete - releaseComplete" "(%s, %s)\n", call->callType, call->callToken); @@ -1779,7 +1779,7 @@ call->callType, call->callToken); /* Send H225 message */ ret = ooSendH225Msg(call, q931msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue ReleaseComplete message to outbound" " queue.(%s, %s)\n", call->callType, call->callToken); @@ -1795,8 +1795,8 @@ call->connectTime = (H235TimeStamp) time(NULL); - if(gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) { - if(gH323ep.gkClient->state == GkClientRegistered) { + if (gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) { + if (gH323ep.gkClient->state == GkClientRegistered) { ooGkClientSendIRR(gH323ep.gkClient, call); } } @@ -1817,7 +1817,7 @@ OOCTXT *pctxt = call->msgctxt; ret = ooCreateQ931Message(pctxt, &q931msg, Q931ConnectMsg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("Error: In allocating memory for - H225 " "Connect message\n"); @@ -1826,7 +1826,7 @@ q931msg->callReference = call->callReference; /* Set bearer capability */ - if(OO_OK != ooSetBearerCapabilityIE(pctxt, q931msg, Q931CCITTStd, + if (OO_OK != ooSetBearerCapabilityIE(pctxt, q931msg, Q931CCITTStd, // Q931TransferUnrestrictedDigital, Q931TransferPacketMode, // Q931TransferRatePacketMode, Q931UserInfoLayer1G722G725)) Q931TransferSpeech, Q931TransferCircuitMode, @@ -1840,7 +1840,7 @@ q931msg->userInfo = (H225H323_UserInformation*) memAllocZ (pctxt,sizeof(H225H323_UserInformation)); - if(!q931msg->userInfo) + if (!q931msg->userInfo) { OOTRACEERR1("ERROR:Memory - ooAcceptCall - userInfo\n"); return OO_FAILED; @@ -1857,7 +1857,7 @@ connect = (H225Connect_UUIE*) memAllocZ (pctxt, sizeof(H225Connect_UUIE)); - if(!connect) + if (!connect) { OOTRACEERR1("ERROR:Memory - ooAcceptCall - connect\n"); return OO_FAILED; @@ -1886,13 +1886,13 @@ call->confIdentifier.numocts); /* Populate alias addresses */ connect->m.connectedAddressPresent = TRUE; - if(call->ourAliases) + if (call->ourAliases) ret = ooPopulateAliasList(pctxt, call->ourAliases, &connect->connectedAddress); else ret = ooPopulateAliasList(pctxt, gH323ep.aliases, &connect->connectedAddress); - if(OO_OK != ret) + if (OO_OK != ret) { OOTRACEERR1("Error:Failed to populate alias list in Connect message\n"); memReset(pctxt); @@ -1907,7 +1907,7 @@ connect->protocolIdentifier = gProtocolID; /* Pose as Terminal or Gateway */ - if(gH323ep.isGateway) + if (gH323ep.isGateway) connect->destinationInfo.m.gatewayPresent = TRUE; else connect->destinationInfo.m.terminalPresent = TRUE; @@ -1919,7 +1919,7 @@ vendor->vendor.t35CountryCode = gH323ep.t35CountryCode; vendor->vendor.t35Extension = gH323ep.t35Extension; vendor->vendor.manufacturerCode = gH323ep.manufacturerCode; - if(gH323ep.productID) + if (gH323ep.productID) { vendor->m.productIdPresent = 1; vendor->productId.numocts = ASN1MIN(strlen(gH323ep.productID), @@ -1927,7 +1927,7 @@ strncpy((char *)vendor->productId.data, gH323ep.productID, vendor->productId.numocts); } - if(gH323ep.versionID) + if (gH323ep.versionID) { vendor->m.versionIdPresent = 1; vendor->versionId.numocts = ASN1MIN(strlen(gH323ep.versionID), @@ -1939,8 +1939,8 @@ if (!call->fsSent) { ret = ooSetFastStartResponse(call, q931msg, &connect->fastStart.n, &connect->fastStart.elem); - if(ret != ASN_OK) { return ret; } - if(connect->fastStart.n > 0) { + if (ret != ASN_OK) { return ret; } + if (connect->fastStart.n > 0) { connect->m.fastStartPresent = TRUE; call->fsSent = TRUE; } else @@ -1950,9 +1950,9 @@ } /* free the stored fast start response */ - if(call->pFastStartRes) { + if (call->pFastStartRes) { int k; - for(k = 0; k < call->pFastStartRes->n; k ++) { + for (k = 0; k < call->pFastStartRes->n; k ++) { memFreePtr(call->pctxt, call->pFastStartRes->elem[k].data); } memFreePtr(call->pctxt, call->pFastStartRes->elem); @@ -1973,7 +1973,7 @@ h245IpAddr = (H225TransportAddress_ipAddress*) memAllocZ (pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!h245IpAddr) + if (!h245IpAddr) { OOTRACEERR3("Error:Memory - ooAcceptCall - h245IpAddr" "(%s, %s)\n", call->callType, call->callToken); @@ -1989,11 +1989,11 @@ call->callToken); /* H225 message callback */ - if(gH323ep.h225Callbacks.onBuiltConnect) + if (gH323ep.h225Callbacks.onBuiltConnect) gH323ep.h225Callbacks.onBuiltConnect(call, q931msg); ret=ooSendH225Msg(call, q931msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue Connect message to outbound queue.(%s, %s)\n", call->callType, call->callToken); /* memReset(&gH323ep.msgctxt);*/ @@ -2021,20 +2021,20 @@ pctxt = fwdedCall->pctxt; /* Retrieve new destination info from original call */ - if(!ooUtilsIsStrEmpty(call->pCallFwdData->ip)) + if (!ooUtilsIsStrEmpty(call->pCallFwdData->ip)) { strcpy(fwdedCall->remoteIP, call->pCallFwdData->ip); } fwdedCall->remotePort = call->pCallFwdData->port; - if(call->pCallFwdData->aliases) + if (call->pCallFwdData->aliases) { alias = call->pCallFwdData->aliases; - while(alias) + while (alias) { pNewAlias = (ooAliases*) memAlloc(pctxt, sizeof(ooAliases)); pNewAlias->value = (char*) memAlloc(pctxt, strlen(alias->value)+1); - if(!pNewAlias || !pNewAlias->value) + if (!pNewAlias || !pNewAlias->value) { OOTRACEERR3("Error:Memory - ooH323HandleCallFwdRequest - " "pNewAlias/pNewAlias->value" @@ -2060,7 +2060,7 @@ } - if(gH323ep.gkClient && !OO_TESTFLAG(fwdedCall->flags, OO_M_DISABLEGK)) + if (gH323ep.gkClient && !OO_TESTFLAG(fwdedCall->flags, OO_M_DISABLEGK)) { /* No need to check registration status here as it is already checked for MakeCall command */ @@ -2087,7 +2087,7 @@ int ooH323NewCall(char *callToken) { OOH323CallData* call; - if(!callToken) + if (!callToken) { OOTRACEERR1("ERROR: Invalid callToken parameter to make call\n"); return OO_FAILED; @@ -2111,12 +2111,12 @@ char *ip=NULL, *port = NULL; struct timespec ts; - if(!dest) + if (!dest) { OOTRACEERR1("ERROR:Invalid destination for new call\n"); return OO_FAILED; } - if(!callToken) + if (!callToken) { OOTRACEERR1("ERROR: Invalid callToken parameter to make call\n"); return OO_FAILED; @@ -2131,19 +2131,19 @@ } pctxt = call->pctxt; - if(opts) + if (opts) { - if(opts->fastStart) + if (opts->fastStart) OO_SETFLAG(call->flags, OO_M_FASTSTART); else OO_CLRFLAG(call->flags, OO_M_FASTSTART); - if(opts->tunneling) + if (opts->tunneling) OO_SETFLAG(call->flags, OO_M_TUNNELING); else OO_CLRFLAG(call->flags, OO_M_TUNNELING); - if(opts->disableGk) + if (opts->disableGk) OO_SETFLAG(call->flags, OO_M_DISABLEGK); else OO_CLRFLAG(call->flags, OO_M_DISABLEGK); @@ -2154,7 +2154,7 @@ ret = ooParseDestination(call, dest, tmp, 24, &call->remoteAliases); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR2("Error: Failed to parse the destination string %s for " "new call\n", dest); @@ -2163,7 +2163,7 @@ } /* Check whether we have ip address */ - if(!ooUtilsIsStrEmpty(tmp)) { + if (!ooUtilsIsStrEmpty(tmp)) { ip = tmp; port = strchr(tmp, ':'); *port = '\0'; @@ -2182,7 +2182,7 @@ } - if(gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) + if (gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK)) { /* No need to check registration status here as it is already checked for MakeCall command */ @@ -2216,20 +2216,20 @@ { int ret=0; - if(!call) + if (!call) { /* Call not supplied. Must locate it in list */ OOTRACEERR1("ERROR: Invalid call parameter to ooH323CallAdmitted"); return OO_FAILED; } - if(!strcmp(call->callType, "outgoing")) { + if (!strcmp(call->callType, "outgoing")) { ret = ooCreateH225Connection(call); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR:Failed to create H225 connection to %s:%d\n", call->remoteIP, call->remotePort); - if(call->callState< OO_CALL_CLEAR) + if (call->callState< OO_CALL_CLEAR) { call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_UNKNOWN; @@ -2237,7 +2237,7 @@ return OO_FAILED; } - if(gH323ep.h323Callbacks.onOutgoingCall) { + if (gH323ep.h323Callbacks.onOutgoingCall) { /* Outgoing call callback function */ gH323ep.h323Callbacks.onOutgoingCall(call); } @@ -2246,17 +2246,17 @@ } else { /* incoming call */ - if(gH323ep.h323Callbacks.onIncomingCall) { + if (gH323ep.h323Callbacks.onIncomingCall) { /* Incoming call callback function */ gH323ep.h323Callbacks.onIncomingCall(call); } /* Check for manual ringback generation */ - if(!OO_TESTFLAG(gH323ep.flags, OO_M_MANUALRINGBACK)) + if (!OO_TESTFLAG(gH323ep.flags, OO_M_MANUALRINGBACK)) { ooSendAlerting(call); /* Send alerting message */ - if(OO_TESTFLAG(gH323ep.flags, OO_M_AUTOANSWER)) { + if (OO_TESTFLAG(gH323ep.flags, OO_M_AUTOANSWER)) { ooSendConnect(call); /* Send connect message - call accepted */ } } @@ -2285,7 +2285,7 @@ pctxt = call->msgctxt; ret = ooCreateQ931Message(pctxt, &q931msg, Q931SetupMsg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR1("ERROR:Failed to Create Q931 SETUP Message\n "); return OO_FAILED; @@ -2294,7 +2294,7 @@ q931msg->callReference = call->callReference; /* Set bearer capability */ - if(OO_OK != ooSetBearerCapabilityIE(pctxt, q931msg, Q931CCITTStd, + if (OO_OK != ooSetBearerCapabilityIE(pctxt, q931msg, Q931CCITTStd, // Q931TransferUnrestrictedDigital, Q931TransferPacketMode, call->transfercap, Q931TransferCircuitMode, // Q931TransferRatePacketMode, Q931UserInfoLayer1G722G725)) @@ -2306,27 +2306,27 @@ } /* Set calling party number Q931 IE */ - if(call->callingPartyNumber && call->callingPartyNumber[0]) + if (call->callingPartyNumber && call->callingPartyNumber[0]) ooQ931SetCallingPartyNumberIE(pctxt, q931msg, (const char*)call->callingPartyNumber, 1, 0, 0, 0); /* Set called party number Q931 IE */ - if(call->calledPartyNumber) + if (call->calledPartyNumber) ooQ931SetCalledPartyNumberIE(pctxt, q931msg, (const char*)call->calledPartyNumber, 1, 0); - else if(call->remoteAliases) { + else if (call->remoteAliases) { pAlias = call->remoteAliases; - while(pAlias) { - if(pAlias->type == T_H225AliasAddress_dialedDigits) + while (pAlias) { + if (pAlias->type == T_H225AliasAddress_dialedDigits) break; pAlias = pAlias->next; } - if(pAlias) + if (pAlias) { call->calledPartyNumber = (char*)memAlloc(call->pctxt, strlen(pAlias->value)+1); - if(!call->calledPartyNumber) + if (!call->calledPartyNumber) { OOTRACEERR3("Error:Memory - ooH323MakeCall_helper - " "calledPartyNumber(%s, %s)\n", call->callType, @@ -2342,7 +2342,7 @@ q931msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt, sizeof(H225H323_UserInformation)); - if(!q931msg->userInfo) + if (!q931msg->userInfo) { OOTRACEERR1("ERROR:Memory - ooH323MakeCall_helper - userInfo\n"); return OO_FAILED; @@ -2350,7 +2350,7 @@ memset(q931msg->userInfo, 0, sizeof(H225H323_UserInformation)); setup = (H225Setup_UUIE*) memAlloc(pctxt, sizeof(H225Setup_UUIE)); - if(!setup) + if (!setup) { OOTRACEERR3("Error:Memory - ooH323MakeCall_helper - setup (%s, %s)\n", call->callType, call->callToken); @@ -2361,16 +2361,16 @@ /* Populate Alias Address.*/ - if(call->ourAliases || gH323ep.aliases) + if (call->ourAliases || gH323ep.aliases) { setup->m.sourceAddressPresent = TRUE; - if(call->ourAliases) + if (call->ourAliases) ret = ooPopulateAliasList(pctxt, call->ourAliases, &setup->sourceAddress); - else if(gH323ep.aliases) + else if (gH323ep.aliases) ret = ooPopulateAliasList(pctxt, gH323ep.aliases, &setup->sourceAddress); - if(OO_OK != ret) + if (OO_OK != ret) { OOTRACEERR1("Error:Failed to populate alias list in SETUP message\n"); memReset(pctxt); @@ -2390,12 +2390,12 @@ setup->maintainConnection = FALSE; /* Populate Destination aliases */ - if(call->remoteAliases) + if (call->remoteAliases) { setup->m.destinationAddressPresent = TRUE; ret = ooPopulateAliasList(pctxt, call->remoteAliases, &setup->destinationAddress); - if(OO_OK != ret) + if (OO_OK != ret) { OOTRACEERR1("Error:Failed to populate destination alias list in SETUP" "message\n"); @@ -2405,7 +2405,7 @@ } /* Populate the vendor information */ - if(gH323ep.isGateway) + if (gH323ep.isGateway) setup->sourceInfo.m.gatewayPresent = TRUE; else setup->sourceInfo.m.terminalPresent = TRUE; @@ -2415,7 +2415,7 @@ setup->sourceInfo.vendor.vendor.t35Extension = gH323ep.t35Extension; setup->sourceInfo.vendor.vendor.manufacturerCode= gH323ep.manufacturerCode; - if(gH323ep.productID) + if (gH323ep.productID) { setup->sourceInfo.vendor.m.productIdPresent=TRUE; setup->sourceInfo.vendor.productId.numocts = ASN1MIN( @@ -2427,7 +2427,7 @@ else setup->sourceInfo.vendor.m.productIdPresent=FALSE; - if(gH323ep.versionID) + if (gH323ep.versionID) { setup->sourceInfo.vendor.m.versionIdPresent=TRUE; setup->sourceInfo.vendor.versionId.numocts = ASN1MIN( @@ -2446,7 +2446,7 @@ setup->destCallSignalAddress.t=T_H225TransportAddress_ipAddress; destCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!destCallSignalIpAddress) + if (!destCallSignalIpAddress) { OOTRACEERR3("Error:Memory - ooH323MakeCall_helper - " "destCallSignalAddress. (%s, %s)\n", call->callType, @@ -2466,7 +2466,7 @@ setup->sourceCallSignalAddress.t=T_H225TransportAddress_ipAddress; srcCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!srcCallSignalIpAddress) + if (!srcCallSignalIpAddress) { OOTRACEERR3("Error:Memory - ooH323MakeCall_helper - srcCallSignalAddress" "(%s, %s)\n", call->callType, call->callToken); @@ -2479,7 +2479,7 @@ setup->sourceCallSignalAddress.u.ipAddress = srcCallSignalIpAddress; setup->m.sourceCallSignalAddressPresent=TRUE; /* No fast start */ - if(!OO_TESTFLAG(call->flags, OO_M_FASTSTART)) + if (!OO_TESTFLAG(call->flags, OO_M_FASTSTART)) { setup->m.fastStartPresent = FALSE; } @@ -2487,7 +2487,7 @@ setup->m.fastStartPresent = TRUE; pFS = (ASN1DynOctStr*)memAlloc(pctxt, gH323ep.noOfCaps* sizeof(ASN1DynOctStr)); - if(!pFS) + if (!pFS) { OOTRACEERR3("Error:Memory - ooH323MakeCall_helper - pFS(%s, %s)\n", call->callType, call->callToken); @@ -2496,13 +2496,13 @@ /* Use preference order of codecs */ i=0; - for(k=0; k< call->capPrefs.index; k++) + for (k=0; k< call->capPrefs.index; k++) { OOTRACEDBGC5("Preffered capability at index %d is %s. (%s, %s)\n", k, ooGetCapTypeText(call->capPrefs.order[k]), call->callType, call->callToken); - if(call->ourCaps) { + if (call->ourCaps) { epCap = call->ourCaps; OOTRACEDBGC3("Using call specific capabilities in faststart of " "setup message. (%s, %s)\n", call->callType, @@ -2515,11 +2515,11 @@ call->callToken); } - while(epCap){ - if(epCap->cap == call->capPrefs.order[k]) break; + while (epCap){ + if (epCap->cap == call->capPrefs.order[k]) break; else epCap = epCap->next; } - if(!epCap) + if (!epCap) { OOTRACEWARN4("Warn:Preferred capability %s is abscent in " "capability list. (%s, %s)\n", @@ -2536,16 +2536,16 @@ OOTRACEDBGC4("Building olcs with capability %s. (%s, %s)\n", ooGetCapTypeText(epCap->cap), call->callType, call->callToken); - if(epCap->dir & OORX) + if (epCap->dir & OORX) { olc = (H245OpenLogicalChannel*)memAlloc(pctxt, sizeof(H245OpenLogicalChannel)); - if(!olc) + if (!olc) { OOTRACEERR3("ERROR:Memory - ooH323MakeCall_helper - olc(%s, %s)" "\n", call->callType, call->callToken); ooFreeQ931Message(pctxt, q931msg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -2554,18 +2554,18 @@ } memset(olc, 0, sizeof(H245OpenLogicalChannel)); olc->forwardLogicalChannelNumber = call->logicalChanNoCur++; - if(call->logicalChanNoCur > call->logicalChanNoMax) + if (call->logicalChanNoCur > call->logicalChanNoMax) call->logicalChanNoCur = call->logicalChanNoBase; ooBuildFastStartOLC(call, olc, epCap, pctxt, OORX); /* Do not specify msg buffer let automatic allocation work */ setPERBuffer(pctxt, NULL, 0, aligned); - if(asn1PE_H245OpenLogicalChannel(pctxt, olc) != ASN_OK) + if (asn1PE_H245OpenLogicalChannel(pctxt, olc) != ASN_OK) { OOTRACEERR3("ERROR:Encoding of olc failed for faststart(%s, %s)" "\n", call->callType, call->callToken); ooFreeQ931Message(pctxt, q931msg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -2581,12 +2581,12 @@ setEventHandler (pctxt, &printHandler); memset(&printOlc, 0, sizeof(printOlc)); ret = asn1PD_H245OpenLogicalChannel(pctxt, &(printOlc)); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("Error: Failed decoding FastStart Element." "(%s, %s)\n", call->callType, call->callToken); ooFreeQ931Message(pctxt, q931msg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -2604,16 +2604,16 @@ call->callToken); } - if(epCap->dir & OOTX) + if (epCap->dir & OOTX) { olc = (H245OpenLogicalChannel*)memAlloc(pctxt, sizeof(H245OpenLogicalChannel)); - if(!olc) + if (!olc) { OOTRACEERR3("ERROR:Memory - ooH323MakeCall_helper - olc(%s, %s)" "\n", call->callType, call->callToken); ooFreeQ931Message(pctxt, q931msg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -2622,18 +2622,18 @@ } memset(olc, 0, sizeof(H245OpenLogicalChannel)); olc->forwardLogicalChannelNumber = call->logicalChanNoCur++; - if(call->logicalChanNoCur > call->logicalChanNoMax) + if (call->logicalChanNoCur > call->logicalChanNoMax) call->logicalChanNoCur = call->logicalChanNoBase; ooBuildFastStartOLC(call, olc, epCap, pctxt, OOTX); /* Do not specify msg buffer let automatic allocation work */ setPERBuffer(pctxt, NULL, 0, aligned); - if(asn1PE_H245OpenLogicalChannel(pctxt, olc) != ASN_OK) + if (asn1PE_H245OpenLogicalChannel(pctxt, olc) != ASN_OK) { OOTRACEERR3("ERROR:Encoding of olc failed for faststart(%s, %s)" "\n", call->callType, call->callToken); ooFreeQ931Message(pctxt, q931msg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -2648,12 +2648,12 @@ setEventHandler (pctxt, &printHandler); memset(&printOlc, 0, sizeof(printOlc)); ret = asn1PD_H245OpenLogicalChannel(pctxt, &(printOlc)); - if(ret != ASN_OK) + if (ret != ASN_OK) { OOTRACEERR3("Error: Failed decoding FastStart Element." "(%s, %s)\n", call->callType, call->callToken); ooFreeQ931Message(pctxt, q931msg); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = OO_REASON_LOCAL_CLEARED; call->callState = OO_CALL_CLEAR; @@ -2694,7 +2694,7 @@ call->callIdentifier.guid.numocts); setup->m.mediaWaitForConnectPresent = TRUE; - if(OO_TESTFLAG(call->flags, OO_M_MEDIAWAITFORCONN)) { + if (OO_TESTFLAG(call->flags, OO_M_MEDIAWAITFORCONN)) { setup->mediaWaitForConnect = TRUE; } else { @@ -2716,7 +2716,7 @@ /* For H.323 version 4 and higher, if fast connect, tunneling should be supported. */ - if(OO_TESTFLAG(call->flags, OO_M_FASTSTART)) { + if (OO_TESTFLAG(call->flags, OO_M_FASTSTART)) { q931msg->userInfo->h323_uu_pdu.h245Tunneling = TRUE; OO_SETFLAG(call->flags, OO_M_TUNNELING); } @@ -2725,11 +2725,11 @@ call->callToken); /* H225 message callback */ - if(gH323ep.h225Callbacks.onBuiltSetup) + if (gH323ep.h225Callbacks.onBuiltSetup) gH323ep.h225Callbacks.onBuiltSetup(call, q931msg); ret=ooSendH225Msg(call, q931msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue SETUP message to outbound queue. (%s, %s)\n", call->callType, call->callToken); } @@ -2750,7 +2750,7 @@ OOCTXT *pctxt = call->msgctxt; ret = ooCreateQ931Message(pctxt, &q931msg, Q931InformationMsg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error: In allocating memory for - H225 Information message." "(%s, %s)\n", call->callType, call->callToken); @@ -2761,7 +2761,7 @@ q931msg->userInfo = (H225H323_UserInformation*)memAllocZ(pctxt, sizeof(H225H323_UserInformation)); - if(!q931msg->userInfo) + if (!q931msg->userInfo) { OOTRACEERR3("ERROR:Memory - ooQ931SendDTMFAsKeypadIE - userInfo" "(%s, %s)\n", call->callType, call->callToken); @@ -2777,7 +2777,7 @@ information = (H225Information_UUIE*)memAllocZ(pctxt, sizeof(H225Information_UUIE)); - if(!information) + if (!information) { OOTRACEERR3("ERROR:Memory - ooQ931SendDTMFAsKeypadIE - information" "(%s, %s)\n", call->callType, call->callToken); @@ -2797,7 +2797,7 @@ /*Add keypad IE*/ ret = ooQ931SetKeypadIE(pctxt, q931msg, data); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Creating keypad IE for (%s, %s)\n", call->callType, call->callToken); @@ -2807,7 +2807,7 @@ } ret=ooSendH225Msg(call, q931msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue Information message to outbound " "queue. (%s, %s)\n", call->callType, call->callToken); @@ -2830,7 +2830,7 @@ H225TransportAddress_ipAddress *fwdCallSignalIpAddress; call= ooFindCallByToken(callToken); - if(!call) + if (!call) { OOTRACEERR2("ERROR: Invalid call token for forward - %s\n", callToken); return OO_FAILED; @@ -2839,7 +2839,7 @@ call->callType, call->callToken); call->pCallFwdData = (OOCallFwdData*)memAllocZ(call->pctxt, sizeof(OOCallFwdData)); - if(!call->pCallFwdData) + if (!call->pCallFwdData) { OOTRACEERR3("Error:Memory - ooH323ForwardCall - pCallFwdData (%s, %s)\n", call->callType, call->callToken); @@ -2848,7 +2848,7 @@ ret = ooParseDestination(call, dest, ip, 20, &call->pCallFwdData->aliases); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR4("Error:Failed to parse the destination %s for call fwd." "(%s, %s)\n", dest, call->callType, call->callToken); @@ -2856,10 +2856,10 @@ return OO_FAILED; } - if(!ooUtilsIsStrEmpty(ip)) + if (!ooUtilsIsStrEmpty(ip)) { pcPort = strchr(ip, ':'); - if(pcPort) + if (pcPort) { *pcPort = '\0'; pcPort++; @@ -2869,7 +2869,7 @@ } ret = ooCreateQ931Message(pctxt, &pQ931Msg, Q931FacilityMsg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3 ("ERROR: In allocating memory for call transfer facility message " @@ -2881,7 +2881,7 @@ pQ931Msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt, sizeof(H225H323_UserInformation)); - if(!pQ931Msg->userInfo) + if (!pQ931Msg->userInfo) { OOTRACEERR3("ERROR:Memory - ooH323ForwardCall - userInfo(%s, %s)\n", call->callType, call->callToken); @@ -2899,7 +2899,7 @@ facility = (H225Facility_UUIE*) memAllocZ (pctxt, sizeof(H225Facility_UUIE)); - if(!facility) + if (!facility) { OOTRACEERR3("ERROR:Memory - ooH323ForwardCall - facility (%s, %s)" "\n", call->callType, call->callToken); @@ -2919,13 +2919,13 @@ facility->reason.t = T_H225FacilityReason_callForwarded; - if(!ooUtilsIsStrEmpty(call->pCallFwdData->ip)) + if (!ooUtilsIsStrEmpty(call->pCallFwdData->ip)) { facility->m.alternativeAddressPresent = TRUE; facility->alternativeAddress.t=T_H225TransportAddress_ipAddress; fwdCallSignalIpAddress = (H225TransportAddress_ipAddress*)memAlloc(pctxt, sizeof(H225TransportAddress_ipAddress)); - if(!fwdCallSignalIpAddress) + if (!fwdCallSignalIpAddress) { OOTRACEERR3("Error:Memory - ooH323ForwardCall - fwdCallSignalAddress" "(%s, %s)\n", call->callType, call->callToken); @@ -2939,12 +2939,12 @@ facility->alternativeAddress.u.ipAddress = fwdCallSignalIpAddress; } - if(call->pCallFwdData->aliases) + if (call->pCallFwdData->aliases) { facility->m.alternativeAliasAddressPresent = TRUE; ret = ooPopulateAliasList(pctxt, call->pCallFwdData->aliases, &facility->alternativeAliasAddress); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to populate alternate aliases in " "ooH323ForwardCall. (%s, %s)\n", call->callType, @@ -2954,7 +2954,7 @@ } ret = ooSendH225Msg(call, pQ931Msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3 ("Error:Failed to enqueue Forward Facility message to outbound " @@ -2970,14 +2970,14 @@ OOH323CallData *call; call= ooFindCallByToken(callToken); - if(!call) + if (!call) { OOTRACEWARN2("WARN: Call hangup failed - Call %s not present\n", callToken); return OO_FAILED; } OOTRACEINFO3("Hanging up call (%s, %s)\n", call->callType, call->callToken); - if(call->callState < OO_CALL_CLEAR) + if (call->callState < OO_CALL_CLEAR) { call->callEndReason = reason; call->q931cause = q931cause; @@ -2995,7 +2995,7 @@ unsigned size = 3; /* OOCTXT *pctxt = &gH323ep.msgctxt; */ - if(pmsg->bearerCapabilityIE) + if (pmsg->bearerCapabilityIE) { memFreePtr(pctxt, pmsg->bearerCapabilityIE); pmsg->bearerCapabilityIE = NULL; @@ -3003,7 +3003,7 @@ pmsg->bearerCapabilityIE = (Q931InformationElement*) memAlloc(pctxt, sizeof(Q931InformationElement)+size-1); - if(!pmsg->bearerCapabilityIE) + if (!pmsg->bearerCapabilityIE) { OOTRACEERR1("Error:Memory - ooSetBearerCapabilityIE - bearerCapabilityIE" "\n"); @@ -3029,7 +3029,7 @@ len = strlen(data); pmsg->keypadIE = (Q931InformationElement*) memAlloc(pctxt, sizeof(Q931InformationElement)+len-1); - if(!pmsg->keypadIE) + if (!pmsg->keypadIE) { OOTRACEERR1("Error:Memory - ooQ931SetKeypadIE - keypadIE\n"); return OO_FAILED; @@ -3051,7 +3051,7 @@ unsigned len = 0; /* OOCTXT *pctxt = &gH323ep.msgctxt; */ - if(pmsg->callingPartyNumberIE) + if (pmsg->callingPartyNumberIE) { memFreePtr(pctxt, pmsg->callingPartyNumberIE); pmsg->callingPartyNumberIE = NULL; @@ -3060,7 +3060,7 @@ len = strlen(number); pmsg->callingPartyNumberIE = (Q931InformationElement*) memAlloc(pctxt, sizeof(Q931InformationElement)+len+2-1); - if(!pmsg->callingPartyNumberIE) + if (!pmsg->callingPartyNumberIE) { OOTRACEERR1("Error:Memory - ooQ931SetCallingPartyNumberIE - " "callingPartyNumberIE\n"); @@ -3081,7 +3081,7 @@ unsigned len = 0; /* OOCTXT *pctxt = &gH323ep.msgctxt; */ - if(pmsg->calledPartyNumberIE) + if (pmsg->calledPartyNumberIE) { memFreePtr(pctxt, pmsg->calledPartyNumberIE); pmsg->calledPartyNumberIE = NULL; @@ -3090,7 +3090,7 @@ len = strlen(number); pmsg->calledPartyNumberIE = (Q931InformationElement*) memAlloc(pctxt, sizeof(Q931InformationElement)+len+1-1); - if(!pmsg->calledPartyNumberIE) + if (!pmsg->calledPartyNumberIE) { OOTRACEERR1("Error:Memory - ooQ931SetCalledPartyNumberIE - " "calledPartyNumberIE\n"); @@ -3110,14 +3110,14 @@ { /* OOCTXT *pctxt = &gH323ep.msgctxt; */ - if(pmsg->causeIE){ + if (pmsg->causeIE){ memFreePtr(pctxt, pmsg->causeIE); pmsg->causeIE = NULL; } pmsg->causeIE = (Q931InformationElement*) memAlloc(pctxt, sizeof(Q931InformationElement)+1); - if(!pmsg->causeIE) + if (!pmsg->causeIE) { OOTRACEERR1("Error:Memory - ooQ931SetCauseIE - causeIE\n"); return OO_FAILED; @@ -3149,7 +3149,7 @@ ooGetMsgTypeText(h245MsgType), call->callType, call->callToken); ret = ooCreateQ931Message(pctxt, &pQ931Msg, Q931FacilityMsg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("ERROR: In allocating memory for facility message " "(%s, %s)\n", call->callType, call->callToken); @@ -3160,7 +3160,7 @@ pQ931Msg->userInfo = (H225H323_UserInformation*)memAlloc(pctxt, sizeof(H225H323_UserInformation)); - if(!pQ931Msg->userInfo) + if (!pQ931Msg->userInfo) { OOTRACEERR3("ERROR:Memory - ooSendAsTunneledMessage - userInfo" " (%s, %s)\n", call->callType, call->callToken); @@ -3180,7 +3180,7 @@ facility = (H225Facility_UUIE*) memAllocZ (pctxt, sizeof(H225Facility_UUIE)); - if(!facility) + if (!facility) { OOTRACEERR3("ERROR:Memory - ooSendAsTunneledMessage - facility (%s, %s)" "\n", call->callType, call->callToken); @@ -3211,7 +3211,7 @@ elem = (ASN1DynOctStr*) memAlloc(pctxt, sizeof(ASN1DynOctStr)); - if(!elem) + if (!elem) { OOTRACEERR3("ERROR:Memory - ooSendAsTunneledMessage - elem " "(%s, %s)\n", call->callType, call->callToken); @@ -3226,7 +3226,7 @@ ret = ooSendH225Msg(call, pQ931Msg); - if(ret != OO_OK) + if (ret != OO_OK) { OOTRACEERR3("Error:Failed to enqueue Facility(tunneling) message to " "outbound queue.(%s, %s)\n", call->callType, call->callToken); @@ -3250,7 +3250,7 @@ OOTRACEINFO3("Call Establishment timer expired. (%s, %s)\n", call->callType, call->callToken); memFreePtr(call->pctxt, cbData); - if(call->callState < OO_CALL_CLEAR){ + if (call->callState < OO_CALL_CLEAR){ call->callState = OO_CALL_CLEAR; call->callEndReason = OO_REASON_LOCAL_CLEARED; } @@ -3263,7 +3263,7 @@ (OOCallClearReason clearReason, enum Q931CauseValues *cause, unsigned *reasonCode) { - switch(clearReason) + switch (clearReason) { case OO_REASON_INVALIDMESSAGE: case OO_REASON_TRANSPORTFAILURE: @@ -3345,7 +3345,7 @@ enum OOCallClearReason ooGetCallClearReasonFromCauseAndReasonCode (enum Q931CauseValues cause, unsigned reasonCode) { - switch(cause) + switch (cause) { case Q931NormalCallClearing: return OO_REASON_REMOTE_CLEARED; @@ -3390,7 +3390,7 @@ case Q931RecoveryOnTimerExpiry: case Q931InvalidCallReference: default: - switch(reasonCode) + switch (reasonCode) { case T_H225ReleaseCompleteReason_noBandwidth: return OO_REASON_NOBW; @@ -3458,17 +3458,17 @@ IPv6 won't pass the test and so will numeric IP representation*/ sscanf(dest, "%d.%d.%d.%d:%d", &iEk, &iDon, &iTeen, &iChaar, &iPort); - if((iEk > 0 && iEk <= 255) && + if ((iEk > 0 && iEk <= 255) && (iDon >= 0 && iDon <= 255) && (iTeen >=0 && iTeen <= 255) && (iChaar >= 0 && iChaar <= 255) && (!strchr(dest, ':') || iPort != -1)) { - if(!strchr(dest, ':')) + if (!strchr(dest, ':')) iPort = 1720; /*Default h.323 port */ sprintf(buf, "%d.%d.%d.%d:%d", iEk, iDon, iTeen, iChaar, iPort); - if(strlen(buf)+1>len) + if (strlen(buf)+1>len) { OOTRACEERR1("Error:Insufficient buffer space for parsed ip - " "ooParseDestination\n"); @@ -3482,22 +3482,22 @@ /* alias@host */ strncpy(tmp, dest, sizeof(tmp)-1); tmp[sizeof(tmp)-1]='\0'; - if((host=strchr(tmp, '@')) != NULL) + if ((host=strchr(tmp, '@')) != NULL) { *host = '\0'; host++; sscanf(host, "%d.%d.%d.%d:%d", &iEk, &iDon, &iTeen, &iChaar, &iPort); - if((iEk > 0 && iEk <= 255) && + if ((iEk > 0 && iEk <= 255) && (iDon >= 0 && iDon <= 255) && (iTeen >=0 && iTeen <= 255) && (iChaar >= 0 && iChaar <= 255) && (!strchr(host, ':') || iPort != -1)) { - if(!strchr(dest, ':')) + if (!strchr(dest, ':')) iPort = 1720; /*Default h.323 port */ sprintf(buf, "%d.%d.%d.%d:%d", iEk, iDon, iTeen, iChaar, iPort); - if(strlen(buf)+1>len) + if (strlen(buf)+1>len) { OOTRACEERR1("Error:Insufficient buffer space for parsed ip - " "ooParseDestination\n"); @@ -3510,22 +3510,22 @@ } } - if(!alias) + if (!alias) { alias = dest; } /* url test */ - if(alias == strstr(alias, "http://")) + if (alias == strstr(alias, "http://")) { psNewAlias = (ooAliases*) memAlloc(pctxt, sizeof(ooAliases)); - if(!psNewAlias) + if (!psNewAlias) { OOTRACEERR1("Error:Memory - ooParseDestination - psNewAlias\n"); return OO_FAILED; } psNewAlias->type = T_H225AliasAddress_url_ID; psNewAlias->value = (char*) memAlloc(pctxt, strlen(alias)+1); - if(!psNewAlias->value) + if (!psNewAlias->value) { OOTRACEERR1("Error:Memory - ooParseDestination - " "psNewAlias->value\n"); @@ -3540,19 +3540,19 @@ } /* E-mail ID test */ - if((cAt = strchr(alias, '@')) && alias != strchr(alias, '@')) + if ((cAt = strchr(alias, '@')) && alias != strchr(alias, '@')) { - if(strchr(cAt, '.')) + if (strchr(cAt, '.')) { psNewAlias = (ooAliases*) memAlloc(pctxt, sizeof(ooAliases)); - if(!psNewAlias) + if (!psNewAlias) { OOTRACEERR1("Error:Memory - ooParseDestination - psNewAlias\n"); return OO_FAILED; } psNewAlias->type = T_H225AliasAddress_email_ID; psNewAlias->value = (char*) memAlloc(pctxt, strlen(alias)+1); - if(!psNewAlias->value) + if (!psNewAlias->value) { OOTRACEERR1("Error:Memory - ooParseDestination - " "psNewAlias->value\n"); @@ -3571,16 +3571,16 @@ /* e-164 */ /* strspn(dest, "1234567890*#,") == strlen(dest)*/ /* Dialed digits test*/ - for(i=0; *(alias+i) != '\0'; i++) + for (i=0; *(alias+i) != '\0'; i++) { - if(!isdigit(alias[i]) && alias[i] != '#' && alias[i] != '*' && + if (!isdigit(alias[i]) && alias[i] != '#' && alias[i] != '*' && alias[i] != ',') break; } - if(*(alias+i) == '\0') + if (*(alias+i) == '\0') { psNewAlias = (ooAliases*) memAlloc(pctxt, sizeof(ooAliases)); - if(!psNewAlias) + if (!psNewAlias) { OOTRACEERR1("Error:Memory - ooParseDestination - psNewAlias\n"); return OO_FAILED; @@ -3588,7 +3588,7 @@ /* memset(psNewAlias, 0, sizeof(ooAliases));*/ psNewAlias->type = T_H225AliasAddress_dialedDigits; psNewAlias->value = (char*) memAlloc(pctxt, strlen(alias)+1); - if(!psNewAlias->value) + if (!psNewAlias->value) { OOTRACEERR1("Error:Memroy - ooParseDestination - " "psNewAlias->value\n"); @@ -3601,9 +3601,9 @@ OOTRACEINFO2("Destination is parsed as dialed digits %s\n", psNewAlias->value); /* Also set called party number */ - if(!call->calledPartyNumber) + if (!call->calledPartyNumber) { - if(ooCallSetCalledPartyNumber(call, alias) != OO_OK) + if (ooCallSetCalledPartyNumber(call, alias) != OO_OK) { OOTRACEWARN3("Warning:Failed to set calling party number." "(%s, %s)\n", call->callType, call->callToken); @@ -3613,14 +3613,14 @@ } /* Evrything else is an h323-id for now */ psNewAlias = (ooAliases*) memAlloc(pctxt, sizeof(ooAliases)); - if(!psNewAlias) + if (!psNewAlias) { OOTRACEERR1("Error:Memory - ooParseDestination - psNewAlias\n"); return OO_FAILED; } psNewAlias->type = T_H225AliasAddress_h323_ID; psNewAlias->value = (char*) memAlloc(pctxt, strlen(alias)+1); - if(!psNewAlias->value) + if (!psNewAlias->value) { OOTRACEERR1("Error:Memory - ooParseDestination - psNewAlias->value\n"); memFreePtr(pctxt, psNewAlias); @@ -3677,7 +3677,7 @@ const char* ooGetQ931CauseValueText(int val) { - switch(val) + switch (val) { case Q931UnallocatedNumber: return "Q931UnallocatedNumber"; Index: addons/ooh323c/src/ooSocket.c =================================================================== --- addons/ooh323c/src/ooSocket.c (revision 228266) +++ addons/ooh323c/src/ooSocket.c (working copy) @@ -143,7 +143,7 @@ if (getsockname == NULL) return ASN_E_NOTINIT; ioctlsocket = (LPFN_IOCTLSOCKET) GetProcAddress(ws32, "ioctlsocket"); - if(ioctlsocket == NULL) return ASN_E_NOTINIT; + if (ioctlsocket == NULL) return ASN_E_NOTINIT; sendto = (LPFN_SENDTO) GetProcAddress (ws32, "sendto"); if (sendto == NULL) return ASN_E_NOTINIT; @@ -288,7 +288,7 @@ { int ret; ret = getsockname(socket, (struct sockaddr*)name, size); - if(ret == 0) + if (ret == 0) return ASN_OK; else{ OOTRACEERR1("Error:ooSocketGetSockName - getsockname\n"); @@ -306,12 +306,12 @@ size = sizeof(addr); ret = ooSocketGetSockName(socket, &addr, &size); - if(ret != 0) + if (ret != 0) return ASN_E_INVSOCKET; host = ast_inet_ntoa(addr.sin_addr); - if(host && strlen(host) < (unsigned)len) + if (host && strlen(host) < (unsigned)len) strcpy(ip, host); else{ OOTRACEERR1("Error:Insufficient buffer for ip address - " @@ -446,12 +446,12 @@ (struct sockaddr*)&m_addr, (socklen_t *) &addrlen)) == -1) return ASN_E_INVSOCKET; - if(remoteport) + if (remoteport) *remoteport = ntohs(m_addr.sin_port); - if(remotehost) + if (remotehost) { host = ast_inet_ntoa(m_addr.sin_addr); - if(strlen(host) < (hostBufLen-1)) + if (strlen(host) < (hostBufLen-1)) strcpy(remotehost, host); else return -1; @@ -505,15 +505,15 @@ char hostname[100]; char buf[2048]; - if(pIPAddrs == NULL) + if (pIPAddrs == NULL) return -1; /* Need to find suitable return value */ ret = gethostname(hostname, 100); - if(ret == 0) + if (ret == 0) { if (!gethostbyname_r(hostname, &phost, buf, sizeof(buf), &reshost, &h_errnop)) { - if(reshost == NULL) + if (reshost == NULL) return -1; /* Need to define a return value if made part of rtsrc */ memcpy(&addr, &phost.h_addr_list[0], sizeof(struct in_addr)); strcpy(pIPAddrs, (ast_inet_ntoa(addr) == NULL) ? "127.0.0.1" : ast_inet_ntoa(addr)); @@ -546,13 +546,13 @@ struct sockaddr_in sin = {0}; #ifdef _WIN32 sin.sin_addr.s_addr = inet_addr(inetIp); - if(sin.sin_addr.s_addr == INADDR_NONE) + if (sin.sin_addr.s_addr == INADDR_NONE) { OOTRACEERR1("Error:Failed to convert address\n"); return -1; } #else - if(!inet_aton(inetIp, &sin.sin_addr)) + if (!inet_aton(inetIp, &sin.sin_addr)) { OOTRACEERR1("Error:Failed to convert address\n"); return -1; @@ -586,7 +586,7 @@ { #ifdef _WIN32 int ret = WSACleanup(); - if(ret == 0) + if (ret == 0) return ASN_OK; else return ret; @@ -613,14 +613,14 @@ OOInterface *pIf=NULL; OOTRACEDBGA1("Retrieving local interfaces\n"); - if(ooSocketCreateUDP(&sock)!= ASN_OK) + if (ooSocketCreateUDP(&sock)!= ASN_OK) { OOTRACEERR1("Error:Failed to create udp socket - " "ooSocketGetInterfaceList\n"); return -1; } #ifdef SIOCGIFNUM - if(ioctl(sock, SIOCGIFNUM, &ifNum) >= 0) + if (ioctl(sock, SIOCGIFNUM, &ifNum) >= 0) { OOTRACEERR1("Error: ioctl for ifNum failed\n"); return -1; @@ -631,7 +631,7 @@ ifc.ifc_len = ifNum * sizeof(struct ifreq); ifc.ifc_req = (struct ifreq *)memAlloc(pctxt, ifNum *sizeof(struct ifreq)); - if(!ifc.ifc_req) + if (!ifc.ifc_req) { OOTRACEERR1("Error:Memory - ooSocketGetInterfaceList - ifc.ifc_req\n"); return -1; @@ -648,7 +648,7 @@ pIf = (struct OOInterface*)memAlloc(pctxt, sizeof(struct OOInterface)); pName = (char*)memAlloc(pctxt, strlen(ifName->ifr_name)+1); - if(!pIf) + if (!pIf) { OOTRACEERR1("Error:Memory - ooSocketGetInterfaceList - " "pIf/pName\n"); @@ -689,7 +689,7 @@ strcpy(addr, ast_inet_ntoa(((struct sockaddr_in*)&ifReq.ifr_addr)->sin_addr)); OOTRACEDBGA2("\tIP address is %s\n", addr); pIf->addr = (char*)memAlloc(pctxt, strlen(addr)+1); - if(!pIf->addr) + if (!pIf->addr) { OOTRACEERR1("Error:Memory - ooSocketGetInterfaceList - " "pIf->addr\n"); @@ -712,7 +712,7 @@ strcpy(mask, ast_inet_ntoa(((struct sockaddr_in *)&ifReq.ifr_netmask)->sin_addr)); OOTRACEDBGA2("\tMask is %s\n", mask); pIf->mask = (char*)memAlloc(pctxt, strlen(mask)+1); - if(!pIf->mask) + if (!pIf->mask) { OOTRACEERR1("Error:Memory - ooSocketGetInterfaceList - " "pIf->mask\n"); @@ -726,7 +726,7 @@ pIf->next = NULL; /* Add to the list */ - if(!*ifList) + if (!*ifList) { *ifList = pIf; pIf = NULL; Index: addons/ooh323c/src/ooStackCmds.c =================================================================== --- addons/ooh323c/src/ooStackCmds.c (revision 228266) +++ addons/ooh323c/src/ooStackCmds.c (working copy) @@ -50,7 +50,7 @@ int isRunning(char *callToken) { OOH323CallData *call; - if((call = ooFindCallByToken(callToken))) + if ((call = ooFindCallByToken(callToken))) if (call->Monitor) return 1; return 0; @@ -61,7 +61,7 @@ { OOStackCommand cmd; - if(!callToken) + if (!callToken) return OO_STKCMD_INVALIDPARAM; @@ -70,16 +70,16 @@ return OO_STKCMD_INVALIDPARAM; } - if(gCmdChan == 0) + if (gCmdChan == 0) { - if(ooCreateCmdConnection() != OO_OK) + if (ooCreateCmdConnection() != OO_OK) return OO_STKCMD_CONNECTIONERR; } memset(&cmd, 0, sizeof(OOStackCommand)); cmd.type = OO_CMD_MAKECALL; cmd.param1 = (void*) malloc(strlen(dest)+1); - if(!cmd.param1) + if (!cmd.param1) { return OO_STKCMD_MEMERR; } @@ -87,7 +87,7 @@ cmd.param2 = (void*) malloc(strlen(callToken)+1); - if(!cmd.param2) + if (!cmd.param2) { free(cmd.param1); return OO_STKCMD_MEMERR; @@ -95,13 +95,13 @@ strcpy((char*)cmd.param2, callToken); - if(!opts) + if (!opts) { cmd.param3 = 0; } else { cmd.param3 = (void*) malloc(sizeof(ooCallOptions)); - if(!cmd.param3) + if (!cmd.param3) { free(cmd.param1); free(cmd.param2); @@ -110,11 +110,11 @@ memcpy((void*)cmd.param3, opts, sizeof(ooCallOptions)); } - if(ooWriteStackCommand(&cmd) != OO_OK) + if (ooWriteStackCommand(&cmd) != OO_OK) { free(cmd.param1); free(cmd.param2); - if(cmd.param3) free(cmd.param3); + if (cmd.param3) free(cmd.param3); return OO_STKCMD_WRITEERR; } @@ -127,29 +127,29 @@ OOStackCommand cmd; OOH323CallData *call; - if(!callToken) + if (!callToken) { return OO_STKCMD_INVALIDPARAM; } - if(!(call = ooFindCallByToken(callToken))) { + if (!(call = ooFindCallByToken(callToken))) { return OO_STKCMD_INVALIDPARAM; } - if(call->CmdChan == 0) + if (call->CmdChan == 0) { - if(ooCreateCallCmdConnection(call) != OO_OK) + if (ooCreateCallCmdConnection(call) != OO_OK) return OO_STKCMD_CONNECTIONERR; } - if(!callToken) + if (!callToken) return OO_STKCMD_INVALIDPARAM; memset(&cmd, 0, sizeof(OOStackCommand)); cmd.type = OO_CMD_MAKECALL; cmd.param1 = (void*) malloc(strlen(dest)+1); - if(!cmd.param1) + if (!cmd.param1) { return OO_STKCMD_MEMERR; } @@ -158,7 +158,7 @@ cmd.param2 = (void*) malloc(strlen(callToken)+1); - if(!cmd.param2) + if (!cmd.param2) { free(cmd.param1); return OO_STKCMD_MEMERR; @@ -167,13 +167,13 @@ strcpy((char*)cmd.param2, callToken); cmd.plen2 = strlen(callToken); - if(!opts) + if (!opts) { cmd.param3 = 0; } else { cmd.param3 = (void*) malloc(sizeof(ooCallOptions)); - if(!cmd.param3) + if (!cmd.param3) { free(cmd.param1); free(cmd.param2); @@ -183,18 +183,18 @@ cmd.plen3 = sizeof(ooCallOptions); } - if(ooWriteCallStackCommand(call, &cmd) != OO_OK) + if (ooWriteCallStackCommand(call, &cmd) != OO_OK) { free(cmd.param1); free(cmd.param2); - if(cmd.param3) free(cmd.param3); + if (cmd.param3) free(cmd.param3); return OO_STKCMD_WRITEERR; } free(cmd.param1); free(cmd.param2); - if(cmd.param3) free(cmd.param3); + if (cmd.param3) free(cmd.param3); return OO_STKCMD_SUCCESS; } @@ -205,32 +205,32 @@ OOStackCommand cmd; OOH323CallData *call; - if(!callToken) + if (!callToken) { return OO_STKCMD_INVALIDPARAM; } - if(!(call = ooFindCallByToken(callToken))) { + if (!(call = ooFindCallByToken(callToken))) { return OO_STKCMD_INVALIDPARAM; } - if(call->CmdChan == 0) + if (call->CmdChan == 0) { - if(ooCreateCallCmdConnection(call) != OO_OK) + if (ooCreateCallCmdConnection(call) != OO_OK) return OO_STKCMD_CONNECTIONERR; } memset(&cmd, 0, sizeof(OOStackCommand)); cmd.type = OO_CMD_MANUALRINGBACK; cmd.param1 = (void*) malloc(strlen(callToken)+1); - if(!cmd.param1) + if (!cmd.param1) { return OO_STKCMD_MEMERR; } strcpy((char*)cmd.param1, callToken); cmd.plen1 = strlen(callToken); - if(ooWriteCallStackCommand(call,&cmd) != OO_OK) + if (ooWriteCallStackCommand(call,&cmd) != OO_OK) { free(cmd.param1); return OO_STKCMD_WRITEERR; @@ -246,32 +246,32 @@ OOStackCommand cmd; OOH323CallData *call; - if(!callToken) + if (!callToken) { return OO_STKCMD_INVALIDPARAM; } - if(!(call = ooFindCallByToken(callToken))) { + if (!(call = ooFindCallByToken(callToken))) { return OO_STKCMD_INVALIDPARAM; } - if(call->CmdChan == 0) + if (call->CmdChan == 0) { - if(ooCreateCallCmdConnection(call) != OO_OK) + if (ooCreateCallCmdConnection(call) != OO_OK) return OO_STKCMD_CONNECTIONERR; } memset(&cmd, 0, sizeof(OOStackCommand)); cmd.type = OO_CMD_MANUALPROGRESS; cmd.param1 = (void*) malloc(strlen(callToken)+1); - if(!cmd.param1) + if (!cmd.param1) { return OO_STKCMD_MEMERR; } strcpy((char*)cmd.param1, callToken); cmd.plen1 = strlen(callToken); - if(ooWriteCallStackCommand(call, &cmd) != OO_OK) + if (ooWriteCallStackCommand(call, &cmd) != OO_OK) { free(cmd.param1); return OO_STKCMD_WRITEERR; @@ -287,18 +287,18 @@ OOStackCommand cmd; OOH323CallData *call; - if(!callToken) + if (!callToken) { return OO_STKCMD_INVALIDPARAM; } - if(!(call = ooFindCallByToken(callToken))) { + if (!(call = ooFindCallByToken(callToken))) { return OO_STKCMD_INVALIDPARAM; } - if(call->CmdChan == 0) + if (call->CmdChan == 0) { - if(ooCreateCallCmdConnection(call) != OO_OK) + if (ooCreateCallCmdConnection(call) != OO_OK) return OO_STKCMD_CONNECTIONERR; } @@ -306,14 +306,14 @@ cmd.type = OO_CMD_ANSCALL; cmd.param1 = (void*) malloc(strlen(callToken)+1); - if(!cmd.param1) + if (!cmd.param1) { return OO_STKCMD_MEMERR; } strcpy((char*)cmd.param1, callToken); cmd.plen1 = strlen(callToken); - if(ooWriteCallStackCommand(call, &cmd) != OO_OK) + if (ooWriteCallStackCommand(call, &cmd) != OO_OK) { free(cmd.param1); return OO_STKCMD_WRITEERR; @@ -329,18 +329,18 @@ OOStackCommand cmd; OOH323CallData *call; - if(!callToken || !dest) + if (!callToken || !dest) { return OO_STKCMD_INVALIDPARAM; } - if(!(call = ooFindCallByToken(callToken))) { + if (!(call = ooFindCallByToken(callToken))) { return OO_STKCMD_INVALIDPARAM; } - if(call->CmdChan == 0) + if (call->CmdChan == 0) { - if(ooCreateCallCmdConnection(call) != OO_OK) + if (ooCreateCallCmdConnection(call) != OO_OK) return OO_STKCMD_CONNECTIONERR; } memset(&cmd, 0, sizeof(OOStackCommand)); @@ -348,10 +348,10 @@ cmd.param1 = (void*) malloc(strlen(callToken)+1); cmd.param2 = (void*) malloc(strlen(dest)+1); - if(!cmd.param1 || !cmd.param2) + if (!cmd.param1 || !cmd.param2) { - if(cmd.param1) free(cmd.param1); /* Release memory */ - if(cmd.param2) free(cmd.param2); + if (cmd.param1) free(cmd.param1); /* Release memory */ + if (cmd.param2) free(cmd.param2); return OO_STKCMD_MEMERR; } strcpy((char*)cmd.param1, callToken); @@ -359,7 +359,7 @@ strcpy((char*)cmd.param2, dest); cmd.plen2 = strlen(dest); - if(ooWriteCallStackCommand(call, &cmd) != OO_OK) + if (ooWriteCallStackCommand(call, &cmd) != OO_OK) { free(cmd.param1); free(cmd.param2); @@ -378,18 +378,18 @@ OOH323CallData *call; - if(!callToken) + if (!callToken) { return OO_STKCMD_INVALIDPARAM; } - if(!(call = ooFindCallByToken(callToken))) { + if (!(call = ooFindCallByToken(callToken))) { return OO_STKCMD_INVALIDPARAM; } - if(call->CmdChan == 0) + if (call->CmdChan == 0) { - if(ooCreateCallCmdConnection(call) != OO_OK) + if (ooCreateCallCmdConnection(call) != OO_OK) return OO_STKCMD_CONNECTIONERR; } @@ -398,11 +398,11 @@ cmd.param1 = (void*) malloc(strlen(callToken)+1); cmd.param2 = (void*) malloc(sizeof(OOCallClearReason)); cmd.param3 = (void*) malloc(sizeof(int)); - if(!cmd.param1 || !cmd.param2 || !cmd.param3) + if (!cmd.param1 || !cmd.param2 || !cmd.param3) { - if(cmd.param1) free(cmd.param1); /* Release memory */ - if(cmd.param2) free(cmd.param2); - if(cmd.param3) free(cmd.param3); + if (cmd.param1) free(cmd.param1); /* Release memory */ + if (cmd.param2) free(cmd.param2); + if (cmd.param3) free(cmd.param3); return OO_STKCMD_MEMERR; } strcpy((char*)cmd.param1, callToken); @@ -412,7 +412,7 @@ *(int *)cmd.param3 = q931cause; cmd.plen3 = sizeof(int); - if(ooWriteCallStackCommand(call, &cmd) != OO_OK) + if (ooWriteCallStackCommand(call, &cmd) != OO_OK) { free(cmd.param1); free(cmd.param2); @@ -431,16 +431,16 @@ { OOStackCommand cmd; - if(gCmdChan == 0) + if (gCmdChan == 0) { - if(ooCreateCmdConnection() != OO_OK) + if (ooCreateCmdConnection() != OO_OK) return OO_STKCMD_CONNECTIONERR; } memset(&cmd, 0, sizeof(OOStackCommand)); cmd.type = OO_CMD_STOPMONITOR; - if(ooWriteStackCommand(&cmd) != OO_OK) + if (ooWriteStackCommand(&cmd) != OO_OK) return OO_STKCMD_WRITEERR; return OO_STKCMD_SUCCESS; @@ -451,18 +451,18 @@ OOStackCommand cmd; OOH323CallData *call; - if(!callToken) + if (!callToken) { return OO_STKCMD_INVALIDPARAM; } - if(!(call = ooFindCallByToken(callToken))) { + if (!(call = ooFindCallByToken(callToken))) { return OO_STKCMD_INVALIDPARAM; } - if(call->CmdChan == 0) + if (call->CmdChan == 0) { - if(ooCreateCallCmdConnection(call) != OO_OK) + if (ooCreateCallCmdConnection(call) != OO_OK) return OO_STKCMD_CONNECTIONERR; } @@ -471,10 +471,10 @@ cmd.param1 = (void*) malloc(strlen(callToken)+1); cmd.param2 = (void*) malloc(strlen(dtmf)+1); - if(!cmd.param1 || !cmd.param2) + if (!cmd.param1 || !cmd.param2) { - if(cmd.param1) free(cmd.param1); /* Release memory */ - if(cmd.param2) free(cmd.param2); + if (cmd.param1) free(cmd.param1); /* Release memory */ + if (cmd.param2) free(cmd.param2); return OO_STKCMD_MEMERR; } strcpy((char*)cmd.param1, callToken); @@ -482,7 +482,7 @@ strcpy((char*)cmd.param2, dtmf); cmd.plen2 = strlen(dtmf); - if(ooWriteCallStackCommand(call,&cmd) != OO_OK) + if (ooWriteCallStackCommand(call,&cmd) != OO_OK) { free(cmd.param1); free(cmd.param2); @@ -499,18 +499,18 @@ OOStackCommand cmd; OOH323CallData *call; - if(!callToken) + if (!callToken) { return OO_STKCMD_INVALIDPARAM; } - if(!(call = ooFindCallByToken(callToken))) { + if (!(call = ooFindCallByToken(callToken))) { return OO_STKCMD_INVALIDPARAM; } - if(call->CmdChan == 0) + if (call->CmdChan == 0) { - if(ooCreateCallCmdConnection(call) != OO_OK) + if (ooCreateCallCmdConnection(call) != OO_OK) return OO_STKCMD_CONNECTIONERR; } @@ -519,10 +519,10 @@ cmd.param1 = (void*) malloc(strlen(callToken)+1); cmd.param2 = (void*) malloc(sizeof(int)); - if(!cmd.param1 || !cmd.param2) + if (!cmd.param1 || !cmd.param2) { - if(cmd.param1) free(cmd.param1); /* Release memory */ - if(cmd.param2) free(cmd.param2); + if (cmd.param1) free(cmd.param1); /* Release memory */ + if (cmd.param2) free(cmd.param2); return OO_STKCMD_MEMERR; } strcpy((char*)cmd.param1, callToken); @@ -530,7 +530,7 @@ *((int *) cmd.param2) = isT38Mode; cmd.plen2 = sizeof(int); - if(ooWriteCallStackCommand(call,&cmd) != OO_OK) + if (ooWriteCallStackCommand(call,&cmd) != OO_OK) { free(cmd.param1); free(cmd.param2); @@ -545,7 +545,7 @@ const char* ooGetStkCmdStatusCodeTxt(OOStkCmdStat stat) { - switch(stat) + switch (stat) { case OO_STKCMD_SUCCESS: return "Stack command - successfully issued"; Index: addons/ooh323c/src/ooTimer.c =================================================================== --- addons/ooh323c/src/ooTimer.c (revision 228266) +++ addons/ooh323c/src/ooTimer.c (working copy) @@ -53,7 +53,7 @@ ooTimerComputeExpireTime (pTimer); /* Insert this timer into the complete list */ - if(pList) + if (pList) ooTimerInsertEntry (pctxt, pList, pTimer); else ooTimerInsertEntry (pctxt, &g_TimerList, pTimer); @@ -186,11 +186,11 @@ int ooCompareTimeouts(struct timeval *to1, struct timeval *to2) { - if(to1->tv_sec > to2->tv_sec) return 1; - if(to1->tv_sec < to2->tv_sec) return -1; + if (to1->tv_sec > to2->tv_sec) return 1; + if (to1->tv_sec < to2->tv_sec) return -1; - if(to1->tv_usec > to2->tv_usec) return 1; - if(to1->tv_usec < to2->tv_usec) return -1; + if (to1->tv_usec > to2->tv_usec) return 1; + if (to1->tv_usec < to2->tv_usec) return -1; return 0; } Index: addons/ooh323c/src/ootrace.c =================================================================== --- addons/ooh323c/src/ootrace.c (revision 228266) +++ addons/ooh323c/src/ootrace.c (working copy) @@ -44,7 +44,7 @@ void ooTrace(OOUINT32 traceLevel, const char * fmtspec, ...) { va_list arglist; char logMessage[MAXLOGMSGLEN]; - if(traceLevel > gs_traceLevel) return; + if (traceLevel > gs_traceLevel) return; va_start (arglist, fmtspec); /* memset(logMessage, 0, MAXLOGMSGLEN);*/ vsprintf(logMessage, fmtspec, arglist); @@ -67,7 +67,7 @@ GetTimeFormat(LOCALE_SYSTEM_DEFAULT,0, &systemTime, "HH':'mm':'ss", timeString, 100); GetTimeFormat(LOCALE_SYSTEM_DEFAULT,0, &systemTime, "H", currtime, 3); - if(lasttime> atoi(currtime)) + if (lasttime> atoi(currtime)) printDate=1; lasttime = atoi(currtime); @@ -78,20 +78,20 @@ ptime = localtime(&t); strftime(timeString, 100, "%H:%M:%S", ptime); strftime(currtime, 3, "%H", ptime); - if(lasttime>atoi(currtime)) + if (lasttime>atoi(currtime)) printDate = 1; lasttime = atoi(currtime); #endif #ifdef _WIN32 - if(printDate) + if (printDate) { printDate = 0; fprintf(gH323ep.fptraceFile, "---------Date %d/%d/%d---------\n", systemTime.wMonth, systemTime.wDay, systemTime.wYear); } - if(printTime) { + if (printTime) { fprintf(gH323ep.fptraceFile, "%s:%03d %s", timeString, systemTime.wMilliseconds, logMessage); } @@ -100,14 +100,14 @@ fflush(gH323ep.fptraceFile); #else - if(printDate) + if (printDate) { printDate = 0; strftime(dateString, 10, "%d", ptime); fprintf(gH323ep.fptraceFile, "---------Date %s---------\n", dateString); } - if(printTime) { + if (printTime) { struct timeval systemTime; gettimeofday(&systemTime, NULL); fprintf(gH323ep.fptraceFile, "%s:%03ld %s", timeString, @@ -119,7 +119,7 @@ fflush(gH323ep.fptraceFile); #endif - if(strchr(logMessage, '\n')) + if (strchr(logMessage, '\n')) printTime = 1; else printTime = 0; Index: addons/ooh323c/src/ooUtils.c =================================================================== --- addons/ooh323c/src/ooUtils.c (revision 228266) +++ addons/ooh323c/src/ooUtils.c (working copy) @@ -32,10 +32,10 @@ OOBOOL ooIsDailedDigit(const char* str) { - if(str == NULL || *str =='\0') { return FALSE; } - while(*str != '\0') + if (str == NULL || *str =='\0') { return FALSE; } + while (*str != '\0') { - if(!isdigit(*str) && + if (!isdigit(*str) && *str != '#' && *str != '*' && *str != ',') { return FALSE; } str++; } Index: addons/ooh323cDriver.c =================================================================== --- addons/ooh323cDriver.c (revision 228266) +++ addons/ooh323cDriver.c (working copy) @@ -166,7 +166,7 @@ if (gH323Debug) ast_debug(1,"new call thread created for call %s\n", call->callToken); - if(ast_pthread_create_detached_background(&call->callThread, NULL, ooh323c_call_thread, cur) < 0) + if (ast_pthread_create_detached_background(&call->callThread, NULL, ooh323c_call_thread, cur) < 0) { ast_log(LOG_ERROR, "Unable to start ooh323c call thread for call %s\n", call->callToken); @@ -199,12 +199,12 @@ int ooh323c_start_stack_thread() { - if(ast_pthread_create_background(&ooh323c_thread, NULL, ooh323c_stack_thread, NULL) < 0) + if (ast_pthread_create_background(&ooh323c_thread, NULL, ooh323c_stack_thread, NULL) < 0) { ast_log(LOG_ERROR, "Unable to start ooh323c thread.\n"); return -1; } - if(ast_pthread_create_background(&ooh323cmd_thread, NULL, ooh323c_cmd_thread, NULL) < 0) + if (ast_pthread_create_background(&ooh323cmd_thread, NULL, ooh323c_cmd_thread, NULL) < 0) { ast_log(LOG_ERROR, "Unable to start ooh323cmd thread.\n"); return -1; @@ -214,7 +214,7 @@ int ooh323c_stop_stack_thread(void) { - if(ooh323c_thread != AST_PTHREADT_NULL) + if (ooh323c_thread != AST_PTHREADT_NULL) { ooStopMonitor(); pthread_join(ooh323c_thread, NULL); @@ -229,14 +229,14 @@ (struct ast_codec_pref *prefs, int capability, int dtmf, int dtmfcodec) { int ret = 0, x, format=0; - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding capabilities to H323 endpoint\n"); - for(x=0; 0 != (format=ast_codec_pref_index(prefs, x)); x++) + for (x=0; 0 != (format=ast_codec_pref_index(prefs, x)); x++) { - if(format & AST_FORMAT_ULAW) + if (format & AST_FORMAT_ULAW) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g711 ulaw capability to H323 endpoint\n"); ret= ooH323EpAddG711Capability(OO_G711ULAW64K, gtxframes, grxframes, OORXANDTX, &ooh323c_start_receive_channel, @@ -244,9 +244,9 @@ &ooh323c_stop_receive_channel, &ooh323c_stop_transmit_channel); } - if(format & AST_FORMAT_ALAW) + if (format & AST_FORMAT_ALAW) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g711 alaw capability to H323 endpoint\n"); ret= ooH323EpAddG711Capability(OO_G711ALAW64K, gtxframes, grxframes, OORXANDTX, &ooh323c_start_receive_channel, @@ -255,9 +255,9 @@ &ooh323c_stop_transmit_channel); } - if(format & AST_FORMAT_G729A) + if (format & AST_FORMAT_G729A) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g729A capability to H323 endpoint\n"); ret = ooH323EpAddG729Capability(OO_G729A, 2, 24, OORXANDTX, &ooh323c_start_receive_channel, @@ -265,14 +265,14 @@ &ooh323c_stop_receive_channel, &ooh323c_stop_transmit_channel); - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g729 capability to H323 endpoint\n"); ret |= ooH323EpAddG729Capability(OO_G729, 2, 24, OORXANDTX, &ooh323c_start_receive_channel, &ooh323c_start_transmit_channel, &ooh323c_stop_receive_channel, &ooh323c_stop_transmit_channel); - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g729b capability to H323 endpoint\n"); ret |= ooH323EpAddG729Capability(OO_G729B, 2, 24, OORXANDTX, &ooh323c_start_receive_channel, @@ -281,9 +281,9 @@ &ooh323c_stop_transmit_channel); } - if(format & AST_FORMAT_G723_1) + if (format & AST_FORMAT_G723_1) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g7231 capability to H323 endpoint\n"); ret = ooH323EpAddG7231Capability(OO_G7231, 1, 1, FALSE, OORXANDTX, &ooh323c_start_receive_channel, @@ -293,9 +293,9 @@ } - if(format & AST_FORMAT_G726) + if (format & AST_FORMAT_G726) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g726 capability to H323 endpoint\n"); ret = ooH323EpAddG726Capability(OO_G726, gtxframes, grxframes, FALSE, OORXANDTX, &ooh323c_start_receive_channel, @@ -305,9 +305,9 @@ } - if(format & AST_FORMAT_G726_AAL2) + if (format & AST_FORMAT_G726_AAL2) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g726aal2 capability to H323 endpoint\n"); ret = ooH323EpAddG726Capability(OO_G726AAL2, gtxframes, grxframes, FALSE, OORXANDTX, &ooh323c_start_receive_channel, @@ -317,9 +317,9 @@ } - if(format & AST_FORMAT_H263) + if (format & AST_FORMAT_H263) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding h263 capability to H323 endpoint\n"); ret = ooH323EpAddH263VideoCapability(OO_H263VIDEO, 1, 0, 0, 0, 0, 320*1024, OORXANDTX, &ooh323c_start_receive_channel, @@ -329,9 +329,9 @@ } - if(format & AST_FORMAT_GSM) + if (format & AST_FORMAT_GSM) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding gsm capability to H323 endpoint\n"); ret = ooH323EpAddGSMCapability(OO_GSMFULLRATE, 4, FALSE, FALSE, OORXANDTX, &ooh323c_start_receive_channel, @@ -342,9 +342,9 @@ } #ifdef AST_FORMAT_AMRNB - if(format & AST_FORMAT_AMRNB) + if (format & AST_FORMAT_AMRNB) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding amr nb capability to H323 endpoint\n"); ret = ooH323EpAddAMRNBCapability(OO_AMRNB, 4, 4, FALSE, OORXANDTX, &ooh323c_start_receive_channel, @@ -356,9 +356,9 @@ #endif #ifdef AST_FORMAT_SPEEX - if(format & AST_FORMAT_SPEEX) + if (format & AST_FORMAT_SPEEX) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding speex capability to H323 endpoint\n"); ret = ooH323EpAddSpeexCapability(OO_SPEEX, 4, 4, FALSE, OORXANDTX, &ooh323c_start_receive_channel, @@ -371,13 +371,13 @@ } - if(dtmf & H323_DTMF_CISCO) + if (dtmf & H323_DTMF_CISCO) ret |= ooH323EpEnableDTMFCISCO(0); - if(dtmf & H323_DTMF_RFC2833) + if (dtmf & H323_DTMF_RFC2833) ret |= ooH323EpEnableDTMFRFC2833(0); - else if(dtmf & H323_DTMF_H245ALPHANUMERIC) + else if (dtmf & H323_DTMF_H245ALPHANUMERIC) ret |= ooH323EpEnableDTMFH245Alphanumeric(); - else if(dtmf & H323_DTMF_H245SIGNAL) + else if (dtmf & H323_DTMF_H245SIGNAL) ret |= ooH323EpEnableDTMFH245Signal(); return ret; @@ -389,16 +389,16 @@ { int ret = 0, x, txframes; int format=0; - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding capabilities to call(%s, %s)\n", call->callType, call->callToken); - if(dtmf & H323_DTMF_CISCO || 1) + if (dtmf & H323_DTMF_CISCO || 1) ret |= ooCallEnableDTMFCISCO(call,dtmfcodec); - if(dtmf & H323_DTMF_RFC2833 || 1) + if (dtmf & H323_DTMF_RFC2833 || 1) ret |= ooCallEnableDTMFRFC2833(call,dtmfcodec); - if(dtmf & H323_DTMF_H245ALPHANUMERIC || 1) + if (dtmf & H323_DTMF_H245ALPHANUMERIC || 1) ret |= ooCallEnableDTMFH245Alphanumeric(call); - if(dtmf & H323_DTMF_H245SIGNAL || 1) + if (dtmf & H323_DTMF_H245SIGNAL || 1) ret |= ooCallEnableDTMFH245Signal(call); if (t38support) @@ -409,11 +409,11 @@ &ooh323c_stop_transmit_datachannel, 0); - for(x=0; 0 !=(format=ast_codec_pref_index(prefs, x)); x++) + for (x=0; 0 !=(format=ast_codec_pref_index(prefs, x)); x++) { - if(format & AST_FORMAT_ULAW) + if (format & AST_FORMAT_ULAW) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g711 ulaw capability to call(%s, %s)\n", call->callType, call->callToken); txframes = prefs->framing[x]; @@ -424,9 +424,9 @@ &ooh323c_stop_receive_channel, &ooh323c_stop_transmit_channel); } - if(format & AST_FORMAT_ALAW) + if (format & AST_FORMAT_ALAW) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g711 alaw capability to call(%s, %s)\n", call->callType, call->callToken); txframes = prefs->framing[x]; @@ -438,9 +438,9 @@ &ooh323c_stop_transmit_channel); } - if(format & AST_FORMAT_G726) + if (format & AST_FORMAT_G726) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g726 capability to call (%s, %s)\n", call->callType, call->callToken); txframes = prefs->framing[x]; @@ -452,9 +452,9 @@ } - if(format & AST_FORMAT_G726_AAL2) + if (format & AST_FORMAT_G726_AAL2) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g726aal2 capability to call (%s, %s)\n", call->callType, call->callToken); txframes = prefs->framing[x]; @@ -466,11 +466,11 @@ } - if(format & AST_FORMAT_G729A) + if (format & AST_FORMAT_G729A) { txframes = (prefs->framing[x])/10; - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g729 capability to call(%s, %s)\n", call->callType, call->callToken); ret|= ooCallAddG729Capability(call, OO_G729, txframes, txframes, @@ -478,7 +478,7 @@ &ooh323c_start_transmit_channel, &ooh323c_stop_receive_channel, &ooh323c_stop_transmit_channel); - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g729A capability to call(%s, %s)\n", call->callType, call->callToken); ret= ooCallAddG729Capability(call, OO_G729A, txframes, txframes, @@ -486,7 +486,7 @@ &ooh323c_start_transmit_channel, &ooh323c_stop_receive_channel, &ooh323c_stop_transmit_channel); - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g729B capability to call(%s, %s)\n", call->callType, call->callToken); ret|= ooCallAddG729Capability(call, OO_G729B, txframes, txframes, @@ -497,9 +497,9 @@ } - if(format & AST_FORMAT_G723_1) + if (format & AST_FORMAT_G723_1) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding g7231 capability to call (%s, %s)\n", call->callType, call->callToken); ret = ooCallAddG7231Capability(call, OO_G7231, 1, 1, FALSE, @@ -510,9 +510,9 @@ } - if(format & AST_FORMAT_H263) + if (format & AST_FORMAT_H263) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding h263 capability to call (%s, %s)\n", call->callType, call->callToken); ret = ooCallAddH263VideoCapability(call, OO_H263VIDEO, 1, 0, 0, 0, 0, 320*1024, @@ -523,9 +523,9 @@ } - if(format & AST_FORMAT_GSM) + if (format & AST_FORMAT_GSM) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding gsm capability to call(%s, %s)\n", call->callType, call->callToken); ret = ooCallAddGSMCapability(call, OO_GSMFULLRATE, 4, FALSE, FALSE, @@ -536,9 +536,9 @@ } #ifdef AST_FORMAT_AMRNB - if(format & AST_FORMAT_AMRNB) + if (format & AST_FORMAT_AMRNB) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding AMR capability to call(%s, %s)\n", call->callType, call->callToken); ret = ooCallAddAMRNBCapability(call, OO_AMRNB, 4, 4, FALSE, @@ -549,9 +549,9 @@ } #endif #ifdef AST_FORMAT_SPEEX - if(format & AST_FORMAT_SPEEX) + if (format & AST_FORMAT_SPEEX) { - if(gH323Debug) + if (gH323Debug) ast_verbose("\tAdding Speex capability to call(%s, %s)\n", call->callType, call->callToken); ret = ooCallAddSpeexCapability(call, OO_SPEEX, 4, 4, FALSE, @@ -568,9 +568,9 @@ int ooh323c_set_aliases(ooAliases * aliases) { ooAliases *cur = aliases; - while(cur) + while (cur) { - switch(cur->type) + switch (cur->type) { case T_H225AliasAddress_dialedDigits: ooH323EpAddAliasDialedDigits(cur->value); @@ -596,7 +596,7 @@ { int fmt=-1; fmt = convertH323CapToAsteriskCap(pChannel->chanCap->cap); - if(fmt>0) { + if (fmt>0) { /* ooh323_set_read_format(call, fmt); */ }else{ ast_log(LOG_ERROR, "Invalid capability type for receive channel %s\n", @@ -610,7 +610,7 @@ { int fmt=-1; fmt = convertH323CapToAsteriskCap(pChannel->chanCap->cap); - if(fmt>0) { + if (fmt>0) { switch (fmt) { case AST_FORMAT_ALAW: case AST_FORMAT_ULAW: @@ -668,7 +668,7 @@ int convertH323CapToAsteriskCap(int cap) { - switch(cap) + switch (cap) { case OO_G711ULAW64K: return AST_FORMAT_ULAW; Index: agi/eagi-sphinx-test.c =================================================================== --- agi/eagi-sphinx-test.c (revision 228266) +++ agi/eagi-sphinx-test.c (working copy) @@ -78,7 +78,7 @@ char buf[256]; char *val; /* Read environment */ - for(;;) { + for (;;) { if (!fgets(buf, sizeof(buf), stdin)) { return -1; } Index: agi/eagi-test.c =================================================================== --- agi/eagi-test.c (revision 228266) +++ agi/eagi-test.c (working copy) @@ -23,7 +23,7 @@ char buf[256]; char *val; /* Read environment */ - for(;;) { + for (;;) { if (!fgets(buf, sizeof(buf), stdin)) { return -1; } Index: apps/app_adsiprog.c =================================================================== --- apps/app_adsiprog.c (revision 228266) +++ apps/app_adsiprog.c (working copy) @@ -238,12 +238,12 @@ int quoted = 0; /* Advance past any white space */ - while(*tmp && (*tmp < 33)) + while (*tmp && (*tmp < 33)) tmp++; if (!*tmp) return NULL; keyword = tmp; - while(*tmp && ((*tmp > 32) || quoted)) { + while (*tmp && ((*tmp > 32) || quoted)) { if (*tmp == '\"') { quoted = !quoted; } @@ -255,7 +255,7 @@ } *tmp = '\0'; tmp++; - while(*tmp && (*tmp < 33)) + while (*tmp && (*tmp < 33)) tmp++; /* Note where we left off */ *buf = tmp; @@ -1021,7 +1021,7 @@ if (!keyword) return 0; - switch(state->state) { + switch (state->state) { case STATE_NORMAL: if (!strcasecmp(keyword, "DESCRIPTION")) { if ((args = get_token(&buf, script, lineno))) { @@ -1399,7 +1399,7 @@ } fclose(f); /* Make sure we're in the main routine again */ - switch(scr->state) { + switch (scr->state) { case STATE_NORMAL: break; case STATE_INSUB: Index: apps/app_alarmreceiver.c =================================================================== --- apps/app_alarmreceiver.c (revision 228266) +++ apps/app_alarmreceiver.c (working copy) @@ -280,7 +280,7 @@ ast_frfree(f); /* If we have all the digits we expect, leave */ - if(i >= length) + if (i >= length) break; lastdigittime = ast_tvnow(); @@ -537,7 +537,7 @@ if (*ehead == NULL) *ehead = enew; else { - for(elp = *ehead; elp->next != NULL; elp = elp->next) + for (elp = *ehead; elp->next != NULL; elp = elp->next) ; elp->next = enew; } @@ -603,7 +603,7 @@ /* Determine the protocol to receive in advance */ /* Note: Ademco contact is the only one supported at this time */ /* Others may be added later */ - if(!strcmp(signalling_type, ADEMCO_CONTACT_ID)) + if (!strcmp(signalling_type, ADEMCO_CONTACT_ID)) receive_ademco_contact_id(chan, data, fdtimeout, sdtimeout, toneloudness, &event_head); else res = -1; @@ -660,26 +660,26 @@ p = ast_variable_retrieve(cfg, "general", "loudness"); if (p) { toneloudness = atoi(p); - if(toneloudness < 100) + if (toneloudness < 100) toneloudness = 100; - if(toneloudness > 8192) + if (toneloudness > 8192) toneloudness = 8192; } p = ast_variable_retrieve(cfg, "general", "fdtimeout"); if (p) { fdtimeout = atoi(p); - if(fdtimeout < 1000) + if (fdtimeout < 1000) fdtimeout = 1000; - if(fdtimeout > 10000) + if (fdtimeout > 10000) fdtimeout = 10000; } p = ast_variable_retrieve(cfg, "general", "sdtimeout"); if (p) { sdtimeout = atoi(p); - if(sdtimeout < 110) + if (sdtimeout < 110) sdtimeout = 110; - if(sdtimeout > 4000) + if (sdtimeout > 4000) sdtimeout = 4000; } Index: apps/app_dahdibarge.c =================================================================== --- apps/app_dahdibarge.c (revision 228266) +++ apps/app_dahdibarge.c (working copy) @@ -77,7 +77,7 @@ static int careful_write(int fd, unsigned char *data, int len) { int res; - while(len) { + while (len) { res = write(fd, data, len); if (res < 1) { if (errno != EAGAIN) { @@ -191,7 +191,7 @@ } ast_debug(1, "Placed channel %s in DAHDI channel %d monitor\n", chan->name, confno); - for(;;) { + for (;;) { outfd = -1; ms = -1; c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms); @@ -277,7 +277,7 @@ if (chan->_state != AST_STATE_UP) ast_answer(chan); - while(!confno && (++retrycnt < 4)) { + while (!confno && (++retrycnt < 4)) { /* Prompt user for conference number */ confnostr[0] = '\0'; res = ast_app_getdata(chan, "conf-getchannel",confnostr, sizeof(confnostr) - 1, 0); Index: apps/app_dahdiras.c =================================================================== --- apps/app_dahdiras.c (revision 228266) +++ apps/app_dahdiras.c (working copy) @@ -114,7 +114,7 @@ /* And all the other arguments */ stringp=args; c = strsep(&stringp, ","); - while(c && strlen(c) && (argc < (PPP_MAX_ARGS - 4))) { + while (c && strlen(c) && (argc < (PPP_MAX_ARGS - 4))) { argv[argc++] = c; c = strsep(&stringp, ","); } @@ -139,7 +139,7 @@ int x; res = ioctl(chan->fds[0], DAHDI_GET_BUFINFO, &savebi); - if(res) { + if (res) { ast_log(LOG_WARNING, "Unable to check buffer policy on channel %s\n", chan->name); return; } Index: apps/app_dial.c =================================================================== --- apps/app_dial.c (revision 228266) +++ apps/app_dial.c (working copy) @@ -646,7 +646,7 @@ { struct ast_cdr *cdr = num->chan->cdr; - switch(cause) { + switch (cause) { case AST_CAUSE_BUSY: if (cdr) ast_cdr_busy(cdr); @@ -1091,7 +1091,7 @@ if (single || (!single && !pa->sentringing)) { ast_indicate(in, AST_CONTROL_PROGRESS); } - if(!ast_strlen_zero(dtmf_progress)) { + if (!ast_strlen_zero(dtmf_progress)) { ast_verb(3, "Sending DTMF '%s' to the called party as result of receiving a PROGRESS message.\n", dtmf_progress); ast_dtmf_stream(c, in, dtmf_progress, 250, 0); } @@ -2073,7 +2073,7 @@ res = -1; goto done; } - switch(fr->frametype) { + switch (fr->frametype) { case AST_FRAME_DTMF_END: digit = fr->subclass.integer; if (active_chan == peer && strchr(AST_DIGIT_ANY, res)) { @@ -2380,7 +2380,7 @@ ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP); /* set it back the way it was */ } if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON)) { - if(!ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) { + if (!ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) { replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]); ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]); } else { /* F() */ Index: apps/app_dictate.c =================================================================== --- apps/app_dictate.c (revision 228266) +++ apps/app_dictate.c (working copy) @@ -70,7 +70,7 @@ DMODE_PLAY } dmodes; -#define ast_toggle_flag(it,flag) if(ast_test_flag(it, flag)) ast_clear_flag(it, flag); else ast_set_flag(it, flag) +#define ast_toggle_flag(it,flag) if (ast_test_flag(it, flag)) ast_clear_flag(it, flag); else ast_set_flag(it, flag) static int play_and_wait(struct ast_channel *chan, char *file, char *digits) { @@ -171,7 +171,7 @@ } if ((f->frametype == AST_FRAME_DTMF)) { int got = 1; - switch(mode) { + switch (mode) { case DMODE_PLAY: switch (f->subclass.integer) { case '1': @@ -187,7 +187,7 @@ break; case '7': samples -= ffactor; - if(samples < 0) { + if (samples < 0) { samples = 0; } ast_seekstream(fs, samples, SEEK_SET); @@ -235,7 +235,7 @@ case '0': ast_set_flag(&flags, DFLAG_PAUSE); digit = play_and_wait(chan, "dictate/paused", AST_DIGIT_ANY); - switch(mode) { + switch (mode) { case DMODE_PLAY: digit = play_and_wait(chan, "dictate/play_help", AST_DIGIT_ANY); break; @@ -254,7 +254,7 @@ } } else if (f->frametype == AST_FRAME_VOICE) { - switch(mode) { + switch (mode) { struct ast_frame *fr; int x; case DMODE_PLAY: Index: apps/app_disa.c =================================================================== --- apps/app_disa.c (revision 228266) +++ apps/app_disa.c (working copy) @@ -257,7 +257,7 @@ return -1; } pwline[0] = 0; - while(fgets(pwline,sizeof(pwline) - 1,fp)) { + while (fgets(pwline,sizeof(pwline) - 1,fp)) { if (!pwline[0]) continue; if (pwline[strlen(pwline) - 1] == '\n') Index: apps/app_followme.c =================================================================== --- apps/app_followme.c (revision 228266) +++ apps/app_followme.c (working copy) @@ -451,7 +451,7 @@ ast_debug(2, "Logging parameter %s with value %s from lineno %d\n", var->name, var->value, var->lineno); } var = var->next; - } /* End while(var) loop */ + } /* End while (var) loop */ if (!new) ast_mutex_unlock(&f->lock); @@ -1178,7 +1178,7 @@ static int load_module(void) { - if(!reload_followme(0)) + if (!reload_followme(0)) return AST_MODULE_LOAD_DECLINE; return ast_register_application_xml(app, app_exec); Index: apps/app_getcpeid.c =================================================================== --- apps/app_getcpeid.c (revision 228266) +++ apps/app_getcpeid.c (working copy) @@ -106,7 +106,7 @@ strcpy(data[2], "Geometry unknown"); strcpy(data[3], "Press # to exit"); cpeid_setstatus(chan, data, 1); - for(;;) { + for (;;) { res = ast_waitfordigit(chan, 1000); if (res < 0) break; Index: apps/app_macro.c =================================================================== --- apps/app_macro.c (revision 228266) +++ apps/app_macro.c (working copy) @@ -356,7 +356,7 @@ chan->priority = 1; ast_channel_lock(chan); - while((cur = strsep(&rest, ",")) && (argc < MAX_ARGS)) { + while ((cur = strsep(&rest, ",")) && (argc < MAX_ARGS)) { const char *argp; /* Save copy of old arguments if we're overwriting some, otherwise let them pass through to the other macro */ @@ -370,7 +370,7 @@ ast_channel_unlock(chan); autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP); ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP); - while(ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) { + while (ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) { struct ast_context *c; struct ast_exten *e; int foundx; @@ -410,7 +410,7 @@ ast_debug(1, "Oooh, got something to jump out with ('%c')!\n", res); break; } - switch(res) { + switch (res) { case MACRO_EXIT_RESULT: res = 0; goto out; Index: apps/app_meetme.c =================================================================== --- apps/app_meetme.c (revision 228266) +++ apps/app_meetme.c (working copy) @@ -1092,7 +1092,7 @@ AST_LIST_LOCK(&confs); - switch(sound) { + switch (sound) { case ENTER: data = enter; len = sizeof(enter); @@ -1254,7 +1254,7 @@ /* TODO: Find the conf number from the cmdline (ignore spaces) <- test this and make it fail-safe! */ myline = ast_strdupa(line); if (strsep(&myline, " ") && strsep(&myline, " ") && !confno) { - while((confno = strsep(&myline, " ")) && (strcmp(confno, " ") == 0)) + while ((confno = strsep(&myline, " ")) && (strcmp(confno, " ") == 0)) ; } @@ -3023,7 +3023,7 @@ dtmf = f->subclass.integer; } if (dtmf) { - switch(dtmf) { + switch (dtmf) { case '1': /* Un/Mute */ menu_active = 0; Index: apps/app_minivm.c =================================================================== --- apps/app_minivm.c (revision 228266) +++ apps/app_minivm.c (working copy) @@ -1666,7 +1666,7 @@ cmd = ast_play_and_wait(chan, "vm-sorry"); break; case '0': - if(!ast_test_flag(vmu, MVM_OPERATOR)) { + if (!ast_test_flag(vmu, MVM_OPERATOR)) { cmd = ast_play_and_wait(chan, "vm-sorry"); break; } @@ -1953,7 +1953,7 @@ ast_debug(1, "The recorded media file is gone, so we should remove the .txt file too!\n"); unlink(tmptxtfile); pbx_builtin_setvar_helper(chan, "MVM_RECORD_STATUS", "FAILED"); - if(ast_test_flag(vmu, MVM_ALLOCED)) + if (ast_test_flag(vmu, MVM_ALLOCED)) free_user(vmu); return 0; } @@ -1979,7 +1979,7 @@ if (res > 0) res = 0; - if(ast_test_flag(vmu, MVM_ALLOCED)) + if (ast_test_flag(vmu, MVM_ALLOCED)) free_user(vmu); pbx_builtin_setvar_helper(chan, "MVM_RECORD_STATUS", "SUCCESS"); @@ -2096,7 +2096,7 @@ return -1; } - if(!(vmu = find_account(domain, username, TRUE))) { + if (!(vmu = find_account(domain, username, TRUE))) { /* We could not find user, let's exit */ ast_log(LOG_WARNING, "Could not allocate temporary memory for '%s@%s'\n", username, domain); pbx_builtin_setvar_helper(chan, "MVM_NOTIFY_STATUS", "FAILED"); @@ -2124,7 +2124,7 @@ pbx_builtin_setvar_helper(chan, "MVM_NOTIFY_STATUS", res == 0 ? "SUCCESS" : "FAILED"); - if(ast_test_flag(vmu, MVM_ALLOCED)) + if (ast_test_flag(vmu, MVM_ALLOCED)) free_user(vmu); /* Ok, we're ready to rock and roll. Return to dialplan */ @@ -2315,7 +2315,7 @@ if (res < 0) { ast_debug(2, "Hang up during prefile playback\n"); pbx_builtin_setvar_helper(chan, "MVM_GREET_STATUS", "FAILED"); - if(ast_test_flag(vmu, MVM_ALLOCED)) + if (ast_test_flag(vmu, MVM_ALLOCED)) free_user(vmu); return -1; } @@ -2349,7 +2349,7 @@ pbx_builtin_setvar_helper(chan, "MVM_GREET_STATUS", "USEREXIT"); res = 0; } else if (res == '0') { /* Check for a '0' here */ - if(ouseexten || ousemacro) { + if (ouseexten || ousemacro) { chan->exten[0] = 'o'; chan->exten[1] = '\0'; if (!ast_strlen_zero(vmu->exit)) { @@ -2368,7 +2368,7 @@ } else pbx_builtin_setvar_helper(chan, "MVM_GREET_STATUS", "SUCCESS"); - if(ast_test_flag(vmu, MVM_ALLOCED)) + if (ast_test_flag(vmu, MVM_ALLOCED)) free_user(vmu); @@ -2480,7 +2480,7 @@ return -1; } - if(!(vmu = find_account(domain, username, TRUE))) { + if (!(vmu = find_account(domain, username, TRUE))) { /* We could not find user, let's exit */ ast_log(LOG_WARNING, "Could not allocate temporary memory for '%s@%s'\n", username, domain); pbx_builtin_setvar_helper(chan, "MVM_ACCMESS_STATUS", "FAILED"); @@ -2511,7 +2511,7 @@ ast_debug(1, "Recorded new %s message in %s (duration %d)\n", message, filename, duration); - if(ast_test_flag(vmu, MVM_ALLOCED)) + if (ast_test_flag(vmu, MVM_ALLOCED)) free_user(vmu); pbx_builtin_setvar_helper(chan, "MVM_ACCMESS_STATUS", "SUCCESS"); @@ -2753,7 +2753,7 @@ global_maxsilence *= 1000; } else if (!strcmp(var->name, "logfile")) { if (!ast_strlen_zero(var->value) ) { - if(*(var->value) == '/') + if (*(var->value) == '/') ast_copy_string(global_logfile, var->value, sizeof(global_logfile)); else snprintf(global_logfile, sizeof(global_logfile), "%s/%s", ast_config_AST_LOG_DIR, var->value); @@ -2919,13 +2919,13 @@ ast_config_destroy(cfg); /* Close log file if it's open and disabled */ - if(minivmlogfile) + if (minivmlogfile) fclose(minivmlogfile); /* Open log file if it's enabled */ - if(!ast_strlen_zero(global_logfile)) { + if (!ast_strlen_zero(global_logfile)) { minivmlogfile = fopen(global_logfile, "a"); - if(!minivmlogfile) + if (!minivmlogfile) ast_log(LOG_ERROR, "Failed to open minivm log file %s : %s\n", global_logfile, strerror(errno)); if (minivmlogfile) ast_debug(3, "Opened log file %s \n", global_logfile); @@ -3229,7 +3229,7 @@ } } - if(ast_test_flag(vmu, MVM_ALLOCED)) + if (ast_test_flag(vmu, MVM_ALLOCED)) free_user(vmu); return 0; @@ -3272,7 +3272,7 @@ if (operand != 1) { counterfile = fopen(filename, "r"); if (counterfile) { - if(fgets(readbuf, sizeof(readbuf), counterfile)) { + if (fgets(readbuf, sizeof(readbuf), counterfile)) { ast_debug(3, "Read this string from counter file: %s\n", readbuf); old = counter = atoi(readbuf); } @@ -3374,7 +3374,7 @@ int change = 0; int operation = 0; - if(!value) + if (!value) return -1; change = atoi(value); Index: apps/app_osplookup.c =================================================================== --- apps/app_osplookup.c (revision 228266) +++ apps/app_osplookup.c (working copy) @@ -374,7 +374,7 @@ p->handle = OSP_INVALID_HANDLE; v = ast_variable_browse(cfg, provider); - while(v) { + while (v) { if (!strcasecmp(v->name, "privatekey")) { if (osp_security) { if (v->value[0] == '/') { @@ -599,7 +599,7 @@ ast_mutex_lock(&osplock); p = ospproviders; - while(p) { + while (p) { if (!strcasecmp(p->name, name)) { *provider = p; ast_debug(1, "OSP: find provider '%s'\n", name); @@ -633,7 +633,7 @@ ast_mutex_lock(&osplock); p = ospproviders; - while(p) { + while (p) { if (!strcasecmp(p->name, provider)) { error = OSPPTransactionNew(p->handle, transaction); if (error == OSPC_ERR_NO_ERROR) { @@ -820,7 +820,7 @@ res = 1; /* Strip leading and trailing brackets */ destination[strlen(destination) - 1] = '\0'; - switch(protocol) { + switch (protocol) { case OSPC_DPROT_Q931: ast_debug(1, "OSP: protocol '%s'\n", OSP_PROT_H323); ast_copy_string(result->tech, OSP_TECH_H323, sizeof(result->tech)); @@ -919,7 +919,7 @@ ast_debug(1, "OSP: Unable to generate transaction handle\n"); *transaction = OSP_INVALID_HANDLE; res = 0; - } else if((res = osp_validate_token(*transaction, source, dest, calling, called, token, timelimit)) <= 0) { + } else if ((res = osp_validate_token(*transaction, source, dest, calling, called, token, timelimit)) <= 0) { OSPPTransactionRecordFailure(*transaction, OSPC_FAIL_CALL_REJECTED); } break; @@ -931,7 +931,7 @@ ast_debug(1, "OSP: Unable to generate transaction handle\n"); *transaction = OSP_INVALID_HANDLE; res = 0; - } else if((res = osp_validate_token(*transaction, source, dest, calling, called, token, timelimit)) <= 0) { + } else if ((res = osp_validate_token(*transaction, source, dest, calling, called, token, timelimit)) <= 0) { OSPPTransactionRecordFailure(*transaction, OSPC_FAIL_CALL_REJECTED); } break; @@ -1203,7 +1203,7 @@ return 0; } - while(result->numresults) { + while (result->numresults) { result->outcallid.len = sizeof(result->outcallid.buf); tokenlen = sizeof(token); error = OSPPTransactionGetNextDestination( @@ -1314,7 +1314,7 @@ return 0; } - while(result->numresults) { + while (result->numresults) { result->outcallid.len = sizeof(result->outcallid.buf); tokenlen = sizeof(token); error = OSPPTransactionGetNextDestination( @@ -1512,7 +1512,7 @@ pbx_builtin_setvar_helper(chan, "OSPAUTHSTATUS", status); ast_debug(1, "OSPAuth: %s\n", status); - if(res <= 0) { + if (res <= 0) { res = -1; } else { res = 0; @@ -1686,7 +1686,7 @@ return -1; } - if(res <= 0) { + if (res <= 0) { res = -1; } else { res = 0; @@ -1842,7 +1842,7 @@ pbx_builtin_setvar_helper(chan, "OSPDIALSTR", buffer); } - if(res <= 0) { + if (res <= 0) { res = -1; } else { res = 0; @@ -1960,7 +1960,7 @@ } pbx_builtin_setvar_helper(chan, "OSPFINISHSTATUS", status); - if(!res) { + if (!res) { res = -1; } else { res = 0; @@ -2024,7 +2024,7 @@ ast_debug(1, "OSP: osp_tokenformat '%d'\n", osp_tokenformat); t = ast_category_browse(cfg, NULL); - while(t) { + while (t) { if (strcasecmp(t, OSP_GENERAL_CAT)) { osp_create_provider(cfg, t); } @@ -2051,7 +2051,7 @@ if (osp_initialized) { ast_mutex_lock(&osplock); p = ospproviders; - while(p) { + while (p) { next = p->next; OSPPProviderDelete(p->handle, 0); ast_free(p); @@ -2115,7 +2115,7 @@ ast_mutex_lock(&osplock); p = ospproviders; - while(p) { + while (p) { if (!provider || !strcasecmp(p->name, provider)) { if (found) { ast_cli(a->fd, "\n"); Index: apps/app_queue.c =================================================================== --- apps/app_queue.c (revision 228266) +++ apps/app_queue.c (working copy) @@ -6046,7 +6046,7 @@ ast_copy_string(new_rl->name, rulecat, sizeof(new_rl->name)); AST_LIST_INSERT_TAIL(&rule_lists, new_rl, list); for (rulevar = ast_variable_browse(cfg, rulecat); rulevar; rulevar = rulevar->next) - if(!strcasecmp(rulevar->name, "penaltychange")) + if (!strcasecmp(rulevar->name, "penaltychange")) insert_penaltychange(new_rl->name, rulevar->value, rulevar->lineno); else ast_log(LOG_WARNING, "Don't know how to handle rule type '%s' on line %d\n", rulevar->name, rulevar->lineno); Index: apps/app_rpt.c =================================================================== --- apps/app_rpt.c (revision 228266) +++ apps/app_rpt.c (working copy) @@ -921,7 +921,7 @@ { int i; - for(i = 0; i < MAXLOCKTHREAD; i++) + for (i = 0; i < MAXLOCKTHREAD; i++) { if (lockthreads[i].id == id) return(&lockthreads[i]); } @@ -932,12 +932,12 @@ { int i; - for(i = 0; i < MAXLOCKTHREAD; i++) + for (i = 0; i < MAXLOCKTHREAD; i++) { if (lockthreads[i].id == id) return(&lockthreads[i]); } - for(i = 0; i < MAXLOCKTHREAD; i++) + for (i = 0; i < MAXLOCKTHREAD; i++) { if (!lockthreads[i].id) { @@ -967,13 +967,13 @@ ast_mutex_unlock(&locklock); lasttv.tv_sec = lasttv.tv_usec = 0; - for(i = 0 ; i < 32 ; i++) + for (i = 0 ; i < 32 ; i++) { j = (i + lock_ring_index_copy) % 32; strftime(a,sizeof(a) - 1,"%m/%d/%Y %H:%M:%S", localtime(&lock_ring_copy[j].tv.tv_sec)); diff = 0; - if(lasttv.tv_sec) + if (lasttv.tv_sec) { diff = (lock_ring_copy[j].tv.tv_sec - lasttv.tv_sec) * 1000000; @@ -1023,7 +1023,7 @@ lock_ring[lock_ring_index].rpt = myrpt; memcpy(&lock_ring[lock_ring_index].lockthread,t,sizeof(struct lockthread)); lock_ring[lock_ring_index++].line = line; - if(lock_ring_index == 32) + if (lock_ring_index == 32) lock_ring_index = 0; ast_mutex_unlock(&locklock); ast_mutex_lock(lockp); @@ -1057,7 +1057,7 @@ lock_ring[lock_ring_index].rpt = myrpt; memcpy(&lock_ring[lock_ring_index].lockthread,t,sizeof(struct lockthread)); lock_ring[lock_ring_index++].line = -line; - if(lock_ring_index == 32) + if (lock_ring_index == 32) lock_ring_index = 0; ast_mutex_unlock(&locklock); ast_mutex_unlock(lockp); @@ -1076,9 +1076,9 @@ static int multimode_capable(struct rpt *myrpt) { - if(!strcmp(myrpt->remoterig, remote_rig_ft897)) + if (!strcmp(myrpt->remoterig, remote_rig_ft897)) return 1; - if(!strcmp(myrpt->remoterig, remote_rig_ic706)) + if (!strcmp(myrpt->remoterig, remote_rig_ic706)) return 1; return 0; } @@ -1124,7 +1124,7 @@ float threshold = 0.0; if (v->voxena < 0) return(v->lastvox); - for(i = 0; i < bs; i++) + for (i = 0; i < bs; i++) { esquare += (float) buf[i] * (float) buf[i]; } @@ -1348,11 +1348,11 @@ static void flush_telem(struct rpt *myrpt) { struct rpt_tele *telem; - if(debug > 2) + if (debug > 2) ast_log(LOG_NOTICE, "flush_telem()!!"); rpt_mutex_lock(&myrpt->lock); telem = myrpt->tele.next; - while(telem != &myrpt->tele) + while (telem != &myrpt->tele) { if (telem->mode != SETREMOTE) ast_softhangup(telem->chan,AST_SOFTHANGUP_DEV); telem = telem->next; @@ -1385,8 +1385,8 @@ reverse_patch_state = "DOWN"; numoflinks = 0; l = myrpt->links.next; - while(l && (l != &myrpt->links)){ - if(numoflinks >= MAX_STAT_LINKS){ + while (l && (l != &myrpt->links)){ + if (numoflinks >= MAX_STAT_LINKS){ ast_log(LOG_WARNING, "maximum number of links exceeds %d in rpt_do_stats()!",MAX_STAT_LINKS); break; @@ -1437,8 +1437,8 @@ myrpt->offset = REM_SIMPLEX; myrpt->powerlevel = REM_MEDPWR; myrpt->txplon = myrpt->rxplon = 0; - while(*s1){ - switch(*s1++){ + while (*s1){ + switch (*s1++){ case 'A': case 'a': strcpy(myrpt->rxpl, "100.0"); @@ -1509,11 +1509,11 @@ static void birdbath(struct rpt *myrpt) { struct rpt_tele *telem; - if(debug > 2) + if (debug > 2) ast_log(LOG_NOTICE, "birdbath!!"); rpt_mutex_lock(&myrpt->lock); telem = myrpt->tele.next; - while(telem != &myrpt->tele) + while (telem != &myrpt->tele) { if (telem->mode == PARROT) ast_softhangup(telem->chan,AST_SOFTHANGUP_DEV); telem = telem->next; @@ -1527,7 +1527,7 @@ l = myrpt->links.next; /* go thru all the links */ - while(l != &myrpt->links) + while (l != &myrpt->links) { if (!l->phonemode) { @@ -1608,7 +1608,7 @@ /* if at timeout */ if (myrpt->dtmf_local_timer == 1) { - if(debug > 6) + if (debug > 6) ast_log(LOG_NOTICE,"time out dtmf_local_timer=%i\n",myrpt->dtmf_local_timer); /* if anything in the string */ @@ -1616,7 +1616,7 @@ { digit = myrpt->dtmf_local_str[0]; myrpt->dtmf_local_str[0] = 0; - for(i = 1; myrpt->dtmf_local_str[i]; i++) + for (i = 1; myrpt->dtmf_local_str[i]; i++) { myrpt->dtmf_local_str[i - 1] = myrpt->dtmf_local_str[i]; @@ -1703,7 +1703,7 @@ cfsetospeed(&mode, B9600); if (tcsetattr(fd, TCSANOW, &mode)) ast_log(LOG_WARNING, "Unable to set serial parameters on %s: %s\n", fname, strerror(errno)); - if(!strcmp(myrpt->remoterig, remote_rig_kenwood)) setdtr(fd,0); + if (!strcmp(myrpt->remoterig, remote_rig_kenwood)) setdtr(fd,0); usleep(100000); if (debug)ast_log(LOG_NOTICE,"Opened serial port %s\n",fname); return(fd); @@ -1744,7 +1744,7 @@ l = myrpt->links.next; /* otherwise, send it to all of em */ - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->name[0] == '0') { @@ -1807,8 +1807,8 @@ static char *eatwhite(char *s) { - while((*s == ' ') || (*s == 0x09)){ /* get rid of any leading white space */ - if(!*s) + while ((*s == ' ') || (*s == 0x09)){ /* get rid of any leading white space */ + if (!*s) break; s++; } @@ -1837,7 +1837,7 @@ strp[0] = 0; return(0); } - for(l = 0; *str && (l < limit) ; str++) + for (l = 0; *str && (l < limit) ; str++) { if (*str == QUOTECHR) { @@ -1891,7 +1891,7 @@ buf[0] = 0; /* clear output buffer */ if (myrpt->remote) return; /* go thru all links */ - for(l = myrpt->links.next; l != &myrpt->links; l = l->next) + for (l = myrpt->links.next; l != &myrpt->links; l = l->next) { /* if is not a real link, ignore it */ if (l->name[0] == '0') continue; @@ -1922,7 +1922,7 @@ /* if we are in tranceive mode, let all modes stand */ if (mode == 'T') continue; /* downgrade everyone on this node if appropriate */ - for(i = spos; buf[i]; i++) + for (i = spos; buf[i]; i++) { if (buf[i] == 'T') buf[i] = mode; if ((buf[i] == 'R') && (mode == 'C')) buf[i] = mode; @@ -1936,7 +1936,7 @@ { struct rpt_link *l; - for(l = myrpt->links.next; l != &myrpt->links; l = l->next) + for (l = myrpt->links.next; l != &myrpt->links; l = l->next) { /* if is not a real link, ignore it */ if (l->name[0] == '0') continue; @@ -2028,7 +2028,7 @@ /* determine longest node length again */ longestnode = 0; vp = ast_variable_browse(myrpt->cfg, myrpt->p.nodes); - while(vp){ + while (vp){ j = strlen(vp->name); if (j > longestnode) longestnode = j; @@ -2036,7 +2036,7 @@ } vp = ast_variable_browse(ourcfg, myrpt->p.extnodes); - while(vp){ + while (vp){ j = strlen(vp->name); if (j > longestnode) longestnode = j; @@ -2060,14 +2060,14 @@ static int matchkeyword(char *string, char **param, char *keywords[]) { int i,ls; - for( i = 0 ; keywords[i] ; i++){ + for ( i = 0 ; keywords[i] ; i++){ ls = strlen(keywords[i]); - if(!ls){ + if (!ls){ *param = NULL; return 0; } - if(!strncmp(string, keywords[i], ls)){ - if(param) + if (!strncmp(string, keywords[i], ls)){ + if (param) *param = string + ls; return i + 1; } @@ -2084,14 +2084,14 @@ static char *skipchars(char *string, char *charlist) { int i; - while(*string){ - for(i = 0; charlist[i] ; i++){ - if(*string == charlist[i]){ + while (*string){ + for (i = 0; charlist[i] ; i++){ + if (*string == charlist[i]){ string++; break; } } - if(!charlist[i]) + if (!charlist[i]) return string; } return string; @@ -2140,9 +2140,9 @@ int i,j; struct rptfilter *f; - for(i = 0; i < len; i++) + for (i = 0; i < len; i++) { - for(j = 0; j < MAXFILTERS; j++) + for (j = 0; j < MAXFILTERS; j++) { f = &myrpt->filters[j]; if (!*f->desc) continue; @@ -2205,19 +2205,19 @@ int ret; char include_zero = 0; - if(min < 0){ /* If min is negative, this means include 0 as a valid entry */ + if (min < 0){ /* If min is negative, this means include 0 as a valid entry */ min = -min; include_zero = 1; } var = (char *) ast_variable_retrieve(myrpt->cfg, category, name); - if(var){ + if (var){ ret = myatoi(var); - if(include_zero && !ret) + if (include_zero && !ret) return 0; - if(ret < min) + if (ret < min) ret = min; - if(ret > max) + if (ret > max) ret = max; } else @@ -2418,7 +2418,7 @@ if (val) { i = finddelim(val,strs,MAXFILTERS * 2); i &= ~1; /* force an even number, rounded down */ - if (i >= 2) for(j = 0; j < i; j += 2) + if (i >= 2) for (j = 0; j < i; j += 2) { rpt_mknotch(atof(strs[j]),atof(strs[j + 1]), &rpt_vars[n].filters[j >> 1].gain, @@ -2463,7 +2463,7 @@ vp = ast_variable_browse(cfg, rpt_vars[n].p.nodes); - while(vp){ + while (vp){ j = strlen(vp->name); if (j > longestnode) longestnode = j; @@ -2477,7 +2477,7 @@ */ rpt_vars[n].longestfunc = 0; vp = ast_variable_browse(cfg, rpt_vars[n].p.functions); - while(vp){ + while (vp){ j = strlen(vp->name); if (j > rpt_vars[n].longestfunc) rpt_vars[n].longestfunc = j; @@ -2488,7 +2488,7 @@ */ rpt_vars[n].link_longestfunc = 0; vp = ast_variable_browse(cfg, rpt_vars[n].p.link_functions); - while(vp){ + while (vp){ j = strlen(vp->name); if (j > rpt_vars[n].link_longestfunc) rpt_vars[n].link_longestfunc = j; @@ -2498,7 +2498,7 @@ if (rpt_vars[n].p.phone_functions) { vp = ast_variable_browse(cfg, rpt_vars[n].p.phone_functions); - while(vp){ + while (vp){ j = strlen(vp->name); if (j > rpt_vars[n].phone_longestfunc) rpt_vars[n].phone_longestfunc = j; @@ -2509,7 +2509,7 @@ if (rpt_vars[n].p.dphone_functions) { vp = ast_variable_browse(cfg, rpt_vars[n].p.dphone_functions); - while(vp){ + while (vp){ j = strlen(vp->name); if (j > rpt_vars[n].dphone_longestfunc) rpt_vars[n].dphone_longestfunc = j; @@ -2520,7 +2520,7 @@ if (rpt_vars[n].p.alt_functions) { vp = ast_variable_browse(cfg, rpt_vars[n].p.alt_functions); - while(vp){ + while (vp){ j = strlen(vp->name); if (j > rpt_vars[n].alt_longestfunc) rpt_vars[n].alt_longestfunc = j; @@ -2529,7 +2529,7 @@ } rpt_vars[n].macro_longest = 1; vp = ast_variable_browse(cfg, rpt_vars[n].p.macro); - while(vp){ + while (vp){ j = strlen(vp->name); if (j > rpt_vars[n].macro_longest) rpt_vars[n].macro_longest = j; @@ -2537,11 +2537,11 @@ } /* Browse for control states */ - if(rpt_vars[n].p.csstanzaname) + if (rpt_vars[n].p.csstanzaname) vp = ast_variable_browse(cfg, rpt_vars[n].p.csstanzaname); else vp = NULL; - for( i = 0 ; vp && (i < MAX_SYSSTATES) ; i++){ /* Iterate over the number of control state lines in the stanza */ + for ( i = 0 ; vp && (i < MAX_SYSSTATES) ; i++){ /* Iterate over the number of control state lines in the stanza */ int k,nukw,statenum; statenum=atoi(vp->name); strncpy(s1, vp->value, 255); @@ -2549,9 +2549,9 @@ nukw = finddelim(s1,strs,32); for (k = 0 ; k < nukw ; k++){ /* for each user specified keyword */ - for(j = 0 ; cs_keywords[j] != NULL ; j++){ /* try to match to one in our internal table */ - if(!strcmp(strs[k],cs_keywords[j])){ - switch(j){ + for (j = 0 ; cs_keywords[j] != NULL ; j++){ /* try to match to one in our internal table */ + if (!strcmp(strs[k],cs_keywords[j])){ + switch (j){ case 0: /* rptena */ rpt_vars[n].p.s[statenum].txdisable = 0; break; @@ -2659,7 +2659,7 @@ if (argc != 3) return RESULT_SHOWUSAGE; - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (!strcmp(argv[2],rpt_vars[i].name)) { @@ -2694,7 +2694,7 @@ static char *not_applicable = "N/A"; - if(argc != 3) + if (argc != 3) return RESULT_SHOWUSAGE; tot_state = ider_state = @@ -2703,7 +2703,7 @@ called_number = lastdtmfcommand = NULL; time(&now); - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (!strcmp(argv[2],rpt_vars[i].name)){ /* Make a copy of all stat variables while locked */ @@ -2724,8 +2724,8 @@ reverse_patch_state = "DOWN"; numoflinks = 0; l = myrpt->links.next; - while(l && (l != &myrpt->links)){ - if(numoflinks >= MAX_STAT_LINKS){ + while (l && (l != &myrpt->links)){ + if (numoflinks >= MAX_STAT_LINKS){ ast_log(LOG_NOTICE, "maximum number of links exceeds %d in rpt_do_stats()!",MAX_STAT_LINKS); break; @@ -2736,7 +2736,7 @@ continue; } listoflinks[numoflinks] = ast_strdup(l->name); - if(listoflinks[numoflinks] == NULL){ + if (listoflinks[numoflinks] == NULL){ break; } else{ @@ -2745,66 +2745,66 @@ l = l->next; } - if(myrpt->keyed) + if (myrpt->keyed) input_signal = "YES"; else input_signal = "NO"; - if(myrpt->p.parrotmode) + if (myrpt->p.parrotmode) parrot_ena = "ENABLED"; else parrot_ena = "DISABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].txdisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable) sys_ena = "DISABLED"; else sys_ena = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].totdisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].totdisable) tot_ena = "DISABLED"; else tot_ena = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable) link_ena = "DISABLED"; else link_ena = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable) patch_ena = "DISABLED"; else patch_ena = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable) sch_ena = "DISABLED"; else sch_ena = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].userfundisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].userfundisable) user_funs = "DISABLED"; else user_funs = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].alternatetail) + if (myrpt->p.s[myrpt->p.sysstate_cur].alternatetail) tail_type = "ALTERNATE"; else tail_type = "STANDARD"; - if(!myrpt->totimer) + if (!myrpt->totimer) tot_state = "TIMED OUT!"; - else if(myrpt->totimer != myrpt->p.totime) + else if (myrpt->totimer != myrpt->p.totime) tot_state = "ARMED"; else tot_state = "RESET"; - if(myrpt->tailid) + if (myrpt->tailid) ider_state = "QUEUED IN TAIL"; - else if(myrpt->mustid) + else if (myrpt->mustid) ider_state = "QUEUED FOR CLEANUP"; else ider_state = "CLEAN"; - switch(myrpt->callmode){ + switch (myrpt->callmode){ case 1: patch_state = "DIALING"; break; @@ -2823,11 +2823,11 @@ patch_state = "DOWN"; } - if(strlen(myrpt->exten)){ + if (strlen(myrpt->exten)){ called_number = ast_strdup(myrpt->exten); } - if(strlen(myrpt->lastdtmfcommand)){ + if (strlen(myrpt->lastdtmfcommand)){ lastdtmfcommand = ast_strdup(myrpt->lastdtmfcommand); } rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */ @@ -2880,18 +2880,18 @@ hours, minutes, uptime); ast_cli(fd, "Nodes currently connected to us..................: "); - if(!numoflinks){ + if (!numoflinks){ ast_cli(fd,""); } else{ - for(j = 0 ;j < numoflinks; j++){ + for (j = 0 ;j < numoflinks; j++){ ast_cli(fd, "%s", listoflinks[j]); - if(j % 4 == 3){ + if (j % 4 == 3){ ast_cli(fd, "\n"); ast_cli(fd, " : "); } else{ - if((numoflinks - 1) - j > 0) + if ((numoflinks - 1) - j > 0) ast_cli(fd, ", "); } } @@ -2906,7 +2906,7 @@ ast_cli(fd, "User linking commands............................: %s\n", link_ena); ast_cli(fd, "User functions...................................: %s\n\n", user_funs); - for(j = 0; j < numoflinks; j++){ /* ast_free() all link names */ + for (j = 0; j < numoflinks; j++){ /* ast_free() all link names */ ast_free(listoflinks[j]); } ast_free(called_number); @@ -2929,14 +2929,14 @@ struct rpt_link *l; struct rpt_lstat *s,*t; struct rpt_lstat s_head; - if(argc != 3) + if (argc != 3) return RESULT_SHOWUSAGE; s = NULL; s_head.next = &s_head; s_head.prev = &s_head; - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (!strcmp(argv[2],rpt_vars[i].name)){ /* Make a copy of all stat variables while locked */ @@ -2945,12 +2945,12 @@ /* Traverse the list of connected nodes */ j = 0; l = myrpt->links.next; - while(l && (l != &myrpt->links)){ + while (l && (l != &myrpt->links)){ if (l->name[0] == '0'){ /* Skip '0' nodes */ l = l->next; continue; } - if((s = (struct rpt_lstat *) ast_malloc(sizeof(struct rpt_lstat))) == NULL){ + if ((s = (struct rpt_lstat *) ast_malloc(sizeof(struct rpt_lstat))) == NULL){ ast_log(LOG_ERROR, "Malloc failed in rpt_do_lstats\n"); rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */ return RESULT_FAILURE; @@ -2973,7 +2973,7 @@ ast_cli(fd, "NODE PEER RECONNECTS DIRECTION CONNECT TIME CONNECT STATE\n"); ast_cli(fd, "---- ---- ---------- --------- ------------ -------------\n"); - for(s = s_head.next; s != &s_head; s = s->next){ + for (s = s_head.next; s != &s_head; s = s->next){ int hours, minutes, seconds; long long connecttime = s->connecttime; char conntime[21]; @@ -2986,7 +2986,7 @@ snprintf(conntime, 20, "%02d:%02d:%02d.%d", hours, minutes, seconds, (int) connecttime); conntime[20] = 0; - if(s->thisconnected) + if (s->thisconnected) connstate = "ESTABLISHED"; else connstate = "CONNECTING"; @@ -2995,7 +2995,7 @@ } /* destroy our local link queue */ s = s_head.next; - while(s != &s_head){ + while (s != &s_head){ t = s; s = s->next; remque((struct qelem *)t); @@ -3017,10 +3017,10 @@ char ns; char lbuf[MAXLINKLIST],*strs[MAXLINKLIST]; struct rpt *myrpt; - if(argc != 3) + if (argc != 3) return RESULT_SHOWUSAGE; - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (!strcmp(argv[2],rpt_vars[i].name)){ /* Make a copy of all stat variables while locked */ @@ -3034,19 +3034,19 @@ if (ns) qsort((void *)strs,ns,sizeof(char *),mycompar); ast_cli(fd,"\n"); ast_cli(fd, "************************* CONNECTED NODES *************************\n\n"); - for(j = 0 ;; j++){ - if(!strs[j]){ - if(!j){ + for (j = 0 ;; j++){ + if (!strs[j]){ + if (!j){ ast_cli(fd,""); } break; } ast_cli(fd, "%s", strs[j]); - if(j % 8 == 7){ + if (j % 8 == 7){ ast_cli(fd, "\n"); } else{ - if(strs[j + 1]) + if (strs[j + 1]) ast_cli(fd, ", "); } } @@ -3085,7 +3085,7 @@ if (argc > 2) return RESULT_SHOWUSAGE; - for(n = 0; n < nrpts; n++) rpt_vars[n].reload = 1; + for (n = 0; n < nrpts; n++) rpt_vars[n].reload = 1; return RESULT_FAILURE; } @@ -3099,7 +3099,7 @@ int i; if (argc > 2) return RESULT_SHOWUSAGE; - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (rpt_vars[i].rxchannel) ast_softhangup(rpt_vars[i].rxchannel,AST_SOFTHANGUP_DEV); } @@ -3117,22 +3117,22 @@ if (argc != 4) return RESULT_SHOWUSAGE; - for(i = 0; i < nrpts; i++){ - if(!strcmp(argv[2], rpt_vars[i].name)){ + for (i = 0; i < nrpts; i++){ + if (!strcmp(argv[2], rpt_vars[i].name)){ struct rpt *myrpt = &rpt_vars[i]; rpt_mutex_lock(&myrpt->lock); if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(argv[3])){ rpt_mutex_unlock(&myrpt->lock); busy=1; } - if(!busy){ + if (!busy){ myrpt->macrotimer = MACROTIME; strncat(myrpt->macrobuf,argv[3],MAXMACRO - 1); } rpt_mutex_unlock(&myrpt->lock); } } - if(busy){ + if (busy){ ast_cli(fd, "Function decoder busy"); } return RESULT_FAILURE; @@ -3154,17 +3154,17 @@ rpt_mutex_unlock(&myrpt->lock); busy=1; } - if(!busy){ + if (!busy){ int x; if (debug)ast_log(LOG_NOTICE, "rpt_push_alt_macro %s\n",sptr); myrpt->macrotimer = MACROTIME; - for(x = 0; *(sptr + x); x++) + for (x = 0; *(sptr + x); x++) myrpt->macrobuf[x] = *(sptr + x) | 0x80; *(sptr + x) = 0; } rpt_mutex_unlock(&myrpt->lock); - if(busy)ast_log(LOG_WARNING, "Function decoder busy on app_rpt command macro.\n"); + if (busy)ast_log(LOG_WARNING, "Function decoder busy on app_rpt command macro.\n"); return busy; } @@ -3177,8 +3177,8 @@ if (argc != 4) return RESULT_SHOWUSAGE; - for(i = 0; i < nrpts; i++){ - if(!strcmp(argv[2], rpt_vars[i].name)){ + for (i = 0; i < nrpts; i++){ + if (!strcmp(argv[2], rpt_vars[i].name)){ struct rpt *myrpt = &rpt_vars[i]; rpt_push_alt_macro(myrpt, (char *) argv[3]); } @@ -3200,9 +3200,9 @@ struct rpt *myrpt = NULL; if (argc != 6) return RESULT_SHOWUSAGE; - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { - if(!strcmp(argv[2], rpt_vars[i].name)) + if (!strcmp(argv[2], rpt_vars[i].name)) { thisRpt = i; myrpt = &rpt_vars[i]; @@ -3218,9 +3218,9 @@ /* Look up the action */ l = strlen(argv[3]); - for(i = 0 ; i < maxActions; i++) + for (i = 0 ; i < maxActions; i++) { - if(!strncasecmp(argv[3], function_table[i].action, l)) + if (!strncasecmp(argv[3], function_table[i].action, l)) { thisAction = i; break; @@ -3262,7 +3262,7 @@ if ((res = ast_tonepair_start(chan, f1, f2, duration, amplitude))) return res; - while(chan->generatordata) { + while (chan->generatordata) { if (ast_safe_sleep(chan,1)) return -1; } @@ -3556,24 +3556,24 @@ interlettertime = dottime * 4 ; interwordtime = dottime * 7; - for(;(*string) && (!res); string++){ + for (;(*string) && (!res); string++){ c = *string; /* Convert lower case to upper case */ - if((c >= 'a') && (c <= 'z')) + if ((c >= 'a') && (c <= 'z')) c -= 0x20; /* Can't deal with any char code greater than Z, skip it */ - if(c > 'Z') + if (c > 'Z') continue; /* If space char, wait the inter word time */ - if(c == ' '){ - if(!res) + if (c == ' '){ + if (!res) res = play_silence(chan, interwordtime); continue; } @@ -3589,17 +3589,17 @@ /* Send the character */ - for(; len ; len--){ - if(!res) + for (; len ; len--){ + if (!res) res = play_tone(chan, freq, (ddcomb & 1) ? dashtime : dottime, amplitude); - if(!res) + if (!res) res = play_silence(chan, intralettertime); ddcomb >>= 1; } /* Wait the interletter time */ - if(!res) + if (!res) res = play_silence(chan, interlettertime - intralettertime); } @@ -3613,12 +3613,12 @@ * Wait for the DAHDI driver to physically write the tone blocks to the hardware */ - for(i = 0; i < 20 ; i++){ + for (i = 0; i < 20 ; i++){ flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT; res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags); - if(flags & DAHDI_IOMUX_WRITEEMPTY) + if (flags & DAHDI_IOMUX_WRITEEMPTY) break; - if( ast_safe_sleep(chan, 50)){ + if ( ast_safe_sleep(chan, 50)){ res = -1; break; } @@ -3641,23 +3641,23 @@ res = 0; - if(!tonestring) + if (!tonestring) return res; p = stringp = ast_strdup(tonestring); - for(;tonestring;){ + for (;tonestring;){ tonesubset = strsep(&stringp,")"); - if(!tonesubset) + if (!tonesubset) break; - if(sscanf(tonesubset,"(%30d,%30d,%30d,%30d", &f1, &f2, &duration, &litude) != 4) + if (sscanf(tonesubset,"(%30d,%30d,%30d,%30d", &f1, &f2, &duration, &litude) != 4) break; res = play_tone_pair(chan, f1, f2, duration, amplitude); - if(res) + if (res) break; } ast_free(p); - if(!res) + if (!res) res = play_tone_pair(chan, 0, 0, 100, 0); /* This is needed to ensure the last tone segment is timed correctly */ if (!res) @@ -3669,12 +3669,12 @@ * Wait for the DAHDI driver to physically write the tone blocks to the hardware */ - for(i = 0; i < 20 ; i++){ + for (i = 0; i < 20 ; i++){ flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT; res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags); - if(flags & DAHDI_IOMUX_WRITEEMPTY) + if (flags & DAHDI_IOMUX_WRITEEMPTY) break; - if( ast_safe_sleep(chan, 50)){ + if ( ast_safe_sleep(chan, 50)){ res = -1; break; } @@ -3714,7 +3714,7 @@ { int res; res = ast_say_number(mychannel, num, NULL, mychannel->language, NULL); - if(!res) + if (!res) res = ast_waitstream(mychannel, ""); else ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name); @@ -3755,7 +3755,7 @@ res = 0; - if(!morseidfreq){ /* Get the morse parameters if not already loaded */ + if (!morseidfreq){ /* Get the morse parameters if not already loaded */ morsespeed = retrieve_astcfgint(myrpt, mcat, "speed", 5, 20, 20); morsefreq = retrieve_astcfgint(myrpt, mcat, "frequency", 300, 3000, 800); morseampl = retrieve_astcfgint(myrpt, mcat, "amplitude", 200, 8192, 4096); @@ -3765,12 +3765,12 @@ /* Is it a file, or a tone sequence? */ - if(entry[0] == '|'){ + if (entry[0] == '|'){ c = entry[1]; - if((c >= 'a')&&(c <= 'z')) + if ((c >= 'a')&&(c <= 'z')) c -= 0x20; - switch(c){ + switch (c){ case 'I': /* Morse ID */ res = send_morse(chan, entry + 2, morsespeed, morseidfreq, morseidampl); break; @@ -3812,9 +3812,9 @@ /* Retrieve the section name for telemetry from the node section */ telemetry = (char *) ast_variable_retrieve(myrpt->cfg, node, TELEMETRY); - if(telemetry ){ + if (telemetry ){ telemetry_save = ast_strdup(telemetry); - if(!telemetry_save){ + if (!telemetry_save){ ast_log(LOG_WARNING,"ast_strdup() failed in telem_lookup()\n"); return res; } @@ -3823,15 +3823,15 @@ /* Try to look up the telemetry name */ - if(!entry){ + if (!entry){ /* Telemetry name wasn't found in the config file, use the default */ - for(i = 0; i < sizeof(tele_defs)/sizeof(struct telem_defaults) ; i++){ - if(!strcasecmp(tele_defs[i].name, name)) + for (i = 0; i < sizeof(tele_defs)/sizeof(struct telem_defaults) ; i++){ + if (!strcasecmp(tele_defs[i].name, name)) entry = tele_defs[i].value; } } - if(entry){ - if(strlen(entry)) + if (entry){ + if (strlen(entry)) if (chan) telem_any(myrpt,chan, entry); } else{ @@ -3854,58 +3854,58 @@ wait_times_save = NULL; wait_times = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, "wait_times"); - if(wait_times){ + if (wait_times){ wait_times_save = ast_strdup(wait_times); - if(!wait_times_save) + if (!wait_times_save) return 0; } - switch(type){ + switch (type){ case DLY_TELEM: - if(wait_times) + if (wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "telemwait", 500, 5000, 1000); else interval = 1000; break; case DLY_ID: - if(wait_times) + if (wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "idwait",250,5000,500); else interval = 500; break; case DLY_UNKEY: - if(wait_times) + if (wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "unkeywait",50,5000,1000); else interval = 1000; break; case DLY_LINKUNKEY: - if(wait_times) + if (wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "linkunkeywait",500,5000,1000); else interval = 1000; break; case DLY_CALLTERM: - if(wait_times) + if (wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "calltermwait",500,5000,1500); else interval = 1500; break; case DLY_COMP: - if(wait_times) + if (wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "compwait",500,5000,200); else interval = 200; break; case DLY_PARROT: - if(wait_times) + if (wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "parrotwait",500,5000,200); else interval = 200; @@ -3927,11 +3927,11 @@ { int interval; interval = get_wait_interval(myrpt, type); - if(debug) + if (debug) ast_log(LOG_NOTICE,"Delay interval = %d\n", interval); - if(interval) + if (interval) ast_safe_sleep(chan,interval); - if(debug) + if (debug) ast_log(LOG_NOTICE,"Delay complete\n"); return; } @@ -3969,7 +3969,7 @@ /* Snag copies of a few key myrpt variables */ rpt_mutex_lock(&myrpt->lock); nodename = ast_strdup(myrpt->name); - if(!nodename) + if (!nodename) { fprintf(stderr,"rpt:Sorry unable strdup nodename\n"); rpt_mutex_lock(&myrpt->lock); @@ -3982,7 +3982,7 @@ if (myrpt->p.ident){ ident = ast_strdup(myrpt->p.ident); - if(!ident) + if (!ident) { fprintf(stderr,"rpt:Sorry unable strdup ident\n"); rpt_mutex_lock(&myrpt->lock); @@ -4025,7 +4025,7 @@ mytele->chan = mychannel; rpt_mutex_unlock(&myrpt->lock); - while((mytele->mode != SETREMOTE) && (mytele->mode != UNKEY) && + while ((mytele->mode != SETREMOTE) && (mytele->mode != UNKEY) && (mytele->mode != LINKUNKEY)) { rpt_mutex_lock(&myrpt->lock); @@ -4065,7 +4065,7 @@ pthread_exit(NULL); } ast_stopstream(mychannel); - switch(mytele->mode) + switch (mytele->mode) { case ID: case ID1: @@ -4081,7 +4081,7 @@ case IDTALKOVER: p = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "idtalkover"); - if(p) + if (p) res = telem_any(myrpt,mychannel, p); imdone=1; break; @@ -4090,7 +4090,7 @@ /* wait a little bit longer */ wait_interval(myrpt, DLY_TELEM, mychannel); res = telem_lookup(myrpt, mychannel, myrpt->name, "patchup"); - if(res < 0){ /* Then default message */ + if (res < 0){ /* Then default message */ res = ast_streamfile(mychannel, "rpt/callproceeding", mychannel->language); } break; @@ -4098,7 +4098,7 @@ /* wait a little bit longer */ wait_interval(myrpt, DLY_CALLTERM, mychannel); res = telem_lookup(myrpt, mychannel, myrpt->name, "patchdown"); - if(res < 0){ /* Then default message */ + if (res < 0){ /* Then default message */ res = ast_streamfile(mychannel, "rpt/callterminated", mychannel->language); } break; @@ -4118,7 +4118,7 @@ res = ast_streamfile(mychannel, "rpt/macro_busy", mychannel->language); break; case UNKEY: - if(myrpt->patchnoct && myrpt->callmode){ /* If no CT during patch configured, then don't send one */ + if (myrpt->patchnoct && myrpt->callmode){ /* If no CT during patch configured, then don't send one */ imdone = 1; break; } @@ -4141,29 +4141,29 @@ if (tlist != &myrpt->tele) { rpt_mutex_lock(&myrpt->lock); - while(tlist != &myrpt->tele){ + while (tlist != &myrpt->tele){ if (tlist->mode == UNKEY) unkeys_queued++; tlist = tlist->next; } rpt_mutex_unlock(&myrpt->lock); } - if( unkeys_queued > 1){ + if ( unkeys_queued > 1){ imdone = 1; break; } /* Wait for the telemetry timer to expire */ /* Periodically check the timer since it can be re-initialized above */ - while(myrpt->unkeytocttimer) + while (myrpt->unkeytocttimer) { int ctint; - if(myrpt->unkeytocttimer > 100) + if (myrpt->unkeytocttimer > 100) ctint = 100; else ctint = myrpt->unkeytocttimer; ast_safe_sleep(mychannel, ctint); rpt_mutex_lock(&myrpt->lock); - if(myrpt->unkeytocttimer < ctint) + if (myrpt->unkeytocttimer < ctint) myrpt->unkeytocttimer = 0; else myrpt->unkeytocttimer -= ctint; @@ -4174,7 +4174,7 @@ * Now, the carrier on the rptr rx should be gone. * If it re-appeared, then forget about sending the CT */ - if(myrpt->keyed){ + if (myrpt->keyed){ imdone = 1; break; } @@ -4191,7 +4191,7 @@ if (l != &myrpt->links) { rpt_mutex_lock(&myrpt->lock); - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->name[0] == '0') { @@ -4211,7 +4211,7 @@ { res = telem_lookup(myrpt,mychannel, myrpt->name, (!hastx) ? "remotemon" : "remotetx"); - if(res) + if (res) ast_log(LOG_WARNING, "telem_lookup:remotexx failed on %s\n", mychannel->name); @@ -4220,21 +4220,21 @@ { ast_safe_sleep(mychannel,200); res = telem_lookup(myrpt,mychannel, myrpt->name, "cmdmode"); - if(res) + if (res) ast_log(LOG_WARNING, "telem_lookup:cmdmode failed on %s\n", mychannel->name); ast_stopstream(mychannel); } } - else if((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "unlinkedct"))){ /* Unlinked Courtesy Tone */ + else if ((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "unlinkedct"))){ /* Unlinked Courtesy Tone */ ct_copy = ast_strdup(ct); - if(ct_copy) + if (ct_copy) { res = telem_lookup(myrpt,mychannel, myrpt->name, ct_copy); ast_free(ct_copy); } else res = -1; - if(res) + if (res) ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", mychannel->name); } if (hasremote && (!myrpt->cmdnode[0])) @@ -4258,10 +4258,10 @@ ast_hangup(mychannel); pthread_exit(NULL); } - if((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "remotect"))){ /* Unlinked Courtesy Tone */ + if ((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "remotect"))){ /* Unlinked Courtesy Tone */ ast_safe_sleep(mychannel,200); ct_copy = ast_strdup(ct); - if(ct_copy) + if (ct_copy) { res = telem_lookup(myrpt,mychannel, myrpt->name, ct_copy); ast_free(ct_copy); @@ -4269,7 +4269,7 @@ else res = -1; - if(res) + if (res) ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", mychannel->name); } } @@ -4307,7 +4307,7 @@ imdone = 1; break; case LINKUNKEY: - if(myrpt->patchnoct && myrpt->callmode){ /* If no CT during patch configured, then don't send one */ + if (myrpt->patchnoct && myrpt->callmode){ /* If no CT during patch configured, then don't send one */ imdone = 1; break; } @@ -4328,44 +4328,44 @@ if (tlist != &myrpt->tele) { rpt_mutex_lock(&myrpt->lock); - while(tlist != &myrpt->tele){ + while (tlist != &myrpt->tele){ if (tlist->mode == LINKUNKEY) unkeys_queued++; tlist = tlist->next; } rpt_mutex_unlock(&myrpt->lock); } - if( unkeys_queued > 1){ + if ( unkeys_queued > 1){ imdone = 1; break; } /* Wait for the telemetry timer to expire */ /* Periodically check the timer since it can be re-initialized above */ - while(mytele->mylink.linkunkeytocttimer) + while (mytele->mylink.linkunkeytocttimer) { int ctint; - if(mytele->mylink.linkunkeytocttimer > 100) + if (mytele->mylink.linkunkeytocttimer > 100) ctint = 100; else ctint = mytele->mylink.linkunkeytocttimer; ast_safe_sleep(mychannel, ctint); rpt_mutex_lock(&myrpt->lock); - if(mytele->mylink.linkunkeytocttimer < ctint) + if (mytele->mylink.linkunkeytocttimer < ctint) mytele->mylink.linkunkeytocttimer = 0; else mytele->mylink.linkunkeytocttimer -= ctint; rpt_mutex_unlock(&myrpt->lock); } - if((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "linkunkeyct"))){ /* Unlinked Courtesy Tone */ + if ((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "linkunkeyct"))){ /* Unlinked Courtesy Tone */ ct_copy = ast_strdup(ct); - if(ct_copy){ + if (ct_copy){ res = telem_lookup(myrpt,mychannel, myrpt->name, ct_copy); ast_free(ct_copy); } else res = -1; - if(res) + if (res) ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", mychannel->name); } imdone = 1; @@ -4379,7 +4379,7 @@ if (l != &myrpt->links) { rpt_mutex_lock(&myrpt->lock); - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->name[0] == '0') { @@ -4458,7 +4458,7 @@ case TOPKEY: /* wait a little bit */ wait_interval(myrpt, DLY_TELEM, mychannel); - for(i = 0; i < TOPKEYN; i++) + for (i = 0; i < TOPKEYN; i++) { if (!myrpt->topkey[i].node[0]) continue; if ((!myrpt->topkeylong) && (myrpt->topkey[i].keyed)) continue; @@ -4475,20 +4475,20 @@ case SETREMOTE: ast_mutex_lock(&myrpt->remlock); res = 0; - if(!strcmp(myrpt->remoterig, remote_rig_ft897)) + if (!strcmp(myrpt->remoterig, remote_rig_ft897)) { res = set_ft897(myrpt); } - else if(!strcmp(myrpt->remoterig, remote_rig_tm271)) + else if (!strcmp(myrpt->remoterig, remote_rig_tm271)) { res = set_tm271(myrpt); } - else if(!strcmp(myrpt->remoterig, remote_rig_ic706)) + else if (!strcmp(myrpt->remoterig, remote_rig_ic706)) { res = set_ic706(myrpt); } #ifdef HAVE_IOPERM - else if(!strcmp(myrpt->remoterig, remote_rig_rbi)||!strcmp(myrpt->remoterig, remote_rig_ppp16)) + else if (!strcmp(myrpt->remoterig, remote_rig_rbi)||!strcmp(myrpt->remoterig, remote_rig_ppp16)) { if (ioperm(myrpt->p.iobase,1,1) == -1) { @@ -4499,7 +4499,7 @@ else res = setrbi(myrpt); } #endif - else if(!strcmp(myrpt->remoterig, remote_rig_kenwood)) + else if (!strcmp(myrpt->remoterig, remote_rig_kenwood)) { if (myrpt->iofd >= 0) setdtr(myrpt->iofd,1); res = setkenwood(myrpt); @@ -4547,7 +4547,7 @@ case REMMODE: cp = 0; wait_interval(myrpt, DLY_TELEM, mychannel); - switch(myrpt->remmode) + switch (myrpt->remmode) { case REM_MODE_FM: saycharstr(mychannel,"FM"); @@ -4580,7 +4580,7 @@ case REMXXX: wait_interval(myrpt, DLY_TELEM, mychannel); res = 0; - switch(mytele->submode) + switch (mytele->submode) { case 100: /* RX PL Off */ sayfile(mychannel, "rpt/rxpl"); @@ -4665,7 +4665,7 @@ if (!strcmp(myrpt->remoterig,remote_rig_ic706)) { set_mode_ic706(myrpt, REM_MODE_AM); - if(play_tone(mychannel, 800, 6000, 8192) == -1) break; + if (play_tone(mychannel, 800, 6000, 8192) == -1) break; ast_safe_sleep(mychannel,500); set_mode_ic706(myrpt, myrpt->remmode); myrpt->tunerequest = 0; @@ -4675,7 +4675,7 @@ } set_mode_ft897(myrpt, REM_MODE_AM); simple_command_ft897(myrpt, 8); - if(play_tone(mychannel, 800, 6000, 8192) == -1) break; + if (play_tone(mychannel, 800, 6000, 8192) == -1) break; simple_command_ft897(myrpt, 0x88); ast_safe_sleep(mychannel,500); set_mode_ft897(myrpt, myrpt->remmode); @@ -4687,26 +4687,26 @@ case REMLONGSTATUS: wait_interval(myrpt, DLY_TELEM, mychannel); res = saynode(myrpt,mychannel,myrpt->name); - if(!res) + if (!res) res = sayfile(mychannel,"rpt/frequency"); - if(!res) + if (!res) res = split_freq(mhz, decimals, myrpt->freq); if (!multimode_capable(myrpt)) decimals[3] = 0; - if(!res){ + if (!res){ m = atoi(mhz); - if(m < 100) + if (m < 100) res = saynum(mychannel, m); else res = saycharstr(mychannel, mhz); } - if(!res) + if (!res) res = sayfile(mychannel, "letters/dot"); - if(!res) + if (!res) res = saycharstr(mychannel, decimals); - if(res) break; - if(myrpt->remmode == REM_MODE_FM){ /* Mode FM? */ - switch(myrpt->offset){ + if (res) break; + if (myrpt->remmode == REM_MODE_FM){ /* Mode FM? */ + switch (myrpt->offset){ case REM_MINUS: res = sayfile(mychannel,"rpt/minus"); @@ -4725,7 +4725,7 @@ } } else{ /* Must be USB, LSB, or AM */ - switch(myrpt->remmode){ + switch (myrpt->remmode){ case REM_MODE_USB: res = saycharstr(mychannel, "USB"); @@ -4747,7 +4747,7 @@ if (res == -1) break; - if(mytele->mode == REMSHORTSTATUS){ /* Short status? */ + if (mytele->mode == REMSHORTSTATUS){ /* Short status? */ wait_interval(myrpt, DLY_COMP, mychannel); if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete"); break; @@ -4755,7 +4755,7 @@ if (strcmp(myrpt->remoterig,remote_rig_ic706)) { - switch(myrpt->powerlevel){ + switch (myrpt->powerlevel){ case REM_LOWPWR: res = sayfile(mychannel,"rpt/lopwr") ; @@ -4778,7 +4778,7 @@ if ((!rbimode) && ((sayfile(mychannel,"rpt/txpl") == -1) || (sayfile(mychannel,"rpt/frequency") == -1) || (saycharstr(mychannel,myrpt->txpl) == -1))) break; - if(myrpt->remmode == REM_MODE_FM){ /* Mode FM? */ + if (myrpt->remmode == REM_MODE_FM){ /* Mode FM? */ if ((sayfile(mychannel,"rpt/rxpl") == -1) || (sayfile(mychannel,((myrpt->rxplon) ? "rpt/on" : "rpt/off")) == -1) || (sayfile(mychannel,"rpt/txpl") == -1) || @@ -4799,7 +4799,7 @@ rpt_mutex_lock(&myrpt->lock); /* make our own list of links */ l = myrpt->links.next; - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->name[0] == '0') { @@ -4838,7 +4838,7 @@ ast_stopstream(mychannel); } l = linkbase.next; - while(l != &linkbase) + while (l != &linkbase) { char *s; @@ -4866,7 +4866,7 @@ } /* destroy our local link queue */ l = linkbase.next; - while(l != &linkbase) + while (l != &linkbase) { l1 = l; l = l->next; @@ -4899,7 +4899,7 @@ ast_stopstream(mychannel); } /* go thru all the nodes in list */ - for(i = 0; i < ns; i++) + for (i = 0; i < ns; i++) { char *s,mode = 'T'; @@ -4936,9 +4936,9 @@ case LASTNODEKEY: /* Identify last node which keyed us up */ rpt_mutex_lock(&myrpt->lock); - if(myrpt->lastnodewhichkeyedusup){ + if (myrpt->lastnodewhichkeyedusup){ p = ast_strdup(myrpt->lastnodewhichkeyedusup); /* Make a local copy of the node name */ - if(!p){ + if (!p){ ast_log(LOG_WARNING, "ast_strdup failed in telemetery LASTNODEKEY"); imdone = 1; break; @@ -4947,7 +4947,7 @@ else p = NULL; rpt_mutex_unlock(&myrpt->lock); - if(!p){ + if (!p){ imdone = 1; /* no node previously keyed us up, or the node which did has been disconnected */ break; } @@ -5008,7 +5008,7 @@ else ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name); ast_stopstream(mychannel); - if(!res) /* Say number of seconds */ + if (!res) /* Say number of seconds */ ast_say_number(mychannel, myrpt->p.remotetimeout - (t - myrpt->last_activity_time), "", mychannel->language, (char *) NULL); @@ -5028,7 +5028,7 @@ else ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name); ast_stopstream(mychannel); - if(!res) /* Say number of seconds */ + if (!res) /* Say number of seconds */ ast_say_number(mychannel, myrpt->p.remoteinacttimeout - (t - myrpt->last_activity_time), "", mychannel->language, (char *) NULL); @@ -5044,9 +5044,9 @@ t = time(NULL); rpt_localtime(&t, &localtm); /* Say the phase of the day is before the time */ - if((localtm.tm_hour >= 0) && (localtm.tm_hour < 12)) + if ((localtm.tm_hour >= 0) && (localtm.tm_hour < 12)) p = "rpt/goodmorning"; - else if((localtm.tm_hour >= 12) && (localtm.tm_hour < 18)) + else if ((localtm.tm_hour >= 12) && (localtm.tm_hour < 18)) p = "rpt/goodafternoon"; else p = "rpt/goodevening"; @@ -5070,9 +5070,9 @@ break; case STATS_VERSION: p = strstr(tdesc, "version"); - if(!p) + if (!p) break; - if(sscanf(p, "version %30d.%30d", &vmajor, &vminor) != 2) + if (sscanf(p, "version %30d.%30d", &vmajor, &vminor) != 2) break; wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */ /* Say "version" */ @@ -5081,7 +5081,7 @@ imdone = 1; break; } - if(!res) /* Say "X" */ + if (!res) /* Say "X" */ ast_say_number(mychannel, vmajor, "", mychannel->language, (char *) NULL); if (!res) res = ast_waitstream(mychannel, ""); @@ -5091,7 +5091,7 @@ imdone = 1; break; } - if(!res) /* Say "Y" */ + if (!res) /* Say "Y" */ ast_say_number(mychannel, vminor, "", mychannel->language, (char *) NULL); if (!res){ res = ast_waitstream(mychannel, ""); @@ -5103,13 +5103,13 @@ break; case ARB_ALPHA: wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */ - if(mytele->param) + if (mytele->param) saycharstr(mychannel, mytele->param); imdone = 1; break; case REV_PATCH: wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */ - if(mytele->param) { + if (mytele->param) { /* Parts of this section taken from app_parkandannounce */ char *tpl_working, *tpl_current; @@ -5121,20 +5121,20 @@ myparm = strsep(&tpl_working,","); tpl_current=strsep(&tpl_working, ":"); - while(tpl_current && looptemp < sizeof(tmp)) { + while (tpl_current && looptemp < sizeof(tmp)) { tmp[looptemp]=tpl_current; looptemp++; tpl_current=strsep(&tpl_working,":"); } - for(idx=0; idxlanguage); - } else if(!strcmp(tmp[idx], "NODE")) { + } else if (!strcmp(tmp[idx], "NODE")) { ast_say_digits(mychannel, atoi(myrpt->name), "", mychannel->language); } else { dres = ast_streamfile(mychannel, tmp[idx], mychannel->language); - if(!dres) { + if (!dres) { dres = ast_waitstream(mychannel, ""); } else { ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[idx], mychannel->name); @@ -5155,7 +5155,7 @@ myrpt->stopgen = 0; break; } - while(mychannel->generatordata && (myrpt->stopgen <= 0)) { + while (mychannel->generatordata && (myrpt->stopgen <= 0)) { if (ast_safe_sleep(mychannel,1)) break; imdone = 1; } @@ -5180,7 +5180,7 @@ if (!res) { myrpt->tailmessagen++; - if(myrpt->tailmessagen >= myrpt->p.tailmessagemax) myrpt->tailmessagen = 0; + if (myrpt->tailmessagen >= myrpt->p.tailmessagemax) myrpt->tailmessagen = 0; } else { @@ -5216,10 +5216,10 @@ pthread_attr_t attr; char *v1, *v2; - if(debug > 6) + if (debug > 6) ast_log(LOG_NOTICE,"mode=%i data=%s\n",mode, (char *)data); - switch(mode) + switch (mode) { case UNKEY: /* if any of the following are defined, go ahead and do it, @@ -5255,7 +5255,7 @@ if (mode == PARROT) tele->parrot = (uintptr_t) data; else mylink = (struct rpt_link *) data; rpt_mutex_lock(&myrpt->lock); - if((mode == CONNFAIL) || (mode == REMDISC) || (mode == CONNECTED) || + if ((mode == CONNFAIL) || (mode == REMDISC) || (mode == CONNECTED) || (mode == LINKUNKEY)){ memset(&tele->mylink,0,sizeof(struct rpt_link)); if (mylink){ @@ -5272,7 +5272,7 @@ pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); res = ast_pthread_create(&tele->threadid,&attr,rpt_tele_thread,(void *) tele); - if(res < 0){ + if (res < 0){ rpt_mutex_lock(&myrpt->lock); remque((struct qlem *) tele); /* We don't like stuck transmitters, remove it from the queue */ rpt_mutex_unlock(&myrpt->lock); @@ -5375,13 +5375,13 @@ while ((myrpt->callmode == 1) || (myrpt->callmode == 4)) { - if((myrpt->patchdialtime)&&(myrpt->callmode == 1)&&(myrpt->cidx != lastcidx)){ + if ((myrpt->patchdialtime)&&(myrpt->callmode == 1)&&(myrpt->cidx != lastcidx)){ dialtimer = 0; lastcidx = myrpt->cidx; } - if((myrpt->patchdialtime)&&(dialtimer >= myrpt->patchdialtime)){ - if(debug) + if ((myrpt->patchdialtime)&&(dialtimer >= myrpt->patchdialtime)){ + if (debug) ast_log(LOG_NOTICE, "dialtimer %i > patchdialtime %i\n", dialtimer,myrpt->patchdialtime); rpt_mutex_lock(&myrpt->lock); aborted = 1; @@ -5398,7 +5398,7 @@ } if (myrpt->callmode == 1) { - if(myrpt->calldigittimer > PATCH_DIALPLAN_TIMEOUT) + if (myrpt->calldigittimer > PATCH_DIALPLAN_TIMEOUT) { myrpt->callmode = 2; break; @@ -5409,7 +5409,7 @@ } if (myrpt->callmode == 4) { - if(!congstarted){ + if (!congstarted){ congstarted = 1; /* start congestion tone */ tone_zone_play_tone(genchannel->fds[0],DAHDI_TONE_CONGESTION); @@ -5418,7 +5418,7 @@ res = ast_safe_sleep(mychannel, MSWAIT); if (res < 0) { - if(debug) + if (debug) ast_log(LOG_NOTICE, "ast_safe_sleep=%i\n", res); ast_hangup(mychannel); ast_hangup(genchannel); @@ -5434,7 +5434,7 @@ /* end if done */ if (!myrpt->callmode) { - if(debug) + if (debug) ast_log(LOG_NOTICE, "callmode==0\n"); ast_hangup(mychannel); ast_hangup(genchannel); @@ -5443,7 +5443,7 @@ myrpt->macropatch=0; channel_revert(myrpt); rpt_mutex_unlock(&myrpt->lock); - if((!myrpt->patchquiet) && aborted) + if ((!myrpt->patchquiet) && aborted) rpt_telemetry(myrpt, TERM, NULL); pthread_exit(NULL); } @@ -5451,15 +5451,15 @@ if (myrpt->p.ourcallerid && *myrpt->p.ourcallerid){ char *name, *loc, *instr; instr = ast_strdup(myrpt->p.ourcallerid); - if(instr){ + if (instr){ ast_callerid_parse(instr, &name, &loc); - if(loc){ - if(mychannel->cid.cid_num) + if (loc){ + if (mychannel->cid.cid_num) ast_free(mychannel->cid.cid_num); mychannel->cid.cid_num = ast_strdup(loc); } - if(name){ - if(mychannel->cid.cid_name) + if (name){ + if (mychannel->cid.cid_name) ast_free(mychannel->cid.cid_name); mychannel->cid.cid_name = ast_strdup(name); } @@ -5520,17 +5520,17 @@ myrpt->callmode = 0; pthread_exit(NULL); } - while(myrpt->callmode) + while (myrpt->callmode) { if ((!mychannel->pbx) && (myrpt->callmode != 4)) { /* If patch is setup for far end disconnect */ - if(myrpt->patchfarenddisconnect || (myrpt->p.duplex < 2)){ - if(debug)ast_log(LOG_NOTICE,"callmode=%i, patchfarenddisconnect=%i, duplex=%i\n",\ + if (myrpt->patchfarenddisconnect || (myrpt->p.duplex < 2)){ + if (debug)ast_log(LOG_NOTICE,"callmode=%i, patchfarenddisconnect=%i, duplex=%i\n",\ myrpt->callmode,myrpt->patchfarenddisconnect,myrpt->p.duplex); myrpt->callmode = 0; myrpt->macropatch=0; - if(!myrpt->patchquiet){ + if (!myrpt->patchquiet){ rpt_mutex_unlock(&myrpt->lock); rpt_telemetry(myrpt, TERM, NULL); rpt_mutex_lock(&myrpt->lock); @@ -5562,7 +5562,7 @@ usleep(MSWAIT * 1000); rpt_mutex_lock(&myrpt->lock); } - if(debug) + if (debug) ast_log(LOG_NOTICE, "exit channel loop\n"); rpt_mutex_unlock(&myrpt->lock); tone_zone_play_tone(genchannel->fds[0],-1); @@ -5601,7 +5601,7 @@ wf.samples = 0; l = myrpt->links.next; /* first, see if our dude is there */ - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->name[0] == '0') { @@ -5619,7 +5619,7 @@ } l = myrpt->links.next; /* if not, give it to everyone */ - while(l != &myrpt->links) + while (l != &myrpt->links) { wf.data.ptr = str; if (l->chan) ast_write(l->chan,&wf); @@ -5648,7 +5648,7 @@ wf.samples = 0; l = myrpt->links.next; /* give it to everyone */ - while(l != &myrpt->links) + while (l != &myrpt->links) { wf.data.ptr = str; if (l->chan) ast_write(l->chan,&wf); @@ -5692,15 +5692,15 @@ val = node_lookup(myrpt,node); if (!val){ - if(strlen(node) >= myrpt->longestnode) + if (strlen(node) >= myrpt->longestnode) return -1; /* No such node */ return 1; /* No match yet */ } - if(!strcmp(myrpt->name,node)) /* Do not allow connections to self */ + if (!strcmp(myrpt->name,node)) /* Do not allow connections to self */ return -2; - if(debug > 3){ + if (debug > 3){ ast_log(LOG_NOTICE,"Connect attempt to node %s\n", node); ast_log(LOG_NOTICE,"Mode: %s\n",(mode)?"Transceive":"Monitor"); ast_log(LOG_NOTICE,"Connection type: %s\n",(perma)?"Permalink":"Normal"); @@ -5720,7 +5720,7 @@ rpt_mutex_lock(&myrpt->lock); l = myrpt->links.next; /* try to find this one in queue */ - while(l != &myrpt->links){ + while (l != &myrpt->links){ if (l->name[0] == '0') { l = l->next; @@ -5749,7 +5749,7 @@ __mklinklist(myrpt,NULL,lstr); rpt_mutex_unlock(&myrpt->lock); n = finddelim(lstr,strs,MAXLINKLIST); - for(i = 0; i < n; i++) + for (i = 0; i < n; i++) { if ((*strs[i] < '0') || (*strs[i] > '9')) strs[i]++; @@ -5808,13 +5808,13 @@ if (debug > 3) ast_log(LOG_NOTICE, "rpt (remote) initiating call to %s/%s on %s\n", deststr, tele, l->chan->name); - if(l->chan->cid.cid_num) + if (l->chan->cid.cid_num) ast_free(l->chan->cid.cid_num); l->chan->cid.cid_num = ast_strdup(myrpt->name); ast_call(l->chan,tele,999); } else { - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE, "Unable to place call to %s/%s on %s\n", deststr,tele,l->chan->name); if (myrpt->p.archivedir) @@ -5884,7 +5884,7 @@ struct rpt_link *l; int i,r; - if(!param) + if (!param) return DC_ERROR; @@ -5893,17 +5893,17 @@ strncpy(digitbuf,digits,MAXNODESTR - 1); - if(debug > 6) + if (debug > 6) printf("@@@@ ilink param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf); - switch(myatoi(param)){ + switch (myatoi(param)){ case 11: /* Perm Link off */ case 1: /* Link off */ if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0])) strcpy(digitbuf,myrpt->lastlinknode); val = node_lookup(myrpt,digitbuf); if (!val){ - if(strlen(digitbuf) >= myrpt->longestnode) + if (strlen(digitbuf) >= myrpt->longestnode) return DC_ERROR; break; } @@ -5921,7 +5921,7 @@ rpt_mutex_lock(&myrpt->lock); l = myrpt->links.next; /* try to find this one in queue */ - while(l != &myrpt->links){ + while (l != &myrpt->links){ if (l->name[0] == '0') { l = l->next; @@ -5974,7 +5974,7 @@ perma = (atoi(param) > 10) ? 1 : 0; mode = (atoi(param) & 1) ? 1 : 0; r = connect_link(myrpt, digitbuf, mode, perma); - switch(r){ + switch (r){ case -2: /* Attempt to connect to self */ return DC_COMPLETE; /* Silent error */ @@ -6016,7 +6016,7 @@ /* node must at least exist in list */ val = node_lookup(myrpt,digitbuf); if (!val){ - if(strlen(digitbuf) >= myrpt->longestnode) + if (strlen(digitbuf) >= myrpt->longestnode) return DC_ERROR; break; @@ -6042,7 +6042,7 @@ myrpt->savednodes[0] = 0; l = myrpt->links.next; /* loop through all links */ - while(l != &myrpt->links){ + while (l != &myrpt->links){ struct ast_frame wf; if (l->name[0] == '0') /* Skip any IAXRPT monitoring */ { @@ -6051,8 +6051,8 @@ } /* Make a string of disconnected nodes for possible restoration */ sprintf(tmp,"%c%c%s",(l->mode) ? 'X' : 'M',(l->perma) ? 'P':'T',l->name); - if(strlen(tmp) + strlen(myrpt->savednodes) + 1 < MAXNODESTR){ - if(myrpt->savednodes[0]) + if (strlen(tmp) + strlen(myrpt->savednodes) + 1 < MAXNODESTR){ + if (myrpt->savednodes[0]) strcat(myrpt->savednodes, ","); strcat(myrpt->savednodes, tmp); } @@ -6078,7 +6078,7 @@ l = l->next; } rpt_mutex_unlock(&myrpt->lock); - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE,"Nodes disconnected: %s\n",myrpt->savednodes); rpt_telemetry(myrpt, COMPLETE, NULL); return DC_COMPLETE; @@ -6099,7 +6099,7 @@ case 16: /* Restore links disconnected with "disconnect all links" command */ strcpy(tmp, myrpt->savednodes); /* Make a copy */ finddelim(tmp, strs, MAXLINKLIST); /* convert into substrings */ - for(i = 0; tmp[0] && strs[i] != NULL && i < MAXLINKLIST; i++){ + for (i = 0; tmp[0] && strs[i] != NULL && i < MAXLINKLIST; i++){ s1 = strs[i]; mode = (s1[0] == 'X') ? 1 : 0; perma = (s1[1] == 'P') ? 1 : 0; @@ -6164,10 +6164,10 @@ if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable || myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable) return DC_ERROR; - if(debug) + if (debug) printf("@@@@ Autopatch up\n"); - if(!myrpt->callmode){ + if (!myrpt->callmode){ /* Set defaults */ myrpt->patchnoct = 0; myrpt->patchdialtime = 0; @@ -6175,19 +6175,19 @@ myrpt->patchquiet = 0; strncpy(myrpt->patchcontext, myrpt->p.ourcontext, MAXPATCHCONTEXT); - if(param){ + if (param){ /* Process parameter list */ lparam = ast_strdup(param); - if(!lparam){ + if (!lparam){ ast_log(LOG_ERROR,"App_rpt out of memory on line %d\n",__LINE__); return DC_ERROR; } paramlength = finddelim(lparam, paramlist, 20); - for(i = 0; i < paramlength; i++){ + for (i = 0; i < paramlength; i++){ idx = matchkeyword(paramlist[i], &value, keywords); - if(value) + if (value) value = skipchars(value, "= "); - switch(idx){ + switch (idx){ case 1: /* context */ strncpy(myrpt->patchcontext, value, MAXPATCHCONTEXT - 1) ; @@ -6247,7 +6247,7 @@ if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable || myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable) return DC_ERROR; - if(debug) + if (debug) printf("@@@@ Autopatch down\n"); rpt_mutex_lock(&myrpt->lock); @@ -6279,10 +6279,10 @@ if ((myrpt->p.s[myrpt->p.sysstate_cur].txdisable) || (myrpt->p.s[myrpt->p.sysstate_cur].userfundisable)) return DC_ERROR; - if(debug) + if (debug) printf("@@@@ status param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf); - switch(myatoi(param)){ + switch (myatoi(param)){ case 1: /* System ID */ rpt_telemetry(myrpt, ID1, NULL); return DC_COMPLETE; @@ -6313,14 +6313,14 @@ if (myrpt->remote) return DC_ERROR; - if(debug) + if (debug) printf("@@@@ macro-oni param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf); - if(strlen(digitbuf) < 1) /* needs 1 digit */ + if (strlen(digitbuf) < 1) /* needs 1 digit */ return DC_INDETERMINATE; - for(i = 0 ; i < digitbuf[i] ; i++) { - if((digitbuf[i] < '0') || (digitbuf[i] > '9')) + for (i = 0 ; i < digitbuf[i] ; i++) { + if ((digitbuf[i] < '0') || (digitbuf[i] > '9')) return DC_ERROR; } @@ -6356,7 +6356,7 @@ if (myrpt->remote) return DC_ERROR; - if(debug) + if (debug) printf("@@@@ playback param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf); if (ast_fileexists(param,NULL,myrpt->rxchannel->language) <= 0) @@ -6377,10 +6377,10 @@ int i, r; - if(!param) + if (!param) return DC_ERROR; - switch(myatoi(param)){ + switch (myatoi(param)){ case 1: /* System reset */ res = system("killall -9 asterisk"); return DC_COMPLETE; @@ -6453,9 +6453,9 @@ return DC_COMPLETE; case 14: /* Change System State */ - if(strlen(digitbuf) == 0) + if (strlen(digitbuf) == 0) break; - if((digitbuf[0] < '0') || (digitbuf[0] > '9')) + if ((digitbuf[0] < '0') || (digitbuf[0] > '9')) return DC_ERROR; myrpt->p.sysstate_cur = digitbuf[0] - '0'; string[0] = string[1] = 'S'; @@ -6534,11 +6534,11 @@ case 30: /* recall memory location on programmable radio */ - if(strlen(digitbuf) < 2) /* needs 2 digits */ + if (strlen(digitbuf) < 2) /* needs 2 digits */ break; - for(i = 0 ; i < 2 ; i++){ - if((digitbuf[i] < '0') || (digitbuf[i] > '9')) + for (i = 0 ; i < 2 ; i++){ + if ((digitbuf[i] < '0') || (digitbuf[i] > '9')) return DC_ERROR; } @@ -6556,11 +6556,11 @@ case 31: /* set channel. note that it's going to change channel then confirm on the new channel! */ - if(strlen(digitbuf) < 2) /* needs 2 digits */ + if (strlen(digitbuf) < 2) /* needs 2 digits */ break; - for(i = 0 ; i < 2 ; i++){ - if((digitbuf[i] < '0') || (digitbuf[i] > '9')) + for (i = 0 ; i < 2 ; i++){ + if ((digitbuf[i] < '0') || (digitbuf[i] > '9')) return DC_ERROR; } channel_steer(myrpt,digitbuf); @@ -6568,19 +6568,19 @@ case 32: /* Touch Tone Pad Test */ i = strlen(digitbuf); - if(!i){ - if(debug > 3) + if (!i){ + if (debug > 3) ast_log(LOG_NOTICE,"Padtest entered"); myrpt->inpadtest = 1; } else{ - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE,"Padtest len= %d digits=%s",i,digitbuf); - if(digitbuf[i-1] != myrpt->p.endchar) + if (digitbuf[i-1] != myrpt->p.endchar) break; rpt_telemetry(myrpt, ARB_ALPHA, digitbuf); myrpt->inpadtest = 0; - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE,"Padtest exited"); return DC_COMPLETE; } @@ -6602,7 +6602,7 @@ if (debug > 6) ast_log(LOG_NOTICE,"digits=%s source=%d\n",digits, command_source); - //if(debug) + //if (debug) // printf("@@@@ Digits collected: %s, source: %d\n", digits, command_source); if (command_source == SOURCE_DPHONE) { @@ -6623,13 +6623,13 @@ strncpy(function_table_name, myrpt->p.functions, sizeof(function_table_name) - 1); /* find context for function table in rpt.conf file */ vp = ast_variable_browse(myrpt->cfg, function_table_name); - while(vp) { - if(!strncasecmp(vp->name, digits, strlen(vp->name))) + while (vp) { + if (!strncasecmp(vp->name, digits, strlen(vp->name))) break; vp = vp->next; } /* if function context not found */ - if(!vp) { + if (!vp) { int n; n = myrpt->longestfunc; @@ -6641,7 +6641,7 @@ else if (command_source == SOURCE_DPHONE) n = myrpt->dphone_longestfunc; - if(strlen(digits) >= n) + if (strlen(digits) >= n) return DC_ERROR; else return DC_INDETERMINATE; @@ -6651,22 +6651,22 @@ stringp = workstring; action = strsep(&stringp, ","); param = stringp; - if(debug) + if (debug) printf("@@@@ action: %s, param = %s\n",action, (param) ? param : "(null)"); /* Look up the action */ - for(i = 0 ; i < (sizeof(function_table)/sizeof(struct function_table_tag)); i++){ - if(!strncasecmp(action, function_table[i].action, strlen(action))) + for (i = 0 ; i < (sizeof(function_table)/sizeof(struct function_table_tag)); i++){ + if (!strncasecmp(action, function_table[i].action, strlen(action))) break; } - if(debug) + if (debug) printf("@@@@ table index i = %d\n",i); - if(i == (sizeof(function_table)/sizeof(struct function_table_tag))){ + if (i == (sizeof(function_table)/sizeof(struct function_table_tag))){ /* Error, action not in table */ return DC_ERROR; } - if(function_table[i].function == NULL){ + if (function_table[i].function == NULL){ /* Error, function undefined */ - if(debug) + if (debug) printf("@@@@ NULL for action: %s\n",action); return DC_ERROR; } @@ -6734,7 +6734,7 @@ { l = myrpt->links.next; /* see if this is one in list */ - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->name[0] == '0') { @@ -6765,7 +6765,7 @@ { l = myrpt->links.next; /* otherwise, send it to all of em */ - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->name[0] == '0') { @@ -6806,13 +6806,13 @@ } if (myrpt->topkeystate != 1) return; rpt_mutex_lock(&myrpt->lock); - for(i = 0; i < TOPKEYN; i++) + for (i = 0; i < TOPKEYN; i++) { if (!strcmp(myrpt->topkey[i].node,src)) break; } if (i >= TOPKEYN) { - for(i = 0; i < TOPKEYN; i++) + for (i = 0; i < TOPKEYN; i++) { if (!myrpt->topkey[i].node[0]) break; } @@ -6863,7 +6863,7 @@ { l = myrpt->links.next; /* see if this is one in list */ - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->name[0] == '0') { @@ -6890,7 +6890,7 @@ } l = myrpt->links.next; /* otherwise, send it to all of em */ - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->name[0] == '0') { @@ -6935,7 +6935,7 @@ myrpt->exten,1,NULL)) { myrpt->callmode = 2; - if(!myrpt->patchquiet) + if (!myrpt->patchquiet) { rpt_mutex_unlock(&myrpt->lock); rpt_telemetry(myrpt,PROC,NULL); @@ -6986,7 +6986,7 @@ res = collect_function_digits(myrpt, cmd, SOURCE_LNK, mylink); rpt_mutex_lock(&myrpt->lock); - switch(res){ + switch (res){ case DC_INDETERMINATE: break; @@ -7040,14 +7040,14 @@ if (mylink->phonemode == 3) /*If in simplex dumb phone mode */ { - if(c == myrpt->p.endchar) /* If end char */ + if (c == myrpt->p.endchar) /* If end char */ { mylink->lastrealrx = 0; /* Keying state = off */ rpt_mutex_unlock(&myrpt->lock); return; } - if(c == myrpt->p.funcchar) /* If lead-in char */ + if (c == myrpt->p.funcchar) /* If lead-in char */ { mylink->lastrealrx = !mylink->lastrealrx; /* Toggle keying state */ rpt_mutex_unlock(&myrpt->lock); @@ -7094,7 +7094,7 @@ myrpt->exten,1,NULL)) { myrpt->callmode = 2; - if(!myrpt->patchquiet) + if (!myrpt->patchquiet) { rpt_mutex_unlock(&myrpt->lock); rpt_telemetry(myrpt,PROC,NULL); @@ -7135,7 +7135,7 @@ rpt_mutex_unlock(&myrpt->lock); strncpy(cmd, myrpt->rem_dtmfbuf, sizeof(cmd) - 1); - switch(mylink->phonemode) + switch (mylink->phonemode) { case 1: res = collect_function_digits(myrpt, cmd, @@ -7157,7 +7157,7 @@ rpt_mutex_lock(&myrpt->lock); - switch(res){ + switch (res){ case DC_INDETERMINATE: break; @@ -7233,7 +7233,7 @@ int i; i = atoi(str) / 10; /* get the 10's of mhz */ - switch(i) + switch (i) { case 2: return 10; @@ -7273,7 +7273,7 @@ i = 0; if (s) i = atoi(s + 1); i += atoi(str) * 10; - switch(i) + switch (i) { case 670: return 0; @@ -7366,24 +7366,24 @@ unsigned char od,d; static volatile long long delayvar; - for(i = 0 ; i < 5 ; i++){ + for (i = 0 ; i < 5 ; i++){ od = *data++; - for(j = 0 ; j < 8 ; j++){ + for (j = 0 ; j < 8 ; j++){ d = od & 1; outb(d,myrpt->p.iobase); /* >= 15 us */ - for(delayvar = 1; delayvar < 15000; delayvar++); + for (delayvar = 1; delayvar < 15000; delayvar++); od >>= 1; outb(d | 2,myrpt->p.iobase); /* >= 30 us */ - for(delayvar = 1; delayvar < 30000; delayvar++); + for (delayvar = 1; delayvar < 30000; delayvar++); outb(d,myrpt->p.iobase); /* >= 10 us */ - for(delayvar = 1; delayvar < 10000; delayvar++); + for (delayvar = 1; delayvar < 10000; delayvar++); } } /* >= 50 us */ - for(delayvar = 1; delayvar < 50000; delayvar++); + for (delayvar = 1; delayvar < 50000; delayvar++); #endif } @@ -7416,10 +7416,10 @@ struct dahdi_radio_param prm; char c; - if(debug) { + if (debug) { ast_log(LOG_NOTICE, "ioport=%s iofd=0x%x\n",myrpt->p.ioport,myrpt->iofd); printf("String output was:\n"); - for(i = 0; i < txbytes; i++) + for (i = 0; i < txbytes; i++) printf("%02X ", (unsigned char ) txbuf[i]); printf("\n"); } @@ -7435,7 +7435,7 @@ return(0); } memset(rxbuf,0,rxmaxbytes); - for(i = 0; i < rxmaxbytes; i++) + for (i = 0; i < rxmaxbytes; i++) { j = read(myrpt->iofd,&c,1); if (j < 1) @@ -7449,9 +7449,9 @@ if (c == '\r') break; } } - if(debug) { + if (debug) { printf("String returned was:\n"); - for(j = 0; j < i; j++) + for (j = 0; j < i; j++) printf("%02X ", (unsigned char ) rxbuf[j]); printf("\n"); } @@ -7513,7 +7513,7 @@ rv = serial_remote_io(myrpt,cmd,cmdlen,rxbuf,cmdlen + 6,0); if (rv == -1) return(-1); if (rv != (cmdlen + 6)) return(1); - for(i = 0; i < 6; i++) + for (i = 0; i < 6; i++) if (rxbuf[i] != cmd[i]) return(1); if (rxbuf[cmdlen] != 0xfe) return(1); if (rxbuf[cmdlen + 1] != 0xfe) return(1); @@ -7548,7 +7548,7 @@ i = 0; if (s) i = atoi(s + 1); i += atoi(str) * 10; - switch(i) + switch (i) { case 670: return 1; @@ -7635,7 +7635,7 @@ { int i,j; - for(i = 0;i < KENWOOD_RETRIES;i++) + for (i = 0;i < KENWOOD_RETRIES;i++) { j = sendkenwood(myrpt,txstr,rxstr); if (j < 0) return(j); @@ -7728,33 +7728,33 @@ /* if no decimal, is invalid */ if (s == NULL){ - if(debug) + if (debug) printf("@@@@ Frequency needs a decimal\n"); return -1; } *s++ = 0; if (strlen(tmp) < 2){ - if(debug) + if (debug) printf("@@@@ Bad MHz digits: %s\n", tmp); return -1; } if (strlen(s) < 3){ - if(debug) + if (debug) printf("@@@@ Bad KHz digits: %s\n", s); return -1; } if ((s[2] != '0') && (s[2] != '5')){ - if(debug) + if (debug) printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]); return -1; } band = rbi_mhztoband(tmp); if (band == -1){ - if(debug) + if (debug) printf("@@@@ Bad Band: %s\n", tmp); return -1; } @@ -7762,13 +7762,13 @@ rxpl = rbi_pltocode(myrpt->rxpl); if (rxpl == -1){ - if(debug) + if (debug) printf("@@@@ Bad TX PL: %s\n", myrpt->rxpl); return -1; } - switch(myrpt->offset) + switch (myrpt->offset) { case REM_MINUS: txoffset = 0; @@ -7780,7 +7780,7 @@ txoffset = 0x20; break; } - switch(myrpt->powerlevel) + switch (myrpt->powerlevel) { case REM_LOWPWR: txpower = 0; @@ -7822,35 +7822,35 @@ s = strchr(tmp,'.'); /* if no decimal, is invalid */ - if(debug)printf("setrtx() %s %s\n",myrpt->name,myrpt->remoterig); + if (debug)printf("setrtx() %s %s\n",myrpt->name,myrpt->remoterig); if (s == NULL){ - if(debug) + if (debug) printf("@@@@ Frequency needs a decimal\n"); return -1; } *s++ = 0; if (strlen(tmp) < 2){ - if(debug) + if (debug) printf("@@@@ Bad MHz digits: %s\n", tmp); return -1; } if (strlen(s) < 3){ - if(debug) + if (debug) printf("@@@@ Bad KHz digits: %s\n", s); return -1; } if ((s[2] != '0') && (s[2] != '5')){ - if(debug) + if (debug) printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]); return -1; } band = rbi_mhztoband(tmp); if (band == -1){ - if(debug) + if (debug) printf("@@@@ Bad Band: %s\n", tmp); return -1; } @@ -7858,7 +7858,7 @@ rxpl = rbi_pltocode(myrpt->rxpl); if (rxpl == -1){ - if(debug) + if (debug) printf("@@@@ Bad RX PL: %s\n", myrpt->rxpl); return -1; } @@ -7866,12 +7866,12 @@ txpl = rbi_pltocode(myrpt->txpl); if (txpl == -1){ - if(debug) + if (debug) printf("@@@@ Bad TX PL: %s\n", myrpt->txpl); return -1; } - switch(myrpt->offset) + switch (myrpt->offset) { case REM_MINUS: txoffset = 0; @@ -7883,7 +7883,7 @@ txoffset = 0x20; break; } - switch(myrpt->powerlevel) + switch (myrpt->powerlevel) { case REM_LOWPWR: txpower = 0; @@ -7938,19 +7938,19 @@ /* must be a usbradio interface type */ if (!IS_XPMR(myrpt)) return(0); - if(debug)printf("setxpmr() %s %s\n",myrpt->name,myrpt->remoterig ); + if (debug)printf("setxpmr() %s %s\n",myrpt->name,myrpt->remoterig ); rxpl = rbi_pltocode(myrpt->rxpl); if (rxpl == -1){ - if(debug) + if (debug) printf("@@@@ Bad RX PL: %s\n", myrpt->rxpl); return -1; } txpl = rbi_pltocode(myrpt->txpl); if (txpl == -1){ - if(debug) + if (debug) printf("@@@@ Bad TX PL: %s\n", myrpt->txpl); return -1; } @@ -7976,33 +7976,33 @@ /* if no decimal, is invalid */ if (s == NULL){ - if(debug) + if (debug) printf("@@@@ Frequency needs a decimal\n"); return -1; } *s++ = 0; if (strlen(tmp) < 2){ - if(debug) + if (debug) printf("@@@@ Bad MHz digits: %s\n", tmp); return -1; } if (strlen(s) < 3){ - if(debug) + if (debug) printf("@@@@ Bad KHz digits: %s\n", s); return -1; } if ((s[2] != '0') && (s[2] != '5')){ - if(debug) + if (debug) printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]); return -1; } band = rbi_mhztoband(tmp); if (band == -1){ - if(debug) + if (debug) printf("@@@@ Bad Band: %s\n", tmp); return -1; } @@ -8010,7 +8010,7 @@ txpl = rbi_pltocode(myrpt->txpl); if (txpl == -1){ - if(debug) + if (debug) printf("@@@@ Bad TX PL: %s\n", myrpt->txpl); return -1; } @@ -8031,33 +8031,33 @@ /* if no decimal, is invalid */ if (s == NULL){ - if(debug) + if (debug) printf("@@@@ Frequency needs a decimal\n"); return -1; } *s++ = 0; if (strlen(tmp) < 2){ - if(debug) + if (debug) printf("@@@@ Bad MHz digits: %s\n", tmp); return -1; } if (strlen(s) < 3){ - if(debug) + if (debug) printf("@@@@ Bad KHz digits: %s\n", s); return -1; } if ((s[2] != '0') && (s[2] != '5')){ - if(debug) + if (debug) printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]); return -1; } band = rbi_mhztoband(tmp); if (band == -1){ - if(debug) + if (debug) printf("@@@@ Bad Band: %s\n", tmp); return -1; } @@ -8065,7 +8065,7 @@ txpl = rbi_pltocode(myrpt->txpl); if (txpl == -1){ - if(debug) + if (debug) printf("@@@@ Bad TX PL: %s\n", myrpt->txpl); return -1; } @@ -8073,7 +8073,7 @@ rxpl = rbi_pltocode(myrpt->rxpl); if (rxpl == -1){ - if(debug) + if (debug) printf("@@@@ Bad RX PL: %s\n", myrpt->rxpl); return -1; } @@ -8085,19 +8085,19 @@ int dflmd = REM_MODE_FM; if (m == 144){ /* 2 meters */ - if(d < 10100) + if (d < 10100) return -1; } - else if((m >= 145) && (m < 148)){ + else if ((m >= 145) && (m < 148)){ ; } - else if((m >= 430) && (m < 450)){ /* 70 centimeters */ + else if ((m >= 430) && (m < 450)){ /* 70 centimeters */ ; } else return -1; - if(defmode) + if (defmode) *defmode = dflmd; @@ -8110,15 +8110,15 @@ int dflmd = REM_MODE_FM; if (m == 144){ /* 2 meters */ - if(d < 10100) + if (d < 10100) return -1; } - else if((m >= 145) && (m < 148)){ + else if ((m >= 145) && (m < 148)){ ; } return -1; - if(defmode) + if (defmode) *defmode = dflmd; @@ -8133,33 +8133,33 @@ { int dflmd = REM_MODE_FM; - if(m == 50){ /* 6 meters */ - if(d < 10100) + if (m == 50){ /* 6 meters */ + if (d < 10100) return -1; } - else if((m >= 51) && ( m < 54)){ + else if ((m >= 51) && ( m < 54)){ ; } - else if(m == 144){ /* 2 meters */ - if(d < 10100) + else if (m == 144){ /* 2 meters */ + if (d < 10100) return -1; } - else if((m >= 145) && (m < 148)){ + else if ((m >= 145) && (m < 148)){ ; } - else if((m >= 222) && (m < 225)){ /* 1.25 meters */ + else if ((m >= 222) && (m < 225)){ /* 1.25 meters */ ; } - else if((m >= 430) && (m < 450)){ /* 70 centimeters */ + else if ((m >= 430) && (m < 450)){ /* 70 centimeters */ ; } - else if((m >= 1240) && (m < 1300)){ /* 23 centimeters */ + else if ((m >= 1240) && (m < 1300)){ /* 23 centimeters */ ; } else return -1; - if(defmode) + if (defmode) *defmode = dflmd; @@ -8176,11 +8176,11 @@ if (!strcmp(myrpt->remoterig,remote_rig_rtx150)) { - if(m == 144){ /* 2 meters */ - if(d < 10100) + if (m == 144){ /* 2 meters */ + if (d < 10100) return -1; } - else if((m >= 145) && (m < 148)){ + else if ((m >= 145) && (m < 148)){ ; } else @@ -8188,13 +8188,13 @@ } else { - if((m >= 430) && (m < 450)){ /* 70 centimeters */ + if ((m >= 430) && (m < 450)){ /* 70 centimeters */ ; } else return -1; } - if(defmode) + if (defmode) *defmode = dflmd; @@ -8212,9 +8212,9 @@ int multiplier = 100000; int res = 0; - if(!len) + if (!len) return 0; - for( i = 0 ; i < len ; i++, multiplier /= 10) + for ( i = 0 ; i < len ; i++, multiplier /= 10) res += (fraction[i] - '0') * multiplier; return res; } @@ -8230,7 +8230,7 @@ char *decp; decp = strchr(strncpy(freq_copy, freq, MAXREMSTR),'.'); - if(decp){ + if (decp){ *decp++ = 0; strncpy(mhz, freq_copy, MAXREMSTR); strcpy(decimals, "00000"); @@ -8253,7 +8253,7 @@ char *decp; decp = strchr(strncpy(freq_copy, freq, MAXREMSTR),'.'); - if(decp){ + if (decp){ *decp++ = 0; strncpy(hertz, freq_copy, MAXREMSTR); strncpy(decimal, decp, strlen(decp)); @@ -8278,73 +8278,73 @@ { int dflmd = REM_MODE_FM; - if(m == 1){ /* 160 meters */ + if (m == 1){ /* 160 meters */ dflmd = REM_MODE_LSB; - if(d < 80000) + if (d < 80000) return -1; } - else if(m == 3){ /* 80 meters */ + else if (m == 3){ /* 80 meters */ dflmd = REM_MODE_LSB; - if(d < 50000) + if (d < 50000) return -1; } - else if(m == 7){ /* 40 meters */ + else if (m == 7){ /* 40 meters */ dflmd = REM_MODE_LSB; - if(d > 30000) + if (d > 30000) return -1; } - else if(m == 14){ /* 20 meters */ + else if (m == 14){ /* 20 meters */ dflmd = REM_MODE_USB; - if(d > 35000) + if (d > 35000) return -1; } - else if(m == 18){ /* 17 meters */ + else if (m == 18){ /* 17 meters */ dflmd = REM_MODE_USB; - if((d < 6800) || (d > 16800)) + if ((d < 6800) || (d > 16800)) return -1; } - else if(m == 21){ /* 15 meters */ + else if (m == 21){ /* 15 meters */ dflmd = REM_MODE_USB; - if((d < 20000) || (d > 45000)) + if ((d < 20000) || (d > 45000)) return -1; } - else if(m == 24){ /* 12 meters */ + else if (m == 24){ /* 12 meters */ dflmd = REM_MODE_USB; - if((d < 89000) || (d > 99000)) + if ((d < 89000) || (d > 99000)) return -1; } - else if(m == 28){ /* 10 meters */ + else if (m == 28){ /* 10 meters */ dflmd = REM_MODE_USB; } - else if(m == 29){ - if(d >= 51000) + else if (m == 29){ + if (d >= 51000) dflmd = REM_MODE_FM; else dflmd = REM_MODE_USB; - if(d > 70000) + if (d > 70000) return -1; } - else if(m == 50){ /* 6 meters */ - if(d >= 30000) + else if (m == 50){ /* 6 meters */ + if (d >= 30000) dflmd = REM_MODE_FM; else dflmd = REM_MODE_USB; } - else if((m >= 51) && ( m < 54)){ + else if ((m >= 51) && ( m < 54)){ dflmd = REM_MODE_FM; } - else if(m == 144){ /* 2 meters */ - if(d >= 30000) + else if (m == 144){ /* 2 meters */ + if (d >= 30000) dflmd = REM_MODE_FM; else dflmd = REM_MODE_USB; } - else if((m >= 145) && (m < 148)){ + else if ((m >= 145) && (m < 148)){ dflmd = REM_MODE_FM; } - else if((m >= 430) && (m < 450)){ /* 70 centimeters */ - if(m < 438) + else if ((m >= 430) && (m < 450)){ /* 70 centimeters */ + if (m < 438) dflmd = REM_MODE_USB; else dflmd = REM_MODE_FM; @@ -8353,7 +8353,7 @@ else return -1; - if(defmode) + if (defmode) *defmode = dflmd; return 0; @@ -8371,10 +8371,10 @@ char decimals[MAXREMSTR]; fd = 0; - if(debug) + if (debug) printf("New frequency: %s\n",newfreq); - if(split_freq(mhz, decimals, newfreq)) + if (split_freq(mhz, decimals, newfreq)) return -1; m = atoi(mhz); @@ -8414,7 +8414,7 @@ memset(cmdstr, 0, 5); - switch(offset){ + switch (offset){ case REM_SIMPLEX: cmdstr[0] = 0x89; break; @@ -8444,7 +8444,7 @@ memset(cmdstr, 0, 5); - switch(newmode){ + switch (newmode){ case REM_MODE_FM: cmdstr[0] = 0x08; break; @@ -8477,7 +8477,7 @@ memset(cmdstr, 0, 5); - if(rxplon && txplon) + if (rxplon && txplon) cmdstr[0] = 0x2A; /* Encode and Decode */ else if (!rxplon && txplon) cmdstr[0] = 0x4A; /* Encode only */ @@ -8502,7 +8502,7 @@ memset(cmdstr, 0, 5); - if(split_ctcss_freq(hertz, decimal, txtone)) + if (split_ctcss_freq(hertz, decimal, txtone)) return -1; h = atoi(hertz); @@ -8511,9 +8511,9 @@ cmdstr[0] = ((h / 100) << 4) + (h % 100)/ 10; cmdstr[1] = ((h % 10) << 4) + (d % 10); - if(rxtone){ + if (rxtone){ - if(split_ctcss_freq(hertz, decimal, rxtone)) + if (split_ctcss_freq(hertz, decimal, rxtone)) return -1; h = atoi(hertz); @@ -8533,52 +8533,52 @@ { int res; - if(debug) + if (debug) printf("@@@@ lock on\n"); res = simple_command_ft897(myrpt, 0x00); /* LOCK on */ - if(debug) + if (debug) printf("@@@@ ptt off\n"); - if(!res) + if (!res) res = simple_command_ft897(myrpt, 0x88); /* PTT off */ - if(debug) + if (debug) printf("Modulation mode\n"); - if(!res) + if (!res) res = set_mode_ft897(myrpt, myrpt->remmode); /* Modulation mode */ - if(debug) + if (debug) printf("Split off\n"); - if(!res) + if (!res) simple_command_ft897(myrpt, 0x82); /* Split off */ - if(debug) + if (debug) printf("Frequency\n"); - if(!res) + if (!res) res = set_freq_ft897(myrpt, myrpt->freq); /* Frequency */ - if((myrpt->remmode == REM_MODE_FM)){ - if(debug) + if ((myrpt->remmode == REM_MODE_FM)){ + if (debug) printf("Offset\n"); - if(!res) + if (!res) res = set_offset_ft897(myrpt, myrpt->offset); /* Offset if FM */ - if((!res)&&(myrpt->rxplon || myrpt->txplon)){ - if(debug) + if ((!res)&&(myrpt->rxplon || myrpt->txplon)){ + if (debug) printf("CTCSS tone freqs.\n"); res = set_ctcss_freq_ft897(myrpt, myrpt->txpl, myrpt->rxpl); /* CTCSS freqs if CTCSS is enabled */ } - if(!res){ - if(debug) + if (!res){ + if (debug) printf("CTCSS mode\n"); res = set_ctcss_mode_ft897(myrpt, myrpt->txplon, myrpt->rxplon); /* CTCSS mode */ } } - if((myrpt->remmode == REM_MODE_USB)||(myrpt->remmode == REM_MODE_LSB)){ - if(debug) + if ((myrpt->remmode == REM_MODE_USB)||(myrpt->remmode == REM_MODE_LSB)){ + if (debug) printf("Clarifier off\n"); simple_command_ft897(myrpt, 0x85); /* Clarifier off if LSB or USB */ } @@ -8602,34 +8602,34 @@ int m,d; char mhz[MAXREMSTR], decimals[MAXREMSTR]; - if(debug) + if (debug) printf("Before bump: %s\n", myrpt->freq); - if(split_freq(mhz, decimals, myrpt->freq)) + if (split_freq(mhz, decimals, myrpt->freq)) return -1; m = atoi(mhz); d = atoi(decimals); d += (interval / 10); /* 10Hz resolution */ - if(d < 0){ + if (d < 0){ m--; d += 100000; } - else if(d >= 100000){ + else if (d >= 100000){ m++; d -= 100000; } - if(check_freq_ft897(m, d, NULL)){ - if(debug) + if (check_freq_ft897(m, d, NULL)){ + if (debug) printf("Bump freq invalid\n"); return -1; } snprintf(myrpt->freq, MAXREMSTR, "%d.%05d", m, d); - if(debug) + if (debug) printf("After bump: %s\n", myrpt->freq); return set_freq_ft897(myrpt, myrpt->freq); @@ -8649,106 +8649,106 @@ int dflmd = REM_MODE_FM; int rv=0; - if(debug > 6) + if (debug > 6) ast_log(LOG_NOTICE,"(%i,%i,%i,%i)\n",m,d,*defmode,mars); /* first test for standard amateur radio bands */ - if(m == 1){ /* 160 meters */ + if (m == 1){ /* 160 meters */ dflmd = REM_MODE_LSB; - if(d < 80000)rv=-1; + if (d < 80000)rv=-1; } - else if(m == 3){ /* 80 meters */ + else if (m == 3){ /* 80 meters */ dflmd = REM_MODE_LSB; - if(d < 50000)rv=-1; + if (d < 50000)rv=-1; } - else if(m == 7){ /* 40 meters */ + else if (m == 7){ /* 40 meters */ dflmd = REM_MODE_LSB; - if(d > 30000)rv=-1; + if (d > 30000)rv=-1; } - else if(m == 14){ /* 20 meters */ + else if (m == 14){ /* 20 meters */ dflmd = REM_MODE_USB; - if(d > 35000)rv=-1; + if (d > 35000)rv=-1; } - else if(m == 18){ /* 17 meters */ + else if (m == 18){ /* 17 meters */ dflmd = REM_MODE_USB; - if((d < 6800) || (d > 16800))rv=-1; + if ((d < 6800) || (d > 16800))rv=-1; } - else if(m == 21){ /* 15 meters */ + else if (m == 21){ /* 15 meters */ dflmd = REM_MODE_USB; - if((d < 20000) || (d > 45000))rv=-1; + if ((d < 20000) || (d > 45000))rv=-1; } - else if(m == 24){ /* 12 meters */ + else if (m == 24){ /* 12 meters */ dflmd = REM_MODE_USB; - if((d < 89000) || (d > 99000))rv=-1; + if ((d < 89000) || (d > 99000))rv=-1; } - else if(m == 28){ /* 10 meters */ + else if (m == 28){ /* 10 meters */ dflmd = REM_MODE_USB; } - else if(m == 29){ - if(d >= 51000) + else if (m == 29){ + if (d >= 51000) dflmd = REM_MODE_FM; else dflmd = REM_MODE_USB; - if(d > 70000)rv=-1; + if (d > 70000)rv=-1; } - else if(m == 50){ /* 6 meters */ - if(d >= 30000) + else if (m == 50){ /* 6 meters */ + if (d >= 30000) dflmd = REM_MODE_FM; else dflmd = REM_MODE_USB; } - else if((m >= 51) && ( m < 54)){ + else if ((m >= 51) && ( m < 54)){ dflmd = REM_MODE_FM; } - else if(m == 144){ /* 2 meters */ - if(d >= 30000) + else if (m == 144){ /* 2 meters */ + if (d >= 30000) dflmd = REM_MODE_FM; else dflmd = REM_MODE_USB; } - else if((m >= 145) && (m < 148)){ + else if ((m >= 145) && (m < 148)){ dflmd = REM_MODE_FM; } - else if((m >= 430) && (m < 450)){ /* 70 centimeters */ - if(m < 438) + else if ((m >= 430) && (m < 450)){ /* 70 centimeters */ + if (m < 438) dflmd = REM_MODE_USB; else dflmd = REM_MODE_FM; } /* check expanded coverage */ - if(mars && rv<0){ - if((m >= 450) && (m < 470)){ /* LMR */ + if (mars && rv<0){ + if ((m >= 450) && (m < 470)){ /* LMR */ dflmd = REM_MODE_FM; rv=0; } - else if((m >= 148) && (m < 174)){ /* LMR */ + else if ((m >= 148) && (m < 174)){ /* LMR */ dflmd = REM_MODE_FM; rv=0; } - else if((m >= 138) && (m < 144)){ /* VHF-AM AIRCRAFT */ + else if ((m >= 138) && (m < 144)){ /* VHF-AM AIRCRAFT */ dflmd = REM_MODE_AM; rv=0; } - else if((m >= 108) && (m < 138)){ /* VHF-AM AIRCRAFT */ + else if ((m >= 108) && (m < 138)){ /* VHF-AM AIRCRAFT */ dflmd = REM_MODE_AM; rv=0; } - else if( (m==0 && d>=55000) || (m==1 && d<=75000) ){ /* AM BCB*/ + else if ( (m==0 && d>=55000) || (m==1 && d<=75000) ){ /* AM BCB*/ dflmd = REM_MODE_AM; rv=0; } - else if( (m == 1 && d>75000) || (m>1 && m<30) ){ /* HF SWL*/ + else if ( (m == 1 && d>75000) || (m>1 && m<30) ){ /* HF SWL*/ dflmd = REM_MODE_AM; rv=0; } } - if(defmode) + if (defmode) *defmode = dflmd; - if(debug > 1) + if (debug > 1) ast_log(LOG_NOTICE,"(%i,%i,%i,%i) returning %i\n",m,d,*defmode,mars,rv); return rv; @@ -8765,7 +8765,7 @@ i = 0; if (s) i = atoi(s + 1); i += atoi(str) * 10; - switch(i) + switch (i) { case 670: rv=0; @@ -8868,7 +8868,7 @@ case 2541: rv=49; } - if(debug > 1) + if (debug > 1) ast_log(LOG_NOTICE,"%i rv=%i\n",i, rv); return rv; @@ -8901,10 +8901,10 @@ int fd,m,d; fd = 0; - if(debug) + if (debug) ast_log(LOG_NOTICE,"newfreq:%s\n",newfreq); - if(split_freq(mhz, decimals, newfreq)) + if (split_freq(mhz, decimals, newfreq)) return -1; m = atoi(mhz); @@ -8932,10 +8932,10 @@ { unsigned char c; - if(debug > 6) + if (debug > 6) ast_log(LOG_NOTICE,"offset=%i\n",offset); - switch(offset){ + switch (offset){ case REM_SIMPLEX: c = 0x10; break; @@ -8962,10 +8962,10 @@ { unsigned char c; - if(debug > 6) + if (debug > 6) ast_log(LOG_NOTICE,"newmode=%i\n",newmode); - switch(newmode){ + switch (newmode){ case REM_MODE_FM: c = 5; break; @@ -8995,7 +8995,7 @@ unsigned char cmdstr[10]; int rv; - if(debug > 6) + if (debug > 6) ast_log(LOG_NOTICE,"txplon=%i rxplon=%i \n",txplon,rxplon); cmdstr[0] = cmdstr[1] = 0xfe; @@ -9031,10 +9031,10 @@ memset(cmdstr, 0, 5); - if(debug > 6) + if (debug > 6) ast_log(LOG_NOTICE,"txtone=%s rxtone=%s \n",txtone,rxtone); - if(split_ctcss_freq(hertz, decimal, txtone)) + if (split_ctcss_freq(hertz, decimal, txtone)) return -1; h = atoi(hertz); @@ -9054,7 +9054,7 @@ if (!rxtone) return(0); - if(split_ctcss_freq(hertz, decimal, rxtone)) + if (split_ctcss_freq(hertz, decimal, rxtone)) return -1; h = atoi(hertz); @@ -9117,55 +9117,55 @@ { int res = 0,i; - if(debug)ast_log(LOG_NOTICE, "Set to VFO A iobase=%i\n",myrpt->p.iobase); + if (debug)ast_log(LOG_NOTICE, "Set to VFO A iobase=%i\n",myrpt->p.iobase); if (!res) res = simple_command_ic706(myrpt,7,0); - if((myrpt->remmode == REM_MODE_FM)) + if ((myrpt->remmode == REM_MODE_FM)) { i = ic706_pltocode(myrpt->rxpl); if (i == -1) return -1; - if(debug) + if (debug) printf("Select memory number\n"); if (!res) res = select_mem_ic706(myrpt,i + IC706_PL_MEMORY_OFFSET); - if(debug) + if (debug) printf("Transfer memory to VFO\n"); if (!res) res = mem2vfo_ic706(myrpt); } - if(debug) + if (debug) printf("Set to VFO\n"); if (!res) res = vfo_ic706(myrpt); - if(debug) + if (debug) printf("Modulation mode\n"); if (!res) res = set_mode_ic706(myrpt, myrpt->remmode); /* Modulation mode */ - if(debug) + if (debug) printf("Split off\n"); - if(!res) + if (!res) simple_command_ic706(myrpt, 0x82,0); /* Split off */ - if(debug) + if (debug) printf("Frequency\n"); - if(!res) + if (!res) res = set_freq_ic706(myrpt, myrpt->freq); /* Frequency */ - if((myrpt->remmode == REM_MODE_FM)){ - if(debug) + if ((myrpt->remmode == REM_MODE_FM)){ + if (debug) printf("Offset\n"); - if(!res) + if (!res) res = set_offset_ic706(myrpt, myrpt->offset); /* Offset if FM */ - if(!res){ - if(debug) + if (!res){ + if (debug) printf("CTCSS mode\n"); res = set_ctcss_mode_ic706(myrpt, myrpt->txplon, myrpt->rxplon); /* CTCSS mode */ } @@ -9185,34 +9185,34 @@ char mhz[MAXREMSTR], decimals[MAXREMSTR]; unsigned char cmdstr[20]; - if(debug) + if (debug) printf("Before bump: %s\n", myrpt->freq); - if(split_freq(mhz, decimals, myrpt->freq)) + if (split_freq(mhz, decimals, myrpt->freq)) return -1; m = atoi(mhz); d = atoi(decimals); d += (interval / 10); /* 10Hz resolution */ - if(d < 0){ + if (d < 0){ m--; d += 100000; } - else if(d >= 100000){ + else if (d >= 100000){ m++; d -= 100000; } - if(check_freq_ic706(m, d, NULL,myrpt->p.remote_mars)){ - if(debug) + if (check_freq_ic706(m, d, NULL,myrpt->p.remote_mars)){ + if (debug) printf("Bump freq invalid\n"); return -1; } snprintf(myrpt->freq, MAXREMSTR, "%d.%05d", m, d); - if(debug) + if (debug) printf("After bump: %s\n", myrpt->freq); /* The ic-706 likes packed BCD frequencies */ @@ -9260,22 +9260,22 @@ myrpt->rxplon); donodelog(myrpt,str); } - if(!strcmp(myrpt->remoterig, remote_rig_ft897)) + if (!strcmp(myrpt->remoterig, remote_rig_ft897)) { rpt_telemetry(myrpt,SETREMOTE,NULL); res = 0; } - if(!strcmp(myrpt->remoterig, remote_rig_ic706)) + if (!strcmp(myrpt->remoterig, remote_rig_ic706)) { rpt_telemetry(myrpt,SETREMOTE,NULL); res = 0; } - if(!strcmp(myrpt->remoterig, remote_rig_tm271)) + if (!strcmp(myrpt->remoterig, remote_rig_tm271)) { rpt_telemetry(myrpt,SETREMOTE,NULL); res = 0; } - else if(!strcmp(myrpt->remoterig, remote_rig_rbi)) + else if (!strcmp(myrpt->remoterig, remote_rig_rbi)) { res = setrbi_check(myrpt); if (!res) @@ -9284,12 +9284,12 @@ res = 0; } } - else if(ISRIG_RTX(myrpt->remoterig)) + else if (ISRIG_RTX(myrpt->remoterig)) { setrtx(myrpt); res = 0; } - else if(!strcmp(myrpt->remoterig, remote_rig_kenwood)) { + else if (!strcmp(myrpt->remoterig, remote_rig_kenwood)) { rpt_telemetry(myrpt,SETREMOTE,NULL); res = 0; } @@ -9303,7 +9303,7 @@ static int closerem(struct rpt *myrpt) { - if(!strcmp(myrpt->remoterig, remote_rig_ft897)) + if (!strcmp(myrpt->remoterig, remote_rig_ft897)) return closerem_ft897(myrpt); else return 0; @@ -9315,17 +9315,17 @@ static int check_freq(struct rpt *myrpt, int m, int d, int *defmode) { - if(!strcmp(myrpt->remoterig, remote_rig_ft897)) + if (!strcmp(myrpt->remoterig, remote_rig_ft897)) return check_freq_ft897(m, d, defmode); - else if(!strcmp(myrpt->remoterig, remote_rig_ic706)) + else if (!strcmp(myrpt->remoterig, remote_rig_ic706)) return check_freq_ic706(m, d, defmode,myrpt->p.remote_mars); - else if(!strcmp(myrpt->remoterig, remote_rig_rbi)) + else if (!strcmp(myrpt->remoterig, remote_rig_rbi)) return check_freq_rbi(m, d, defmode); - else if(!strcmp(myrpt->remoterig, remote_rig_kenwood)) + else if (!strcmp(myrpt->remoterig, remote_rig_kenwood)) return check_freq_kenwood(m, d, defmode); - else if(!strcmp(myrpt->remoterig, remote_rig_tm271)) + else if (!strcmp(myrpt->remoterig, remote_rig_tm271)) return check_freq_tm271(m, d, defmode); - else if(ISRIG_RTX(myrpt->remoterig)) + else if (ISRIG_RTX(myrpt->remoterig)) return check_freq_rtx(m, d, defmode, myrpt); else return -1; @@ -9348,14 +9348,14 @@ char *limit_ranges[40]; struct ast_variable *limitlist; - if(debug > 3){ + if (debug > 3){ ast_log(LOG_NOTICE, "myrpt->freq = %s\n", myrpt->freq); } /* Must have user logged in and tx_limits defined */ - if(!myrpt->p.txlimitsstanzaname || !myrpt->loginuser[0] || !myrpt->loginlevel[0]){ - if(debug > 3){ + if (!myrpt->p.txlimitsstanzaname || !myrpt->loginuser[0] || !myrpt->loginlevel[0]){ + if (debug > 3){ ast_log(LOG_NOTICE, "No tx band table defined, or no user logged in. rv=1\n"); } rv=1; @@ -9365,7 +9365,7 @@ /* Retrieve the band table for the loginlevel */ limitlist = ast_variable_browse(myrpt->cfg, myrpt->p.txlimitsstanzaname); - if(!limitlist){ + if (!limitlist){ ast_log(LOG_WARNING, "No entries in %s band table stanza. rv=0\n", myrpt->p.txlimitsstanzaname); rv=0; return 0; @@ -9375,24 +9375,24 @@ radio_mhz = atoi(radio_mhz_char); radio_decimals = decimals2int(radio_decimals_char); - if(debug > 3){ + if (debug > 3){ ast_log(LOG_NOTICE, "Login User = %s, login level = %s\n", myrpt->loginuser, myrpt->loginlevel); } /* Find our entry */ - for(;limitlist; limitlist=limitlist->next){ - if(!strcmp(limitlist->name, myrpt->loginlevel)) + for (;limitlist; limitlist=limitlist->next){ + if (!strcmp(limitlist->name, myrpt->loginlevel)) break; } - if(!limitlist){ + if (!limitlist){ ast_log(LOG_WARNING, "Can't find %s entry in band table stanza %s. rv=0\n", myrpt->loginlevel, myrpt->p.txlimitsstanzaname); rv=0; return 0; } - if(debug > 3){ + if (debug > 3){ ast_log(LOG_NOTICE, "Auth: %s = %s\n", limitlist->name, limitlist->value); } @@ -9401,16 +9401,16 @@ strncpy(limits, limitlist->value, 256); limits[255] = 0; finddelim(limits, limit_ranges, 40); - for(i = 0; i < 40 && limit_ranges[i] ; i++){ + for (i = 0; i < 40 && limit_ranges[i] ; i++){ char range[40]; char *r,*s; strncpy(range, limit_ranges[i], 40); range[39] = 0; - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE, "Check %s within %s\n", myrpt->freq, range); r = strchr(range, '-'); - if(!r){ + if (!r){ ast_log(LOG_WARNING, "Malformed range in %s tx band table entry. rv=0\n", limitlist->name); rv=0; break; @@ -9425,16 +9425,16 @@ ulimit_mhz = atoi(limit_mhz_char); ulimit_decimals = decimals2int(limit_decimals_char); - if((radio_mhz >= llimit_mhz) && (radio_mhz <= ulimit_mhz)){ - if(radio_mhz == llimit_mhz){ /* CASE 1: TX freq is in llimit mhz portion of band */ - if(radio_decimals >= llimit_decimals){ /* Cannot be below llimit decimals */ - if(llimit_mhz == ulimit_mhz){ /* If bandwidth < 1Mhz, check ulimit decimals */ - if(radio_decimals <= ulimit_decimals){ + if ((radio_mhz >= llimit_mhz) && (radio_mhz <= ulimit_mhz)){ + if (radio_mhz == llimit_mhz){ /* CASE 1: TX freq is in llimit mhz portion of band */ + if (radio_decimals >= llimit_decimals){ /* Cannot be below llimit decimals */ + if (llimit_mhz == ulimit_mhz){ /* If bandwidth < 1Mhz, check ulimit decimals */ + if (radio_decimals <= ulimit_decimals){ rv=1; break; } else{ - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 1\n"); rv=0; break; @@ -9446,34 +9446,34 @@ } } else{ /* Is below llimit decimals */ - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 2\n"); rv=0; break; } } - else if(radio_mhz == ulimit_mhz){ /* CASE 2: TX freq not in llimit mhz portion of band */ - if(radio_decimals <= ulimit_decimals){ - if(debug > 3) + else if (radio_mhz == ulimit_mhz){ /* CASE 2: TX freq not in llimit mhz portion of band */ + if (radio_decimals <= ulimit_decimals){ + if (debug > 3) ast_log(LOG_NOTICE, "radio_decimals <= ulimit_decimals\n"); rv=1; break; } else{ /* Is above ulimit decimals */ - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 3\n"); rv=0; break; } } else /* CASE 3: TX freq within a multi-Mhz band and ok */ - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE, "Valid TX freq within a multi-Mhz band and ok.\n"); rv=1; break; } } - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE, "rv=%i\n",rv); return rv; @@ -9486,9 +9486,9 @@ static int multimode_bump_freq(struct rpt *myrpt, int interval) { - if(!strcmp(myrpt->remoterig, remote_rig_ft897)) + if (!strcmp(myrpt->remoterig, remote_rig_ft897)) return multimode_bump_freq_ft897(myrpt, interval); - else if(!strcmp(myrpt->remoterig, remote_rig_ic706)) + else if (!strcmp(myrpt->remoterig, remote_rig_ic706)) return multimode_bump_freq_ic706(myrpt, interval); else return -1; @@ -9515,7 +9515,7 @@ int res, interval; char mhz[MAXREMSTR], decimals[MAXREMSTR], k10=0i, k100=0; - switch(myrpt->hfscanmode){ + switch (myrpt->hfscanmode){ case HF_SCAN_DOWN_SLOW: interval = -10; /* 100Hz /sec */ @@ -9548,24 +9548,24 @@ res = split_freq(mhz, decimals, myrpt->freq); - if(!res){ + if (!res){ k100 =decimals[0]; k10 = decimals[1]; res = multimode_bump_freq(myrpt, interval); } - if(!res) + if (!res) res = split_freq(mhz, decimals, myrpt->freq); - if(res){ + if (res){ myrpt->hfscanmode = 0; myrpt->hfscanstatus = -2; return -1; } /* Announce 10KHz boundaries */ - if(k10 != decimals[1]){ + if (k10 != decimals[1]){ int myhund = (interval < 0) ? k100 : decimals[0]; int myten = (interval < 0) ? k10 : decimals[1]; myrpt->hfscanstatus = (myten == '0') ? (myhund - '0') * 100 : (myten - '0') * 10; @@ -9579,10 +9579,10 @@ static int get_mem_set(struct rpt *myrpt, char *digitbuf) { int res=0; - if(debug)ast_log(LOG_NOTICE," digitbuf=%s\n", digitbuf); + if (debug)ast_log(LOG_NOTICE," digitbuf=%s\n", digitbuf); res = retreive_memory(myrpt, digitbuf); - if(!res)res=setrem(myrpt); - if(debug)ast_log(LOG_NOTICE," freq=%s res=%i\n", myrpt->freq, res); + if (!res)res=setrem(myrpt); + if (debug)ast_log(LOG_NOTICE," freq=%s res=%i\n", myrpt->freq, res); return res; } /* @@ -9593,16 +9593,16 @@ { int res=0; - if(debug)ast_log(LOG_NOTICE,"remoterig=%s, data=%s\n",myrpt->remoterig,data); + if (debug)ast_log(LOG_NOTICE,"remoterig=%s, data=%s\n",myrpt->remoterig,data); if (!myrpt->remoterig) return(0); - if(data<=0) + if (data<=0) { res=-1; } else { myrpt->nowchan=strtod(data,NULL); - if(!strcmp(myrpt->remoterig, remote_rig_ppp16)) + if (!strcmp(myrpt->remoterig, remote_rig_ppp16)) { char string[16]; sprintf(string,"SETCHAN %d ",myrpt->nowchan); @@ -9610,10 +9610,10 @@ } else { - if(get_mem_set(myrpt, data))res=-1; + if (get_mem_set(myrpt, data))res=-1; } } - if(debug)ast_log(LOG_NOTICE,"nowchan=%i res=%i\n",myrpt->nowchan, res); + if (debug)ast_log(LOG_NOTICE,"nowchan=%i res=%i\n",myrpt->nowchan, res); return res; } /* @@ -9621,12 +9621,12 @@ static int channel_revert(struct rpt *myrpt) { int res=0; - if(debug)ast_log(LOG_NOTICE,"remoterig=%s, nowchan=%02d, waschan=%02d\n",myrpt->remoterig,myrpt->nowchan,myrpt->waschan); + if (debug)ast_log(LOG_NOTICE,"remoterig=%s, nowchan=%02d, waschan=%02d\n",myrpt->remoterig,myrpt->nowchan,myrpt->waschan); if (!myrpt->remoterig) return(0); - if(myrpt->nowchan!=myrpt->waschan) + if (myrpt->nowchan!=myrpt->waschan) { char data[8]; - if(debug)ast_log(LOG_NOTICE,"reverting.\n"); + if (debug)ast_log(LOG_NOTICE,"reverting.\n"); sprintf(data,"%02d",myrpt->waschan); myrpt->nowchan=myrpt->waschan; channel_steer(myrpt,data); @@ -9648,11 +9648,11 @@ char tmp[20], freq[20] = "", savestr[20] = ""; char mhz[MAXREMSTR], decimals[MAXREMSTR]; - if(debug > 6) { + if (debug > 6) { ast_log(LOG_NOTICE,"%s param=%s digitbuf=%s source=%i\n",myrpt->name,param,digitbuf,command_source); } - if((!param) || (command_source == SOURCE_RPT) || (command_source == SOURCE_LNK)) + if ((!param) || (command_source == SOURCE_RPT) || (command_source == SOURCE_LNK)) return DC_ERROR; p = myatoi(param); @@ -9661,14 +9661,14 @@ (!myrpt->loginlevel[0])) return DC_ERROR; multimode = multimode_capable(myrpt); - switch(p){ + switch (p){ case 1: /* retrieve memory */ - if(strlen(digitbuf) < 2) /* needs 2 digits */ + if (strlen(digitbuf) < 2) /* needs 2 digits */ break; - for(i = 0 ; i < 2 ; i++){ - if((digitbuf[i] < '0') || (digitbuf[i] > '9')) + for (i = 0 ; i < 2 ; i++){ + if ((digitbuf[i] < '0') || (digitbuf[i] > '9')) return DC_ERROR; } r=get_mem_set(myrpt, digitbuf); @@ -9684,34 +9684,34 @@ case 2: /* set freq and offset */ - for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for M+*K+*O or M+*H+* depending on mode */ - if(digitbuf[i] == '*'){ + for (i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for M+*K+*O or M+*H+* depending on mode */ + if (digitbuf[i] == '*'){ j++; continue; } - if((digitbuf[i] < '0') || (digitbuf[i] > '9')) + if ((digitbuf[i] < '0') || (digitbuf[i] > '9')) goto invalid_freq; else{ - if(j == 0) + if (j == 0) l++; /* # of digits before first * */ - if(j == 1) + if (j == 1) k++; /* # of digits after first * */ } } i = strlen(digitbuf) - 1; - if(multimode){ - if((j > 2) || (l > 3) || (k > 6)) + if (multimode){ + if ((j > 2) || (l > 3) || (k > 6)) goto invalid_freq; /* &^@#! */ } else{ - if((j > 2) || (l > 4) || (k > 3)) + if ((j > 2) || (l > 4) || (k > 3)) goto invalid_freq; /* &^@#! */ } /* Wait for M+*K+* */ - if(j < 2) + if (j < 2) break; /* Not yet */ /* We have a frequency */ @@ -9723,7 +9723,7 @@ s2 = strsep(&s,"*"); /* Pick off KHz and Hz */ ls2 = strlen(s2); - switch(ls2){ /* Allow partial entry of khz and hz digits for laziness support */ + switch (ls2){ /* Allow partial entry of khz and hz digits for laziness support */ case 1: ht = 0; k = 100 * atoi(s2); @@ -9735,8 +9735,8 @@ break; case 3: - if(!multimode){ - if((s2[2] != '0')&&(s2[2] != '5')) + if (!multimode){ + if ((s2[2] != '0')&&(s2[2] != '5')) goto invalid_freq; } ht = 0; @@ -9760,28 +9760,28 @@ snprintf(freq, sizeof(freq), "%s.%03d%02d",s1, k, ht); - if(debug) + if (debug) ast_log(LOG_NOTICE, "New frequency: %s\n", freq); split_freq(mhz, decimals, freq); m = atoi(mhz); d = atoi(decimals); - if(check_freq(myrpt, m, d, &defmode)) /* Check to see if frequency entered is legit */ + if (check_freq(myrpt, m, d, &defmode)) /* Check to see if frequency entered is legit */ goto invalid_freq; - if((defmode == REM_MODE_FM) && (digitbuf[i] == '*')) /* If FM, user must enter and additional offset digit */ + if ((defmode == REM_MODE_FM) && (digitbuf[i] == '*')) /* If FM, user must enter and additional offset digit */ break; /* Not yet */ offset = REM_SIMPLEX; /* Assume simplex */ - if(defmode == REM_MODE_FM){ + if (defmode == REM_MODE_FM){ oc = *s; /* Pick off offset */ if (oc){ - switch(oc){ + switch (oc){ case '1': offset = REM_MINUS; break; @@ -9820,36 +9820,36 @@ return DC_ERROR; case 3: /* set rx PL tone */ - for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for N+*N */ - if(digitbuf[i] == '*'){ + for (i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for N+*N */ + if (digitbuf[i] == '*'){ j++; continue; } - if((digitbuf[i] < '0') || (digitbuf[i] > '9')) + if ((digitbuf[i] < '0') || (digitbuf[i] > '9')) return DC_ERROR; else{ - if(j) + if (j) l++; else k++; } } - if((j > 1) || (k > 3) || (l > 1)) + if ((j > 1) || (k > 3) || (l > 1)) return DC_ERROR; /* &$@^! */ i = strlen(digitbuf) - 1; - if((j != 1) || (k < 2)|| (l != 1)) + if ((j != 1) || (k < 2)|| (l != 1)) break; /* Not yet */ - if(debug) + if (debug) printf("PL digits entered %s\n", digitbuf); strncpy(tmp, digitbuf, sizeof(tmp) - 1); /* see if we have at least 1 */ s = strchr(tmp,'*'); - if(s) + if (s) *s = '.'; strncpy(savestr, myrpt->rxpl, sizeof(savestr) - 1); strncpy(myrpt->rxpl, tmp, sizeof(myrpt->rxpl) - 1); - if(!strcmp(myrpt->remoterig, remote_rig_rbi)) + if (!strcmp(myrpt->remoterig, remote_rig_rbi)) { strncpy(myrpt->txpl, tmp, sizeof(myrpt->txpl) - 1); } @@ -9861,45 +9861,45 @@ case 4: /* set tx PL tone */ /* cant set tx tone on RBI (rx tone does both) */ - if(!strcmp(myrpt->remoterig, remote_rig_rbi)) + if (!strcmp(myrpt->remoterig, remote_rig_rbi)) return DC_ERROR; /* eventually for the ic706 instead of just throwing the exception we can check if we are in encode only mode and allow the tx ctcss code to be changed. but at least the warning message is issued for now. */ - if(!strcmp(myrpt->remoterig, remote_rig_ic706)) + if (!strcmp(myrpt->remoterig, remote_rig_ic706)) { - if(debug) + if (debug) ast_log(LOG_WARNING,"Setting IC706 Tx CTCSS Code Not Supported. Set Rx Code for both.\n"); return DC_ERROR; } - for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for N+*N */ - if(digitbuf[i] == '*'){ + for (i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for N+*N */ + if (digitbuf[i] == '*'){ j++; continue; } - if((digitbuf[i] < '0') || (digitbuf[i] > '9')) + if ((digitbuf[i] < '0') || (digitbuf[i] > '9')) return DC_ERROR; else{ - if(j) + if (j) l++; else k++; } } - if((j > 1) || (k > 3) || (l > 1)) + if ((j > 1) || (k > 3) || (l > 1)) return DC_ERROR; /* &$@^! */ i = strlen(digitbuf) - 1; - if((j != 1) || (k < 2)|| (l != 1)) + if ((j != 1) || (k < 2)|| (l != 1)) break; /* Not yet */ - if(debug) + if (debug) printf("PL digits entered %s\n", digitbuf); strncpy(tmp, digitbuf, sizeof(tmp) - 1); /* see if we have at least 1 */ s = strchr(tmp,'*'); - if(s) + if (s) *s = '.'; strncpy(savestr, myrpt->txpl, sizeof(savestr) - 1); strncpy(myrpt->txpl, tmp, sizeof(myrpt->txpl) - 1); @@ -9912,17 +9912,17 @@ case 6: /* MODE (FM,USB,LSB,AM) */ - if(strlen(digitbuf) < 1) + if (strlen(digitbuf) < 1) break; - if(!multimode) + if (!multimode) return DC_ERROR; /* Multimode radios only */ - switch(*digitbuf){ + switch (*digitbuf){ case '1': split_freq(mhz, decimals, myrpt->freq); m=atoi(mhz); - if(m < 29) /* No FM allowed below 29MHz! */ + if (m < 29) /* No FM allowed below 29MHz! */ return DC_ERROR; myrpt->remmode = REM_MODE_FM; @@ -9948,7 +9948,7 @@ return DC_ERROR; } - if(setrem(myrpt)) + if (setrem(myrpt)) return DC_ERROR; return DC_COMPLETEQUIET; case 99: @@ -10007,14 +10007,14 @@ rpt_telemetry(myrpt,REMXXX,(void *)p); return DC_COMPLETEQUIET; case 104: /* Low Power */ - if(!strcmp(myrpt->remoterig, remote_rig_ic706)) + if (!strcmp(myrpt->remoterig, remote_rig_ic706)) return DC_ERROR; myrpt->powerlevel = REM_LOWPWR; setrem(myrpt); rpt_telemetry(myrpt,REMXXX,(void *)p); return DC_COMPLETEQUIET; case 105: /* Medium Power */ - if(!strcmp(myrpt->remoterig, remote_rig_ic706)) + if (!strcmp(myrpt->remoterig, remote_rig_ic706)) return DC_ERROR; if (ISRIG_RTX(myrpt->remoterig)) return DC_ERROR; myrpt->powerlevel = REM_MEDPWR; @@ -10022,7 +10022,7 @@ rpt_telemetry(myrpt,REMXXX,(void *)p); return DC_COMPLETEQUIET; case 106: /* Hi Power */ - if(!strcmp(myrpt->remoterig, remote_rig_ic706)) + if (!strcmp(myrpt->remoterig, remote_rig_ic706)) return DC_ERROR; myrpt->powerlevel = REM_HIPWR; setrem(myrpt); @@ -10077,10 +10077,10 @@ rpt_telemetry(myrpt,REMXXX,(void *)p); return DC_COMPLETEQUIET; case 119: /* Tune Request */ - if(debug > 3) + if (debug > 3) ast_log(LOG_NOTICE,"TUNE REQUEST\n"); /* if not currently going, and valid to do */ - if((!myrpt->tunerequest) && + if ((!myrpt->tunerequest) && ((!strcmp(myrpt->remoterig, remote_rig_ft897) || !strcmp(myrpt->remoterig, remote_rig_ic706)) )) { myrpt->remotetx = 0; @@ -10126,12 +10126,12 @@ time_t now; int ret,res = 0,src; - if(debug > 6) + if (debug > 6) ast_log(LOG_NOTICE,"c=%c phonemode=%i dtmfidx=%i\n",c,phonemode,myrpt->dtmfidx); time(&myrpt->last_activity_time); /* Stop scan mode if in scan mode */ - if(myrpt->hfscanmode){ + if (myrpt->hfscanmode){ stop_scan(myrpt); return 0; } @@ -10193,7 +10193,7 @@ else if (phonemode == 4) src = SOURCE_ALT; ret = collect_function_digits(myrpt, myrpt->dtmfbuf, src, NULL); - switch(ret){ + switch (ret){ case DC_INDETERMINATE: res = 0; @@ -10300,7 +10300,7 @@ int res; - if(phonemode == 3) /* simplex phonemode, funcchar key/unkey toggle */ + if (phonemode == 3) /* simplex phonemode, funcchar key/unkey toggle */ { if (keyed && *keyed && ((c == myrpt->p.funcchar) || (c == myrpt->p.endchar))) { @@ -10388,7 +10388,7 @@ if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "rpt (attempt_reconnect) initiating call to %s/%s on %s\n", deststr, tele, l->chan->name); - if(l->chan->cid.cid_num) + if (l->chan->cid.cid_num) ast_free(l->chan->cid.cid_num); l->chan->cid.cid_num = ast_strdup(myrpt->name); ast_call(l->chan,tele,999); @@ -10431,7 +10431,7 @@ /* if in simple mode, kill autopatch */ if (myrpt->p.simple && myrpt->callmode) { - if(debug) + if (debug) ast_log(LOG_WARNING, "simple mode autopatch kill\n"); rpt_mutex_lock(&myrpt->lock); myrpt->callmode = 0; @@ -10452,7 +10452,7 @@ rpt_telemetry(myrpt,COMPLETE,NULL); return; } - else if(!myrpt->inpadtest) + else if (!myrpt->inpadtest) { rpt_mutex_unlock(&myrpt->lock); if (myrpt->p.propagate_phonedtmf) @@ -10497,7 +10497,7 @@ if (c_in & 0x80) src = SOURCE_ALT; res = collect_function_digits(myrpt, cmd, src, NULL); rpt_mutex_lock(&myrpt->lock); - switch(res){ + switch (res){ case DC_INDETERMINATE: break; case DC_REQ_FLUSH: @@ -10522,7 +10522,7 @@ myrpt->dtmf_time = 0; break; } - if(res != DC_INDETERMINATE) { + if (res != DC_INDETERMINATE) { rpt_mutex_unlock(&myrpt->lock); return; } @@ -10561,7 +10561,7 @@ { myrpt->callmode = 2; rpt_mutex_unlock(&myrpt->lock); - if(!myrpt->patchquiet) + if (!myrpt->patchquiet) rpt_telemetry(myrpt,PROC,NULL); return; } @@ -10594,7 +10594,7 @@ static void queue_id(struct rpt *myrpt) { - if(myrpt->p.idtime){ /* ID time must be non-zero */ + if (myrpt->p.idtime){ /* ID time must be non-zero */ myrpt->mustid = myrpt->tailid = 0; myrpt->idtimer = myrpt->p.idtime; /* Reset our ID timer */ rpt_mutex_unlock(&myrpt->lock); @@ -10620,26 +10620,26 @@ memcpy(&myrpt->lasttv, &myrpt->curtv, sizeof(struct timeval)); - if( (res = gettimeofday(&myrpt->curtv, NULL)) < 0) + if ( (res = gettimeofday(&myrpt->curtv, NULL)) < 0) ast_log(LOG_NOTICE, "Scheduler gettime of day returned: %s\n", strerror(res)); /* Try to get close to a 1 second resolution */ - if(myrpt->lasttv.tv_sec == myrpt->curtv.tv_sec) + if (myrpt->lasttv.tv_sec == myrpt->curtv.tv_sec) return; rpt_localtime(&myrpt->curtv.tv_sec, &tmnow); /* If midnight, then reset all daily statistics */ - if((tmnow.tm_hour == 0)&&(tmnow.tm_min == 0)&&(tmnow.tm_sec == 0)){ + if ((tmnow.tm_hour == 0)&&(tmnow.tm_min == 0)&&(tmnow.tm_sec == 0)){ myrpt->dailykeyups = 0; myrpt->dailytxtime = 0; myrpt->dailykerchunks = 0; myrpt->dailyexecdcommands = 0; } - if(tmnow.tm_sec != 0) + if (tmnow.tm_sec != 0) return; /* Code below only executes once per minute */ @@ -10652,14 +10652,14 @@ /* Don't schedule if disabled */ - if(myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable){ - if(debug > 6) + if (myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable){ + if (debug > 6) ast_log(LOG_NOTICE, "Scheduler disabled\n"); return; } - if(!myrpt->p.skedstanzaname){ /* No stanza means we do nothing */ - if(debug > 6) + if (!myrpt->p.skedstanzaname){ /* No stanza means we do nothing */ + if (debug > 6) ast_log(LOG_NOTICE,"No stanza for scheduler in rpt.conf\n"); return; } @@ -10667,47 +10667,47 @@ /* get pointer to linked list of scheduler entries */ skedlist = ast_variable_browse(myrpt->cfg, myrpt->p.skedstanzaname); - if(debug > 6){ + if (debug > 6){ ast_log(LOG_NOTICE, "Time now: %02d:%02d %02d %02d %02d\n", tmnow.tm_hour,tmnow.tm_min,tmnow.tm_mday,tmnow.tm_mon + 1, tmnow.tm_wday); } /* walk the list */ - for(; skedlist; skedlist = skedlist->next){ - if(debug > 6) + for (; skedlist; skedlist = skedlist->next){ + if (debug > 6) ast_log(LOG_NOTICE, "Scheduler entry %s = %s being considered\n",skedlist->name, skedlist->value); strncpy(value,skedlist->value,99); value[99] = 0; /* point to the substrings for minute, hour, dom, month, and dow */ - for( i = 0, vp = value ; i < 5; i++){ - if(!*vp) + for ( i = 0, vp = value ; i < 5; i++){ + if (!*vp) break; - while((*vp == ' ') || (*vp == 0x09)) /* get rid of any leading white space */ + while ((*vp == ' ') || (*vp == 0x09)) /* get rid of any leading white space */ vp++; strs[i] = vp; /* save pointer to beginning of substring */ - while((*vp != ' ') && (*vp != 0x09) && (*vp != 0)) /* skip over substring */ + while ((*vp != ' ') && (*vp != 0x09) && (*vp != 0)) /* skip over substring */ vp++; - if(*vp) + if (*vp) *vp++ = 0; /* mark end of substring */ } - if(debug > 6) + if (debug > 6) ast_log(LOG_NOTICE, "i = %d, min = %s, hour = %s, mday=%s, mon=%s, wday=%s\n",i, strs[0], strs[1], strs[2], strs[3], strs[4]); - if(i == 5){ - if((*strs[0] != '*')&&(atoi(strs[0]) != tmnow.tm_min)) + if (i == 5){ + if ((*strs[0] != '*')&&(atoi(strs[0]) != tmnow.tm_min)) continue; - if((*strs[1] != '*')&&(atoi(strs[1]) != tmnow.tm_hour)) + if ((*strs[1] != '*')&&(atoi(strs[1]) != tmnow.tm_hour)) continue; - if((*strs[2] != '*')&&(atoi(strs[2]) != tmnow.tm_mday)) + if ((*strs[2] != '*')&&(atoi(strs[2]) != tmnow.tm_mday)) continue; - if((*strs[3] != '*')&&(atoi(strs[3]) != tmnow.tm_mon + 1)) + if ((*strs[3] != '*')&&(atoi(strs[3]) != tmnow.tm_mon + 1)) continue; - if(atoi(strs[4]) == 7) + if (atoi(strs[4]) == 7) strs[4] = "0"; - if((*strs[4] != '*')&&(atoi(strs[4]) != tmnow.tm_wday)) + if ((*strs[4] != '*')&&(atoi(strs[4]) != tmnow.tm_wday)) continue; - if(debug) + if (debug) ast_log(LOG_NOTICE, "Executing scheduler entry %s = %s\n", skedlist->name, skedlist->value); - if(atoi(skedlist->name) == 0) + if (atoi(skedlist->name) == 0) return; /* Zero is reserved for the startup macro */ val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.macro, skedlist->name); if (!val){ @@ -10751,14 +10751,14 @@ rpt_mutex_lock(&myrpt->lock); telem = myrpt->tele.next; - while(telem != &myrpt->tele) + while (telem != &myrpt->tele) { ast_softhangup(telem->chan,AST_SOFTHANGUP_DEV); telem = telem->next; } rpt_mutex_unlock(&myrpt->lock); /* find our index, and load the vars initially */ - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (&rpt_vars[i] == myrpt) { @@ -10768,7 +10768,7 @@ } rpt_mutex_lock(&myrpt->lock); - while(myrpt->xlink) + while (myrpt->xlink) { myrpt->xlink = 3; rpt_mutex_unlock(&myrpt->lock); @@ -11192,7 +11192,7 @@ int totx=0,elap=0,n,x,toexit=0; /* DEBUG Dump */ - if((myrpt->disgorgetime) && (time(NULL) >= myrpt->disgorgetime)){ + if ((myrpt->disgorgetime) && (time(NULL) >= myrpt->disgorgetime)){ struct rpt_link *dl; struct rpt_tele *dt; @@ -11216,7 +11216,7 @@ ast_log(LOG_NOTICE,"myrpt->tailevent = %d\n",myrpt->tailevent); dl = myrpt->links.next; - while(dl != &myrpt->links){ + while (dl != &myrpt->links){ ast_log(LOG_NOTICE,"*** Link Name: %s ***\n",dl->name); ast_log(LOG_NOTICE," link->lasttx %d\n",dl->lasttx); ast_log(LOG_NOTICE," link->lastrx %d\n",dl->lastrx); @@ -11234,9 +11234,9 @@ } dt = myrpt->tele.next; - if(dt != &myrpt->tele) + if (dt != &myrpt->tele) ast_log(LOG_NOTICE,"*** Telemetry Queue ***\n"); - while(dt != &myrpt->tele){ + while (dt != &myrpt->tele){ ast_log(LOG_NOTICE," Telemetry mode: %d\n",dt->mode); dt = dt->next; } @@ -11251,7 +11251,7 @@ rpt_mutex_lock(&myrpt->lock); inner_telem = myrpt->tele.next; - while(inner_telem != &myrpt->tele) + while (inner_telem != &myrpt->tele) { ast_softhangup(inner_telem->chan,AST_SOFTHANGUP_DEV); inner_telem = inner_telem->next; @@ -11260,7 +11260,7 @@ rpt_mutex_unlock(&myrpt->lock); usleep(10000); /* find our index, and load the vars */ - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (&rpt_vars[i] == myrpt) { @@ -11287,17 +11287,17 @@ /* If someone's connected, and they're transmitting from their end to us, set remrx true */ l = myrpt->links.next; remrx = 0; - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->lastrx){ remrx = 1; - if(l->name[0] != '0') /* Ignore '0' nodes */ + if (l->name[0] != '0') /* Ignore '0' nodes */ strcpy(myrpt->lastnodewhichkeyedusup, l->name); /* Note the node which is doing the key up */ } l = l->next; } /* Create a "must_id" flag for the cleanup ID */ - if(myrpt->p.idtime) /* ID time must be non-zero */ + if (myrpt->p.idtime) /* ID time must be non-zero */ myrpt->mustid |= (myrpt->idtimer) && (myrpt->keyed || remrx) ; /* Build a fresh totx from myrpt->keyed and autopatch activated */ /* If full duplex, add local tx to totx */ @@ -11339,16 +11339,16 @@ tailmessagequeued = 0; ctqueued = 0; telem = myrpt->tele.next; - while(telem != &myrpt->tele) + while (telem != &myrpt->tele) { - if((telem->mode == ID) || (telem->mode == IDTALKOVER)){ + if ((telem->mode == ID) || (telem->mode == IDTALKOVER)){ identqueued = 1; /* Identification telemetry */ } - else if(telem->mode == TAILMSG) + else if (telem->mode == TAILMSG) { tailmessagequeued = 1; /* Tail message telemetry */ } - else if(telem->mode == STATS_TIME_LOCAL) + else if (telem->mode == STATS_TIME_LOCAL) { localmsgqueued = 1; /* Local message */ } @@ -11423,7 +11423,7 @@ /* if timed-out and in circuit busy after call */ if ((!totx) && (!myrpt->totimer) && (myrpt->callmode == 4)) { - if(debug) + if (debug) ast_log(LOG_NOTICE, "timed-out and in circuit busy after call\n"); myrpt->callmode = 0; myrpt->macropatch=0; @@ -11439,12 +11439,12 @@ int hasid = 0,hastalkover = 0; telem = myrpt->tele.next; - while(telem != &myrpt->tele){ - if(telem->mode == ID){ + while (telem != &myrpt->tele){ + if (telem->mode == ID){ if (telem->chan) ast_softhangup(telem->chan, AST_SOFTHANGUP_DEV); /* Whoosh! */ hasid = 1; } - if(telem->mode == TAILMSG){ + if (telem->mode == TAILMSG){ if (telem->chan) ast_softhangup(telem->chan, AST_SOFTHANGUP_DEV); /* Whoosh! */ } if (telem->mode == IDTALKOVER) hastalkover = 1; @@ -11459,7 +11459,7 @@ /* If within 30 seconds of the time to ID, try do it in the tail */ /* else if at ID time limit, do it right over the top of them */ /* Lastly, if the repeater has been keyed, and the ID timer is expired, do a clean up ID */ - if(myrpt->mustid && (!myrpt->idtimer)) + if (myrpt->mustid && (!myrpt->idtimer)) queue_id(myrpt); if ((myrpt->p.idtime && totx && (!myrpt->exttx) && @@ -11470,9 +11470,9 @@ /* If tail timer expires, then check for tail messages */ - if(myrpt->tailevent){ + if (myrpt->tailevent){ myrpt->tailevent = 0; - if(myrpt->tailid){ + if (myrpt->tailid){ totx = 1; queue_id(myrpt); } @@ -11587,7 +11587,7 @@ /* Reconnect */ l = myrpt->links.next; - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->killme) { @@ -11618,7 +11618,7 @@ if (myrpt->dahditxchannel != myrpt->txchannel) cs[n++] = myrpt->dahditxchannel; l = myrpt->links.next; - while(l != &myrpt->links) + while (l != &myrpt->links) { if ((!l->killme) && (!l->disctime) && l->chan) { @@ -11642,7 +11642,7 @@ myrpt->topkeystate = 3; } ms = MSWAIT; - for(x = 0; x < n; x++) + for (x = 0; x < n; x++) { int s = -(-x - myrpt->scram - 1) % n; cs1[x] = cs[s]; @@ -11653,7 +11653,7 @@ elap = MSWAIT - ms; rpt_mutex_lock(&myrpt->lock); l = myrpt->links.next; - while(l != &myrpt->links) + while (l != &myrpt->links) { int myrx; @@ -11741,7 +11741,7 @@ sprintf(str,"RXUNKEY(T),%s",l->name); donodelog(myrpt,str); } - if(myrpt->p.duplex) + if (myrpt->p.duplex) rpt_telemetry(myrpt,LINKUNKEY,l); l->lastrx1 = 0; } @@ -11833,10 +11833,10 @@ } if ((!l->chan) && (!l->disctime) && (!l->outbound)) { - if(debug)ast_log(LOG_NOTICE, "LINKDISC AA\n"); + if (debug)ast_log(LOG_NOTICE, "LINKDISC AA\n"); /* remove from queue */ remque((struct qelem *) l); - if(myrpt->links.next==&myrpt->links)channel_revert(myrpt); + if (myrpt->links.next==&myrpt->links)channel_revert(myrpt); if (!strcmp(myrpt->cmdnode,l->name))myrpt->cmdnode[0] = 0; rpt_mutex_unlock(&myrpt->lock); if (l->name[0] != '0') @@ -11870,7 +11870,7 @@ myrpt->linkposttimer = LINKPOSTTIME; nstr = 0; - for(l = myrpt->links.next; l != &myrpt->links; l = l->next) + for (l = myrpt->links.next; l != &myrpt->links; l = l->next) { /* if is not a real link, ignore it */ if (l->name[0] == '0') continue; @@ -11884,7 +11884,7 @@ } nstr = 0; strcpy(str,"nodes="); - for(l = myrpt->links.next; l != &myrpt->links; l = l->next) + for (l = myrpt->links.next; l != &myrpt->links; l = l->next) { /* if is not a real link, ignore it */ if (l->name[0] == '0') continue; @@ -11896,9 +11896,9 @@ nstr = 1; } p = strstr(tdesc, "version"); - if(p){ + if (p){ int vmajor,vminor; - if(sscanf(p, "version %30d.%30d", &vmajor, &vminor) == 2) + if (sscanf(p, "version %30d.%30d", &vmajor, &vminor) == 2) sprintf(str + strlen(str),"&apprptvers=%d.%d",vmajor,vminor); } time(&now); @@ -11934,14 +11934,14 @@ statpost(myrpt,str); rpt_mutex_lock(&myrpt->lock); } - if(totx){ + if (totx){ myrpt->dailytxtime += elap; myrpt->totaltxtime += elap; } i = myrpt->tailtimer; if (myrpt->tailtimer) myrpt->tailtimer -= elap; if (myrpt->tailtimer < 0) myrpt->tailtimer = 0; - if((i) && (myrpt->tailtimer == 0)) + if ((i) && (myrpt->tailtimer == 0)) myrpt->tailevent = 1; if ((!myrpt->p.s[myrpt->p.sysstate_cur].totdisable) && myrpt->totimer) myrpt->totimer -= elap; if (myrpt->totimer < 0) myrpt->totimer = 0; @@ -12060,7 +12060,7 @@ #ifdef _MDC_DECODE_H_ sp = (short *) f->data; /* convert block to unsigned char */ - for(n = 0; n < f->datalen / 2; n++) + for (n = 0; n < f->datalen / 2; n++) { ubuf[n] = (*sp++ >> 8) + 128; } @@ -12196,7 +12196,7 @@ rpt_mutex_unlock(&myrpt->lock); busy=1; } - if(!busy){ + if (!busy){ myrpt->macrotimer = MACROTIME; strncat(myrpt->macrobuf,value,MAXMACRO - 1); if (!busy) strcpy(myrpt->lasttone,(char*)f->data.ptr); @@ -12214,7 +12214,7 @@ rpt_mutex_unlock(&myrpt->lock); busy=1; } - if(!busy){ + if (!busy){ myrpt->macrotimer = MACROTIME; strncat(myrpt->macrobuf,value,MAXMACRO - 1); } @@ -12230,7 +12230,7 @@ if ((!lasttx) || (myrpt->p.duplex > 1) || (myrpt->p.linktolink)) { if (debug == 7) printf("@@@@ rx un-key\n"); - if(myrpt->p.duplex && myrpt->keyed) { + if (myrpt->p.duplex && myrpt->keyed) { rpt_telemetry(myrpt,UNKEY,NULL); } } @@ -12311,7 +12311,7 @@ x = 0; AST_LIST_TRAVERSE(&myrpt->txq, vframe, frame_list) x++; - for(;x < myrpt->p.simplexpatchdelay; x++) + for (;x < myrpt->p.simplexpatchdelay; x++) { vframe = ast_frdup(f); memset(vframe->data.ptr,0,vframe->datalen); @@ -12339,7 +12339,7 @@ } else { - while((vframe = AST_LIST_REMOVE_HEAD(&myrpt->txq, + while ((vframe = AST_LIST_REMOVE_HEAD(&myrpt->txq, frame_list))) ast_frfree(vframe); } ast_write(myrpt->txchannel,f); @@ -12359,7 +12359,7 @@ toexit = 0; rpt_mutex_lock(&myrpt->lock); l = myrpt->links.next; - while(l != &myrpt->links) + while (l != &myrpt->links) { int remnomute; struct timeval now; @@ -12373,7 +12373,7 @@ remrx = 0; /* see if any other links are receiving */ m = myrpt->links.next; - while(m != &myrpt->links) + while (m != &myrpt->links) { /* if not us, count it */ if ((m != l) && (m->lastrx)) remrx = 1; @@ -12508,7 +12508,7 @@ x = 0; AST_LIST_TRAVERSE(&l->rxq, f1, frame_list) x++; - for(;x < myrpt->p.simplexphonedelay; x++) + for (;x < myrpt->p.simplexphonedelay; x++) { f1 = ast_frdup(f); memset(f1->data.ptr,0,f1->datalen); @@ -12659,7 +12659,7 @@ donodelog(myrpt,str); } l->lastrx1 = 0; - if(myrpt->p.duplex) + if (myrpt->p.duplex) rpt_telemetry(myrpt,LINKUNKEY,l); } } @@ -12900,7 +12900,7 @@ ast_hangup(myrpt->rxchannel); rpt_mutex_lock(&myrpt->lock); l = myrpt->links.next; - while(l != &myrpt->links) + while (l != &myrpt->links) { struct rpt_link *ll = l; /* remove from queue */ @@ -12934,7 +12934,7 @@ n = 0; #ifndef OLD_ASTERISK /* wait until asterisk starts */ - while(!ast_test_flag(&ast_options,AST_OPT_FLAG_FULLY_BOOTED)) + while (!ast_test_flag(&ast_options,AST_OPT_FLAG_FULLY_BOOTED)) usleep(250000); #endif #ifdef NEW_ASTERISK @@ -12947,13 +12947,13 @@ ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf. Radio Repeater disabled.\n"); pthread_exit(NULL); } - while((this = ast_category_browse(cfg,this)) != NULL) + while ((this = ast_category_browse(cfg,this)) != NULL) { - for(i = 0 ; i < strlen(this) ; i++){ - if((this[i] < '0') || (this[i] > '9')) + for (i = 0 ; i < strlen(this) ; i++){ + if ((this[i] < '0') || (this[i] > '9')) break; } - if(i != strlen(this)) continue; /* Not a node defn */ + if (i != strlen(this)) continue; /* Not a node defn */ memset(&rpt_vars[n],0,sizeof(rpt_vars[n])); rpt_vars[n].name = ast_strdup(this); val = (char *) ast_variable_retrieve(cfg,this,"rxchannel"); @@ -12986,14 +12986,14 @@ ast_config_destroy(cfg); /* start em all */ - for(i = 0; i < n; i++) + for (i = 0; i < n; i++) { load_rpt_vars(i,1); /* if is a remote, dont start one for it */ if (rpt_vars[i].remote) { - if(retreive_memory(&rpt_vars[i],"init")){ /* Try to retreive initial memory channel */ + if (retreive_memory(&rpt_vars[i],"init")){ /* Try to retreive initial memory channel */ if (!strcmp(rpt_vars[i].remoterig,remote_rig_rtx450)) strncpy(rpt_vars[i].freq, "446.500", sizeof(rpt_vars[i].freq) - 1); else @@ -13010,7 +13010,7 @@ else /* is a normal repeater */ { rpt_vars[i].p.memory = rpt_vars[i].name; - if(retreive_memory(&rpt_vars[i],"radiofreq")){ /* Try to retreive initial memory channel */ + if (retreive_memory(&rpt_vars[i],"radiofreq")){ /* Try to retreive initial memory channel */ if (!strcmp(rpt_vars[i].remoterig,remote_rig_rtx450)) strncpy(rpt_vars[i].freq, "446.500", sizeof(rpt_vars[i].freq) - 1); else if (!strcmp(rpt_vars[i].remoterig,remote_rig_rtx150)) @@ -13036,10 +13036,10 @@ } usleep(500000); time(&starttime); - for(;;) + for (;;) { /* Now monitor each thread, and restart it if necessary */ - for(i = 0; i < n; i++) + for (i = 0; i < n; i++) { int rv; if (rpt_vars[i].remote) continue; @@ -13049,9 +13049,9 @@ rv = pthread_kill(rpt_vars[i].rpt_thread,0); if (rv) { - if(time(NULL) - rpt_vars[i].lastthreadrestarttime <= 15) + if (time(NULL) - rpt_vars[i].lastthreadrestarttime <= 15) { - if(rpt_vars[i].threadrestarts >= 5) + if (rpt_vars[i].threadrestarts >= 5) { ast_log(LOG_ERROR,"Continual RPT thread restarts, killing Asterisk\n"); exit(1); /* Stuck in a restart loop, kill Asterisk and start over */ @@ -13074,7 +13074,7 @@ } } - for(;;) + for (;;) { struct nodelog *nodep; char *space,datestr[100],fname[300]; @@ -13082,7 +13082,7 @@ ast_mutex_lock(&nodeloglock); nodep = nodelog.next; - if(nodep == &nodelog) /* if nothing in queue */ + if (nodep == &nodelog) /* if nothing in queue */ { ast_mutex_unlock(&nodeloglock); break; @@ -13167,13 +13167,13 @@ ast_log(LOG_NOTICE,"parsing argument=%s \n",tmp); altp=strstr(tmp, "|*"); - if(altp){ + if (altp){ altp[0]=0; altp++; } memp=strstr(tmp, "|M"); - if(memp){ + if (memp){ memp[0]=0; memp+=2; } @@ -13183,12 +13183,12 @@ options = stringp; ast_log(LOG_NOTICE,"options=%s \n",options); - if(memp>0)ast_log(LOG_NOTICE,"memp=%s \n",memp); - if(altp>0)ast_log(LOG_NOTICE,"altp=%s \n",altp); + if (memp>0)ast_log(LOG_NOTICE,"memp=%s \n",memp); + if (altp>0)ast_log(LOG_NOTICE,"altp=%s \n",altp); myrpt = NULL; /* see if we can find our specified one */ - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { /* if name matches, assign it and exit loop */ if (!strcmp(tmp,rpt_vars[i].name)) @@ -13209,16 +13209,16 @@ numlinks=linkcount(myrpt); - if(options && *options == 'q') + if (options && *options == 'q') { char buf2[128]; - if(myrpt->keyed) + if (myrpt->keyed) pbx_builtin_setvar_helper(chan, "RPT_STAT_RXKEYED", "1"); else pbx_builtin_setvar_helper(chan, "RPT_STAT_RXKEYED", "0"); - if(myrpt->txkeyed) + if (myrpt->txkeyed) pbx_builtin_setvar_helper(chan, "RPT_STAT_TXKEYED", "1"); else pbx_builtin_setvar_helper(chan, "RPT_STAT_TXKEYED", "0"); @@ -13247,13 +13247,13 @@ return priority_jump(myrpt,chan); } - if(options && *options == 'o') + if (options && *options == 'o') { return(channel_revert(myrpt)); } #if 0 - if((altp)&&(*options == 'Z')) + if ((altp)&&(*options == 'Z')) { rpt_push_alt_macro(myrpt,altp); return 0; @@ -13269,29 +13269,29 @@ pbx_builtin_setvar_helper(chan, "RPT_STAT_BUSY", "0"); myrpt->bargechan=0; - if(options && strstr(options, "f")>0) + if (options && strstr(options, "f")>0) { myrpt->bargechan=1; } - if(memp>0) + if (memp>0) { char radiochan; radiochan=strtod(data,NULL); - // if(myrpt->nowchan!=0 && radiochan!=myrpt->nowchan && !myrpt->bargechan) + // if (myrpt->nowchan!=0 && radiochan!=myrpt->nowchan && !myrpt->bargechan) - if(numlinks>0 && radiochan!=myrpt->nowchan && !myrpt->bargechan) + if (numlinks>0 && radiochan!=myrpt->nowchan && !myrpt->bargechan) { pbx_builtin_setvar_helper(chan, "RPT_STAT_BUSY", "1"); ast_log(LOG_NOTICE, "Radio Channel Busy.\n"); return (priority_jump(myrpt,chan)); } - else if(radiochan!=myrpt->nowchan || myrpt->bargechan) + else if (radiochan!=myrpt->nowchan || myrpt->bargechan) { channel_steer(myrpt,memp); } } - if(altp)rpt_push_alt_macro(myrpt,altp); + if (altp)rpt_push_alt_macro(myrpt,altp); phone_mode = 1; if (*options == 'D') phone_mode = 2; if (*options == 'S') phone_mode = 3; @@ -13315,7 +13315,7 @@ return -1; } #endif - if(myrpt->p.s[myrpt->p.sysstate_cur].txdisable){ /* Do not allow incoming radio connections if disabled */ + if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable){ /* Do not allow incoming radio connections if disabled */ ast_log(LOG_NOTICE, "Connect attempt to node %s with tx disabled", myrpt->name); return -1; } @@ -13339,7 +13339,7 @@ { ast_indicate(chan,AST_CONTROL_BUSY); } - while(ast_safe_sleep(chan,10000) != -1); + while (ast_safe_sleep(chan,10000) != -1); return -1; } @@ -13351,7 +13351,7 @@ length=strlen(options)+2; orig_s=ast_malloc(length); - if(!orig_s) { + if (!orig_s) { ast_log(LOG_WARNING, "Out of memory\n"); return -1; } @@ -13359,40 +13359,40 @@ strncpy(s,options,length); template=strsep(&s,"|"); - if(!template) { + if (!template) { ast_log(LOG_WARNING, "An announce template must be defined\n"); ast_free(orig_s); return -1; } - if(s) { + if (s) { timeout = atoi(strsep(&s, "|")); timeout *= 1000; } return_context = s; - if(return_context != NULL) { + if (return_context != NULL) { /* set the return context. Code borrowed from the Goto builtin */ working = return_context; context = strsep(&working, "|"); exten = strsep(&working, "|"); - if(!exten) { + if (!exten) { /* Only a priority in this one */ priority = context; exten = NULL; context = NULL; } else { priority = strsep(&working, "|"); - if(!priority) { + if (!priority) { /* Only an extension and priority in this one */ priority = exten; exten = context; context = NULL; } } - if(atoi(priority) < 0) { + if (atoi(priority) < 0) { ast_log(LOG_WARNING, "Priority '%s' must be a number > 0\n", priority); ast_free(orig_s); return -1; @@ -13400,20 +13400,20 @@ /* At this point we have a priority and maybe an extension and a context */ chan->priority = atoi(priority); #ifdef OLD_ASTERISK - if(exten && strcasecmp(exten, "BYEXTENSION")) + if (exten && strcasecmp(exten, "BYEXTENSION")) #else - if(exten) + if (exten) #endif strncpy(chan->exten, exten, sizeof(chan->exten)-1); - if(context) + if (context) strncpy(chan->context, context, sizeof(chan->context)-1); } else { /* increment the priority by default*/ chan->priority++; } - if(option_verbose > 2) { + if (option_verbose > 2) { ast_verbose( VERBOSE_PREFIX_3 "Return Context: (%s,%s,%d) ID: %s\n", chan->context,chan->exten, chan->priority, chan->cid.cid_num); - if(!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) { + if (!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) { ast_verbose( VERBOSE_PREFIX_3 "Warning: Return Context Invalid, call will return to default|s\n"); } } @@ -13580,7 +13580,7 @@ rpt_mutex_lock(&myrpt->lock); l = myrpt->links.next; /* try to find this one in queue */ - while(l != &myrpt->links) + while (l != &myrpt->links) { if (l->name[0] == '0') { @@ -13699,7 +13699,7 @@ time_t now; time(&now); - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (!strcasecmp(rpt_vars[i].name,myrpt->p.rptnode)) { @@ -13717,7 +13717,7 @@ #endif return -1; } - while(rpt_vars[i].xlink != 3) + while (rpt_vars[i].xlink != 3) { if (!killedit) { @@ -13756,7 +13756,7 @@ #endif rpt_mutex_unlock(&myrpt->lock); /* find our index, and load the vars initially */ - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (&rpt_vars[i] == myrpt) { @@ -14063,7 +14063,7 @@ cs[n++] = myrpt->txchannel; if (!phone_mode) send_newkey(chan); /* start un-locked */ - for(;;) + for (;;) { if (ast_check_hangup(chan)) break; if (ast_check_hangup(myrpt->rxchannel)) break; @@ -14071,7 +14071,7 @@ setting = 0; reming = 0; telem = myrpt->tele.next; - while(telem != &myrpt->tele) + while (telem != &myrpt->tele) { if (telem->mode == SETREMOTE) setting = 1; if ((telem->mode == SETREMOTE) || @@ -14084,7 +14084,7 @@ { myrpt->reload = 0; /* find our index, and load the vars */ - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (&rpt_vars[i] == myrpt) { @@ -14187,10 +14187,10 @@ rem_totx = myrpt->dtmf_local_timer && (!phone_mode); rem_totx |= keyed && (!myrpt->tunerequest); rem_rx = (remkeyed && (!setting)) || (myrpt->tele.next != &myrpt->tele); - if(!strcmp(myrpt->remoterig, remote_rig_ic706)) + if (!strcmp(myrpt->remoterig, remote_rig_ic706)) rem_totx |= myrpt->tunerequest; // - if((debug > 6) && rem_totx) { + if ((debug > 6) && rem_totx) { ast_log(LOG_NOTICE,"Set rem_totx=%i. dtmf_local_timer=%i phone_mode=%i keyed=%i tunerequest=%i\n",rem_totx,myrpt->dtmf_local_timer,phone_mode,keyed,myrpt->tunerequest); } if (keyed && (!keyed1)) @@ -14261,12 +14261,12 @@ /* if not authed, and needed, do not transmit */ if ((!myrpt->p.authlevel) || myrpt->loginlevel[0]) { - if(debug > 6) + if (debug > 6) ast_log(LOG_NOTICE,"Handle rem_totx=%i. dtmf_local_timer=%i tunerequest=%i\n",rem_totx,myrpt->dtmf_local_timer,myrpt->tunerequest); myrpt->remotetx = 1; /* asdf maw ??? is this really what you want? Doesn't it always get executed? */ - if((myrpt->remtxfreqok = check_tx_freq(myrpt))) + if ((myrpt->remtxfreqok = check_tx_freq(myrpt))) { time(&myrpt->last_activity_time); if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel)) @@ -14290,7 +14290,7 @@ if ((!rem_totx) && myrpt->remotetx) /* Remote base radio TX unkey */ { myrpt->remotetx = 0; - if(!myrpt->remtxfreqok){ + if (!myrpt->remtxfreqok){ rpt_telemetry(myrpt,UNAUTHTX,NULL); } if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel)) @@ -14311,7 +14311,7 @@ } if (myrpt->hfscanmode){ myrpt->scantimer -= elap; - if(myrpt->scantimer <= 0){ + if (myrpt->scantimer <= 0){ if (!reming) { myrpt->scantimer = REM_SCANTIME; @@ -14455,7 +14455,7 @@ { int myreming = 0; - if(!strcmp(myrpt->remoterig, remote_rig_kenwood)) + if (!strcmp(myrpt->remoterig, remote_rig_kenwood)) myreming = reming; if (myreming || (!remkeyed) || @@ -14557,7 +14557,7 @@ donodelog(myrpt,mycmd); } /* wait for telem to be done */ - while(myrpt->tele.next != &myrpt->tele) usleep(100000); + while (myrpt->tele.next != &myrpt->tele) usleep(100000); sprintf(tmp,"mixmonitor stop %s",chan->name); ast_cli_command(nullfd,tmp); close(nullfd); @@ -14602,7 +14602,7 @@ if (myrpt->p.rptnode) { rpt_mutex_lock(&myrpt->lock); - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if (!strcasecmp(rpt_vars[i].name,myrpt->p.rptnode)) { @@ -14680,14 +14680,14 @@ called_number = lastdtmfcommand = transmitterkeyed = NULL; time(&now); - for(i = 0; i < nrpts; i++) + for (i = 0; i < nrpts; i++) { if ((node)&&(!strcmp(node,rpt_vars[i].name))){ rpt_manager_success(s,m); myrpt = &rpt_vars[i]; - if(myrpt->remote){ /* Remote base ? */ + if (myrpt->remote){ /* Remote base ? */ char *loginuser, *loginlevel, *freq, *rxpl, *txpl, *modestr; char offset = 0, powerlevel = 0, rxplon = 0, txplon = 0, remoteon, remmode = 0, reportfmstuff; char offsetc,powerlevelc; @@ -14695,16 +14695,16 @@ loginuser = loginlevel = freq = rxpl = txpl = NULL; /* Make a copy of all stat variables while locked */ rpt_mutex_lock(&myrpt->lock); /* LOCK */ - if((remoteon = myrpt->remoteon)){ - if(!ast_strlen_zero(myrpt->loginuser)) + if ((remoteon = myrpt->remoteon)){ + if (!ast_strlen_zero(myrpt->loginuser)) loginuser = ast_strdup(myrpt->loginuser); - if(!ast_strlen_zero(myrpt->loginlevel)) + if (!ast_strlen_zero(myrpt->loginlevel)) loginlevel = ast_strdup(myrpt->loginlevel); - if(!ast_strlen_zero(myrpt->freq)) + if (!ast_strlen_zero(myrpt->freq)) freq = ast_strdup(myrpt->freq); - if(!ast_strlen_zero(myrpt->rxpl)) + if (!ast_strlen_zero(myrpt->rxpl)) rxpl = ast_strdup(myrpt->rxpl); - if(!ast_strlen_zero(myrpt->txpl)) + if (!ast_strlen_zero(myrpt->txpl)) txpl = ast_strdup(myrpt->txpl); remmode = myrpt->remmode; offset = myrpt->offset; @@ -14715,21 +14715,21 @@ rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */ astman_append(s, "IsRemoteBase: YES\r\n"); astman_append(s, "RemoteOn: %s\r\n",(remoteon) ? "YES": "NO"); - if(remoteon){ - if(loginuser){ + if (remoteon){ + if (loginuser){ astman_append(s, "LogInUser: %s\r\n", loginuser); ast_free(loginuser); } - if(loginlevel){ + if (loginlevel){ astman_append(s, "LogInLevel: %s\r\n", loginlevel); ast_free(loginlevel); } - if(freq){ + if (freq){ astman_append(s, "Freq: %s\r\n", freq); ast_free(freq); } reportfmstuff = 0; - switch(remmode){ + switch (remmode){ case REM_MODE_FM: modestr = "FM"; reportfmstuff = 1; @@ -14745,8 +14745,8 @@ break; } astman_append(s, "RemMode: %s\r\n", modestr); - if(reportfmstuff){ - switch(offset){ + if (reportfmstuff){ + switch (offset){ case REM_SIMPLEX: offsetc = 'S'; break; @@ -14758,16 +14758,16 @@ break; } astman_append(s, "RemOffset: %c\r\n", offsetc); - if(rxplon && rxpl){ + if (rxplon && rxpl){ astman_append(s, "RxPl: %s\r\n",rxpl); ast_free(rxpl); } - if(txplon && txpl){ + if (txplon && txpl){ astman_append(s, "TxPl: %s\r\n",txpl); ast_free(txpl); } } - switch(powerlevel){ + switch (powerlevel){ case REM_LOWPWR: powerlevelc = 'L'; break; @@ -14802,8 +14802,8 @@ reverse_patch_state = "DOWN"; numoflinks = 0; l = myrpt->links.next; - while(l && (l != &myrpt->links)){ - if(numoflinks >= MAX_STAT_LINKS){ + while (l && (l != &myrpt->links)){ + if (numoflinks >= MAX_STAT_LINKS){ ast_log(LOG_NOTICE, "maximum number of links exceeds %d in rpt_do_stats()!",MAX_STAT_LINKS); break; @@ -14814,7 +14814,7 @@ continue; } listoflinks[numoflinks] = ast_strdup(l->name); - if(listoflinks[numoflinks] == NULL){ + if (listoflinks[numoflinks] == NULL){ break; } else{ @@ -14823,71 +14823,71 @@ l = l->next; } - if(myrpt->keyed) + if (myrpt->keyed) input_signal = "YES"; else input_signal = "NO"; - if(myrpt->txkeyed) + if (myrpt->txkeyed) transmitterkeyed = "YES"; else transmitterkeyed = "NO"; - if(myrpt->p.parrotmode) + if (myrpt->p.parrotmode) parrot_ena = "ENABLED"; else parrot_ena = "DISABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].txdisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable) sys_ena = "DISABLED"; else sys_ena = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].totdisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].totdisable) tot_ena = "DISABLED"; else tot_ena = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable) link_ena = "DISABLED"; else link_ena = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable) patch_ena = "DISABLED"; else patch_ena = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable) sch_ena = "DISABLED"; else sch_ena = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].userfundisable) + if (myrpt->p.s[myrpt->p.sysstate_cur].userfundisable) user_funs = "DISABLED"; else user_funs = "ENABLED"; - if(myrpt->p.s[myrpt->p.sysstate_cur].alternatetail) + if (myrpt->p.s[myrpt->p.sysstate_cur].alternatetail) tail_type = "ALTERNATE"; else tail_type = "STANDARD"; - if(!myrpt->totimer) + if (!myrpt->totimer) tot_state = "TIMED OUT!"; - else if(myrpt->totimer != myrpt->p.totime) + else if (myrpt->totimer != myrpt->p.totime) tot_state = "ARMED"; else tot_state = "RESET"; - if(myrpt->tailid) + if (myrpt->tailid) ider_state = "QUEUED IN TAIL"; - else if(myrpt->mustid) + else if (myrpt->mustid) ider_state = "QUEUED FOR CLEANUP"; else ider_state = "CLEAN"; - switch(myrpt->callmode){ + switch (myrpt->callmode){ case 1: patch_state = "DIALING"; break; @@ -14906,11 +14906,11 @@ patch_state = "DOWN"; } - if(strlen(myrpt->exten)){ + if (strlen(myrpt->exten)){ called_number = ast_strdup(myrpt->exten); } - if(strlen(myrpt->lastdtmfcommand)){ + if (strlen(myrpt->lastdtmfcommand)){ lastdtmfcommand = ast_strdup(myrpt->lastdtmfcommand); } rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */ @@ -14956,13 +14956,13 @@ hours, minutes, seconds, (int) totaltxtime); sprintf(str, "NodesCurrentlyConnectedToUs: "); - if(!numoflinks){ + if (!numoflinks){ strcat(str,""); } else{ - for(j = 0 ;j < numoflinks; j++){ + for (j = 0 ;j < numoflinks; j++){ sprintf(str+strlen(str), "%s", listoflinks[j]); - if(j < numoflinks - 1) + if (j < numoflinks - 1) strcat(str,","); } } @@ -14976,13 +14976,13 @@ astman_append(s, "UserLinkingCommands: %s\r\n", link_ena); astman_append(s, "UserFunctions: %s\r\n", user_funs); - for(j = 0; j < numoflinks; j++){ /* ast_free() all link names */ + for (j = 0; j < numoflinks; j++){ /* ast_free() all link names */ ast_free(listoflinks[j]); } - if(called_number){ + if (called_number){ ast_free(called_number); } - if(lastdtmfcommand){ + if (lastdtmfcommand){ ast_free(lastdtmfcommand); } astman_append(s, "\r\n"); /* We're Done! */ @@ -15020,22 +15020,22 @@ time(&now); len = 1024; /* Allocate a working buffer */ - if(!(str = ast_malloc(len))) + if (!(str = ast_malloc(len))) return -1; /* Check for Command */ - if(ast_strlen_zero(cmd)){ + if (ast_strlen_zero(cmd)){ astman_send_error(s, m, "RptStatus missing command"); ast_free(str); return 0; } /* Try to find the command in the table */ - for(i = 0 ; mct[i].cmd ; i++){ - if(!strcmp(mct[i].cmd, cmd)) + for (i = 0 ; mct[i].cmd ; i++){ + if (!strcmp(mct[i].cmd, cmd)) break; } - if(!mct[i].cmd){ /* Found or not found ? */ + if (!mct[i].cmd){ /* Found or not found ? */ astman_send_error(s, m, "RptStatus unknown command"); ast_free(str); return 0; @@ -15043,25 +15043,25 @@ else idx = mct[i].index; - switch(idx){ /* Use the index to go to the correct command */ + switch (idx){ /* Use the index to go to the correct command */ case MGRCMD_RPTSTAT: /* Return Nodes: and a comma separated list of nodes */ - if((res = snprintf(str, len, "Nodes: ")) > -1) + if ((res = snprintf(str, len, "Nodes: ")) > -1) len -= res; else{ ast_free(str); return 0; } - for(i = 0; i < nrpts; i++){ - if(i < nrpts - 1){ - if((res = snprintf(str+strlen(str), len, "%s,",rpt_vars[i].name)) < 0){ + for (i = 0; i < nrpts; i++){ + if (i < nrpts - 1){ + if ((res = snprintf(str+strlen(str), len, "%s,",rpt_vars[i].name)) < 0){ ast_free(str); return 0; } } else{ - if((res = snprintf(str+strlen(str), len, "%s",rpt_vars[i].name)) < 0){ + if ((res = snprintf(str+strlen(str), len, "%s",rpt_vars[i].name)) < 0){ ast_free(str); return 0; } @@ -15071,7 +15071,7 @@ rpt_manager_success(s,m); - if(!nrpts) + if (!nrpts) astman_append(s, "\r\n"); else astman_append(s, "%s\r\n", str); @@ -15114,7 +15114,7 @@ #ifdef OLD_ASTERISK STANDARD_HANGUP_LOCALUSERS; #endif - for(i = 0; i < nrpts; i++) { + for (i = 0; i < nrpts; i++) { if (!strcmp(rpt_vars[i].name,rpt_vars[i].p.nodes)) continue; ast_mutex_destroy(&rpt_vars[i].lock); ast_mutex_destroy(&rpt_vars[i].remlock); @@ -15205,7 +15205,7 @@ { int n; - for(n = 0; n < nrpts; n++) rpt_vars[n].reload = 1; + for (n = 0; n < nrpts; n++) rpt_vars[n].reload = 1; return(0); } Index: apps/app_test.c =================================================================== --- apps/app_test.c (revision 228266) +++ apps/app_test.c (working copy) @@ -94,7 +94,7 @@ return -1; } start = ast_tvnow(); - for(;;) { + for (;;) { mssofar = ast_tvdiff_ms(ast_tvnow(), start); if (mssofar > ms) break; Index: apps/app_url.c =================================================================== --- apps/app_url.c (revision 228266) +++ apps/app_url.c (working copy) @@ -127,7 +127,7 @@ } status = "SUCCESS"; if (ast_test_flag(&flags, OPTION_WAIT)) { - for(;;) { + for (;;) { /* Wait for an event */ res = ast_waitfor(chan, -1); if (res < 0) Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 228266) +++ apps/app_voicemail.c (working copy) @@ -2046,7 +2046,7 @@ if (ret == 0) { imap_mailbox_name(mailbox, sizeof(mailbox), vms, NEW_FOLDER, 1); ast_mutex_lock(&vms->lock); - if(!mail_append_full(vms->mailstream, mailbox, imap_flags, NIL, &str)) + if (!mail_append_full(vms->mailstream, mailbox, imap_flags, NIL, &str)) ast_log(LOG_ERROR, "Error while sending the message to %s\n", mailbox); ast_mutex_unlock(&vms->lock); fclose(p); @@ -2139,7 +2139,7 @@ return -1; } if (urgentmsgs) { - if((*urgentmsgs = messagecount(context, mailboxnc, "Urgent")) < 0) + if ((*urgentmsgs = messagecount(context, mailboxnc, "Urgent")) < 0) return -1; } return 0; Index: apps/app_waitforring.c =================================================================== --- apps/app_waitforring.c (revision 228266) +++ apps/app_waitforring.c (working copy) @@ -87,7 +87,7 @@ /* Now we're really ready for the ring */ if (!res) { ms = 99999999; - while(ms > 0) { + while (ms > 0) { ms = ast_waitfor(chan, ms); if (ms < 0) { res = ms; Index: apps/app_while.c =================================================================== --- apps/app_while.c (revision 228266) +++ apps/app_while.c (working copy) @@ -57,7 +57,7 @@ - Return to the previous called While(). + Return to the previous called while (). While @@ -71,7 +71,7 @@ - Exits a While() loop, whether or not the conditional has been satisfied. + Exits a while () loop, whether or not the conditional has been satisfied. While Index: cdr/cdr_csv.c =================================================================== --- cdr/cdr_csv.c (revision 228266) +++ cdr/cdr_csv.c (working copy) @@ -142,7 +142,7 @@ buf[pos++] = '\"'; - while(pos < bufsize - 3) { + while (pos < bufsize - 3) { if (!s[spos]) { error = 0; break; @@ -237,7 +237,7 @@ if (loguniqueid) append_string(buf, cdr->uniqueid, bufsize); /* append the user field */ - if(loguserfield) + if (loguserfield) append_string(buf, cdr->userfield,bufsize); /* If we hit the end of our buffer, log an error */ if (strlen(buf) < bufsize - 5) { @@ -325,7 +325,7 @@ { int res; - if(!load_config(0)) + if (!load_config(0)) return AST_MODULE_LOAD_DECLINE; if ((res = ast_cdr_register(name, ast_module_info->description, csv_log))) { Index: cdr/cdr_sqlite.c =================================================================== --- cdr/cdr_sqlite.c (revision 228266) +++ cdr/cdr_sqlite.c (working copy) @@ -108,7 +108,7 @@ format_date(answerstr, sizeof(answerstr), &cdr->answer); format_date(endstr, sizeof(endstr), &cdr->end); - for(count=0; count<5; count++) { + for (count=0; count<5; count++) { res = sqlite_exec_printf(db, "INSERT INTO cdr (" "clid,src,dst,dcontext," Index: channels/chan_agent.c =================================================================== --- channels/chan_agent.c (revision 228266) +++ channels/chan_agent.c (working copy) @@ -293,7 +293,7 @@ if (p->chan->writeformat != ast->rawwriteformat && !p->chan->generator) \ ast_set_write_format(p->chan, ast->rawwriteformat); \ } \ -} while(0) +} while (0) /*! \brief Cleanup moves all the relevant FD's from the 2nd to the first, but retains things properly for a timingfd XXX This might need more work if agents were logged in as agents or other @@ -308,7 +308,7 @@ } \ ast_channel_set_fd(ast, AST_AGENT_FD, p->chan->fds[AST_TIMING_FD]); \ } \ -} while(0) +} while (0) /*--- Forward declarations */ static struct ast_channel *agent_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause); @@ -381,22 +381,22 @@ /* Extract username (agt), password and name from agent (args). */ AST_STANDARD_APP_ARGS(args, parse); - if(args.argc == 0) { + if (args.argc == 0) { ast_log(LOG_WARNING, "A blank agent line!\n"); return NULL; } - if(ast_strlen_zero(args.agt) ) { + if (ast_strlen_zero(args.agt) ) { ast_log(LOG_WARNING, "An agent line with no agentid!\n"); return NULL; } else agt = args.agt; - if(!ast_strlen_zero(args.password)) { + if (!ast_strlen_zero(args.password)) { password = args.password; while (*password && *password < 33) password++; } - if(!ast_strlen_zero(args.name)) { + if (!ast_strlen_zero(args.name)) { name = args.name; while (*name && *name < 33) name++; } @@ -584,7 +584,7 @@ break; case AST_FRAME_DTMF_BEGIN: /*ignore DTMF begin's as it can cause issues with queue announce files*/ - if((!p->acknowledged && f->subclass.integer == p->acceptdtmf) || (f->subclass.integer == p->enddtmf && endcall)){ + if ((!p->acknowledged && f->subclass.integer == p->acceptdtmf) || (f->subclass.integer == p->enddtmf && endcall)){ ast_frfree(f); f = &ast_null_frame; } @@ -776,7 +776,7 @@ if (res) ast_log(LOG_WARNING, "Unable to set write format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats))); } - if(!res) { + if (!res) { /* Call is immediately up, or might need ack */ if (p->ackcall) { newstate = AST_STATE_RINGING; @@ -942,7 +942,7 @@ if (!p->chan) return -1; - for(;;) { + for (;;) { to = ast_waitfor(p->chan, to); if (to < 0) return -1; @@ -1121,7 +1121,7 @@ /* Read in the [agents] section */ v = ast_variable_browse(cfg, "agents"); - while(v) { + while (v) { /* Create the interface list */ if (!strcasecmp(v->name, "agent")) { add_agent(v->value, 0); @@ -1191,7 +1191,7 @@ if (ucfg) { genhasagent = ast_true(ast_variable_retrieve(ucfg, "general", "hasagent")); catname = ast_category_browse(ucfg, NULL); - while(catname) { + while (catname) { if (strcasecmp(catname, "general")) { hasagent = ast_variable_retrieve(ucfg, catname, "hasagent"); if (ast_true(hasagent) || (!hasagent && genhasagent)) { @@ -1950,7 +1950,7 @@ ast_mutex_unlock(&p->lock); AST_LIST_UNLOCK(&agents); - if( !res && play_announcement==1 ) + if ( !res && play_announcement==1 ) res = ast_streamfile(chan, filename, chan->language); if (!res) ast_waitstream(chan, ""); Index: channels/chan_dahdi.c =================================================================== --- channels/chan_dahdi.c (revision 228266) +++ channels/chan_dahdi.c (working copy) @@ -2461,7 +2461,7 @@ res = ANALOG_EVENT_DTMFUP; break; default: - switch(event & 0xFFFF0000) { + switch (event & 0xFFFF0000) { case DAHDI_EVENT_PULSEDIGIT: case DAHDI_EVENT_DTMFDOWN: case DAHDI_EVENT_DTMFUP: @@ -10152,7 +10152,7 @@ break; case MWI_SEND_SPILL: /* We read some number of bytes. Write an equal amount of data */ - if(0 < num_read) { + if (0 < num_read) { if (num_read > pvt->cidlen - pvt->cidpos) num_read = pvt->cidlen - pvt->cidpos; res = write(pvt->subs[SUB_REAL].dfd, pvt->cidspill + pvt->cidpos, num_read); @@ -10205,12 +10205,12 @@ if (MWI_SEND_DONE != pvt->mwisend_data.mwisend_current) { switch (event) { case DAHDI_EVENT_RINGEROFF: - if(pvt->mwisend_data.mwisend_current == MWI_SEND_SA_WAIT) { + if (pvt->mwisend_data.mwisend_current == MWI_SEND_SA_WAIT) { handled = 1; if (dahdi_set_hook(pvt->subs[SUB_REAL].dfd, DAHDI_RINGOFF) ) { ast_log(LOG_WARNING, "Unable to finsh RP-AS: %s mwi send aborted\n", strerror(errno)); - if(pvt->cidspill) { + if (pvt->cidspill) { ast_free(pvt->cidspill); pvt->cidspill = NULL; } @@ -12501,7 +12501,7 @@ ss7_start(ss7); - while(1) { + while (1) { ast_mutex_lock(&linkset->lock); if ((next = ss7_schedule_next(ss7))) { tv = ast_tvnow(); @@ -13477,7 +13477,7 @@ sscanf(db_answer, "%1c:%30d", &state, &why); ast_db_del(db_chan_name, SRVST_DBKEY); } - switch(changestatus) { + switch (changestatus) { case 0: /* enable */ if (why > -1) { if (why & SRVST_FAREND) { @@ -13782,7 +13782,7 @@ continue; } if (filtertype) { - switch(filtertype) { + switch (filtertype) { case 1: /* mfcr2 show channels group */ if (p->group != targetnum) { continue; @@ -14270,7 +14270,7 @@ ast_mutex_lock(&iflock); for (tmp = iflist; tmp; tmp = tmp->next) { if (filtertype) { - switch(filtertype) { + switch (filtertype) { case 1: /* dahdi show channels group */ if (!(tmp->group & targetnum)) { continue; Index: channels/chan_gtalk.c =================================================================== --- channels/chan_gtalk.c (revision 228266) +++ channels/chan_gtalk.c (working copy) @@ -270,7 +270,7 @@ payload_pcmu = iks_new("payload-type"); payload_eg711u = iks_new("payload-type"); - if(!payload_eg711u || !payload_pcmu) { + if (!payload_eg711u || !payload_pcmu) { iks_delete(payload_pcmu); iks_delete(payload_eg711u); ast_log(LOG_WARNING,"Failed to allocate iks node"); @@ -292,7 +292,7 @@ iks *payload_eg711a, *payload_pcma; payload_pcma = iks_new("payload-type"); payload_eg711a = iks_new("payload-type"); - if(!payload_eg711a || !payload_pcma) { + if (!payload_eg711a || !payload_pcma) { iks_delete(payload_eg711a); iks_delete(payload_pcma); ast_log(LOG_WARNING,"Failed to allocate iks node"); @@ -313,7 +313,7 @@ } if (!strcasecmp("ilbc", format)) { iks *payload_ilbc = iks_new("payload-type"); - if(!payload_ilbc) { + if (!payload_ilbc) { ast_log(LOG_WARNING,"Failed to allocate iks node"); return -1; } @@ -326,7 +326,7 @@ } if (!strcasecmp("g723", format)) { iks *payload_g723 = iks_new("payload-type"); - if(!payload_g723) { + if (!payload_g723) { ast_log(LOG_WARNING,"Failed to allocate iks node"); return -1; } @@ -339,7 +339,7 @@ } if (!strcasecmp("speex", format)) { iks *payload_speex = iks_new("payload-type"); - if(!payload_speex) { + if (!payload_speex) { ast_log(LOG_WARNING,"Failed to allocate iks node"); return -1; } @@ -352,7 +352,7 @@ } if (!strcasecmp("gsm", format)) { iks *payload_gsm = iks_new("payload-type"); - if(!payload_gsm) { + if (!payload_gsm) { ast_log(LOG_WARNING,"Failed to allocate iks node"); return -1; } @@ -452,7 +452,7 @@ iq = iks_new("iq"); session = iks_new("session"); transport = iks_new("transport"); - if(!(iq && session && transport)) { + if (!(iq && session && transport)) { iks_delete(iq); iks_delete(session); iks_delete(transport); @@ -638,7 +638,7 @@ } from = iks_find_attrib(pak->x, "to"); - if(!from) + if (!from) from = client->connection->jid->full; if (tmp) { @@ -663,7 +663,7 @@ } from = iks_find_attrib(pak->x, "to"); - if(!from) + if (!from) from = client->connection->jid->full; if (!tmp) @@ -686,30 +686,30 @@ break; } from = iks_find_attrib(pak->x, "to"); - if(!from) + if (!from) from = client->connection->jid->full; if (tmp) { - if(iks_find_with_attrib(pak->x, "dtmf-method", "method", "rtp")) { + if (iks_find_with_attrib(pak->x, "dtmf-method", "method", "rtp")) { gtalk_response(client, from, pak, "feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'", "unsupported-dtmf-method xmlns='http://jabber.org/protocol/gtalk/info/dtmf#errors'"); return -1; } if ((dtmfnode = iks_find(pak->x, "dtmf"))) { - if((dtmf = iks_find_attrib(dtmfnode, "code"))) { - if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-up")) { + if ((dtmf = iks_find_attrib(dtmfnode, "code"))) { + if (iks_find_with_attrib(pak->x, "dtmf", "action", "button-up")) { struct ast_frame f = {AST_FRAME_DTMF_BEGIN, }; f.subclass.integer = dtmf[0]; ast_queue_frame(tmp->owner, &f); ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass.integer); - } else if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-down")) { + } else if (iks_find_with_attrib(pak->x, "dtmf", "action", "button-down")) { struct ast_frame f = {AST_FRAME_DTMF_END, }; f.subclass.integer = dtmf[0]; ast_queue_frame(tmp->owner, &f); ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass.integer); - } else if(iks_find_attrib(pak->x, "dtmf")) { /* 250 millasecond default */ + } else if (iks_find_attrib(pak->x, "dtmf")) { /* 250 millasecond default */ struct ast_frame f = {AST_FRAME_DTMF, }; f.subclass.integer = dtmf[0]; ast_queue_frame(tmp->owner, &f); @@ -717,14 +717,14 @@ } } } else if ((dtmfnode = iks_find_with_attrib(pak->x, "gtalk", "action", "session-info"))) { - if((dtmfchild = iks_find(dtmfnode, "dtmf"))) { - if((dtmf = iks_find_attrib(dtmfchild, "code"))) { - if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) { + if ((dtmfchild = iks_find(dtmfnode, "dtmf"))) { + if ((dtmf = iks_find_attrib(dtmfchild, "code"))) { + if (iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) { struct ast_frame f = {AST_FRAME_DTMF_END, }; f.subclass.integer = dtmf[0]; ast_queue_frame(tmp->owner, &f); ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass.integer); - } else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) { + } else if (iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) { struct ast_frame f = {AST_FRAME_DTMF_BEGIN, }; f.subclass.integer = dtmf[0]; ast_queue_frame(tmp->owner, &f); @@ -754,7 +754,7 @@ break; } from = iks_find_attrib(pak->x, "to"); - if(!from) + if (!from) from = client->connection->jid->full; if (tmp) { @@ -973,7 +973,7 @@ /* Set CALLERID(name) to the full JID of the remote peer */ ast_copy_string(tmp->cid_name, tmp->them, sizeof(tmp->cid_name)); - if(strchr(tmp->us, '/')) { + if (strchr(tmp->us, '/')) { data = ast_strdupa(tmp->us); exten = strsep(&data, "/"); } else @@ -1165,7 +1165,7 @@ /* Make sure our new call doesn't exist yet */ from = iks_find_attrib(pak->x,"to"); - if(!from) + if (!from) from = client->connection->jid->full; while (tmp) { @@ -1310,7 +1310,7 @@ char *from; from = iks_find_attrib(pak->x,"to"); - if(!from) + if (!from) from = c->jid->full; for (tmp = client->p; tmp; tmp = tmp->next) { @@ -1324,16 +1324,16 @@ return -1; traversenodes = pak->query; - while(traversenodes) { - if(!strcasecmp(iks_name(traversenodes), "session")) { + while (traversenodes) { + if (!strcasecmp(iks_name(traversenodes), "session")) { traversenodes = iks_first_tag(traversenodes); continue; } - if(!strcasecmp(iks_name(traversenodes), "transport")) { + if (!strcasecmp(iks_name(traversenodes), "transport")) { traversenodes = iks_first_tag(traversenodes); continue; } - if(!strcasecmp(iks_name(traversenodes), "candidate")) { + if (!strcasecmp(iks_name(traversenodes), "candidate")) { newcandidate = ast_calloc(1, sizeof(*newcandidate)); if (!newcandidate) return 0; @@ -1543,7 +1543,7 @@ iq = iks_new("iq"); gtalk = iks_new("gtalk"); dtmf = iks_new("dtmf"); - if(!iq || !gtalk || !dtmf) { + if (!iq || !gtalk || !dtmf) { iks_delete(iq); iks_delete(gtalk); iks_delete(dtmf); @@ -1733,7 +1733,7 @@ ASTOBJ_CONTAINER_TRAVERSE(>alk_list, 1, { ASTOBJ_WRLOCK(iterator); p = iterator->p; - while(p) { + while (p) { chan = p->owner; ast_copy_string(them, p->them, sizeof(them)); jid = them; @@ -2118,7 +2118,7 @@ ASTOBJ_CONTAINER_TRAVERSE(>alk_list, 1, { ASTOBJ_WRLOCK(iterator); privates = iterator->p; - while(privates) { + while (privates) { if (privates->owner) ast_softhangup(privates->owner, AST_SOFTHANGUP_APPUNLOAD); privates = privates->next; Index: channels/chan_h323.c =================================================================== --- channels/chan_h323.c (revision 228266) +++ channels/chan_h323.c (working copy) @@ -305,7 +305,7 @@ if (pvt) { ast_mutex_lock(&pvt->lock); /* Don't hold pvt lock while trying to lock the channel */ - while(pvt->owner && ast_channel_trylock(pvt->owner)) { + while (pvt->owner && ast_channel_trylock(pvt->owner)) { DEADLOCK_AVOIDANCE(&pvt->lock); } @@ -464,7 +464,7 @@ ast_channel_unlock(pvt->owner); } cur = iflist; - while(cur) { + while (cur) { if (cur == pvt) { if (prev) prev->next = cur->next; @@ -804,7 +804,7 @@ struct oh323_pvt *pvt = (struct oh323_pvt *)c->tech_pvt; ast_mutex_lock(&pvt->lock); __oh323_update_info(c, pvt); - switch(c->fdno) { + switch (c->fdno) { case 0: fr = oh323_rtp_read(pvt); break; @@ -872,7 +872,7 @@ if (h323debug) ast_debug(1, "OH323: Indicating %d on %s (%s)\n", condition, token, c->name); - switch(condition) { + switch (condition) { case AST_CONTROL_RINGING: if (c->_state == AST_STATE_RING || c->_state == AST_STATE_RINGING) { h323_send_alerting(token); @@ -1146,7 +1146,7 @@ ast_mutex_lock(&iflock); pvt = iflist; - while(pvt) { + while (pvt) { if (!pvt->needdestroy && ((signed int)pvt->cd.call_reference == call_reference)) { /* Found the call */ if ((token != NULL) && (pvt->cd.call_token != NULL) && (!strcmp(pvt->cd.call_token, token))) { @@ -2532,7 +2532,7 @@ int reloading; struct oh323_pvt *oh323 = NULL; - for(;;) { + for (;;) { /* Check for a reload request */ ast_mutex_lock(&h323_reload_lock); reloading = h323_reloading; @@ -2559,7 +2559,7 @@ #else restartsearch: oh323 = iflist; - while(oh323) { + while (oh323) { if (!ast_mutex_trylock(&oh323->lock)) { if (oh323->needdestroy) { __oh323_destroy(oh323); @@ -3065,12 +3065,12 @@ gk_changed = 0; if (gatekeeper_disable != gk_disable) gk_changed = is_reload; - else if(!gatekeeper_disable && (gatekeeper_discover != gk_discover)) + else if (!gatekeeper_disable && (gatekeeper_discover != gk_discover)) gk_changed = is_reload; - else if(!gatekeeper_disable && (strncmp(_gatekeeper, gatekeeper, sizeof(_gatekeeper)) != 0)) + else if (!gatekeeper_disable && (strncmp(_gatekeeper, gatekeeper, sizeof(_gatekeeper)) != 0)) gk_changed = is_reload; if (gk_changed) { - if(!gk_disable) + if (!gk_disable) h323_gk_urq(); if (!gatekeeper_disable) { if (h323_set_gk(gatekeeper_discover, gatekeeper, secret)) { @@ -3330,7 +3330,7 @@ if (!ast_mutex_lock(&iflock)) { /* hangup all interfaces if they have an owner */ p = iflist; - while(p) { + while (p) { if (p->owner) { ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD); } @@ -3359,7 +3359,7 @@ if (!ast_mutex_lock(&iflock)) { /* destroy all the interfaces and free their memory */ p = iflist; - while(p) { + while (p) { pl = p; p = p->next; /* free associated memory */ Index: channels/chan_iax2.c =================================================================== --- channels/chan_iax2.c (revision 228266) +++ channels/chan_iax2.c (working copy) @@ -347,7 +347,7 @@ sprintf(digest + (idx << 1), "%2.2x", (unsigned char) key[idx]); \ \ ast_log(LOG_NOTICE, msg " IAX_COMMAND_RTKEY to rotate key to '%s'\n", digest); \ - } while(0) + } while (0) static struct io_context *io; static struct ast_sched_thread *sched; @@ -1594,7 +1594,7 @@ peer = ao2_find(peers, &tmp_peer, OBJ_POINTER); /* Now go for realtime if applicable */ - if(!peer && realtime) + if (!peer && realtime) peer = realtime_peer(name, NULL); return peer; @@ -2941,7 +2941,7 @@ /* Now copy the firmware into it */ len = stbuf.st_size; - while(len) { + while (len) { chunk = len; if (chunk > sizeof(buf)) chunk = sizeof(buf); @@ -3110,7 +3110,7 @@ snprintf(dir, sizeof(dir), "%s/firmware/iax", ast_config_AST_DATA_DIR); fwd = opendir(dir); if (fwd) { - while((de = readdir(fwd))) { + while ((de = readdir(fwd))) { if (de->d_name[0] != '.') { snprintf(fn, sizeof(fn), "%s/%s", dir, de->d_name); if (!try_firmware(fn)) { @@ -3660,12 +3660,12 @@ ast_cli(a->fd, "%s\n", codec_buf); ast_cli(a->fd, " Codec Order : ("); - for(x = 0; x < 32 ; x++) { + for (x = 0; x < 32 ; x++) { codec = ast_codec_pref_index(&peer->prefs,x); - if(!codec) + if (!codec) break; ast_cli(a->fd, "%s", ast_getformatname(codec)); - if(x < 31 && ast_codec_pref_index(&peer->prefs,x+1)) + if (x < 31 && ast_codec_pref_index(&peer->prefs,x+1)) ast_cli(a->fd, "|"); } @@ -3950,9 +3950,9 @@ ms = ast_tvdiff_ms(now, pvt->rxcore); - if(ms >= (next = jb_next(pvt->jb))) { + if (ms >= (next = jb_next(pvt->jb))) { ret = jb_get(pvt->jb,&frame,ms,ast_codec_interp_len(pvt->voiceformat)); - switch(ret) { + switch (ret) { case JB_OK: fr = frame.data; __do_deliver(fr); @@ -4036,10 +4036,10 @@ type = JB_TYPE_CONTROL; len = 0; - if(fr->af.frametype == AST_FRAME_VOICE) { + if (fr->af.frametype == AST_FRAME_VOICE) { type = JB_TYPE_VOICE; len = ast_codec_get_samples(&fr->af) / (ast_format_rate(fr->af.subclass.codec) / 1000); - } else if(fr->af.frametype == AST_FRAME_CNG) { + } else if (fr->af.frametype == AST_FRAME_CNG) { type = JB_TYPE_SILENCE; } @@ -4283,8 +4283,7 @@ realtime_update_peer(peer->name, &peer->addr, 0); ast_debug(1, "realtime_peer: Bah, '%s' is expired (%d/%d/%d)!\n", peername, (int)(nowtime - regseconds), (int)regseconds, (int)nowtime); - } - else { + } else { ast_debug(1, "realtime_peer: Registration for '%s' still active (%d/%d/%d)!\n", peername, (int)(nowtime - regseconds), (int)regseconds, (int)nowtime); } @@ -4336,7 +4335,7 @@ return NULL; tmp = var; - while(tmp) { + while (tmp) { /* Make sure it's not a peer only... */ if (!strcasecmp(tmp->name, "type")) { if (strcasecmp(tmp->value, "friend") && @@ -5391,9 +5390,9 @@ cs[1] = cs[2]; } lock_both(callno0, callno1); - if(iaxs[callno0]) + if (iaxs[callno0]) iaxs[callno0]->bridgecallno = 0; - if(iaxs[callno1]) + if (iaxs[callno1]) iaxs[callno1]->bridgecallno = 0; unlock_both(callno0, callno1); return res; @@ -5976,7 +5975,7 @@ #else unsigned char lastblock[16] = { 0 }; int x; - while(len > 0) { + while (len > 0) { ast_aes_decrypt(src, dst, dcx); for (x=0;x<16;x++) dst[x] ^= lastblock[x]; @@ -6000,7 +5999,7 @@ #else unsigned char curblock[16] = { 0 }; int x; - while(len > 0) { + while (len > 0) { for (x=0;x<16;x++) curblock[x] ^= src[x]; ast_aes_encrypt(curblock, dst, ecx); @@ -6161,7 +6160,7 @@ /* Bail here if this is an "interp" frame; we don't want or need to send these placeholders out * (the endpoint should detect the lost packet itself). But, we want to do this here, so that we * increment the "predicted timestamps" for voice, if we're predicting */ - if(f->frametype == AST_FRAME_VOICE && f->datalen == 0) + if (f->frametype == AST_FRAME_VOICE && f->datalen == 0) return 0; #if 0 ast_log(LOG_NOTICE, @@ -6386,9 +6385,9 @@ } else ast_copy_string(auth, "-no secret-", sizeof(auth)); - if(ast_test_flag64(user, IAX_CODEC_NOCAP)) + if (ast_test_flag64(user, IAX_CODEC_NOCAP)) pstr = "REQ Only"; - else if(ast_test_flag64(user, IAX_CODEC_NOPREFS)) + else if (ast_test_flag64(user, IAX_CODEC_NOPREFS)) pstr = "Disabled"; else pstr = ast_test_flag64(user, IAX_CODEC_USER_FIRST) ? "Caller" : "Host"; @@ -6798,7 +6797,7 @@ static char *regstate2str(int regstate) { - switch(regstate) { + switch (regstate) { case REG_STATE_UNREGISTERED: return "Unregistered"; case REG_STATE_REGSENT: @@ -6990,7 +6989,7 @@ iax_frame_subclass2str(iaxs[x]->first_iax_message & ~MARK_IAX_SUBCLASS_TX, first_message, sizeof(first_message)); iax_frame_subclass2str(iaxs[x]->last_iax_message & ~MARK_IAX_SUBCLASS_TX, last_message, sizeof(last_message)); - if(ast_test_flag64(iaxs[x], IAX_USEJITTERBUF)) { + if (ast_test_flag64(iaxs[x], IAX_USEJITTERBUF)) { jb_getinfo(iaxs[x]->jb, &jbinfo); localjitter = jbinfo.jitter; localdelay = jbinfo.current - jbinfo.min; @@ -7271,7 +7270,7 @@ static int apply_context(struct iax2_context *con, const char *context) { - while(con) { + while (con) { if (!strcmp(con->context, context) || !strcmp(con->context, "*")) return -1; con = con->next; @@ -7417,7 +7416,7 @@ /* We found our match (use the first) */ /* copy vars */ for (v = user->vars ; v ; v = v->next) { - if((tmpvar = ast_variable_new(v->name, v->value, v->file))) { + if ((tmpvar = ast_variable_new(v->name, v->value, v->file))) { tmpvar->next = iaxs[callno]->vars; iaxs[callno]->vars = tmpvar; } @@ -7529,7 +7528,7 @@ /* Select exactly one common encryption if there are any */ p->encmethods &= enc; if (p->encmethods) { - if (!(p->encmethods & IAX_ENCRYPT_KEYROTATE)){ /* if key rotation is not supported, turn off keyrotation. */ + if (!(p->encmethods & IAX_ENCRYPT_KEYROTATE)) { /* if key rotation is not supported, turn off keyrotation. */ p->keyrotateid = -2; } if (p->encmethods & IAX_ENCRYPT_AES128) @@ -7642,7 +7641,7 @@ ast_copy_string(tmpkey, p->inkeys, sizeof(tmpkey)); stringp=tmpkey; keyn = strsep(&stringp, ":"); - while(keyn) { + while (keyn) { key = ast_key_get(keyn, AST_KEY_PUBLIC); if (key && !ast_check_signature(key, p->challenge, rsasecret)) { res = 0; @@ -7658,7 +7657,7 @@ tmppw = ast_strdupa(p->secret); stringp = tmppw; - while((tmppw = strsep(&stringp, ";"))) { + while ((tmppw = strsep(&stringp, ";"))) { MD5Init(&md5); MD5Update(&md5, (unsigned char *)p->challenge, strlen(p->challenge)); MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw)); @@ -7761,7 +7760,7 @@ ast_copy_string(tmpkeys, p->inkeys, sizeof(tmpkeys)); stringp=tmpkeys; keyn = strsep(&stringp, ":"); - while(keyn) { + while (keyn) { key = ast_key_get(keyn, AST_KEY_PUBLIC); if (key && !ast_check_signature(key, iaxs[callno]->challenge, rsasecret)) { ast_set_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED); @@ -7787,7 +7786,7 @@ tmppw = ast_strdupa(p->secret); stringp = tmppw; - while((tmppw = strsep(&stringp, ";"))) { + while ((tmppw = strsep(&stringp, ";"))) { MD5Init(&md5); MD5Update(&md5, (unsigned char *)iaxs[callno]->challenge, strlen(iaxs[callno]->challenge)); MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw)); @@ -8148,7 +8147,7 @@ memset(&pvt->rxcore, 0, sizeof(pvt->rxcore)); memset(&pvt->offset, 0, sizeof(pvt->offset)); /* reset jitterbuffer */ - while(jb_getall(pvt->jb,&frame) == JB_OK) + while (jb_getall(pvt->jb,&frame) == JB_OK) iax2_frame_free(frame.data); jb_reset(pvt->jb); pvt->lag = 0; @@ -8298,7 +8297,7 @@ if (!ast_strlen_zero(regcontext)) { ast_copy_string(multi, S_OR(peer->regexten, peer->name), sizeof(multi)); stringp = multi; - while((ext = strsep(&stringp, "&"))) { + while ((ext = strsep(&stringp, "&"))) { if (onoff) { if (!ast_exists_extension(NULL, regcontext, ext, 1, NULL)) ast_add_extension(regcontext, 1, ext, 1, NULL, NULL, @@ -9084,7 +9083,7 @@ memset(iep, 0, sizeof(*iep)); iax_ie_append_int(iep,IAX_IE_RR_JITTER, stats.jitter); - if(stats.frames_in == 0) stats.frames_in = 1; + if (stats.frames_in == 0) stats.frames_in = 1; iax_ie_append_int(iep,IAX_IE_RR_LOSS, ((0xff & (stats.losspct/1000)) << 24 | (stats.frames_lost & 0x00ffffff))); iax_ie_append_int(iep,IAX_IE_RR_PKTS, stats.frames_in); iax_ie_append_short(iep,IAX_IE_RR_DELAY, stats.current - stats.min); @@ -9140,7 +9139,7 @@ ast_mutex_lock(&iaxsl[callno]); if (iaxs[callno] && iaxs[callno]->owner && iaxs[callno]->owner->name) { - if(ast_test_flag64(iaxs[callno], IAX_USEJITTERBUF)) { + if (ast_test_flag64(iaxs[callno], IAX_USEJITTERBUF)) { jb_getinfo(iaxs[callno]->jb, &jbinfo); localjitter = jbinfo.jitter; localdelay = jbinfo.current - jbinfo.min; @@ -9548,7 +9547,7 @@ } ast_set_hangupsource(iaxs[callno]->owner, iaxs[callno]->owner->name, 0); ast_channel_unlock(owner); - } else if(locked) { + } else if (locked) { ast_channel_unlock(owner); } } @@ -10064,7 +10063,7 @@ if (!iaxs[fr->callno]->first_iax_message) { iaxs[fr->callno]->first_iax_message = f.subclass.integer; } - switch(f.subclass.integer) { + switch (f.subclass.integer) { case IAX_COMMAND_ACK: /* Do nothing */ break; @@ -10201,8 +10200,8 @@ } else { /* Select an appropriate format */ - if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOPREFS)) { - if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) { + if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOPREFS)) { + if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) { using_prefs = "reqonly"; } else { using_prefs = "disabled"; @@ -10232,7 +10231,7 @@ ast_codec_pref_string(&iaxs[fr->callno]->prefs, host_pref_buf, sizeof(host_pref_buf) - 1); } if (!format) { - if(!ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) + if (!ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) format = iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability; if (!format) { memset(&ied0, 0, sizeof(ied0)); @@ -10260,11 +10259,11 @@ } } else { /* Pick one... */ - if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) { - if(!(iaxs[fr->callno]->peerformat & iaxs[fr->callno]->capability)) + if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) { + if (!(iaxs[fr->callno]->peerformat & iaxs[fr->callno]->capability)) format = 0; } else { - if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOPREFS)) { + if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOPREFS)) { using_prefs = ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP) ? "reqonly" : "disabled"; memset(&pref, 0, sizeof(pref)); format = ast_best_codec(iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability); @@ -10660,8 +10659,8 @@ } } else { /* Select an appropriate format */ - if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOPREFS)) { - if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) { + if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOPREFS)) { + if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) { using_prefs = "reqonly"; } else { using_prefs = "disabled"; @@ -10689,7 +10688,7 @@ } if (!format) { char tmp1[256], tmp2[256], tmp3[256]; - if(!ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) { + if (!ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) { ast_debug(1, "We don't do requested format %s, falling back to peer capability '%s'\n", ast_getformatname(iaxs[fr->callno]->peerformat), ast_getformatname_multiple(tmp1, sizeof(tmp1), iaxs[fr->callno]->peercapability)); @@ -10719,11 +10718,11 @@ } } else { /* Pick one... */ - if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) { - if(!(iaxs[fr->callno]->peerformat & iaxs[fr->callno]->capability)) + if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) { + if (!(iaxs[fr->callno]->peerformat & iaxs[fr->callno]->capability)) format = 0; } else { - if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOPREFS)) { + if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOPREFS)) { using_prefs = ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP) ? "reqonly" : "disabled"; memset(&pref, 0, sizeof(pref)); format = ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP) ? @@ -11305,7 +11304,7 @@ ast_atomic_fetchadd_int(&iaxactivethreadcount,1); pthread_cleanup_push(iax2_process_thread_cleanup, data); - for(;;) { + for (;;) { /* Wait for something to signal us to be awake */ ast_mutex_lock(&thread->lock); @@ -11374,7 +11373,7 @@ AST_LIST_UNLOCK(&active_list); /* See what we need to do */ - switch(thread->iostate) { + switch (thread->iostate) { case IAX_IOSTATE_READY: thread->actions++; thread->iostate = IAX_IOSTATE_PROCESSING; @@ -11713,7 +11712,7 @@ static void free_context(struct iax2_context *con) { struct iax2_context *conl; - while(con) { + while (con) { conl = con; con = con->next; ast_free(conl); @@ -12055,7 +12054,7 @@ v = alt; alt = NULL; } - while(v) { + while (v) { if (!strcasecmp(v->name, "secret")) { ast_string_field_set(peer, secret, v->value); } else if (!strcasecmp(v->name, "mailbox")) { @@ -12271,7 +12270,7 @@ ast_free_ha(user->ha); free_context(user->contexts); - if(user->vars) { + if (user->vars) { ast_variables_destroy(user->vars); user->vars = NULL; } @@ -12343,7 +12342,7 @@ v = alt; alt = NULL; } - while(v) { + while (v) { if (!strcasecmp(v->name, "context")) { con = build_context(v->value); if (con) { @@ -12361,7 +12360,7 @@ if (varname && (varval = strchr(varname,'='))) { *varval = '\0'; varval++; - if((tmpvar = ast_variable_new(varname, varval, ""))) { + if ((tmpvar = ast_variable_new(varname, varval, ""))) { tmpvar->next = user->vars; user->vars = tmpvar; } @@ -12400,11 +12399,11 @@ } else ast_set_flags_to64(user, IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_NOTRANSFER); } else if (!strcasecmp(v->name, "codecpriority")) { - if(!strcasecmp(v->value, "caller")) + if (!strcasecmp(v->value, "caller")) ast_set_flag64(user, IAX_CODEC_USER_FIRST); - else if(!strcasecmp(v->value, "disabled")) + else if (!strcasecmp(v->value, "disabled")) ast_set_flag64(user, IAX_CODEC_NOPREFS); - else if(!strcasecmp(v->value, "reqonly")) { + else if (!strcasecmp(v->value, "reqonly")) { ast_set_flag64(user, IAX_CODEC_NOCAP); ast_set_flag64(user, IAX_CODEC_NOPREFS); } @@ -12716,8 +12715,8 @@ if (ast_str2cos(tosval, &qos.cos)) ast_log(LOG_WARNING, "Invalid cos value, refer to QoS documentation\n"); } - while(v) { - if (!strcasecmp(v->name, "bindport")){ + while (v) { + if (!strcasecmp(v->name, "bindport")) { if (reload) ast_log(LOG_NOTICE, "Ignoring bindport on reload\n"); else @@ -12818,11 +12817,11 @@ } else ast_set_flags_to64((&globalflags), IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_NOTRANSFER); } else if (!strcasecmp(v->name, "codecpriority")) { - if(!strcasecmp(v->value, "caller")) + if (!strcasecmp(v->value, "caller")) ast_set_flag64((&globalflags), IAX_CODEC_USER_FIRST); - else if(!strcasecmp(v->value, "disabled")) + else if (!strcasecmp(v->value, "disabled")) ast_set_flag64((&globalflags), IAX_CODEC_NOPREFS); - else if(!strcasecmp(v->value, "reqonly")) { + else if (!strcasecmp(v->value, "reqonly")) { ast_set_flag64((&globalflags), IAX_CODEC_NOCAP); ast_set_flag64((&globalflags), IAX_CODEC_NOPREFS); } @@ -12846,7 +12845,7 @@ ast_set2_flag64(&globalflags, ast_true(v->value), IAX_TRUNKTIMESTAMPS); else if (!strcasecmp(v->name, "rtautoclear")) { int i = atoi(v->value); - if(i > 0) + if (i > 0) global_rtautoclear = i; else i = 0; @@ -13049,7 +13048,7 @@ } cat = ast_category_browse(cfg, NULL); - while(cat) { + while (cat) { if (strcasecmp(cat, "general")) { utype = ast_variable_retrieve(cfg, cat, "type"); if (!strcasecmp(cat, "callnumberlimits")) { @@ -13298,7 +13297,7 @@ if (chan) old = ast_channel_defer_dtmf(chan); doabort = 0; - while(timeout) { + while (timeout) { c = ast_waitfor_nandfds(&chan, chan ? 1 : 0, &com[0], 1, NULL, &outfd, &timeout); if (outfd > -1) break; @@ -13524,7 +13523,7 @@ if ((ptr = strchr(codecnum, ']'))) { *ptr = '\0'; } - if((codec = ast_codec_pref_index(&peer->prefs, atoi(codecnum)))) { + if ((codec = ast_codec_pref_index(&peer->prefs, atoi(codecnum)))) { ast_copy_string(buf, ast_getformatname(codec), len); } else { buf[0] = '\0'; @@ -13817,7 +13816,7 @@ AST_LIST_UNLOCK(&dynamic_list); /* Wait for threads to exit */ - while(0 < iaxactivethreadcount) + while (0 < iaxactivethreadcount) usleep(10000); ast_netsock_release(netsock); Index: channels/chan_jingle.c =================================================================== --- channels/chan_jingle.c (revision 228266) +++ channels/chan_jingle.c (working copy) @@ -501,25 +501,25 @@ } if (tmp) { - if(iks_find_with_attrib(pak->x, "dtmf-method", "method", "rtp")) { + if (iks_find_with_attrib(pak->x, "dtmf-method", "method", "rtp")) { jingle_response(client,pak, "feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'", "unsupported-dtmf-method xmlns='http://www.xmpp.org/extensions/xep-0181.html#ns-errors'"); return -1; } if ((dtmfnode = iks_find(pak->x, "dtmf"))) { - if((dtmf = iks_find_attrib(dtmfnode, "code"))) { - if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-up")) { + if ((dtmf = iks_find_attrib(dtmfnode, "code"))) { + if (iks_find_with_attrib(pak->x, "dtmf", "action", "button-up")) { struct ast_frame f = {AST_FRAME_DTMF_BEGIN, }; f.subclass.integer = dtmf[0]; ast_queue_frame(tmp->owner, &f); ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass.integer); - } else if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-down")) { + } else if (iks_find_with_attrib(pak->x, "dtmf", "action", "button-down")) { struct ast_frame f = {AST_FRAME_DTMF_END, }; f.subclass.integer = dtmf[0]; ast_queue_frame(tmp->owner, &f); ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass.integer); - } else if(iks_find_attrib(pak->x, "dtmf")) { /* 250 millasecond default */ + } else if (iks_find_attrib(pak->x, "dtmf")) { /* 250 millasecond default */ struct ast_frame f = {AST_FRAME_DTMF, }; f.subclass.integer = dtmf[0]; ast_queue_frame(tmp->owner, &f); @@ -527,14 +527,14 @@ } } } else if ((dtmfnode = iks_find_with_attrib(pak->x, JINGLE_NODE, "action", "session-info"))) { - if((dtmfchild = iks_find(dtmfnode, "dtmf"))) { - if((dtmf = iks_find_attrib(dtmfchild, "code"))) { - if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) { + if ((dtmfchild = iks_find(dtmfnode, "dtmf"))) { + if ((dtmf = iks_find_attrib(dtmfchild, "code"))) { + if (iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) { struct ast_frame f = {AST_FRAME_DTMF_END, }; f.subclass.integer = dtmf[0]; ast_queue_frame(tmp->owner, &f); ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass.integer); - } else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) { + } else if (iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) { struct ast_frame f = {AST_FRAME_DTMF_BEGIN, }; f.subclass.integer = dtmf[0]; ast_queue_frame(tmp->owner, &f); @@ -955,7 +955,7 @@ /* Make sure our new call doesn't exist yet */ from = iks_find_attrib(pak->x,"to"); - if(!from) + if (!from) from = client->connection->jid->full; while (tmp) { @@ -1098,21 +1098,21 @@ return -1; traversenodes = pak->query; - while(traversenodes) { - if(!strcasecmp(iks_name(traversenodes), "jingle")) { + while (traversenodes) { + if (!strcasecmp(iks_name(traversenodes), "jingle")) { traversenodes = iks_child(traversenodes); continue; } - if(!strcasecmp(iks_name(traversenodes), "content")) { + if (!strcasecmp(iks_name(traversenodes), "content")) { traversenodes = iks_child(traversenodes); continue; } - if(!strcasecmp(iks_name(traversenodes), "transport")) { + if (!strcasecmp(iks_name(traversenodes), "transport")) { traversenodes = iks_child(traversenodes); continue; } - if(!strcasecmp(iks_name(traversenodes), "candidate")) { + if (!strcasecmp(iks_name(traversenodes), "candidate")) { newcandidate = ast_calloc(1, sizeof(*newcandidate)); if (!newcandidate) return 0; @@ -1307,7 +1307,7 @@ iq = iks_new("iq"); jingle = iks_new("jingle"); dtmf = iks_new("dtmf"); - if(!iq || !jingle || !dtmf) { + if (!iq || !jingle || !dtmf) { iks_delete(iq); iks_delete(jingle); iks_delete(dtmf); @@ -1556,7 +1556,7 @@ ASTOBJ_CONTAINER_TRAVERSE(&jingle_list, 1, { ASTOBJ_WRLOCK(iterator); p = iterator->p; - while(p) { + while (p) { chan = p->owner; ast_copy_string(them, p->them, sizeof(them)); jid = them; @@ -1927,7 +1927,7 @@ ASTOBJ_CONTAINER_TRAVERSE(&jingle_list, 1, { ASTOBJ_WRLOCK(iterator); privates = iterator->p; - while(privates) { + while (privates) { if (privates->owner) ast_softhangup(privates->owner, AST_SOFTHANGUP_APPUNLOAD); privates = privates->next; Index: channels/chan_mgcp.c =================================================================== --- channels/chan_mgcp.c (revision 228266) +++ channels/chan_mgcp.c (working copy) @@ -1427,7 +1427,7 @@ ast_debug(3, "MGCP asked to indicate %d '%s' condition on channel %s\n", ind, control2str(ind), ast->name); ast_mutex_lock(&sub->lock); - switch(ind) { + switch (ind) { case AST_CONTROL_RINGING: #ifdef DLINK_BUGGY_FIRMWARE transmit_notify_request(sub, "rt"); @@ -1767,7 +1767,7 @@ } else if (!name && sin) { if ((g->addr.sin_addr.s_addr != sin->sin_addr.s_addr) || (g->addr.sin_port != sin->sin_port)) { - if(!g->next) + if (!g->next) g = find_realtime_gw(name, at, sin); else g = g->next; @@ -2297,7 +2297,7 @@ } if (sub->gate) { - if(sub->gate->state == GATE_ALLOCATED) { + if (sub->gate->state == GATE_ALLOCATED) { snprintf(tmp, sizeof(tmp), ", dq-gi:%x", sub->gate->gateid); strncat(local, tmp, sizeof(local) - strlen(local) - 1); } @@ -2877,12 +2877,12 @@ /* Make a call*ID */ snprintf(sub->callid, sizeof(sub->callid), "%08lx%s", ast_random(), sub->txident); /* Transmit the connection create */ - if(!sub->parent->pktcgatealloc) { + if (!sub->parent->pktcgatealloc) { transmit_connect_with_sdp(sub, NULL); } else { transmit_connect(sub); sub->gate = NULL; - if(!mgcp_alloc_pktcgate(sub)) + if (!mgcp_alloc_pktcgate(sub)) mgcp_queue_hangup(sub); } ast_mutex_unlock(&sub->lock); @@ -3743,10 +3743,10 @@ lastpass = thispass; thispass = time(NULL); g = gateways; - while(g) { + while (g) { if (thispass != lastpass) { e = g->endpoints; - while(e) { + while (e) { if (e->type == TYPE_LINE) { res = has_voicemail(e); if ((e->msgstate != res) && (e->hookstate == MGCP_ONHOOK) && (!e->rtp)){ @@ -3766,15 +3766,15 @@ } #endif /* pruning unused realtime gateways, running in every 60 seconds*/ - if(time(NULL) > (lastrun + 60)) { + if (time(NULL) > (lastrun + 60)) { ast_mutex_lock(&gatelock); g = gateways; gprev = NULL; - while(g) { + while (g) { gnext = g->next; - if(g->realtime) { - if(mgcp_prune_realtime_gateway(g)) { - if(gprev) { + if (g->realtime) { + if (mgcp_prune_realtime_gateway(g)) { + if (gprev) { gprev->next = gnext; gprev = g; } else { @@ -4400,7 +4400,7 @@ memset(sub->magic, 0, sizeof(sub->magic)); mgcp_queue_hangup(sub); dump_cmd_queues(NULL, sub); - if(sub->gate) { + if (sub->gate) { sub->gate->tech_pvt = NULL; sub->gate->got_dq_gi = NULL; sub->gate->gate_remove = NULL; Index: channels/chan_misdn.c =================================================================== --- channels/chan_misdn.c (revision 228266) +++ channels/chan_misdn.c (working copy) @@ -3307,7 +3307,7 @@ { chan_misdn_log(2, bc->port, " --> Bearer: %s\n", bearer2str(bc->capability)); - switch(bc->law) { + switch (bc->law) { case INFO_CODEC_ALAW: chan_misdn_log(2, bc->port, " --> Codec: Alaw\n"); break; @@ -9456,7 +9456,7 @@ } if (!ch) { - switch(event) { + switch (event) { case EVENT_SETUP: case EVENT_DISCONNECT: case EVENT_RELEASE: @@ -11749,7 +11749,7 @@ tok++; } - switch(tok[0]) { + switch (tok[0]) { case 'd' : ast_copy_string(ch->bc->display, ++tok, sizeof(ch->bc->display)); chan_misdn_log(1, ch->bc->port, "SETOPT: Display:%s\n", ch->bc->display); Index: channels/chan_phone.c =================================================================== --- channels/chan_phone.c (revision 228266) +++ channels/chan_phone.c (working copy) @@ -205,7 +205,7 @@ struct phone_pvt *p = chan->tech_pvt; int res=-1; ast_debug(1, "Requested indication %d on channel %s\n", condition, chan->name); - switch(condition) { + switch (condition) { case AST_CONTROL_FLASH: ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_ON_HOOK); usleep(320000); @@ -248,7 +248,7 @@ int outdigit; p = ast->tech_pvt; ast_debug(1, "Dialed %c\n", digit); - switch(digit) { + switch (digit) { case '0': case '1': case '2': @@ -296,7 +296,7 @@ ast_localtime(&UtcTime, &tm, NULL); memset(&cid, 0, sizeof(PHONE_CID)); - if(&tm != NULL) { + if (&tm != NULL) { snprintf(cid.month, sizeof(cid.month), "%02d",(tm.tm_mon + 1)); snprintf(cid.day, sizeof(cid.day), "%02d", tm.tm_mday); snprintf(cid.hour, sizeof(cid.hour), "%02d", tm.tm_hour); @@ -577,7 +577,7 @@ } p->fr.data.ptr = p->buf; if (p->mode != MODE_FXS) - switch(p->buf[0] & 0x3) { + switch (p->buf[0] & 0x3) { case '0': case '1': /* Normal */ @@ -615,7 +615,7 @@ else memcpy(p->obuf + p->obuflen, buf, len); p->obuflen += len; - while(p->obuflen > frlen) { + while (p->obuflen > frlen) { res = write(p->fd, p->obuf, frlen); if (res != frlen) { if (res < 1) { @@ -798,7 +798,7 @@ /* If we get here, we have a frame of Appropriate data */ sofar = 0; pos = frame->data.ptr; - while(sofar < frame->datalen) { + while (sofar < frame->datalen) { /* Write in no more than maxfr sized frames */ expected = frame->datalen - sofar; if (maxfr < expected) @@ -1093,7 +1093,7 @@ } i = iflist; - for(; i; i=i->next) { + for (; i; i=i->next) { if (FD_ISSET(i->fd, &rfds)) { if (i->owner) { continue; @@ -1224,7 +1224,7 @@ return NULL; } p = iflist; - while(p) { + while (p) { if (p->mode == MODE_FXS || format & (AST_FORMAT_G729A | AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW)) { size_t length = strlen(p->dev + 5); @@ -1285,7 +1285,7 @@ if (!ast_mutex_lock(&iflock)) { /* Hangup all interfaces if they have an owner */ p = iflist; - while(p) { + while (p) { if (p->owner) ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD); p = p->next; @@ -1313,7 +1313,7 @@ if (!ast_mutex_lock(&iflock)) { /* Destroy all the interfaces and free their memory */ p = iflist; - while(p) { + while (p) { /* Close the socket, assuming it's real */ if (p->fd > -1) close(p->fd); @@ -1362,7 +1362,7 @@ return AST_MODULE_LOAD_FAILURE; } v = ast_variable_browse(cfg, "interfaces"); - while(v) { + while (v) { /* Create the interface list */ if (!strcasecmp(v->name, "device")) { tmp = mkif(v->value, mode, txgain, rxgain); Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 228266) +++ channels/chan_sip.c (working copy) @@ -3351,7 +3351,7 @@ dialog->relatedpeer->call = dialog_unref(dialog->relatedpeer->call, "unset the relatedpeer->call field in tandem with relatedpeer field itself"); /* remove all current packets in this dialog */ - while((cp = dialog->packets)) { + while ((cp = dialog->packets)) { dialog->packets = dialog->packets->next; AST_SCHED_DEL(sched, cp->retransid); dialog_unref(cp->owner, "remove all current packets in this dialog, and the pointer to the dialog too as part of __sip_destroy"); @@ -3966,7 +3966,7 @@ pkt->retransid = -1; if (pkt->is_fatal) { - while(pkt->owner->owner && ast_channel_trylock(pkt->owner->owner)) { + while (pkt->owner->owner && ast_channel_trylock(pkt->owner->owner)) { sip_pvt_unlock(pkt->owner); /* SIP_PVT, not channel */ usleep(1); sip_pvt_lock(pkt->owner); @@ -4769,7 +4769,7 @@ * allowed by RFC 3428 (See section 10, Examples) */ if (!text) return 0; - if(!is_method_allowed(&dialog->allowed_methods, SIP_MESSAGE)) { + if (!is_method_allowed(&dialog->allowed_methods, SIP_MESSAGE)) { ast_debug(2, "Trying to send MESSAGE to device that does not support it.\n"); return(0); } @@ -5052,7 +5052,7 @@ peerlist = ast_load_realtime_multientry("sippeers", "host", ipaddr, SENTINEL); if (peerlist) { var = get_insecure_variable_from_config(peerlist); - if(var) { + if (var) { if (realtimeregs) { newpeername = get_name_from_variable(var, newpeername); varregs = ast_load_realtime("sipregs", "name", newpeername, SENTINEL); @@ -5061,9 +5061,9 @@ peerlist = NULL; cat = NULL; peerlist = ast_load_realtime_multientry("sippeers", "ipaddr", ipaddr, SENTINEL); - if(peerlist) { + if (peerlist) { var = get_insecure_variable_from_config(peerlist); - if(var) { + if (var) { if (realtimeregs) { newpeername = get_name_from_variable(var, newpeername); varregs = ast_load_realtime("sipregs", "name", newpeername, SENTINEL); @@ -5105,7 +5105,7 @@ /* If this is type=user, then skip this object. */ if (!strcasecmp(tmp->name, "type") && !strcasecmp(tmp->value, "user")) { - if(peerlist) + if (peerlist) ast_config_destroy(peerlist); else { ast_variables_destroy(var); @@ -5119,7 +5119,7 @@ if (!newpeername) { /* Did not find peer in realtime */ ast_log(LOG_WARNING, "Cannot Determine peer name ip=%s\n", ipaddr); - if(peerlist) + if (peerlist) ast_config_destroy(peerlist); else ast_variables_destroy(var); @@ -5130,7 +5130,7 @@ /* Peer found in realtime, now build it in memory */ peer = build_peer(newpeername, var, varregs, TRUE, devstate_only); if (!peer) { - if(peerlist) + if (peerlist) ast_config_destroy(peerlist); else { ast_variables_destroy(var); @@ -5951,7 +5951,7 @@ return 0; } - switch(event) { + switch (event) { /* incoming and outgoing affects the inUse counter */ case DEC_CALL_LIMIT: /* Decrement inuse count if applicable */ @@ -6086,7 +6086,7 @@ { /* Possible values taken from causes.h */ - switch(cause) { + switch (cause) { case 401: /* Unauthorized */ return AST_CAUSE_CALL_REJECTED; case 403: /* Not found */ @@ -6810,7 +6810,7 @@ int res = 0; sip_pvt_lock(p); - switch(condition) { + switch (condition) { case AST_CONTROL_RINGING: if (ast->_state == AST_STATE_RING) { p->invitestate = INV_EARLY_MEDIA; @@ -7269,7 +7269,7 @@ return &ast_null_frame; } - switch(ast->fdno) { + switch (ast->fdno) { case 0: f = ast_rtp_instance_read(p->rtp, 0); /* RTP Audio */ break; @@ -7672,7 +7672,7 @@ } } return p; /* can be NULL */ - } else if( sip_methods[intended_method].can_create == CAN_CREATE_DIALOG_UNSUPPORTED_METHOD) { + } else if ( sip_methods[intended_method].can_create == CAN_CREATE_DIALOG_UNSUPPORTED_METHOD) { /* A method we do not support, let's take it on the volley */ transmit_response_using_temp(callid, sin, 1, intended_method, req, "501 Method Not Implemented"); ast_debug(2, "Got a request with unsupported SIP method.\n"); @@ -10621,7 +10621,7 @@ } /* Check if we need text in this call */ - if((capability & AST_FORMAT_TEXT_MASK) && !p->notext) { + if ((capability & AST_FORMAT_TEXT_MASK) && !p->notext) { if (sipdebug_text) ast_verbose("We think we can do text\n"); if (p->trtp) { @@ -11718,7 +11718,7 @@ reqprep(&req, p, SIP_NOTIFY, 0, 1); - switch(state) { + switch (state) { case AST_EXTENSION_DEACTIVATED: if (timeout) add_header(&req, "Subscription-State", "terminated;reason=timeout"); @@ -12302,7 +12302,7 @@ p->noncecount = ++r->noncecount; memset(digest, 0, sizeof(digest)); - if(!build_reply_digest(p, sipmethod, digest, sizeof(digest))) + if (!build_reply_digest(p, sipmethod, digest, sizeof(digest))) add_header(&req, "Authorization", digest); else ast_log(LOG_NOTICE, "No authorization available for authentication of registration to %s@%s\n", r->username, r->hostname); @@ -12494,7 +12494,7 @@ char digest[1024]; memset(digest, 0, sizeof(digest)); - if(!build_reply_digest(p, sipmethod, digest, sizeof(digest))) { + if (!build_reply_digest(p, sipmethod, digest, sizeof(digest))) { char *dummy, *response; enum sip_auth_type code = p->options ? p->options->auth_type : PROXY_AUTH; /* XXX force 407 if unknown */ auth_headers(code, &dummy, &response); @@ -13186,7 +13186,7 @@ c = buf->str; - while(c && *(c = ast_skip_blanks(c)) ) { /* lookup for keys */ + while (c && *(c = ast_skip_blanks(c)) ) { /* lookup for keys */ for (i = keys; i->key != NULL; i++) { const char *separator = ","; /* default */ @@ -13320,7 +13320,7 @@ sip_pvt_lock(p); - switch(state) { + switch (state) { case AST_EXTENSION_DEACTIVATED: /* Retry after a while */ case AST_EXTENSION_REMOVED: /* Extension is gone */ if (p->autokillid > -1 && sip_cancel_destroy(p)) /* Remove subscription expiry for renewals */ @@ -14116,7 +14116,7 @@ } /* Return 1 for pickup extension or overlap dialling support (if we support it) */ - if((ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP) && + if ((ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP) && ast_canmatch_extension(NULL, p->context, decoded_uri, 1, S_OR(p->cid_num, from))) || !strncmp(decoded_uri, ast_pickup_ext(), strlen(decoded_uri))) { return 1; @@ -14569,7 +14569,7 @@ /* clear the empty characters in the begining*/ input = ast_skip_blanks(input); /* clear the empty characters in the end */ - while(*end && *end < 33 && end > input) + while (*end && *end < 33 && end > input) end--; if (end >= input) { bytes = (int) (end - input) + 2; @@ -15215,7 +15215,7 @@ iterator->username, iterator->regdomain, iterator->refresh, regstate2str(iterator->regstate), (long) iterator->regtime.tv_sec); ASTOBJ_UNLOCK(iterator); total++; - } while(0)); + } while (0)); astman_append(s, "Event: RegistrationsComplete\r\n" @@ -15357,7 +15357,7 @@ qsort(peerarray, total_peers, sizeof(struct sip_peer *), peercomparefunc); - for(k=0; k < total_peers; k++) { + for (k=0; k < total_peers; k++) { char status[20] = ""; char srch[2000]; char pstatus; @@ -15788,7 +15788,7 @@ int x; format_t codec; - for(x = 0; x < 64 ; x++) { + for (x = 0; x < 64 ; x++) { codec = ast_codec_pref_index(pref, x); if (!codec) break; @@ -16189,7 +16189,7 @@ astman_append(s, "%s\r\n", codec_buf); astman_append(s, "CodecOrder: "); pref = &peer->prefs; - for(x = 0; x < 64 ; x++) { + for (x = 0; x < 64 ; x++) { codec = ast_codec_pref_index(pref, x); if (!codec) break; @@ -16416,7 +16416,7 @@ ast_cli(a->fd, FORMAT, host, (iterator->dnsmgr) ? "Y" : "N", user, iterator->refresh, regstate2str(iterator->regstate), tmpdat); ASTOBJ_UNLOCK(iterator); counter++; - } while(0)); + } while (0)); ast_cli(a->fd, "%d SIP registrations.\n", counter); return CLI_SUCCESS; #undef FORMAT @@ -16775,7 +16775,7 @@ snprintf(host, sizeof(host), "%s:%d", iterator->hostname, iterator->portno ? iterator->portno : STANDARD_SIP_PORT); ast_cli(a->fd, FORMAT, host, iterator->username, iterator->mailbox, iterator->subscribed ? "Yes" : "No"); ASTOBJ_UNLOCK(iterator); - } while(0)); + } while (0)); return CLI_SUCCESS; #undef FORMAT @@ -17784,7 +17784,7 @@ snprintf(cnonce, sizeof(cnonce), "%08lx", ast_random()); /* Check if we have separate auth credentials */ - if(!(auth = find_realm_authentication(p->peerauth, p->realm))) /* Start with peer list */ + if (!(auth = find_realm_authentication(p->peerauth, p->realm))) /* Start with peer list */ auth = find_realm_authentication(authl, p->realm); /* If not, global list */ if (auth) { @@ -17988,7 +17988,7 @@ codecnum = colname + 6; /* move past the '[' */ codecnum = strsep(&codecnum, "]"); /* trim trailing ']' if any */ - if((codec = ast_codec_pref_index(&peer->prefs, atoi(codecnum)))) { + if ((codec = ast_codec_pref_index(&peer->prefs, atoi(codecnum)))) { ast_copy_string(buf, ast_getformatname(codec), len); } else { buf[0] = '\0'; @@ -18534,7 +18534,7 @@ if (!reinvite) build_route(p, req, 1); - if(set_address_from_contact(p)) { + if (set_address_from_contact(p)) { /* Bad contact - we don't know how to reach this device */ /* We need to ACK, but then send a bye */ if (!p->route && !req->ignore) @@ -19031,11 +19031,11 @@ const char *contact = NULL; const char *tmptmp = NULL; int start = 0; - for(;;) { + for (;;) { contact = __get_header(req, "Contact", &start); /* this loop ensures we get a contact header about our register request */ - if(!ast_strlen_zero(contact)) { - if( (tmptmp=strstr(contact, p->our_contact))) { + if (!ast_strlen_zero(contact)) { + if ( (tmptmp=strstr(contact, p->our_contact))) { contact=tmptmp; break; } @@ -19241,7 +19241,7 @@ if (resp != 100) handle_response_peerpoke(p, resp, req); } else if (ast_test_flag(&p->flags[0], SIP_OUTGOING)) { - switch(resp) { + switch (resp) { case 100: /* 100 Trying */ case 101: /* 101 Dialog establishment */ case 183: /* 183 Session Progress */ @@ -19418,7 +19418,7 @@ stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */ /* XXX Locking issues?? XXX */ - switch(resp) { + switch (resp) { case 300: /* Multiple Choices */ case 301: /* Moved permanently */ case 302: /* Moved temporarily */ @@ -19507,7 +19507,7 @@ ast_string_field_set(p, theirtag, tag); } - switch(resp) { + switch (resp) { case 200: if (sipmethod == SIP_INVITE) { handle_response_invite(p, resp, rest, req, seqno); @@ -19590,7 +19590,7 @@ if ((resp >= 300) && (resp < 700)) { if ((resp != 487)) ast_verb(3, "Incoming call: Got SIP response %d \"%s\" back from %s\n", resp, rest, ast_inet_ntoa(p->sa.sin_addr)); - switch(resp) { + switch (resp) { case 488: /* Not acceptable here - codec error */ case 603: /* Decline */ case 500: /* Server error */ @@ -19892,7 +19892,7 @@ char *eventid = NULL; char *sep; - if( (sep = strchr(event, ';')) ) { /* XXX bug here - overwriting string ? */ + if ( (sep = strchr(event, ';')) ) { /* XXX bug here - overwriting string ? */ *sep++ = '\0'; eventid = sep; } @@ -19957,14 +19957,14 @@ cmd = ast_skip_blanks(buf); code = cmd; /* We are at SIP/2.0 */ - while(*code && (*code > 32)) { /* Search white space */ + while (*code && (*code > 32)) { /* Search white space */ code++; } *code++ = '\0'; code = ast_skip_blanks(code); sep = code; sep++; - while(*sep && (*sep > 32)) { /* Search white space */ + while (*sep && (*sep > 32)) { /* Search white space */ sep++; } *sep++ = '\0'; /* Response string */ @@ -20197,7 +20197,7 @@ ast_set_flag(&p->refer->refer_call->flags[0], SIP_DEFER_BYE_ON_TRANSFER); /* Delay hangup */ /* Prepare the masquerade - if this does not happen, we will be gone */ - if(ast_channel_masquerade(replacecall, c)) + if (ast_channel_masquerade(replacecall, c)) ast_log(LOG_ERROR, "Failed to masquerade C into Replacecall\n"); else ast_debug(4, "Invite/Replaces: Going to masquerade %s into %s\n", c->name, replacecall->name); @@ -21235,7 +21235,7 @@ c_state = AST_STATE_UP; } - switch(c_state) { + switch (c_state) { case AST_STATE_DOWN: ast_debug(2, "%s: New call is still down.... Trying... \n", c->name); transmit_provisional_response(p, "100 Trying", req, 0); @@ -21246,7 +21246,7 @@ result = ast_pbx_start(c); - switch(result) { + switch (result) { case AST_PBX_FAILED: ast_log(LOG_WARNING, "Failed to start PBX :(\n"); p->invitestate = INV_COMPLETED; @@ -23441,7 +23441,7 @@ sipsock_read_id = ast_io_add(io, sipsock, sipsock_read, AST_IO_IN, NULL); /* From here on out, we die whenever asked */ - for(;;) { + for (;;) { /* Check for a reload request */ ast_mutex_lock(&sip_reload_lock); reloading = sip_reloading; @@ -25371,7 +25371,7 @@ AST_SCHED_DEL_UNREF(sched, iterator->timeout, registry_unref(iterator, "reg ptr unref from reload config")); } ASTOBJ_UNLOCK(iterator); - } while(0)); + } while (0)); /* Then, actually destroy users and registry */ ASTOBJ_CONTAINER_DESTROYALL(®l, sip_registry_destroy); @@ -26835,7 +26835,7 @@ sip_reloadreason = CHANNEL_MODULE_LOAD; - if(reload_config(sip_reloadreason)) /* Load the configuration from sip.conf */ + if (reload_config(sip_reloadreason)) /* Load the configuration from sip.conf */ return AST_MODULE_LOAD_DECLINE; /* Prepare the version that does not require DTMF BEGIN frames. Index: channels/chan_skinny.c =================================================================== --- channels/chan_skinny.c (revision 228266) +++ channels/chan_skinny.c (working copy) @@ -3027,7 +3027,7 @@ { int x, codec; - for(x = 0; x < 32 ; x++) { + for (x = 0; x < 32 ; x++) { codec = ast_codec_pref_index(pref, x); if (!codec) break; @@ -3527,7 +3527,7 @@ astman_append(s, "Codecs: %s\r\n", codec_buf); astman_append(s, "CodecOrder: "); pref = &l->prefs; - for(x = 0; x < 32 ; x++) { + for (x = 0; x < 32 ; x++) { codec = ast_codec_pref_index(pref, x); if (!codec) break; @@ -3995,7 +3995,7 @@ return &ast_null_frame; } - switch(ast->fdno) { + switch (ast->fdno) { case 0: f = ast_rtp_instance_read(sub->rtp, 0); /* RTP Audio */ break; @@ -4269,7 +4269,7 @@ if (skinnydebug) ast_verb(3, "Asked to indicate '%s' condition on channel %s\n", control2str(ind), ast->name); - switch(ind) { + switch (ind) { case AST_CONTROL_RINGING: if (sub->blindxfer) { if (skinnydebug) @@ -4824,7 +4824,7 @@ l = sub->parent; } - switch(event) { + switch (event) { case STIMULUS_REDIAL: if (skinnydebug) ast_verb(1, "Received Stimulus: Redial(%d/%d)\n", instance, callreference); @@ -5696,7 +5696,7 @@ c = skinny_new(l, AST_STATE_DOWN, NULL); - if(!c) { + if (!c) { ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n", l->name, d->name); } else { l->hookstate = SKINNY_OFFHOOK; @@ -5790,7 +5790,7 @@ ast_devstate_changed(AST_DEVICE_INUSE, "Skinny/%s@%s", l->name, d->name); - switch(event) { + switch (event) { case SOFTKEY_NONE: if (skinnydebug) ast_verb(1, "Received Softkey Event: None(%d/%d)\n", instance, callreference); @@ -6161,7 +6161,7 @@ ast_verb(4, "Received %s from %s\n", message2str(req->e), s->device->name); }) - switch(letohl(req->e)) { + switch (letohl(req->e)) { case KEEP_ALIVE_MESSAGE: res = handle_keep_alive_message(req, s); break; @@ -6495,8 +6495,8 @@ continue; } p = getprotobyname("tcp"); - if(p) { - if( setsockopt(as, p->p_proto, TCP_NODELAY, (char *)&arg, sizeof(arg) ) < 0 ) { + if (p) { + if ( setsockopt(as, p->p_proto, TCP_NODELAY, (char *)&arg, sizeof(arg) ) < 0 ) { ast_log(LOG_WARNING, "Failed to set Skinny tcp connection to TCP_NODELAY mode: %s\n", strerror(errno)); } } @@ -6527,7 +6527,7 @@ /* This thread monitors all the interfaces which are not yet in use (and thus do not have a separate thread) indefinitely */ /* From here on out, we die whenever asked */ - for(;;) { + for (;;) { pthread_testcancel(); /* Wait for sched or io */ res = ast_sched_wait(sched); @@ -6637,7 +6637,7 @@ int lineInstance = 1; int speeddialInstance = 1; - while(vptr) { + while (vptr) { v = vptr; vptr = vptr->next; @@ -7223,7 +7223,7 @@ } if (skinnysock < 0) { skinnysock = socket(AF_INET, SOCK_STREAM, 0); - if(setsockopt(skinnysock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) { + if (setsockopt(skinnysock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) { ast_log(LOG_ERROR, "Set Socket Options failed: errno %d, %s\n", errno, strerror(errno)); ast_config_destroy(cfg); ast_mutex_unlock(&netlock); @@ -7436,7 +7436,7 @@ AST_LIST_LOCK(&sessions); /* Destroy all the interfaces and free their memory */ - while((s = AST_LIST_REMOVE_HEAD(&sessions, list))) { + while ((s = AST_LIST_REMOVE_HEAD(&sessions, list))) { d = s->device; AST_LIST_TRAVERSE(&d->lines, l, list){ ast_mutex_lock(&l->lock); Index: channels/chan_usbradio.c =================================================================== --- channels/chan_usbradio.c (revision 228266) +++ channels/chan_usbradio.c (working copy) @@ -728,7 +728,7 @@ snd_hctl_elem_info(elem,info); type = snd_ctl_elem_info_get_type(info); rv = 0; - switch(type) + switch (type) { case SND_CTL_ELEM_TYPE_INTEGER: rv = snd_ctl_elem_info_get_max(info); @@ -774,7 +774,7 @@ type = snd_ctl_elem_info_get_type(info); snd_ctl_elem_value_alloca(&control); snd_ctl_elem_value_set_id(control, id); - switch(type) + switch (type) { case SND_CTL_ELEM_TYPE_INTEGER: snd_ctl_elem_value_set_integer(control, 0, v1); @@ -851,7 +851,7 @@ unsigned short cs; cs = 0xffff; - for(i = EEPROM_START_ADDR; i < EEPROM_END_ADDR; i++) + for (i = EEPROM_START_ADDR; i < EEPROM_END_ADDR; i++) { cs += buf[i] = read_eeprom(handle,i); } @@ -865,7 +865,7 @@ cs = 0xffff; buf[EEPROM_MAGIC_ADDR] = EEPROM_MAGIC; - for(i = EEPROM_START_ADDR; i < EEPROM_CS_ADDR; i++) + for (i = EEPROM_START_ADDR; i < EEPROM_CS_ADDR; i++) { write_eeprom(handle,i,buf[i]); cs += buf[i]; @@ -897,7 +897,7 @@ == C108_PRODUCT_ID)) { sprintf(devstr,"%s/%s", usb_bus->dirname,dev->filename); - for(i = 0; i < 32; i++) + for (i = 0; i < 32; i++) { sprintf(str,"/proc/asound/card%d/usbbus",i); fp = fopen(str,"r"); @@ -963,7 +963,7 @@ == C108_PRODUCT_ID)) { sprintf(devstr,"%s/%s", usb_bus->dirname,dev->filename); - for(i = 0;i < 32; i++) + for (i = 0;i < 32; i++) { sprintf(str,"/proc/asound/card%d/usbbus",i); fp = fopen(str,"r"); @@ -1000,7 +1000,7 @@ if (!usb_device_list) return -1; usb_device_list_size += strlen(cp) + 2; i = 0; - while(usb_device_list[i]) + while (usb_device_list[i]) { i += strlen(usb_device_list + i) + 1; } @@ -1019,7 +1019,7 @@ int i; char str[200],desdev[200],*cp; - for(i = 0;i < 32; i++) + for (i = 0;i < 32; i++) { if (i) sprintf(str,"/sys/class/sound/dsp%d/device",i); else strcpy(str,"/sys/class/sound/dsp/device"); @@ -1048,7 +1048,7 @@ char *s = usb_device_list; if (!s) return(0); - while(*s) + while (*s) { if (!strcasecmp(s,devstr)) return(1); s += strlen(s) + 1; @@ -1059,7 +1059,7 @@ static int hidhdwconfig(struct chan_usbradio_pvt *o) { - if(o->hdwtype==1) //sphusb + if (o->hdwtype==1) //sphusb { o->hid_gpio_ctl = 0x08; /* set GPIO4 to output mode */ o->hid_gpio_ctl_loc = 2; /* For CTL of GPIO */ @@ -1070,7 +1070,7 @@ o->hid_io_ptt = 8; /* GPIO 4 is PTT */ o->hid_gpio_loc = 1; /* For ALL GPIO */ } - else if(o->hdwtype==0) //dudeusb + else if (o->hdwtype==0) //dudeusb { o->hid_gpio_ctl = 0x0c; /* set GPIO 3 & 4 to output mode */ o->hid_gpio_ctl_loc = 2; /* For CTL of GPIO */ @@ -1081,7 +1081,7 @@ o->hid_io_ptt = 4; /* GPIO 3 is PTT */ o->hid_gpio_loc = 1; /* For ALL GPIO */ } - else if(o->hdwtype==3) // custom version + else if (o->hdwtype==3) // custom version { o->hid_gpio_ctl = 0x0c; /* set GPIO 3 & 4 to output mode */ o->hid_gpio_ctl_loc = 2; /* For CTL of GPIO */ @@ -1154,7 +1154,7 @@ traceusb1(("hidthread: Starting normally on %s!!\n",o->name)); lastrx = 0; // popen - while(!o->stophid) + while (!o->stophid) { to.tv_sec = 0; to.tv_usec = 50000; // maw sph @@ -1176,7 +1176,7 @@ ast_log(LOG_ERROR, "read() failed: %s\n", strerror(errno)); } } - if(o->wanteeprom) + if (o->wanteeprom) { ast_mutex_lock(&o->eepromlock); if (o->eepromctl == 1) /* to read */ @@ -1220,7 +1220,7 @@ keyed = !(buf[o->hid_io_cor_loc] & o->hid_io_cor); if (keyed != o->rxhidsq) { - if(o->debuglevel)printf("chan_usbradio() hidthread: update rxhidsq = %d\n",keyed); + if (o->debuglevel)printf("chan_usbradio() hidthread: update rxhidsq = %d\n",keyed); o->rxhidsq=keyed; } @@ -1230,7 +1230,7 @@ if (o->lasttx != txtmp) { o->pmrChan->txPttHid=o->lasttx = txtmp; - if(o->debuglevel)printf("hidthread: tx set to %d\n",txtmp); + if (o->debuglevel)printf("hidthread: tx set to %d\n",txtmp); buf[o->hid_gpio_loc] = 0; if (!o->invertptt) { @@ -1357,7 +1357,7 @@ // maw maw sph !!! may or may not be a good thing // drop the frame if not transmitting, this keeps from gradually // filling the buffer when asterisk clock > usb sound clock - if(!o->pmrChan->txPttIn && !o->pmrChan->txPttOut) + if (!o->pmrChan->txPttIn && !o->pmrChan->txPttOut) { //return 0; } @@ -1640,7 +1640,7 @@ cmd = alloca(strlen(text) + 10); /* print received messages */ - if(o->debuglevel)ast_verbose(" << Console Received usbradio text %s >> \n", text); + if (o->debuglevel)ast_verbose(" << Console Received usbradio text %s >> \n", text); cnt = sscanf(text, "%300s %15s %15s %15s %15s %1c", cmd, rxs, txs, rxpl, txpl, &pwr); @@ -1649,7 +1649,7 @@ u8 chan; chan=strtod(rxs,NULL); ppbinout(chan); - if(o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio SETCHAN cmd: %s chan: %i\n",text,chan); + if (o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio SETCHAN cmd: %s chan: %i\n",text,chan); return 0; } @@ -1660,12 +1660,12 @@ } else { - if(o->debuglevel)ast_verbose(" << %s %s %s %s %s %c >> \n", cmd,rxs,txs,rxpl,txpl,pwr); + if (o->debuglevel)ast_verbose(" << %s %s %s %s %s %c >> \n", cmd,rxs,txs,rxpl,txpl,pwr); } if (strcmp(cmd,"SETFREQ")==0) { - if(o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio SETFREQ cmd: %s\n",text); + if (o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio SETFREQ cmd: %s\n",text); tx=strtod(txs,NULL); rx=strtod(rxs,NULL); o->set_txfreq = round(tx * (double)1000000); @@ -1774,7 +1774,7 @@ if (ftxcapraw && o->b.txcapraw) { i16 i, tbuff[f->datalen]; - for(i=0;idatalen;i+=2) + for (i=0;idatalen;i+=2) { tbuff[i]= ((i16*)(f->data.ptr))[i/2]; tbuff[i+1]= o->txkeyed*M_Q13; @@ -1850,18 +1850,18 @@ #endif #if 1 - if(o->txkeyed||o->txtestkey) + if (o->txkeyed||o->txtestkey) { - if(!o->pmrChan->txPttIn) + if (!o->pmrChan->txPttIn) { o->pmrChan->txPttIn=1; - if(o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,o->owner->name); + if (o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,o->owner->name); } } - else if(o->pmrChan->txPttIn) + else if (o->pmrChan->txPttIn) { o->pmrChan->txPttIn=0; - if(o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,o->owner->name); + if (o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,o->owner->name); } oldpttout = o->pmrChan->txPttOut; @@ -1872,7 +1872,7 @@ if (oldpttout != o->pmrChan->txPttOut) { - if(o->debuglevel) ast_log(LOG_NOTICE,"txPttOut = %i, chan %s\n",o->pmrChan->txPttOut,o->owner->name); + if (o->debuglevel) ast_log(LOG_NOTICE,"txPttOut = %i, chan %s\n",o->pmrChan->txPttOut,o->owner->name); kickptt(o); } @@ -1918,17 +1918,17 @@ o->pmrChan->b.rxCapture=1; - if(!hInput) + if (!hInput) { hInput = fopen("/usr/src/xpmr/testdata/rx_in.pcm","r"); - if(!hInput) + if (!hInput) { printf(" Input Data File Not Found.\n"); return 0; } } - if(0==fread((void *)iBuff,2,FRAME_SIZE*2*6,hInput))exit; + if (0==fread((void *)iBuff,2,FRAME_SIZE*2*6,hInput))exit; PmrRx( o->pmrChan, (i16 *)iBuff, @@ -1948,13 +1948,13 @@ #endif cd = 0; - if(o->rxcdtype==CD_HID && (o->pmrChan->rxExtCarrierDetect!=o->rxhidsq)) + if (o->rxcdtype==CD_HID && (o->pmrChan->rxExtCarrierDetect!=o->rxhidsq)) o->pmrChan->rxExtCarrierDetect=o->rxhidsq; - if(o->rxcdtype==CD_HID_INVERT && (o->pmrChan->rxExtCarrierDetect==o->rxhidsq)) + if (o->rxcdtype==CD_HID_INVERT && (o->pmrChan->rxExtCarrierDetect==o->rxhidsq)) o->pmrChan->rxExtCarrierDetect=!o->rxhidsq; - if( (o->rxcdtype==CD_HID && o->rxhidsq) || + if ( (o->rxcdtype==CD_HID && o->rxhidsq) || (o->rxcdtype==CD_HID_INVERT && !o->rxhidsq) || (o->rxcdtype==CD_XPMR_NOISE && o->pmrChan->rxCarrierDetect) || (o->rxcdtype==CD_XPMR_VOX && o->pmrChan->rxCarrierDetect) @@ -1967,23 +1967,23 @@ cd=0; } - if(cd!=o->rxcarrierdetect) + if (cd!=o->rxcarrierdetect) { o->rxcarrierdetect=cd; - if(o->debuglevel) ast_log(LOG_NOTICE,"rxcarrierdetect = %i, chan %s\n",cd,o->owner->name); + if (o->debuglevel) ast_log(LOG_NOTICE,"rxcarrierdetect = %i, chan %s\n",cd,o->owner->name); // printf("rxcarrierdetect = %i, chan %s\n",res,o->owner->name); } - if(o->pmrChan->b.ctcssRxEnable && o->pmrChan->rxCtcss->decode!=o->rxctcssdecode) + if (o->pmrChan->b.ctcssRxEnable && o->pmrChan->rxCtcss->decode!=o->rxctcssdecode) { - if(o->debuglevel)ast_log(LOG_NOTICE,"rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name); + if (o->debuglevel)ast_log(LOG_NOTICE,"rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name); // printf("rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name); o->rxctcssdecode=o->pmrChan->rxCtcss->decode; strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq); } #ifndef HAVE_XPMRX - if( !o->pmrChan->b.ctcssRxEnable || + if ( !o->pmrChan->b.ctcssRxEnable || ( o->pmrChan->b.ctcssRxEnable && o->pmrChan->rxCtcss->decode>CTCSS_NULL && o->pmrChan->smode==SMODE_CTCSS ) @@ -1996,7 +1996,7 @@ sd=0; } #else - if( (!o->pmrChan->b.ctcssRxEnable && !o->pmrChan->b.dcsRxEnable && !o->pmrChan->b.lmrRxEnable) || + if ( (!o->pmrChan->b.ctcssRxEnable && !o->pmrChan->b.dcsRxEnable && !o->pmrChan->b.lmrRxEnable) || ( o->pmrChan->b.ctcssRxEnable && o->pmrChan->rxCtcss->decode>CTCSS_NULL && o->pmrChan->smode==SMODE_CTCSS ) || @@ -2012,22 +2012,22 @@ sd=0; } - if(o->pmrChan->decDcs->decode!=o->rxdcsdecode) + if (o->pmrChan->decDcs->decode!=o->rxdcsdecode) { - if(o->debuglevel)ast_log(LOG_NOTICE,"rxdcsdecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,o->owner->name); + if (o->debuglevel)ast_log(LOG_NOTICE,"rxdcsdecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,o->owner->name); // printf("rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name); o->rxdcsdecode=o->pmrChan->decDcs->decode; strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq); } - if(o->pmrChan->rptnum && (o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed != o->rxlsddecode)) + if (o->pmrChan->rptnum && (o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed != o->rxlsddecode)) { - if(o->debuglevel)ast_log(LOG_NOTICE,"rxLSDecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,o->owner->name); + if (o->debuglevel)ast_log(LOG_NOTICE,"rxLSDecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,o->owner->name); o->rxlsddecode=o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed; strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq); } - if( (o->pmrChan->rptnum>0 && o->pmrChan->smode==SMODE_LSD && o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed)|| + if ( (o->pmrChan->rptnum>0 && o->pmrChan->smode==SMODE_LSD && o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed)|| (o->pmrChan->smode==SMODE_DCS && o->pmrChan->decDcs->decode>0) ) { sd=1; @@ -2036,14 +2036,14 @@ if ( cd && sd ) { - //if(!o->rxkeyed)o->pmrChan->dd.b.doitnow=1; - if(!o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 1, chan %s\n", o->owner->name); + //if (!o->rxkeyed)o->pmrChan->dd.b.doitnow=1; + if (!o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 1, chan %s\n", o->owner->name); o->rxkeyed = 1; } else { - //if(o->rxkeyed)o->pmrChan->dd.b.doitnow=1; - if(o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 0, chan %s\n",o->owner->name); + //if (o->rxkeyed)o->pmrChan->dd.b.doitnow=1; + if (o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 0, chan %s\n",o->owner->name); o->rxkeyed = 0; } @@ -2060,7 +2060,7 @@ o->lastrx = 1; //printf("AST_CONTROL_RADIO_KEY\n"); wf.subclass = AST_CONTROL_RADIO_KEY; - if(o->rxctcssdecode) + if (o->rxctcssdecode) { wf.data.ptr = o->rxctcssfreq; wf.datalen = strlen(o->rxctcssfreq) + 1; @@ -2160,11 +2160,11 @@ break; case AST_CONTROL_RADIO_KEY: o->txkeyed = 1; - if(o->debuglevel)ast_verbose(" << AST_CONTROL_RADIO_KEY Radio Transmit On. >> \n"); + if (o->debuglevel)ast_verbose(" << AST_CONTROL_RADIO_KEY Radio Transmit On. >> \n"); break; case AST_CONTROL_RADIO_UNKEY: o->txkeyed = 0; - if(o->debuglevel)ast_verbose(" << AST_CONTROL_RADIO_UNKEY Radio Transmit Off. >> \n"); + if (o->debuglevel)ast_verbose(" << AST_CONTROL_RADIO_UNKEY Radio Transmit Off. >> \n"); break; default: ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, c->name); @@ -2294,14 +2294,14 @@ { ast_cli(fd,"Active radio interface is [%s]\n",usbradio_active); ast_cli(fd,"Output A is currently set to "); - if(o->txmixa==TX_OUT_COMPOSITE)ast_cli(fd,"composite.\n"); + if (o->txmixa==TX_OUT_COMPOSITE)ast_cli(fd,"composite.\n"); else if (o->txmixa==TX_OUT_VOICE)ast_cli(fd,"voice.\n"); else if (o->txmixa==TX_OUT_LSD)ast_cli(fd,"tone.\n"); else if (o->txmixa==TX_OUT_AUX)ast_cli(fd,"auxvoice.\n"); else ast_cli(fd,"off.\n"); ast_cli(fd,"Output B is currently set to "); - if(o->txmixb==TX_OUT_COMPOSITE)ast_cli(fd,"composite.\n"); + if (o->txmixb==TX_OUT_COMPOSITE)ast_cli(fd,"composite.\n"); else if (o->txmixb==TX_OUT_VOICE)ast_cli(fd,"voice.\n"); else if (o->txmixb==TX_OUT_LSD)ast_cli(fd,"tone.\n"); else if (o->txmixb==TX_OUT_AUX)ast_cli(fd,"auxvoice.\n"); @@ -2338,7 +2338,7 @@ else if (!strcasecmp(argv[2],"txvoice")) { i = 0; - if( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) && + if ( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) && (o->txmixa!=TX_OUT_COMPOSITE) && (o->txmixb!=TX_OUT_COMPOSITE) ) { @@ -2346,7 +2346,7 @@ } else if (argc == 3) { - if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE)) + if ((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE)) ast_cli(fd,"Current txvoice setting on Channel A is %d\n",o->txmixaset); else ast_cli(fd,"Current txvoice setting on Channel B is %d\n",o->txmixbset); @@ -2356,7 +2356,7 @@ i = atoi(argv[3]); if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE; - if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE)) + if ((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE)) { o->txmixaset=i; ast_cli(fd,"Changed txvoice setting on Channel A to %d\n",o->txmixaset); @@ -2377,7 +2377,7 @@ else if (!strcasecmp(argv[2],"txall")) { i = 0; - if( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) && + if ( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) && (o->txmixa!=TX_OUT_COMPOSITE) && (o->txmixb!=TX_OUT_COMPOSITE) ) { @@ -2385,7 +2385,7 @@ } else if (argc == 3) { - if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE)) + if ((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE)) ast_cli(fd,"Current txvoice setting on Channel A is %d\n",o->txmixaset); else ast_cli(fd,"Current txvoice setting on Channel B is %d\n",o->txmixbset); @@ -2395,7 +2395,7 @@ i = atoi(argv[3]); if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE; - if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE)) + if ((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE)) { o->txmixaset=i; ast_cli(fd,"Changed txvoice setting on Channel A to %d\n",o->txmixaset); @@ -2413,13 +2413,13 @@ } else if (!strcasecmp(argv[2],"auxvoice")) { i = 0; - if( (o->txmixa!=TX_OUT_AUX) && (o->txmixb!=TX_OUT_AUX)) + if ( (o->txmixa!=TX_OUT_AUX) && (o->txmixb!=TX_OUT_AUX)) { ast_log(LOG_WARNING,"No auxvoice output configured.\n"); } else if (argc == 3) { - if(o->txmixa==TX_OUT_AUX) + if (o->txmixa==TX_OUT_AUX) ast_cli(fd,"Current auxvoice setting on Channel A is %d\n",o->txmixaset); else ast_cli(fd,"Current auxvoice setting on Channel B is %d\n",o->txmixbset); @@ -2428,7 +2428,7 @@ { i = atoi(argv[3]); if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE; - if(o->txmixa==TX_OUT_AUX) + if (o->txmixa==TX_OUT_AUX) { o->txmixbset=i; ast_cli(fd,"Changed auxvoice setting on Channel A to %d\n",o->txmixaset); @@ -2504,7 +2504,7 @@ else if (!strcasecmp(argv[2],"load")) { ast_mutex_lock(&o->eepromlock); - while(o->eepromctl) + while (o->eepromctl) { ast_mutex_unlock(&o->eepromlock); usleep(10000); @@ -2882,20 +2882,20 @@ settingmax = o->micmax; - if(o->pmrChan->rxDemod)tunetype=1; + if (o->pmrChan->rxDemod)tunetype=1; o->pmrChan->b.tuning=1; setting = settingstart; ast_cli(fd,"tune rxnoise maxtries=%i, target=%i, tolerance=%i\n",maxtries,target,tolerance); - while(triesdevicenum,MIXER_PARAM_MIC_CAPTURE_VOL,setting,0); setamixer(o->devicenum,MIXER_PARAM_MIC_BOOST,o->rxboostset,0); usleep(100000); - if(o->rxcdtype!=CD_XPMR_NOISE || o->rxdemod==RX_AUDIO_SPEAKER) + if (o->rxcdtype!=CD_XPMR_NOISE || o->rxdemod==RX_AUDIO_SPEAKER) { // printf("Measure Direct Input\n"); o->pmrChan->spsMeasure->source = o->pmrChan->spsRx->source; @@ -2919,25 +2919,25 @@ o->pmrChan->spsRx->discounteru=o->pmrChan->spsRx->discounterl=0; o->pmrChan->spsRx->amax=o->pmrChan->spsRx->amin=0; } - if(!meas)meas++; + if (!meas)meas++; ast_cli(fd,"tries=%i, setting=%i, meas=%i\n",tries,setting,meas); - if( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){ + if ( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){ setting=setting*target/meas; } - else if(tries>4 && meas>(target-tolerance) && meas<(target+tolerance) ) + else if (tries>4 && meas>(target-tolerance) && meas<(target+tolerance) ) { break; } - if(settingsettingmax)setting=settingmax; + if (settingsettingmax)setting=settingmax; tries++; } ast_cli(fd,"DONE tries=%i, setting=%i, meas=%i\n",tries, (setting * 1000) / o->micmax,meas); - if( meas<(target-tolerance) || meas>(target+tolerance) ){ + if ( meas<(target-tolerance) || meas>(target+tolerance) ){ ast_cli(fd,"ERROR: RX INPUT ADJUST FAILED.\n"); }else{ ast_cli(fd,"INFO: RX INPUT ADJUST SUCCESS.\n"); @@ -2964,10 +2964,10 @@ ast_cli(fd,"target=%i tolerance=%i \n",target,tolerance); o->pmrChan->b.tuning=1; - if(!o->pmrChan->spsMeasure) + if (!o->pmrChan->spsMeasure) ast_cli(fd,"ERROR: NO MEASURE BLOCK.\n"); - if(!o->pmrChan->spsMeasure->source || !o->pmrChan->prxVoiceAdjust ) + if (!o->pmrChan->spsMeasure->source || !o->pmrChan->prxVoiceAdjust ) ast_cli(fd,"ERROR: NO SOURCE OR MEASURE SETTING.\n"); o->pmrChan->spsMeasure->source=o->pmrChan->spsRxOut->sink; @@ -2978,7 +2978,7 @@ // ast_cli(fd,"ERROR: NO MEASURE BLOCK.\n"); - while(triespmrChan->prxVoiceAdjust)=setting*M_Q8; usleep(10000); @@ -2987,15 +2987,15 @@ meas = o->pmrChan->spsMeasure->apeak; ast_cli(fd,"tries=%i, setting=%f, meas=%i\n",tries,setting,meas); - if( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){ + if ( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){ setting=setting*target/meas; } - else if(tries>4 && meas>(target-tolerance) && meas<(target+tolerance) ) + else if (tries>4 && meas>(target-tolerance) && meas<(target+tolerance) ) { break; } - if(settingsettingmax)setting=settingmax; + if (settingsettingmax)setting=settingmax; tries++; } @@ -3003,7 +3003,7 @@ o->pmrChan->spsMeasure->enabled=0; ast_cli(fd,"DONE tries=%i, setting=%f, meas=%f\n",tries,setting,(float)meas); - if( meas<(target-tolerance) || meas>(target+tolerance) ){ + if ( meas<(target-tolerance) || meas>(target+tolerance) ){ ast_cli(fd,"ERROR: RX VOICE GAIN ADJUST FAILED.\n"); }else{ ast_cli(fd,"INFO: RX VOICE GAIN ADJUST SUCCESS.\n"); @@ -3035,7 +3035,7 @@ setting=settingstart; - while(triespmrChan->prxCtcssAdjust)=setting*M_Q8; usleep(10000); @@ -3044,21 +3044,21 @@ meas = o->pmrChan->spsMeasure->apeak; ast_cli(fd,"tries=%i, setting=%f, meas=%i\n",tries,setting,meas); - if( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){ + if ( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){ setting=setting*target/meas; } - else if(tries>4 && meas>(target-tolerance) && meas<(target+tolerance) ) + else if (tries>4 && meas>(target-tolerance) && meas<(target+tolerance) ) { break; } - if(settingsettingmax)setting=settingmax; + if (settingsettingmax)setting=settingmax; tries++; } o->pmrChan->spsMeasure->enabled=0; ast_cli(fd,"DONE tries=%i, setting=%f, meas=%f\n",tries,setting,(float)meas); - if( meas<(target-tolerance) || meas>(target+tolerance) ){ + if ( meas<(target-tolerance) || meas>(target+tolerance) ){ ast_cli(fd,"ERROR: RX CTCSS GAIN ADJUST FAILED.\n"); }else{ ast_cli(fd,"INFO: RX CTCSS GAIN ADJUST SUCCESS.\n"); @@ -3091,10 +3091,10 @@ fprintf(fp,"rxsquelchadj=%i\n",o->rxsquelchadj); fclose(fp); - if(o->wanteeprom) + if (o->wanteeprom) { ast_mutex_lock(&o->eepromlock); - while(o->eepromctl) + while (o->eepromctl) { ast_mutex_unlock(&o->eepromlock); usleep(10000); @@ -3131,11 +3131,11 @@ static void mult_set(struct chan_usbradio_pvt *o) { - if(o->pmrChan->spsTxOutA) { + if (o->pmrChan->spsTxOutA) { o->pmrChan->spsTxOutA->outputGain = mult_calc((o->txmixaset * 152) / 1000); } - if(o->pmrChan->spsTxOutB){ + if (o->pmrChan->spsTxOutB){ o->pmrChan->spsTxOutB->outputGain = mult_calc((o->txmixbset * 152) / 1000); } @@ -3171,7 +3171,7 @@ unsigned char buf[4]; char lastrx, txtmp; - if(opt) + if (opt) { struct usb_device *usb_dev; @@ -3213,7 +3213,7 @@ if (o->lasttx != txtmp) { o->pmrChan->txPttHid=o->lasttx = txtmp; - if(o->debuglevel)printf("usbhid: tx set to %d\n",txtmp); + if (o->debuglevel)printf("usbhid: tx set to %d\n",txtmp); buf[o->hid_gpio_loc] = 0; if (!o->invertptt) { @@ -3263,9 +3263,9 @@ ps(o->txctcssfreq); pd(o->numrxctcssfreqs); - if(o->numrxctcssfreqs>0) + if (o->numrxctcssfreqs>0) { - for(i=0;inumrxctcssfreqs;i++) + for (i=0;inumrxctcssfreqs;i++) { printf(" %i = %s %s\n",i,o->rxctcss[i],o->txctcss[i]); } @@ -3299,9 +3299,9 @@ pd(p->rxCtcss->relax); //pf(p->rxCtcssFreq); pd(p->numrxcodes); - if(o->pmrChan->numrxcodes>0) + if (o->pmrChan->numrxcodes>0) { - for(i=0;ipmrChan->numrxcodes;i++) + for (i=0;ipmrChan->numrxcodes;i++) { printf(" %i = %s\n",i,o->pmrChan->pRxCode[i]); } @@ -3311,9 +3311,9 @@ ps(p->pTxCodeDefault); pd(p->txcodedefaultsmode); pd(p->numtxcodes); - if(o->pmrChan->numtxcodes>0) + if (o->pmrChan->numtxcodes>0) { - for(i=0;ipmrChan->numtxcodes;i++) + for (i=0;ipmrChan->numtxcodes;i++) { printf(" %i = %s\n",i,o->pmrChan->pTxCode[i]); } @@ -3344,8 +3344,8 @@ pd(p->txPreEmpEnable); pd(p->txLpfEnable); - if(p->spsTxOutA)pd(p->spsTxOutA->outputGain); - if(p->spsTxOutB)pd(p->spsTxOutB->outputGain); + if (p->spsTxOutA)pd(p->spsTxOutA->outputGain); + if (p->spsTxOutB)pd(p->spsTxOutB->outputGain); pd(p->txPttIn); pd(p->txPttOut); @@ -3363,7 +3363,7 @@ TRACEO(1,("xpmr_config()\n")); - if(o->pmrChan==NULL) + if (o->pmrChan==NULL) { ast_log(LOG_ERROR,"pmr channel structure NULL\n"); return 1; @@ -3372,7 +3372,7 @@ o->pmrChan->rxCtcss->relax = o->rxctcssrelax; o->pmrChan->txpower=0; - if(o->b.remoted) + if (o->b.remoted) { o->pmrChan->pTxCodeDefault = o->set_txctcssdefault; o->pmrChan->pRxCodeSrc=o->set_rxctcssfreqs; @@ -3396,7 +3396,7 @@ } code_string_parse(o->pmrChan); - if(o->pmrChan->rxfreq) o->pmrChan->b.reprog=1; + if (o->pmrChan->rxfreq) o->pmrChan->b.reprog=1; return 0; } @@ -3536,10 +3536,10 @@ ast_config_destroy(cfg1); } else ast_log(LOG_WARNING,"File %s not found, using default parameters.\n",fname); - if(o->wanteeprom) + if (o->wanteeprom) { ast_mutex_lock(&o->eepromlock); - while(o->eepromctl) + while (o->eepromctl) { ast_mutex_unlock(&o->eepromlock); usleep(10000); @@ -3553,7 +3553,7 @@ { char *s; - for(s = usb_device_list; *s; s += strlen(s) + 1) + for (s = usb_device_list; *s; s += strlen(s) + 1) { if (!find_desc_usb(s)) break; } @@ -3589,7 +3589,7 @@ #endif } - if(o->pmrChan==NULL) + if (o->pmrChan==NULL) { t_pmr_chan tChan; @@ -3655,14 +3655,14 @@ set_txctcss_level(o); } - if( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) && + if ( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) && (o->txmixa!=TX_OUT_COMPOSITE) && (o->txmixb!=TX_OUT_COMPOSITE) ) { ast_log(LOG_ERROR,"No txvoice output configured.\n"); } - if( o->txctcssfreq[0] && + if ( o->txctcssfreq[0] && o->txmixa!=TX_OUT_LSD && o->txmixa!=TX_OUT_COMPOSITE && o->txmixb!=TX_OUT_LSD && o->txmixb!=TX_OUT_COMPOSITE ) @@ -3670,7 +3670,7 @@ ast_log(LOG_ERROR,"No txtone output configured.\n"); } - if(o->b.radioactive) + if (o->b.radioactive) { // 20080328 sphenke asdf maw !!! // this diagnostic option was working but now appears broken @@ -3751,7 +3751,7 @@ txEnable = 0; hInput = fopen("/usr/src/xpmr/testdata/rx_in.pcm","r"); - if(!hInput){ + if (!hInput){ printf(" RxTestIt() File Not Found.\n"); return 0; } @@ -3759,21 +3759,21 @@ printf(" RxTestIt() Working...\n"); - while(!feof(hInput)) + while (!feof(hInput)) { fread((void *)iBuff,2,numSamples*2*6,hInput); - if(txHangTime)txHangTime-=numSamples; - if(txHangTime<0)txHangTime=0; + if (txHangTime)txHangTime-=numSamples; + if (txHangTime<0)txHangTime=0; - if(pChan->rxCtcss->decode)txHangTime=(8000/1000*2000); + if (pChan->rxCtcss->decode)txHangTime=(8000/1000*2000); - if(pChan->rxCtcss->decode && !txEnable) + if (pChan->rxCtcss->decode && !txEnable) { txEnable=1; //pChan->inputBlanking=(8000/1000*200); } - else if(!pChan->rxCtcss->decode && txEnable) + else if (!pChan->rxCtcss->decode && txEnable) { txEnable=0; } @@ -3787,8 +3787,8 @@ pChan->b.txCapture=0; pChan->b.rxCapture=0; - if(hInput)fclose(hInput); - if(hOutput)fclose(hOutput); + if (hInput)fclose(hInput); + if (hOutput)fclose(hOutput); printf(" RxTestIt() Complete.\n"); @@ -4002,7 +4002,7 @@ for (o = usbradio_default.next; o; o = o->next) { ast_log(LOG_WARNING, "destroyPmrChannel() called\n"); - if(o->pmrChan)destroyPmrChannel(o->pmrChan); + if (o->pmrChan)destroyPmrChannel(o->pmrChan); #if DEBUG_CAPTURES == 1 if (frxcapraw) { fclose(frxcapraw); frxcapraw = NULL; } Index: channels/iax2-parser.c =================================================================== --- channels/iax2-parser.c (revision 228266) +++ channels/iax2-parser.c (working copy) @@ -340,7 +340,7 @@ return; strcpy(output, "\n"); maxlen -= strlen(output); output += strlen(output); - while(len > 2) { + while (len > 2) { ie = iedata[0]; ielen = iedata[1]; if (ielen + 2> len) { @@ -390,7 +390,7 @@ char tmp[1024]; if (len < 2) return; - while(len > 2) { + while (len > 2) { ie = iedata[0]; ielen = iedata[1]; if (ielen + 2> len) { @@ -610,7 +610,7 @@ char *dir; char tmp[512]; - switch(rx) { + switch (rx) { case 0: dir = "Tx"; break; @@ -760,14 +760,14 @@ ies->calling_tns = -1; ies->calling_pres = -1; ies->samprate = IAX_RATE_8KHZ; - while(datalen >= 2) { + while (datalen >= 2) { ie = data[0]; len = data[1]; if (len > datalen - 2) { errorf("Information element length exceeds message size\n"); return -1; } - switch(ie) { + switch (ie) { case IAX_IE_CALLED_NUMBER: ies->called_number = (char *)data + 2; break; Index: channels/iax2-provision.c =================================================================== --- channels/iax2-provision.c (revision 228266) +++ channels/iax2-provision.c (working copy) @@ -113,7 +113,7 @@ int found; unsigned int flags = 0; char *e; - while(buf && *buf) { + while (buf && *buf) { e = strchr(buf, ','); if (e) len = e - buf; @@ -129,7 +129,7 @@ } if (e) { buf = e + 1; - while(*buf && (*buf < 33)) + while (*buf && (*buf < 33)) buf++; } else break; @@ -317,7 +317,7 @@ else cur->src[0] = '\0'; v = ast_variable_browse(cfg, s); - while(v) { + while (v) { if (!strcasecmp(v->name, "port") || !strcasecmp(v->name, "serverport")) { if ((sscanf(v->value, "%5d", &x) == 1) && (x > 0) && (x < 65535)) { if (!strcasecmp(v->name, "port")) { @@ -538,7 +538,7 @@ /* Load as appropriate */ cat = ast_category_browse(cfg, NULL); - while(cat) { + while (cat) { if (strcasecmp(cat, "general")) { iax_process_template(cfg, cat, found ? "default" : NULL); found++; Index: channels/misdn/ie.c =================================================================== --- channels/misdn/ie.c (revision 228266) +++ channels/misdn/ie.c (working copy) @@ -286,7 +286,7 @@ } i = 0; - while(i < callid_len) + while (i < callid_len) { if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", callid[i]); i++; @@ -332,7 +332,7 @@ memcpy(callid, p+1, *callid_len); i = 0; - while(i < *callid_len) + while (i < *callid_len) { if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", callid[i]); i++; Index: channels/misdn/isdn_lib.c =================================================================== --- channels/misdn/isdn_lib.c (revision 228266) +++ channels/misdn/isdn_lib.c (working copy) @@ -355,7 +355,7 @@ int i = 0; msg_t *dmsg; - while(i < 10) + while (i < 10) { dmsg = prep_l3data_msg(prim, dinfo, size, 256, NULL); if (dmsg) @@ -382,7 +382,7 @@ if (!ntmode) size = sizeof(Q931_info_t)+2; - while(i < 10) { + while (i < 10) { if (ntmode) { dmsg = prep_l3data_msg(prim, dinfo, size, 256, NULL); if (dmsg) { @@ -1350,7 +1350,7 @@ for (i=0; i<=stinf->childcnt; i++) stack->b_stids[i] = stinf->child[i]; - switch(stinf->pid.protocol[0] & ~ISDN_PID_FEATURE_MASK) { + switch (stinf->pid.protocol[0] & ~ISDN_PID_FEATURE_MASK) { case ISDN_PID_L0_TE_S0: stack->nt=0; break; @@ -1979,7 +1979,7 @@ pthread_mutex_unlock(&stack->nstlock); cb_log(5, stack->port, " --> lib: prim %x dinfo %x\n",hh->prim, hh->dinfo); - switch(hh->prim) { + switch (hh->prim) { case CC_RETRIEVE|INDICATION: { struct misdn_bchannel *hold_bc; @@ -2253,11 +2253,11 @@ break; } - if(!isdn_get_info(msgs_g, event, 1)) { + if (!isdn_get_info(msgs_g, event, 1)) { cb_log(4, stack->port, "Unknown Event Ind: prim %x dinfo %x\n", hh->prim, hh->dinfo); } else { if (reject) { - switch(bc->cause) { + switch (bc->cause) { case AST_CAUSE_USER_BUSY: cb_log(1, stack->port, "Siemens Busy reject..\n"); break; @@ -2309,7 +2309,7 @@ it = stack->nst.tlist; /* find timer */ - for(it=stack->nst.tlist; + for (it=stack->nst.tlist; it; it=it->next) { if (it->id == (int)frm->addr) @@ -2514,7 +2514,7 @@ free_msg(msg); - switch(bc->bc_state) { + switch (bc->bc_state) { case BCHAN_SETUP: bc_state_change(bc,BCHAN_SETUPED); break; @@ -2992,7 +2992,7 @@ return 0 ; } - switch(frm->prim) { + switch (frm->prim) { case DL_ESTABLISH | REQUEST: cb_log(1,stack->port,"DL_ESTABLISH|REQUEST \n"); @@ -3055,7 +3055,7 @@ return 0; } - switch(frm->prim) { + switch (frm->prim) { case MGR_SHORTSTATUS | INDICATION: case MGR_SHORTSTATUS | CONFIRM: cb_log(5, stack->port, "MGMT: Short status dinfo %x\n",frm->dinfo); @@ -4459,7 +4459,7 @@ int i; for ( help=glob_mgr->stack_list; help; help=help->next ) { - for(i=0;i<=help->b_num; i++) { + for (i=0;i<=help->b_num; i++) { char buf[1024]; mISDN_write_frame(help->midev, buf, help->bc[i].addr, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); help->bc[i].addr = 0; @@ -4771,7 +4771,7 @@ char buf[mISDN_HEADER_LEN + 128] = ""; iframe_t *frm = (iframe_t*)buf; - switch(tone) { + switch (tone) { case TONE_DIAL: manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_DIALTONE); break; @@ -4910,7 +4910,7 @@ (*bc)->conf_id=conf_id; cb_log(4, (*bc)->port, " --> bc_addr:%x\n",(*bc)->addr); - switch((*bc)->bc_state) { + switch ((*bc)->bc_state) { case BCHAN_ACTIVATED: misdn_join_conf(*bc,conf_id); break; Index: channels/misdn/isdn_msg_parser.c =================================================================== --- channels/misdn/isdn_msg_parser.c (revision 228266) +++ channels/misdn/isdn_msg_parser.c (working copy) @@ -458,7 +458,7 @@ break; } - switch(user) { + switch (user) { case 2: bc->law=INFO_CODEC_ULAW; break; @@ -1682,14 +1682,14 @@ enum event_e isdn_msg_get_event(struct isdn_msg msgs[], msg_t *msg, int nt) { int i=isdn_msg_get_index(msgs, msg, nt); - if(i>=0) return msgs[i].event; + if (i>=0) return msgs[i].event; return EVENT_UNKNOWN; } char * isdn_msg_get_info(struct isdn_msg msgs[], msg_t *msg, int nt) { int i=isdn_msg_get_index(msgs, msg, nt); - if(i>=0) return msgs[i].info; + if (i>=0) return msgs[i].info; return NULL; } @@ -1709,7 +1709,7 @@ { int i=isdn_msg_get_index_by_event(msgs, event, nt); - if(i>=0) return msgs[i].info; + if (i>=0) return msgs[i].info; if (event == EVENT_CLEANUP) return EVENT_CLEAN_INFO; if (event == EVENT_DTMF_TONE) return EVENT_DTMF_TONE_INFO; @@ -1728,7 +1728,7 @@ int isdn_msg_parse_event(struct isdn_msg msgs[], msg_t *msg, struct misdn_bchannel *bc, int nt) { int i=isdn_msg_get_index(msgs, msg, nt); - if(i<0) return -1; + if (i<0) return -1; msgs[i].msg_parser(msgs, msg, bc, nt); return 0; @@ -1737,7 +1737,7 @@ msg_t * isdn_msg_build_event(struct isdn_msg msgs[], struct misdn_bchannel *bc, enum event_e event, int nt) { int i=isdn_msg_get_index_by_event(msgs, event, nt); - if(i<0) return NULL; + if (i<0) return NULL; return msgs[i].msg_builder(msgs, bc, nt); } Index: channels/misdn/portinfo.c =================================================================== --- channels/misdn/portinfo.c (revision 228266) +++ channels/misdn/portinfo.c (working copy) @@ -38,7 +38,7 @@ } /* loop the number of cards and get their info */ - while(i <= ii) + while (i <= ii) { err = mISDN_get_stack_info(device, i, buff, sizeof(buff)); if (err <= 0) @@ -53,7 +53,7 @@ /* output the port info */ printf("Port %2d: ", i); - switch(stinf->pid.protocol[0] & ~ISDN_PID_FEATURE_MASK) + switch (stinf->pid.protocol[0] & ~ISDN_PID_FEATURE_MASK) { case ISDN_PID_L0_TE_S0: printf("TE-mode BRI S/T interface line (for phone lines)"); @@ -115,7 +115,7 @@ printf(" -> Missing layer 1 NT-mode protocol.\n"); } p = 2; - while(p <= MAX_LAYER_NR) { + while (p <= MAX_LAYER_NR) { if (stinf->pid.protocol[p]) { useable = 0; @@ -153,7 +153,7 @@ } else { printf(" -> Protocol: "); - switch(stinf->pid.protocol[3] & ~ISDN_PID_FEATURE_MASK) + switch (stinf->pid.protocol[3] & ~ISDN_PID_FEATURE_MASK) { case ISDN_PID_L3_DSS1USER: printf("DSS1 (Euro ISDN)"); @@ -166,7 +166,7 @@ printf("\n"); } p = 4; - while(p <= MAX_LAYER_NR) { + while (p <= MAX_LAYER_NR) { if (stinf->pid.protocol[p]) { useable = 0; Index: channels/misdn_config.c =================================================================== --- channels/misdn_config.c (revision 228266) +++ channels/misdn_config.c (working copy) @@ -1071,7 +1071,7 @@ if (!ast_strlen_zero(misdn_init)) { fp = fopen(misdn_init, "r"); if (fp) { - while(fgets(line, sizeof(line), fp)) { + while (fgets(line, sizeof(line), fp)) { if (!strncmp(line, "nt_ptp", 6)) { for (tok = strtok_r(line,",=", &p); tok; @@ -1197,7 +1197,7 @@ cat = ast_category_browse(cfg, NULL); - while(cat) { + while (cat) { v = ast_variable_browse(cfg, cat); if (!strcasecmp(cat, "general")) { _build_general_config(v); Index: channels/xpmr/xpmr.c =================================================================== --- channels/xpmr/xpmr.c (revision 228266) +++ channels/xpmr/xpmr.c (working copy) @@ -81,7 +81,7 @@ void strace(i16 point, t_sdbg *sdbg, i16 idx, i16 value) { // make dbg_trace buffer in structure - if(!sdbg->mode || sdbg->point[point]<0){ + if (!sdbg->mode || sdbg->point[point]<0){ return; } else { sdbg->buffer[(idx*XPMR_DEBUG_CHANS) + sdbg->point[point]] = value; @@ -93,12 +93,12 @@ void strace2(t_sdbg *sdbg) { int i; - for(i=0;isource[i]) + if (sdbg->source[i]) { int ii; - for(ii=0;iibuffer[ii*XPMR_DEBUG_CHANS + i] = sdbg->source[i][ii]; } @@ -126,14 +126,14 @@ */ void pptp_write(i16 bit, i16 state) { - if(bit==0) + if (bit==0) { - if(state)ioctl(ppdrvdev,PPDRV_IOC_PINSET,DTX_TP1); + if (state)ioctl(ppdrvdev,PPDRV_IOC_PINSET,DTX_TP1); else ioctl(ppdrvdev,PPDRV_IOC_PINCLEAR,DTX_TP1); } else { - if(state)ioctl(ppdrvdev,PPDRV_IOC_PINSET,DTX_TP2); + if (state)ioctl(ppdrvdev,PPDRV_IOC_PINSET,DTX_TP2); else ioctl(ppdrvdev,PPDRV_IOC_PINCLEAR,DTX_TP2); } } @@ -164,15 +164,15 @@ p=0; numsub=0; - for(i=0;ib.dstRxEnable=pChan->b.dstTxEnable=0; pChan->b.p25RxEnable=pChan->b.p25TxEnable=0; - if(pChan->spsLsdGen){ + if (pChan->spsLsdGen){ pChan->spsLsdGen->enabled=0; pChan->spsLsdGen->state=0; } @@ -241,7 +241,7 @@ pChan->numrxcodes = string_parse( pChan->pRxCodeSrc, &(pChan->pRxCodeStr), &(pChan->pRxCode)); pChan->numtxcodes = string_parse( pChan->pTxCodeSrc, &(pChan->pTxCodeStr), &(pChan->pTxCode)); - if(pChan->numrxcodes!=pChan->numtxcodes)printf("ERROR: numrxcodes != numtxcodes \n"); + if (pChan->numrxcodes!=pChan->numtxcodes)printf("ERROR: numrxcodes != numtxcodes \n"); pChan->rxCtcss->enabled=0; pChan->rxCtcss->gain=1*M_Q8; @@ -250,11 +250,11 @@ pChan->rxCtcss->decode=CTCSS_NULL; pChan->rxCtcss->testIndex=0; - if(!pChan->rxCtcss->testIndex)pChan->rxCtcss->testIndex=3; + if (!pChan->rxCtcss->testIndex)pChan->rxCtcss->testIndex=3; pChan->rxctcssfreq[0]=0; // decode now CTCSS_RXONLY - for(i=0;irxctcss[i]=0; pChan->txctcss[i]=0; @@ -268,7 +268,7 @@ #endif // Do Receive Codes String - for(i=0;inumrxcodes;i++) + for (i=0;inumrxcodes;i++) { i16 ri,_ti; float _f; @@ -276,25 +276,25 @@ p=pChan->pStr=pChan->pRxCode[i]; #ifdef HAVE_XPMRX - if(!xpmrx(pChan,XXO_LSDCODEPARSE_1)) + if (!xpmrx(pChan,XXO_LSDCODEPARSE_1)) #endif { sscanf(p, "%30f", &_f); ri=CtcssFreqIndex(_f); - if(ri>maxctcssindex)maxctcssindex=ri; + if (ri>maxctcssindex)maxctcssindex=ri; sscanf(pChan->pTxCode[i], "%30f", &_f); _ti=CtcssFreqIndex(_f); - if(_f>maxctcsstxfreq)maxctcsstxfreq=_f; + if (_f>maxctcsstxfreq)maxctcsstxfreq=_f; - if(ri>CTCSS_NULL && _ti>CTCSS_NULL) + if (ri>CTCSS_NULL && _ti>CTCSS_NULL) { pChan->b.ctcssRxEnable=pChan->b.ctcssTxEnable=1; pChan->rxCtcssMap[ri]=_ti; pChan->numrxctcssfreqs++; TRACEF(1,("pChan->rxctcss[%i]=%s pChan->rxCtcssMap[%i]=%i\n",i,pChan->rxctcss[i],ri,_ti)); } - else if(ri>CTCSS_NULL && _f==0) + else if (ri>CTCSS_NULL && _f==0) { pChan->b.ctcssRxEnable=1; pChan->rxCtcssMap[ri]=CTCSS_RXONLY; @@ -305,14 +305,14 @@ { i16 _ii; pChan->numrxctcssfreqs=0; - for(_ii=0;_iirxCtcssMap[_ii]=CTCSS_NULL; + for (_ii=0;_iirxCtcssMap[_ii]=CTCSS_NULL; TRACEF(1,("WARNING: Invalid Channel code detected and ignored. %i %s %s \n",i,pChan->pRxCode[i],pChan->pTxCode[i])); } } } TRACEF(1,("code_string_parse() CTCSS Init Struct %i %i\n",pChan->b.ctcssRxEnable,pChan->b.ctcssTxEnable)); - if(pChan->b.ctcssRxEnable) + if (pChan->b.ctcssRxEnable) { pChan->rxHpfEnable=1; pChan->spsRxLsdNrz->enabled=pChan->rxCenterSlicerEnable=1; @@ -328,7 +328,7 @@ } TRACEF(1,("code_string_parse() CTCSS Init Decoders \n")); - for(i=0;irxCtcss->tdet[i]); @@ -347,14 +347,14 @@ p=pChan->pStr=pChan->pTxCodeDefault; #ifdef HAVE_XPMRX - if(!lsd_code_parse(pChan,3)) + if (!lsd_code_parse(pChan,3)) #endif { sscanf(p, "%30f", &f); ti=CtcssFreqIndex(f); - if(f>maxctcsstxfreq)maxctcsstxfreq=f; + if (f>maxctcsstxfreq)maxctcsstxfreq=f; - if(ti>CTCSS_NULL) + if (ti>CTCSS_NULL) { pChan->b.ctcssTxEnable=1; pChan->txctcssdefault_index=ti; @@ -369,8 +369,8 @@ // set x for maximum length and just change pointers TRACEF(1,("code_string_parse() Filter Config \n")); pSps=pChan->spsTxLsdLpf; - if(pSps->x)free(pSps->x); - if(maxctcsstxfreq>203.5) + if (pSps->x)free(pSps->x); + if (maxctcsstxfreq>203.5) { pSps->ncoef=taps_fir_lpf_250_9_66; pSps->size_coef=2; @@ -396,14 +396,14 @@ // CTCSS Rx Decoder Low Pass Filter hit=0; ii= CtcssFreqIndex(203.5); - for(i=ii;irxCtcssMap[i]>CTCSS_NULL)hit=1; + if (pChan->rxCtcssMap[i]>CTCSS_NULL)hit=1; } pSps=pChan->spsRxLsd; - if(pSps->x)free(pSps->x); - if(hit) + if (pSps->x)free(pSps->x); + if (hit) { pSps->ncoef=taps_fir_lpf_250_9_66; pSps->size_coef=2; @@ -426,7 +426,7 @@ TRACEF(1,("code_string_parse() Rx Filter Freq Low\n")); } - if(pChan->b.ctcssRxEnable || pChan->b.dcsRxEnable || pChan->b.lmrRxEnable) + if (pChan->b.ctcssRxEnable || pChan->b.dcsRxEnable || pChan->b.lmrRxEnable) { pChan->rxCenterSlicerEnable=1; pSps->enabled=1; @@ -443,7 +443,7 @@ TRACEF(2,(" dcsRxEnable = %i \n",pChan->b.dcsRxEnable)); TRACEF(2,(" lmrRxEnable = %i \n",pChan->b.lmrRxEnable)); TRACEF(2,(" txcodedefaultsmode = %i \n",pChan->txcodedefaultsmode)); - for(i=0;irxCtcssMap[i])); } @@ -464,8 +464,8 @@ { i16 i,hit=CTCSS_NULL; - for(i=0;ienabled)return(1); + if (!mySps->enabled)return(1); decimator = mySps->decimator; decimate = mySps->decimate; @@ -519,64 +519,64 @@ x=mySps->x; iOutput=0; - if(mySps->parentChan->rxCdType!=CD_XPMR_VOX)doNoise=1; + if (mySps->parentChan->rxCdType!=CD_XPMR_VOX)doNoise=1; else doNoise=0; - for(i=0;i0; n--) + for (n=nx-1; n>0; n--) x[n] = x[n-1]; x[0] = input[i*2]; --decimator; - if(decimator<=0) + if (decimator<=0) { decimator=decimate; y=0; - for(n=0; n32767)y=32767; - else if(y<-32767)y=-32767; + if (y>32767)y=32767; + else if (y<-32767)y=-32767; output[iOutput]=y; // Rx Baseband decimated noutput[iOutput++] = apeak; // Rx Noise } - if(doNoise) + if (doNoise) { // calculate noise output naccum=0; - for(n=0; namax) + if (naccum>amax) { amax=naccum; discounteru=discfactor; } - else if(--discounteru<=0) + else if (--discounteru<=0) { discounteru=discfactor; amax=(i32)((amax*32700)/32768); } - if(naccumparentChan))->rxRssi=apeak; - if(apeak>setpt || (compOut&&(apeak>(setpt-hyst)))) compOut=1; + if (apeak>setpt || (compOut&&(apeak>(setpt-hyst)))) compOut=1; else compOut=0; mySps->compOut=compOut; mySps->amax=amax; @@ -620,7 +620,7 @@ TRACEJ(5,("pmr_gp_fir() %i %i\n",mySps->index, mySps->enabled)); - if(!mySps->enabled)return(1); + if (!mySps->enabled)return(1); inputGain = mySps->inputGain; calcAdjust = mySps->calcAdjust; @@ -654,13 +654,13 @@ setpt=mySps->setpt; nsamples=mySps->nSamples; - if(mySps->option==3) + if (mySps->option==3) { mySps->option=0; mySps->enabled=0; - for(i=0;i0; n--) + for (n=nx-1; n>0; n--) x[n] = x[n-1]; x[0] = (input[i]*inputGain)/M_Q8; #if 0 --decimator; - if(decimator<=0) + if (decimator<=0) { decimator=decimate; - for(n=0; namax) + if (accum>amax) { amax=accum; discounteru=discfactor; } - else if(--discounteru<=0) + else if (--discounteru<=0) { discounteru=discfactor; amax=(i32)((amax*32700)/32768); } - if(accumsetpt)compOut=1; - else if(compOut&&(apeak<(setpt-hyst)))compOut=0; + if (apeak>setpt)compOut=1; + else if (compOut&&(apeak<(setpt-hyst)))compOut=0; } } @@ -787,7 +787,7 @@ i16 coeff00, coeff01; TRACEJ(5,("gp_inte_00() %i\n",mySps->enabled)); - if(!mySps->enabled)return(1); + if (!mySps->enabled)return(1); input = mySps->source; output = mySps->sink; @@ -805,7 +805,7 @@ // note fixed gain of 2 to compensate for attenuation // in passband - for(i=0;i32766)_y0=32766; - else if(_y0<-32766)_y0=-32766; + if (_y0>32766)_y0=32766; + else if (_y0<-32766)_y0=-32766; output[i]=_y0; } @@ -893,7 +893,7 @@ i32 discfactor; // amplitude detector integrator discharge factor TRACEJ(5,("CenterSlicer() %i\n",mySps->enabled)); - if(!mySps->enabled)return(1); + if (!mySps->enabled)return(1); input = mySps->source; output = mySps->sink; // limited output @@ -915,7 +915,7 @@ discfactor=mySps->discfactor; npoints=mySps->nSamples; - for(i=0;iamax) + if (accum>amax) { amax=accum; uhit=1; - if(amin<(amax-setpt)) + if (amin<(amax-setpt)) { amin=(amax-setpt); lhit=1; } } - else if(accum(amin+setpt)) + if (amax>(amin+setpt)) { amax=(amin+setpt); uhit=1; } } #if 0 - if((discounteru-=1)<=0 && amax>amin) + if ((discounteru-=1)<=0 && amax>amin) { - if((amax-=10)amax)amin=amax; + if ((amin+=10)>amax)amin=amax; lhit=1; } - if(uhit)discounteru=discfactor; - if(lhit)discounterl=discfactor; + if (uhit)discounteru=discfactor; + if (lhit)discounterl=discfactor; #else - if((amax-=discfactor)amax)amin=amax; + if ((amax-=discfactor)amax)amin=amax; #endif @@ -973,21 +973,21 @@ output[i]=accum; // sink output unlimited/centered. // do limiter function - if(accum>inputGainB)accum=inputGainB; - else if(accum<-inputGainB)accum=-inputGainB; + if (accum>inputGainB)accum=inputGainB; + else if (accum<-inputGainB)accum=-inputGainB; buff[i]=accum; #if XPMR_DEBUG0 == 1 #if 0 mySps->parentChan->pRxLsdCen[i]=center; // trace center ref #else - if((tfx++/8)&1) // trace min/max levels + if ((tfx++/8)&1) // trace min/max levels mySps->parentChan->pRxLsdCen[i]=amax; else mySps->parentChan->pRxLsdCen[i]=amin; #endif #if 0 - if(mySps->parentChan->frameCountRx&0x01) mySps->parentChan->prxDebug1[i]=amax; + if (mySps->parentChan->frameCountRx&0x01) mySps->parentChan->prxDebug1[i]=amax; else mySps->parentChan->prxDebug1[i]=amin; #endif #endif @@ -1025,9 +1025,9 @@ TRACEJ(5,("MeasureBlock() %i\n",mySps->enabled)); - if(!mySps->enabled)return 1; + if (!mySps->enabled)return 1; - if(mySps->option==3) + if (mySps->option==3) { mySps->amax = mySps->amin = mySps->apeak = \ mySps->discounteru = mySps->discounterl = \ @@ -1052,34 +1052,34 @@ discfactor=mySps->discfactor; npoints=mySps->nSamples; - for(i=0;iamax) + if (accum>amax) { amax=accum; discounteru=discfactor; } - else if(--discounteru<=0) + else if (--discounteru<=0) { discounteru=discfactor; amax=(i32)((amax*32700)/32768); } - if(accumamax=amax; @@ -1087,7 +1087,7 @@ mySps->apeak=apeak; mySps->discounteru=discounteru; mySps->discounterl=discounterl; - if(apeak>=setpt) mySps->compOut=1; + if (apeak>=setpt) mySps->compOut=1; else mySps->compOut=0; //TRACEX((" -MeasureBlock()=%i\n",mySps->apeak)); @@ -1127,24 +1127,24 @@ TRACEJ(5,("SoftLimiter() %i %i %i) \n",amin, amax,setpt)); - for(i=0;iinputGain/256; - if(accum>setpt) + if (accum>setpt) { tmp=((accum-setpt)*4)/128; accum=setpt+tmp; - if(accum>amax)accum=amax; + if (accum>amax)accum=amax; compOut=1; accum=setpt; } - else if(accum<-setpt) + else if (accum<-setpt) { tmp=((accum+setpt)*4)/128; accum=(-setpt)-tmp; - if(accumparentChan; TRACEC(5,("SigGen(%i %i %i)\n",mySps->option,mySps->enabled,mySps->state)); - if(!mySps->freq ||!mySps->enabled)return 0; + if (!mySps->freq ||!mySps->enabled)return 0; outputgain=mySps->outputGain; waveform=0; numChanOut=mySps->numChanOut; selChanOut=mySps->selChanOut; - if(mySps->option==1) + if (mySps->option==1) { mySps->option=0; mySps->state=1; @@ -1190,9 +1190,9 @@ (SAMPLES_PER_SINE*mySps->freq*PH_FRACT_FACT)/mySps->sampleRate/10; TRACEF(5,(" SigGen() discfactor = %i\n",mySps->discfactor)); - if(mySps->discounterl)mySps->state=2; + if (mySps->discounterl)mySps->state=2; } - else if(mySps->option==2) + else if (mySps->option==2) { i16 shiftfactor=CTCSS_TURN_OFF_SHIFT; // phase shift request @@ -1205,36 +1205,36 @@ //printf("shiftfactor = %i\n",shiftfactor); //shiftfactor+=10; } - else if(mySps->option==3) + else if (mySps->option==3) { // stop it and clear the output buffer mySps->option=0; mySps->state=0; mySps->enabled=0; - for(i=0;inSamples;i++) + for (i=0;inSamples;i++) mySps->sink[(i*numChanOut)+selChanOut]=0; return(0); } - else if(mySps->state==2) + else if (mySps->state==2) { // doing turn off mySps->discounterl-=MS_PER_FRAME; - if(mySps->discounterl<=0) + if (mySps->discounterl<=0) { mySps->option=3; mySps->state=2; } } - else if(mySps->state==0) + else if (mySps->state==0) { return(0); } ph=mySps->discounteru; - for(i=0;inSamples;i++) + for (i=0;inSamples;i++) { - if(!waveform) + if (!waveform) { // sine //tmp=(sinetablex[ph/PH_FRACT_FACT]*amplitude)/M_Q16; @@ -1244,13 +1244,13 @@ else { // square - if(ph>SAMPLES_PER_SINE/2) + if (ph>SAMPLES_PER_SINE/2) accum=outputgain/M_Q8; else accum=-outputgain/M_Q8; } - if(mySps->source)accum+=mySps->source[i]; + if (mySps->source)accum+=mySps->source[i]; mySps->sink[(i*numChanOut)+selChanOut]=accum; @@ -1297,7 +1297,7 @@ npoints=mySps->nSamples; measPeak=mySps->measPeak; - for(i=0;iamax){ + if (accum>amax){ amax=accum; uhit=1; - if(amin<(amax-setpt)){ + if (amin<(amax-setpt)){ amin=(amax-setpt); lhit=1; } } - else if(accum(amin+setpt)){ + if (amax>(amin+setpt)){ amax=(amin+setpt); uhit=1; } } - if(--discounteru<=0 && amax>0){ + if (--discounteru<=0 && amax>0){ amax--; uhit=1; } - if(--discounterl<=0 && amin<0){ + if (--discounterl<=0 && amin<0){ amin++; lhit=1; } - if(uhit)discounteru=discfactor; - if(lhit)discounterl=discfactor; + if (uhit)discounteru=discfactor; + if (lhit)discounterl=discfactor; } } - if(measPeak){ + if (measPeak){ apeak = (amax-amin)/2; mySps->apeak=apeak; mySps->amax=amax; @@ -1372,7 +1372,7 @@ outindex = mySps->buffOutIndex; inindex = outindex + mySps->buffLead; - for(i=0;irxCtcss->testIndex, pChan->rxCtcss->decode)); - if(!pChan->rxCtcss->enabled)return(1); + if (!pChan->rxCtcss->enabled)return(1); relax = pChan->rxCtcss->relax; pInput = pChan->rxCtcss->input; gain = pChan->rxCtcss->gain; - if(relax) difftrig=(-0.1*M_Q15); + if (relax) difftrig=(-0.1*M_Q15); else difftrig=(-0.05*M_Q15); thit=hit=-1; //TRACEX((" ctcss_detect() %i %i %i %i\n", CTCSS_NUM_CODES,0,0,0)); - for(tnum=0;tnumrxCtcssMap[tnum])); - //if(tnum==14)printf("ctcss_detect() %i %i %i\n",tnum,pChan->rxCtcssMap[tnum], pChan->rxCtcss->decode ); + //if (tnum==14)printf("ctcss_detect() %i %i %i\n",tnum,pChan->rxCtcssMap[tnum], pChan->rxCtcss->decode ); - if( (pChan->rxCtcssMap[tnum]==CTCSS_NULL) || + if ( (pChan->rxCtcssMap[tnum]==CTCSS_NULL) || (pChan->rxCtcss->decode>CTCSS_NULL && (tnum!= pChan->rxCtcss->decode)) ) continue; @@ -1440,7 +1440,7 @@ fudgeFactor=ptdet->fudgeFactor; binFactor=ptdet->binFactor; - while(ptdet->counter < (points2do*CTCSS_SCOUNT_MUL)) + while (ptdet->counter < (points2do*CTCSS_SCOUNT_MUL)) { tmp=(ptdet->counter/CTCSS_SCOUNT_MUL)+1; ptdet->counter-=(tmp*CTCSS_SCOUNT_MUL); @@ -1475,27 +1475,27 @@ diffpeak = (temp0 + temp1)/1024; } - if(diffpeak<(-0.03*M_Q15))ptdet->dvd-=4; - else if(ptdet->dvd<0)ptdet->dvd++; + if (diffpeak<(-0.03*M_Q15))ptdet->dvd-=4; + else if (ptdet->dvd<0)ptdet->dvd++; - if((ptdet->dvd < -12) && diffpeak > (-0.02*M_Q15))ptdet->dvu+=2; - else if(ptdet->dvu)ptdet->dvu--; + if ((ptdet->dvd < -12) && diffpeak > (-0.02*M_Q15))ptdet->dvu+=2; + else if (ptdet->dvu)ptdet->dvu--; tmp=ptdet->setpt; - if(pChan->rxCtcss->decode==tnum) + if (pChan->rxCtcss->decode==tnum) { - if(relax)tmp=(tmp*55)/100; + if (relax)tmp=(tmp*55)/100; else tmp=(tmp*80)/100; } - if(ptdet->peak > tmp) + if (ptdet->peak > tmp) { - if(ptdet->decode<(fudgeFactor*32))ptdet->decode++; + if (ptdet->decode<(fudgeFactor*32))ptdet->decode++; } - else if(pChan->rxCtcss->decode==tnum) + else if (pChan->rxCtcss->decode==tnum) { - if(ptdet->peak > ptdet->hyst)ptdet->decode--; - else if(relax) ptdet->decode--; + if (ptdet->peak > ptdet->hyst)ptdet->decode--; + else if (relax) ptdet->decode--; else ptdet->decode-=4; } else @@ -1503,36 +1503,36 @@ ptdet->decode=0; } - if((pChan->rxCtcss->decode==tnum) && !relax && (ptdet->dvu > (0.00075*M_Q15))) + if ((pChan->rxCtcss->decode==tnum) && !relax && (ptdet->dvu > (0.00075*M_Q15))) { ptdet->decode=0; ptdet->z[0]=ptdet->z[1]=ptdet->z[2]=ptdet->z[3]=ptdet->dvu=0; TRACEF(4,("ctcss_detect() turnoff detected by dvdt for tnum = %i.\n",tnum)); } - if(ptdet->decode<0 || !pChan->rxCarrierDetect)ptdet->decode=0; + if (ptdet->decode<0 || !pChan->rxCarrierDetect)ptdet->decode=0; - if(ptdet->decode>=fudgeFactor) + if (ptdet->decode>=fudgeFactor) { thit=tnum; - if(pChan->rxCtcss->decode!=tnum) + if (pChan->rxCtcss->decode!=tnum) { ptdet->zd=ptdet->dvu=ptdet->dvd=0; } } #if XPMR_DEBUG0 == 1 - if(thit>=0 && thit==tnum) + if (thit>=0 && thit==tnum) TRACEF(6,(" ctcss_detect() %i %i %i %i \n",tnum,ptdet->peak,ptdet->setpt,ptdet->hyst)); - if(ptdet->pDebug0) + if (ptdet->pDebug0) { tv0=ptdet->peak; tv1=ptdet->decode; tv2=tmp; tv3=ptdet->dvu*32; - if(indexDebug==0) + if (indexDebug==0) { ptdet->lasttv0=ptdet->pDebug0[points-1]; ptdet->lasttv1=ptdet->pDebug1[points-1]; @@ -1540,7 +1540,7 @@ ptdet->lasttv3=ptdet->pDebug3[points-1]; } - while(indexDebugpDebug0[indexDebug]=ptdet->lasttv0; ptdet->pDebug1[indexDebug]=ptdet->lasttv1; @@ -1560,7 +1560,7 @@ ptdet->counter-=(points2do*CTCSS_SCOUNT_MUL); #if XPMR_DEBUG0 == 1 - for(i=indexWas;ipDebug0[i]=ptdet->lasttv0; ptdet->pDebug1[i]=ptdet->lasttv1; @@ -1572,22 +1572,22 @@ //TRACEX((" ctcss_detect() thit %i\n",thit)); - if(pChan->rxCtcss->BlankingTimer>0)pChan->rxCtcss->BlankingTimer-=points; - if(pChan->rxCtcss->BlankingTimer<0)pChan->rxCtcss->BlankingTimer=0; + if (pChan->rxCtcss->BlankingTimer>0)pChan->rxCtcss->BlankingTimer-=points; + if (pChan->rxCtcss->BlankingTimer<0)pChan->rxCtcss->BlankingTimer=0; - if(thit>CTCSS_NULL && pChan->rxCtcss->decode<=CTCSS_NULL && !pChan->rxCtcss->BlankingTimer) + if (thit>CTCSS_NULL && pChan->rxCtcss->decode<=CTCSS_NULL && !pChan->rxCtcss->BlankingTimer) { pChan->rxCtcss->decode=thit; sprintf(pChan->rxctcssfreq,"%.1f",freq_ctcss[thit]); TRACEC(1,("ctcss decode %i %.1f\n",thit,freq_ctcss[thit])); } - else if(thit<=CTCSS_NULL && pChan->rxCtcss->decode>CTCSS_NULL) + else if (thit<=CTCSS_NULL && pChan->rxCtcss->decode>CTCSS_NULL) { pChan->rxCtcss->BlankingTimer=SAMPLE_RATE_NETWORK/5; pChan->rxCtcss->decode=CTCSS_NULL; strcpy(pChan->rxctcssfreq,"0"); TRACEC(1,("ctcss decode NULL\n")); - for(tnum=0;tnumrxCtcss->tdet[tnum]); @@ -1603,7 +1603,7 @@ */ static i16 TxTestTone(t_pmr_chan *pChan, i16 function) { - if(function==1) + if (function==1) { pChan->spsSigGen1->enabled=1; pChan->spsSigGen1->option=1; @@ -1632,7 +1632,7 @@ TRACEJ(1,("createPmrChannel(%p,%i)\n",tChan,numSamples)); pChan = (t_pmr_chan *)calloc(sizeof(t_pmr_chan),1); - if(pChan==NULL) + if (pChan==NULL) { printf("createPmrChannel() failed\n"); return(NULL); @@ -1650,10 +1650,10 @@ pChan->rxctcssfreq[0]=0; #ifdef HAVE_XPMRX - if(tChan->rptnum>=LSD_CHAN_MAX)tChan->rptnum=0; + if (tChan->rptnum>=LSD_CHAN_MAX)tChan->rptnum=0; #endif - if(tChan==NULL) + if (tChan==NULL) { printf("createPmrChannel() WARNING: NULL tChan!\n"); pChan->rxNoiseSquelchEnable=0; @@ -1714,23 +1714,23 @@ pChan->txHpfEnable=1; pChan->txLpfEnable=1; - if(pChan->rxCdType==CD_XPMR_NOISE) pChan->rxNoiseSquelchEnable=1; + if (pChan->rxCdType==CD_XPMR_NOISE) pChan->rxNoiseSquelchEnable=1; - if(pChan->rxDemod==RX_AUDIO_FLAT) pChan->rxDeEmpEnable=1; + if (pChan->rxDemod==RX_AUDIO_FLAT) pChan->rxDeEmpEnable=1; pChan->rxCarrierPoint=(pChan->rxSquelchPoint*32767)/100; pChan->rxCarrierHyst = 3000; //pChan->rxCarrierPoint/15; pChan->rxDcsDecodeEnable=0; - if(pChan->b.ctcssRxEnable || pChan->b.dcsRxEnable || pChan->b.lmrRxEnable) + if (pChan->b.ctcssRxEnable || pChan->b.dcsRxEnable || pChan->b.lmrRxEnable) { pChan->rxHpfEnable=1; pChan->rxCenterSlicerEnable=1; pChan->rxCtcssDecodeEnable=1; } - if(pChan->txMod){ + if (pChan->txMod){ pChan->txPreEmpEnable=1; pChan->txLimiterEnable=1; } @@ -1784,14 +1784,14 @@ pChan->ptxDebug3 = calloc(numSamples,2); pChan->pNull = calloc(numSamples,2); - for(i=0;ipNull[i]=((i%(numSamples/2))*8000)-4000; + for (i=0;ipNull[i]=((i%(numSamples/2))*8000)-4000; pChan->rxCtcss->pDebug0=calloc(numSamples,2); pChan->rxCtcss->pDebug1=calloc(numSamples,2); pChan->rxCtcss->pDebug2=calloc(numSamples,2); pChan->rxCtcss->pDebug3=calloc(numSamples,2); - for(i=0;irxCtcss->tdet[i].pDebug0=calloc(numSamples,2); pChan->rxCtcss->tdet[i].pDebug1=calloc(numSamples,2); @@ -1806,11 +1806,11 @@ // TSCOPE CONFIGURATION SETSCOPE configure debug traces and sources for each channel of the output pChan->sdbg = (t_sdbg *)calloc(sizeof(t_sdbg),1); - for(i=0;isdbg->trace[i]=-1; + for (i=0;isdbg->trace[i]=-1; TRACEF(1,("pChan->tracetype = %i\n",pChan->tracetype)); - if(pChan->tracetype==1) // CTCSS DECODE + if (pChan->tracetype==1) // CTCSS DECODE { pChan->sdbg->source [0]=pChan->pRxDemod; pChan->sdbg->source [1]=pChan->pRxBase; @@ -1823,7 +1823,7 @@ pChan->sdbg->trace [8]=RX_CTCSS_DECODE; pChan->sdbg->trace [9]=RX_SMODE; } - if(pChan->tracetype==2) // CTCSS DECODE + if (pChan->tracetype==2) // CTCSS DECODE { pChan->sdbg->source [0]=pChan->pRxDemod; pChan->sdbg->source [1]=pChan->pRxBase; @@ -1842,7 +1842,7 @@ pChan->sdbg->trace [14]=TX_PTT_OUT; pChan->sdbg->source [15]=pChan->pTxLsdLpf; } - else if(pChan->tracetype==3) // DCS DECODE + else if (pChan->tracetype==3) // DCS DECODE { pChan->sdbg->source [0]=pChan->pRxDemod; pChan->sdbg->source [1]=pChan->pRxBase; @@ -1862,7 +1862,7 @@ pChan->sdbg->source [14]=pChan->pTxLsd; pChan->sdbg->source [15]=pChan->pTxLsdLpf; } - else if(pChan->tracetype==4) // LSD DECODE + else if (pChan->tracetype==4) // LSD DECODE { pChan->sdbg->source [0]=pChan->pRxDemod; pChan->sdbg->source [1]=pChan->pRxBase; @@ -1883,7 +1883,7 @@ //pChan->sdbg->source [14]=pChan->pTxLsd; pChan->sdbg->source [15]=pChan->pTxLsdLpf; } - else if(pChan->tracetype==5) // LSD LOGIC + else if (pChan->tracetype==5) // LSD LOGIC { pChan->sdbg->source [0]=pChan->pRxBase; pChan->sdbg->trace [1]=RX_NOISE_TRIG; @@ -1894,7 +1894,7 @@ pChan->sdbg->trace [6]=TX_PTT_OUT; pChan->sdbg->source [7]=pChan->pTxLsdLpf; } - else if(pChan->tracetype==6) + else if (pChan->tracetype==6) { // tx clock skew and jitter buffer pChan->sdbg->source [0]=pChan->pRxDemod; @@ -1904,7 +1904,7 @@ pChan->sdbg->trace [8]=TX_DEDRIFT_FACTOR; pChan->sdbg->trace [9]=TX_DEDRIFT_DRIFT; } - else if(pChan->tracetype==7) + else if (pChan->tracetype==7) { // tx path pChan->sdbg->source [0]=pChan->pRxBase; @@ -1924,8 +1924,8 @@ pChan->sdbg->source [12]=pChan->pTxLsdLpf; } - for(i=0;isdbg->trace[i]>=0)pChan->sdbg->point[pChan->sdbg->trace[i]]=i; + for (i=0;isdbg->trace[i]>=0)pChan->sdbg->point[pChan->sdbg->trace[i]]=i; } pChan->sdbg->mode=1; #endif @@ -2005,7 +2005,7 @@ TRACEF(1,("spsTxLsdLpf = sps \n")); - if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); + if (pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); // RX Process @@ -2101,7 +2101,7 @@ pSps->nx=taps_fir_hpf_300_9_66; pSps->size_x=2; pSps->x=(void*)(calloc(pSps->nx,pSps->size_x)); - if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); + if (pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); pSps->calcAdjust=gain_fir_hpf_300_9_66; pSps->inputGain=(1*M_Q8); pSps->outputGain=(1*M_Q8); @@ -2110,7 +2110,7 @@ // allocate space for next sps and set pointers // Rx DeEmp - if(pChan->rxDeEmpEnable){ + if (pChan->rxDeEmpEnable){ pSps=pSps->nextSps=createPmrSps(pChan); pChan->spsRxDeEmp=pSps; pSps->source=pChan->pRxHpf; @@ -2127,7 +2127,7 @@ pSps->nx=taps_int_lpf_300_1_2; pSps->size_x=4; pSps->x=(void*)(calloc(pSps->nx,pSps->size_x)); - if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); + if (pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); pSps->calcAdjust=gain_int_lpf_300_1_2/2; pSps->inputGain=(1.0*M_Q8); pSps->outputGain=(1.0*M_Q8); @@ -2135,7 +2135,7 @@ pChan->prxVoiceAdjust=&(pSps->outputGain); } - if(pChan->rxDelayLineEnable) + if (pChan->rxDelayLineEnable) { TRACEF(1,("create delayline\n")); pSps=pChan->spsDelayLine=pSps->nextSps=createPmrSps(pChan); @@ -2152,7 +2152,7 @@ pSps->buffOutIndex=0; } - if(pChan->rxCdType==CD_XPMR_VOX) + if (pChan->rxCdType==CD_XPMR_VOX) { TRACEF(1,("create vox measureblock\n")); pChan->prxVoxMeas=calloc(pChan->nSamplesRx,2); @@ -2166,7 +2166,7 @@ pSps->outputGain=1*M_Q8; pSps->nSamples=pChan->nSamplesRx; pSps->discfactor=3; - if(pChan->rxSqVoxAdj==0) + if (pChan->rxSqVoxAdj==0) pSps->setpt=(0.011*M_Q15); else pSps->setpt=(pChan->rxSqVoxAdj); @@ -2194,7 +2194,7 @@ // allocate space for first sps and set pointers // Tx HPF SubAudible - if(pChan->txHpfEnable) + if (pChan->txHpfEnable) { pSps=createPmrSps(pChan); pChan->spsTx=pSps; @@ -2213,7 +2213,7 @@ pSps->nx=taps_fir_hpf_300_9_66; pSps->size_x=2; pSps->x=(void*)(calloc(pSps->nx,pSps->size_x)); - if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); + if (pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); pSps->calcAdjust=gain_fir_hpf_300_9_66; pSps->inputGain=(1*M_Q8); pSps->outputGain=(1*M_Q8); @@ -2221,9 +2221,9 @@ } // Tx PreEmphasis - if(pChan->txPreEmpEnable) + if (pChan->txPreEmpEnable) { - if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan); + if (pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan); else pSps=pSps->nextSps=createPmrSps(pChan); pSps->source=inputTmp; @@ -2240,7 +2240,7 @@ pSps->nx=taps_int_hpf_4000_1_2; pSps->size_x=2; pSps->x=(void*)(calloc(pSps->nx,pSps->size_x)); - if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); + if (pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); pSps->calcAdjust=gain_int_hpf_4000_1_2; pSps->inputGain=(1*M_Q8); @@ -2249,9 +2249,9 @@ } // Tx Limiter - if(pChan->txLimiterEnable) + if (pChan->txLimiterEnable) { - if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan); + if (pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan); else pSps=pSps->nextSps=createPmrSps(pChan); pSps->source=inputTmp; pSps->sink=pChan->pTxLimiter; @@ -2265,9 +2265,9 @@ } // Composite Mix of Voice and LSD - if((pChan->txMixA==TX_OUT_COMPOSITE)||(pChan->txMixB==TX_OUT_COMPOSITE)) + if ((pChan->txMixA==TX_OUT_COMPOSITE)||(pChan->txMixB==TX_OUT_COMPOSITE)) { - if(pSps==NULL) + if (pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan); else pSps=pSps->nextSps=createPmrSps(pChan); @@ -2286,21 +2286,21 @@ } // Chan A Upsampler and Filter - if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan); + if (pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan); else pSps=pSps->nextSps=createPmrSps(pChan); pChan->spsTxOutA=pSps; - if(!pChan->spsTx)pChan->spsTx=pSps; + if (!pChan->spsTx)pChan->spsTx=pSps; - if(pChan->txMixA==TX_OUT_COMPOSITE) + if (pChan->txMixA==TX_OUT_COMPOSITE) { pSps->source=pChan->pTxComposite; } - else if(pChan->txMixA==TX_OUT_LSD) + else if (pChan->txMixA==TX_OUT_LSD) { pSps->source=pChan->pTxLsdLpf; } - else if(pChan->txMixA==TX_OUT_VOICE) + else if (pChan->txMixA==TX_OUT_VOICE) { pSps->source=pChan->pTxHpf; } @@ -2327,35 +2327,35 @@ pSps->nx=taps_fir_lpf_3K_1; pSps->size_x=2; pSps->x=(void*)(calloc(pSps->nx,pSps->size_x)); - if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); + if (pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); pSps->calcAdjust=gain_fir_lpf_3K_1; pSps->inputGain=(1*M_Q8); pSps->outputGain=(1*M_Q8); - if(pChan->txMixA==pChan->txMixB)pSps->monoOut=1; + if (pChan->txMixA==pChan->txMixB)pSps->monoOut=1; else pSps->monoOut=0; // Chan B Upsampler and Filter - if((pChan->txMixA!=pChan->txMixB)&&(pChan->txMixB!=TX_OUT_OFF)) + if ((pChan->txMixA!=pChan->txMixB)&&(pChan->txMixB!=TX_OUT_OFF)) { - if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan); + if (pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan); else pSps=pSps->nextSps=createPmrSps(pChan); pChan->spsTxOutB=pSps; - if(pChan->txMixB==TX_OUT_COMPOSITE) + if (pChan->txMixB==TX_OUT_COMPOSITE) { pSps->source=pChan->pTxComposite; } - else if(pChan->txMixB==TX_OUT_LSD) + else if (pChan->txMixB==TX_OUT_LSD) { pSps->source=pChan->pTxLsdLpf; // pChan->ptxCtcssAdjust=&pSps->inputGain; } - else if(pChan->txMixB==TX_OUT_VOICE) + else if (pChan->txMixB==TX_OUT_VOICE) { pSps->source=inputTmp; } - else if(pChan->txMixB==TX_OUT_AUX) + else if (pChan->txMixB==TX_OUT_AUX) { pSps->source=pChan->pTxHpf; } @@ -2378,7 +2378,7 @@ pSps->nx=taps_fir_lpf_3K_1; pSps->size_x=2; pSps->x=(void*)(calloc(pSps->nx,pSps->size_x)); - if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); + if (pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); pSps->calcAdjust=(gain_fir_lpf_3K_1); pSps->inputGain=(1*M_Q8); pSps->outputGain=(1*M_Q8); @@ -2419,24 +2419,24 @@ free(pChan->pRxLsd); free(pChan->pRxSpeaker); free(pChan->pRxDcTrack); - if(pChan->pRxLsdLimit)free(pChan->pRxLsdLimit); + if (pChan->pRxLsdLimit)free(pChan->pRxLsdLimit); free(pChan->pTxBase); free(pChan->pTxHpf); free(pChan->pTxPreEmp); free(pChan->pTxLimiter); free(pChan->pTxLsd); free(pChan->pTxLsdLpf); - if(pChan->pTxComposite)free(pChan->pTxComposite); + if (pChan->pTxComposite)free(pChan->pTxComposite); free(pChan->pTxOut); - if(pChan->prxMeasure)free(pChan->prxMeasure); - if(pChan->pSigGen0)free(pChan->pSigGen0); - if(pChan->pSigGen1)free(pChan->pSigGen1); + if (pChan->prxMeasure)free(pChan->prxMeasure); + if (pChan->pSigGen0)free(pChan->pSigGen0); + if (pChan->pSigGen1)free(pChan->pSigGen1); #if XPMR_DEBUG0 == 1 - //if(pChan->prxDebug)free(pChan->prxDebug); - if(pChan->ptxDebug)free(pChan->ptxDebug); + //if (pChan->prxDebug)free(pChan->prxDebug); + if (pChan->ptxDebug)free(pChan->ptxDebug); free(pChan->prxDebug0); free(pChan->prxDebug1); free(pChan->prxDebug2); @@ -2450,7 +2450,7 @@ free(pChan->rxCtcss->pDebug0); free(pChan->rxCtcss->pDebug1); - for(i=0;irxCtcss->tdet[i].pDebug0); free(pChan->rxCtcss->tdet[i].pDebug1); @@ -2466,9 +2466,9 @@ pmr_sps=pChan->spsRx; - if(pChan->sdbg)free(pChan->sdbg); + if (pChan->sdbg)free(pChan->sdbg); - while(pmr_sps) + while (pmr_sps) { tmp_sps = pmr_sps; pmr_sps = tmp_sps->nextSps; @@ -2489,7 +2489,7 @@ pSps = (t_pmr_sps *)calloc(sizeof(t_pmr_sps),1); - if(!pSps)printf("Error: createPmrSps()\n"); + if (!pSps)printf("Error: createPmrSps()\n"); pSps->parentChan=pChan; pSps->index=pChan->spsIndex++; @@ -2504,7 +2504,7 @@ { TRACEJ(1,("destroyPmrSps(%i)\n",pSps->index)); - if(pSps->x!=NULL)free(pSps->x); + if (pSps->x!=NULL)free(pSps->x); free(pSps); return 0; } @@ -2519,23 +2519,23 @@ #if XPMR_PPTP == 99 pptp_p2^=1; - if(pptp_p2)ioctl(ppdrvdev,PPDRV_IOC_PINSET,LP_PIN02); + if (pptp_p2)ioctl(ppdrvdev,PPDRV_IOC_PINSET,LP_PIN02); else ioctl(ppdrvdev,PPDRV_IOC_PINCLEAR,LP_PIN02); #endif - if(pChan==NULL){ + if (pChan==NULL){ printf("PmrTx() pChan == NULL\n"); return 1; } #if XPMR_DEBUG0 == 1 - if(pChan->b.rxCapture && pChan->tracetype==5) + if (pChan->b.rxCapture && pChan->tracetype==5) { memcpy(pChan->pTxInput,input,pChan->nSamplesRx*2); } #endif - //if(pChan->b.radioactive)pChan->dd.debug=1; + //if (pChan->b.radioactive)pChan->dd.debug=1; //else pChan->dd.debug=0; dedrift_write(pChan,input); @@ -2554,13 +2554,13 @@ TRACEC(5,("PmrRx(%p %p %p %p)\n",pChan, input, outputrx, outputtx)); #if XPMR_PPTP == 1 - if(pChan->b.radioactive) + if (pChan->b.radioactive) { pptp_write(1,pChan->frameCountRx&0x00000001); } #endif - if(pChan==NULL){ + if (pChan==NULL){ printf("PmrRx() pChan == NULL\n"); return 1; } @@ -2568,11 +2568,11 @@ pChan->frameCountRx++; #if XPMR_DEBUG0 == 1 - if(pChan->b.rxCapture) + if (pChan->b.rxCapture) { - //if(pChan->prxDebug)memset((void *)pChan->prxDebug,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2); - if(pChan->ptxDebug)memset((void *)pChan->ptxDebug,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2); - if(pChan->sdbg->buffer) + //if (pChan->prxDebug)memset((void *)pChan->prxDebug,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2); + if (pChan->ptxDebug)memset((void *)pChan->ptxDebug,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2); + if (pChan->sdbg->buffer) { memset((void *)pChan->sdbg->buffer,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2); pChan->prxDebug=pChan->sdbg->buffer; @@ -2583,40 +2583,40 @@ pmr_sps=pChan->spsRx; // first sps pmr_sps->source=input; - if(outputrx!=NULL)pChan->spsRxOut->sink=outputrx; //last sps + if (outputrx!=NULL)pChan->spsRxOut->sink=outputrx; //last sps #if 0 - if(pChan->inputBlanking>0) + if (pChan->inputBlanking>0) { pChan->inputBlanking-=pChan->nSamplesRx; - if(pChan->inputBlanking<0)pChan->inputBlanking=0; - for(i=0;inSamplesRx*6;i++) + if (pChan->inputBlanking<0)pChan->inputBlanking=0; + for (i=0;inSamplesRx*6;i++) input[i]=0; } #endif - if( pChan->rxCpuSaver && !pChan->rxCarrierDetect && + if ( pChan->rxCpuSaver && !pChan->rxCarrierDetect && pChan->smode==SMODE_NULL && !pChan->txPttIn && !pChan->txPttOut) { - if(!pChan->b.rxhalted) + if (!pChan->b.rxhalted) { - if(pChan->spsRxHpf)pChan->spsRxHpf->enabled=0; - if(pChan->spsRxDeEmp)pChan->spsRxDeEmp->enabled=0; + if (pChan->spsRxHpf)pChan->spsRxHpf->enabled=0; + if (pChan->spsRxDeEmp)pChan->spsRxDeEmp->enabled=0; pChan->b.rxhalted=1; TRACEC(1,("PmrRx() rx sps halted\n")); } } - else if(pChan->b.rxhalted) + else if (pChan->b.rxhalted) { - if(pChan->spsRxHpf)pChan->spsRxHpf->enabled=1; - if(pChan->spsRxDeEmp)pChan->spsRxDeEmp->enabled=1; + if (pChan->spsRxHpf)pChan->spsRxHpf->enabled=1; + if (pChan->spsRxDeEmp)pChan->spsRxDeEmp->enabled=1; pChan->b.rxhalted=0; TRACEC(1,("PmrRx() rx sps un-halted\n")); } i=0; - while(pmr_sps!=NULL && pmr_sps!=0) + while (pmr_sps!=NULL && pmr_sps!=0) { TRACEC(5,("PmrRx() sps %i\n",i++)); pmr_sps->sigProc(pmr_sps); @@ -2626,13 +2626,13 @@ #define XPMR_VOX_HANGTIME 2000 - if(pChan->rxCdType==CD_XPMR_VOX) + if (pChan->rxCdType==CD_XPMR_VOX) { - if(pChan->spsRxVox->compOut) + if (pChan->spsRxVox->compOut) { pChan->rxVoxTimer=XPMR_VOX_HANGTIME; //VOX HangTime in ms } - if(pChan->rxVoxTimer>0) + if (pChan->rxVoxTimer>0) { pChan->rxVoxTimer-=MS_PER_FRAME; pChan->rxCarrierDetect=1; @@ -2649,7 +2649,7 @@ } // stop and start these engines instead to eliminate falsing - if( pChan->b.ctcssRxEnable && + if ( pChan->b.ctcssRxEnable && ( (!pChan->b.rxhalted || pChan->rxCtcss->decode!=CTCSS_NULL || pChan->smode==SMODE_CTCSS) && (pChan->smode!=SMODE_DCS&&pChan->smode!=SMODE_LSD) ) @@ -2659,7 +2659,7 @@ } #if 1 - if(pChan->txPttIn!=pChan->b.pttwas) + if (pChan->txPttIn!=pChan->b.pttwas) { pChan->b.pttwas=pChan->txPttIn; TRACEC(1,("PmrRx() txPttIn=%i\n",pChan->b.pttwas)); @@ -2670,11 +2670,11 @@ xpmrx(pChan,XXO_RXDECODE); #endif - if(pChan->smodetimer>0 && !pChan->txPttIn) + if (pChan->smodetimer>0 && !pChan->txPttIn) { pChan->smodetimer-=MS_PER_FRAME; - if(pChan->smodetimer<=0) + if (pChan->smodetimer<=0) { pChan->smodetimer=0; pChan->smodewas=pChan->smode; @@ -2684,10 +2684,10 @@ } } - if(pChan->rxCtcss->decode > CTCSS_NULL && + if (pChan->rxCtcss->decode > CTCSS_NULL && (pChan->smode==SMODE_NULL||pChan->smode==SMODE_CTCSS) ) { - if(pChan->smode!=SMODE_CTCSS) + if (pChan->smode!=SMODE_CTCSS) { TRACEC(1,("smode set=%i code=%i\n",pChan->smode,pChan->rxCtcss->decode)); pChan->smode=pChan->smodewas=SMODE_CTCSS; @@ -2703,19 +2703,19 @@ // handle radio transmitter ptt input hit=0; - if( !(pChan->smode==SMODE_DCS||pChan->smode==SMODE_LSD) ) + if ( !(pChan->smode==SMODE_DCS||pChan->smode==SMODE_LSD) ) { - if( pChan->txPttIn && pChan->txState==CHAN_TXSTATE_IDLE ) + if ( pChan->txPttIn && pChan->txState==CHAN_TXSTATE_IDLE ) { TRACEC(1,("txPttIn==1 from CHAN_TXSTATE_IDLE && !SMODE_LSD. codeindex=%i %i \n",pChan->rxCtcss->decode, pChan->rxCtcssMap[pChan->rxCtcss->decode] )); pChan->dd.b.doitnow=1; - if(pChan->smode==SMODE_CTCSS && !pChan->b.txCtcssInhibit) + if (pChan->smode==SMODE_CTCSS && !pChan->b.txCtcssInhibit) { - if(pChan->rxCtcss->decode>CTCSS_NULL) + if (pChan->rxCtcss->decode>CTCSS_NULL) { - if(pChan->rxCtcssMap[pChan->rxCtcss->decode]!=CTCSS_RXONLY) + if (pChan->rxCtcssMap[pChan->rxCtcss->decode]!=CTCSS_RXONLY) { f=freq_ctcss[pChan->rxCtcssMap[pChan->rxCtcss->decode]]; } @@ -2725,7 +2725,7 @@ f=pChan->txctcssdefault_value; } TRACEC(1,("txPttIn - Start CTCSSGen %f \n",f)); - if(f) + if (f) { t_pmr_sps *pSps; @@ -2734,7 +2734,7 @@ pSps->enabled=1; #if 0 - if(f>203.0) + if (f>203.0) { pSps->ncoef=taps_fir_lpf_250_9_66; pSps->size_coef=2; @@ -2761,7 +2761,7 @@ pChan->spsSigGen0->discounterl=0; } } - else if(pChan->smode==SMODE_NULL && pChan->txcodedefaultsmode==SMODE_CTCSS && !pChan->b.txCtcssInhibit) + else if (pChan->smode==SMODE_NULL && pChan->txcodedefaultsmode==SMODE_CTCSS && !pChan->b.txCtcssInhibit) { TRACEC(1,("txPtt Encode txcodedefaultsmode==SMODE_CTCSS %f\n",pChan->txctcssdefault_value)); pChan->spsSigGen0->freq=pChan->txctcssdefault_value*10; @@ -2771,7 +2771,7 @@ pChan->smode=SMODE_CTCSS; pChan->smodetimer=pChan->smodetime; } - else if(pChan->txcodedefaultsmode==SMODE_NULL||pChan->b.txCtcssInhibit) + else if (pChan->txcodedefaultsmode==SMODE_NULL||pChan->b.txCtcssInhibit) { TRACEC(1,("txPtt Encode txcodedefaultsmode==SMODE_NULL\n")); } @@ -2786,30 +2786,30 @@ pChan->txsettletimer=pChan->txsettletime; - if(pChan->spsTxOutA)pChan->spsTxOutA->enabled=1; - if(pChan->spsTxOutB)pChan->spsTxOutB->enabled=1; - if(pChan->spsTxLsdLpf)pChan->spsTxLsdLpf->enabled=1; - if(pChan->txfreq)pChan->b.reprog=1; + if (pChan->spsTxOutA)pChan->spsTxOutA->enabled=1; + if (pChan->spsTxOutB)pChan->spsTxOutB->enabled=1; + if (pChan->spsTxLsdLpf)pChan->spsTxLsdLpf->enabled=1; + if (pChan->txfreq)pChan->b.reprog=1; TRACEC(1,("PmrRx() TxOn\n")); } - else if(pChan->txPttIn && pChan->txState==CHAN_TXSTATE_ACTIVE) + else if (pChan->txPttIn && pChan->txState==CHAN_TXSTATE_ACTIVE) { // pChan->smode=SMODE_CTCSS; pChan->smodetimer=pChan->smodetime; } - else if(!pChan->txPttIn && pChan->txState==CHAN_TXSTATE_ACTIVE) + else if (!pChan->txPttIn && pChan->txState==CHAN_TXSTATE_ACTIVE) { TRACEC(1,("txPttIn==0 from CHAN_TXSTATE_ACTIVE\n")); - if(pChan->smode==SMODE_CTCSS && !pChan->b.txCtcssInhibit) + if (pChan->smode==SMODE_CTCSS && !pChan->b.txCtcssInhibit) { - if( pChan->txTocType==TOC_NONE || !pChan->b.ctcssTxEnable ) + if ( pChan->txTocType==TOC_NONE || !pChan->b.ctcssTxEnable ) { TRACEC(1,("Tx Off Immediate.\n")); pChan->spsSigGen0->option=3; pChan->txBufferClear=3; pChan->txState=CHAN_TXSTATE_FINISHING; } - else if(pChan->txTocType==TOC_NOTONE) + else if (pChan->txTocType==TOC_NOTONE) { pChan->txState=CHAN_TXSTATE_TOC; pChan->txHangTime=TOC_NOTONE_TIME/MS_PER_FRAME; @@ -2831,9 +2831,9 @@ TRACEC(1,("Tx Off No SMODE to Finish.\n")); } } - else if(pChan->txState==CHAN_TXSTATE_TOC) + else if (pChan->txState==CHAN_TXSTATE_TOC) { - if( pChan->txPttIn && pChan->smode==SMODE_CTCSS ) + if ( pChan->txPttIn && pChan->smode==SMODE_CTCSS ) { TRACEC(1,("Tx Key During HangTime\n")); pChan->txState = CHAN_TXSTATE_ACTIVE; @@ -2842,102 +2842,102 @@ pChan->spsSigGen0->discounterl=0; hit=0; } - else if(pChan->txHangTime) + else if (pChan->txHangTime) { - if(--pChan->txHangTime==0)pChan->txState=CHAN_TXSTATE_FINISHING; + if (--pChan->txHangTime==0)pChan->txState=CHAN_TXSTATE_FINISHING; } - else if(pChan->txHangTime<=0 && pChan->spsSigGen0->state==0) + else if (pChan->txHangTime<=0 && pChan->spsSigGen0->state==0) { pChan->txBufferClear=3; pChan->txState=CHAN_TXSTATE_FINISHING; TRACEC(1,("Tx Off TOC.\n")); } } - else if(pChan->txState==CHAN_TXSTATE_FINISHING) + else if (pChan->txState==CHAN_TXSTATE_FINISHING) { - if(--pChan->txBufferClear<=0) + if (--pChan->txBufferClear<=0) pChan->txState=CHAN_TXSTATE_COMPLETE; } - else if(pChan->txState==CHAN_TXSTATE_COMPLETE) + else if (pChan->txState==CHAN_TXSTATE_COMPLETE) { hit=1; } } // end of if SMODE==LSD - if(hit) + if (hit) { pChan->txPttOut=0; pChan->spsSigGen0->option=3; pChan->txState=CHAN_TXSTATE_IDLE; - if(pChan->spsTxLsdLpf)pChan->spsTxLsdLpf->option=3; - if(pChan->spsTxOutA)pChan->spsTxOutA->option=3; - if(pChan->spsTxOutB)pChan->spsTxOutB->option=3; - if(pChan->rxfreq||pChan->txfreq)pChan->b.reprog=1; + if (pChan->spsTxLsdLpf)pChan->spsTxLsdLpf->option=3; + if (pChan->spsTxOutA)pChan->spsTxOutA->option=3; + if (pChan->spsTxOutB)pChan->spsTxOutB->option=3; + if (pChan->rxfreq||pChan->txfreq)pChan->b.reprog=1; TRACEC(1,("Tx Off hit.\n")); } - if(pChan->b.reprog) + if (pChan->b.reprog) { pChan->b.reprog=0; progdtx(pChan); } - if(pChan->txsettletimer && pChan->txPttHid ) + if (pChan->txsettletimer && pChan->txPttHid ) { pChan->txsettletimer-=MS_PER_FRAME; - if(pChan->txsettletimer<0)pChan->txsettletimer=0; + if (pChan->txsettletimer<0)pChan->txsettletimer=0; } // enable this after we know everything else is working - if( pChan->txCpuSaver && + if ( pChan->txCpuSaver && !pChan->txPttIn && !pChan->txPttOut && pChan->txState==CHAN_TXSTATE_IDLE && !pChan->dd.b.doitnow ) { - if(!pChan->b.txhalted) + if (!pChan->b.txhalted) { pChan->b.txhalted=1; TRACEC(1,("PmrRx() tx sps halted\n")); } } - else if(pChan->b.txhalted) + else if (pChan->b.txhalted) { pChan->dd.b.doitnow=1; pChan->b.txhalted=0; TRACEC(1,("PmrRx() tx sps un-halted\n")); } - if(pChan->b.txhalted)return(1); + if (pChan->b.txhalted)return(1); - if(pChan->b.startSpecialTone) + if (pChan->b.startSpecialTone) { pChan->b.startSpecialTone=0; pChan->spsSigGen1->option=1; pChan->spsSigGen1->enabled=1; pChan->b.doingSpecialTone=1; } - else if(pChan->b.stopSpecialTone) + else if (pChan->b.stopSpecialTone) { pChan->b.stopSpecialTone=0; pChan->spsSigGen1->option=0; pChan->b.doingSpecialTone=0; pChan->spsSigGen1->enabled=0; } - else if(pChan->b.doingSpecialTone) + else if (pChan->b.doingSpecialTone) { pChan->spsSigGen1->sink=outputtx; pChan->spsSigGen1->sigProc(pChan->spsSigGen1); - for(i=0;i<(pChan->nSamplesTx*2*6);i+=2)outputtx[i+1]=outputtx[i]; + for (i=0;i<(pChan->nSamplesTx*2*6);i+=2)outputtx[i+1]=outputtx[i]; return 0; } - if(pChan->spsSigGen0 && pChan->spsSigGen0->enabled ) + if (pChan->spsSigGen0 && pChan->spsSigGen0->enabled ) { pChan->spsSigGen0->sigProc(pChan->spsSigGen0); } - if(pChan->spsSigGen1 && pChan->spsSigGen1->enabled) + if (pChan->spsSigGen1 && pChan->spsSigGen1->enabled) { pChan->spsSigGen1->sigProc(pChan->spsSigGen1); } @@ -2958,20 +2958,20 @@ dedrift(pChan); // tx process - if(!pChan->spsSigGen1->enabled) + if (!pChan->spsSigGen1->enabled) { pmr_sps->source=pChan->pTxBase; } else input=pmr_sps->source; - if(outputtx!=NULL) + if (outputtx!=NULL) { - if(pChan->spsTxOutA)pChan->spsTxOutA->sink=outputtx; - if(pChan->spsTxOutB)pChan->spsTxOutB->sink=outputtx; + if (pChan->spsTxOutA)pChan->spsTxOutA->sink=outputtx; + if (pChan->spsTxOutB)pChan->spsTxOutB->sink=outputtx; } i=0; - while(pmr_sps!=NULL && pmr_sps!=0) + while (pmr_sps!=NULL && pmr_sps!=0) { //TRACEF(1,("PmrTx() sps %i\n",i++)); pmr_sps->sigProc(pmr_sps); @@ -2979,16 +2979,16 @@ } //TRACEF(1,("PmrTx() - outputs \n")); - if(pChan->txMixA==TX_OUT_OFF || !pChan->txPttOut){ - for(i=0;inSamplesTx*2*6;i+=2)outputtx[i]=0; + if (pChan->txMixA==TX_OUT_OFF || !pChan->txPttOut){ + for (i=0;inSamplesTx*2*6;i+=2)outputtx[i]=0; } - if(pChan->txMixB==TX_OUT_OFF || !pChan->txPttOut ){ - for(i=0;inSamplesTx*2*6;i+=2)outputtx[i+1]=0; + if (pChan->txMixB==TX_OUT_OFF || !pChan->txPttOut ){ + for (i=0;inSamplesTx*2*6;i+=2)outputtx[i+1]=0; } #if XPMR_PPTP == 1 - if( pChan->b.radioactive && pChan->b.pptp_p1!=pChan->txPttOut) + if ( pChan->b.radioactive && pChan->b.pptp_p1!=pChan->txPttOut) { pChan->b.pptp_p1=pChan->txPttOut; pptp_write(0,pChan->b.pptp_p1); @@ -2997,8 +2997,8 @@ #if XPMR_DEBUG0 == 1 // TRACEF(1,("PmrRx() - debug outputs \n")); - if(pChan->b.rxCapture){ - for(i=0;inSamplesRx;i++) + if (pChan->b.rxCapture){ + for (i=0;inSamplesRx;i++) { pChan->pRxDemod[i]=input[i*2*6]; pChan->pTstTxOut[i]=outputtx[i*2*6+0]; // txa @@ -3025,7 +3025,7 @@ void ppbinout (u8 chan) { -#if(DTX_PROG == 1) +#if (DTX_PROG == 1) i32 i; if (ppdrvdev == 0) @@ -3038,10 +3038,10 @@ } i=0; - if(chan&0x01)i|=BIN_PROG_0; - if(chan&0x02)i|=BIN_PROG_1; - if(chan&0x04)i|=BIN_PROG_2; - if(chan&0x08)i|=BIN_PROG_3; + if (chan&0x01)i|=BIN_PROG_0; + if (chan&0x02)i|=BIN_PROG_1; + if (chan&0x04)i|=BIN_PROG_2; + if (chan&0x08)i|=BIN_PROG_3; ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, BIN_PROG_3|BIN_PROG_2|BIN_PROG_1|BIN_PROG_0); //ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, BIN_PROG_3|BIN_PROG_2|BIN_PROG_1|BIN_PROG_0); @@ -3062,7 +3062,7 @@ */ void ppspiout (u32 spidata) { -#if(DTX_PROG == 1) +#if (DTX_PROG == 1) static char firstrun=0; i32 i,ii; u32 bitselect; @@ -3076,37 +3076,37 @@ ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX ); ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX ); - if(firstrun==0) + if (firstrun==0) { firstrun=1; - for(ii=0;ii>1); } ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK | DTX_DATA ); ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_ENABLE ); - for(ii=0;iirxfreq>200000000) + if (pChan->rxfreq>200000000) { reffreq=16012500; stepfreq=12500; @@ -3157,7 +3157,7 @@ ppspiout(shiftreg); - if(pChan->txPttOut) + if (pChan->txPttOut) synthfreq=pChan->txfreq; else synthfreq=pChan->rxfreq-rxiffreq; @@ -3171,11 +3171,11 @@ ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX ); ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK | DTX_DATA | DTX_ENABLE ); - if(pChan->txPttOut) + if (pChan->txPttOut) { ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_TXPWR ); ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_TX ); - if(pChan->txpower && 0) ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_TXPWR ); + if (pChan->txpower && 0) ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_TXPWR ); } else { @@ -3195,7 +3195,7 @@ { TRACEC(5,("dedrift()\n")); - if(pChan->dd.option==9) + if (pChan->dd.option==9) { TRACEF(1,("dedrift(9)\n")); pChan->dd.framesize=DDB_FRAME_SIZE; @@ -3218,14 +3218,14 @@ // clear the buffer too! return; } - else if(pChan->dd.option==8) + else if (pChan->dd.option==8) { free(pChan->dd.buff); pChan->dd.lock=0; pChan->dd.b.txlock=pChan->dd.b.rxlock=0; return; } - else if(pChan->dd.initcnt==0) + else if (pChan->dd.initcnt==0) { const i32 a0 = 26231; const i32 a1 = 26231; @@ -3242,7 +3242,7 @@ pChan->dd.rxframecnt++; // pull data from buffer - if( (pChan->dd.outputindex + pChan->dd.framesize) > pChan->dd.buffersize ) + if ( (pChan->dd.outputindex + pChan->dd.framesize) > pChan->dd.buffersize ) { i16 dofirst,donext; @@ -3259,7 +3259,7 @@ } // compute clock error and correction factor - if(pChan->dd.outputindex > inputindex) + if (pChan->dd.outputindex > inputindex) { pChan->dd.lead = (inputindex + pChan->dd.buffersize) - pChan->dd.outputindex; } @@ -3283,7 +3283,7 @@ #if 1 // event sync'd correction - if(pChan->dd.b.doitnow) + if (pChan->dd.b.doitnow) { pChan->dd.b.doitnow=0; indextweak=pChan->dd.factor; @@ -3291,12 +3291,12 @@ pChan->dd.timer=20000/MS_PER_FRAME; } // coarse lead adjustment if really far out of range - else if( pChan->dd.lead >= pChan->dd.framesize*(DDB_FRAMES_IN_BUFF-2) ) + else if ( pChan->dd.lead >= pChan->dd.framesize*(DDB_FRAMES_IN_BUFF-2) ) { pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0; indextweak += (pChan->dd.framesize*5/4); } - else if(pChan->dd.lead <= pChan->dd.framesize*2 ) + else if (pChan->dd.lead <= pChan->dd.framesize*2 ) { pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0; indextweak -= (pChan->dd.framesize*5/4); @@ -3304,8 +3304,8 @@ #endif #if 1 - if(pChan->dd.timer>0)pChan->dd.timer--; - if(pChan->dd.timer==0 && abs(pChan->dd.factor)>=16) + if (pChan->dd.timer>0)pChan->dd.timer--; + if (pChan->dd.timer==0 && abs(pChan->dd.factor)>=16) { indextweak=pChan->dd.factor; pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0; @@ -3314,7 +3314,7 @@ #endif #if XPMR_DEBUG0 == 1 - if(indextweak!=0)TRACEF(4,("%08i indextweak %+4i %+4i %+5i %5i %5i %5i %+4i\n",pChan->dd.rxframecnt, indextweak, pChan->dd.err, accum, inputindex, pChan->dd.outputindex, pChan->dd.lead, pChan->dd.skew)); + if (indextweak!=0)TRACEF(4,("%08i indextweak %+4i %+4i %+5i %5i %5i %5i %+4i\n",pChan->dd.rxframecnt, indextweak, pChan->dd.err, accum, inputindex, pChan->dd.outputindex, pChan->dd.lead, pChan->dd.skew)); #endif // set the output index based on lead and clock offset @@ -3332,7 +3332,7 @@ memcpy(vptr, src, pChan->dd.framesize*2); pChan->dd.inputindex = (pChan->dd.inputindex + pChan->dd.framesize) % pChan->dd.buffersize; pChan->dd.txframecnt++; - if(pChan->dd.initcnt!=0)pChan->dd.initcnt--; + if (pChan->dd.initcnt!=0)pChan->dd.initcnt--; pChan->dd.accum+=pChan->dd.framesize; } Index: codecs/lpc10/chanwr.c =================================================================== --- codecs/lpc10/chanwr.c (revision 228266) +++ codecs/lpc10/chanwr.c (working copy) @@ -161,7 +161,7 @@ --ibits; /* Function Body */ - switch(n__) { + switch (n__) { case 1: goto L_chanrd; } Index: codecs/lpc10/dyptrk.c =================================================================== --- codecs/lpc10/dyptrk.c (revision 228266) +++ codecs/lpc10/dyptrk.c (working copy) @@ -338,7 +338,7 @@ /* Right to left pass: */ i__ = pbar - 1; sbar = s[i__]; - while(i__ >= 1) { + while (i__ >= 1) { sbar += alpha; if (sbar < s[i__ - 1]) { s[i__ - 1] = sbar; Index: codecs/lpc10/encode.c =================================================================== --- codecs/lpc10/encode.c (revision 228266) +++ codecs/lpc10/encode.c (working copy) @@ -284,7 +284,7 @@ for (i__ = 1; i__ <= i__1; ++i__) { irc[i__] = (integer)(rc[i__] * 32768.f); } -/* IF(LISTL.GE.3)WRITE(FDEBUG,800)VOICE,PITCH,IRMS,(IRC(I),I=1,ORDER) */ +/* if (LISTL.GE.3)WRITE(FDEBUG,800)VOICE,PITCH,IRMS,(IRC(I),I=1,ORDER) */ /* 800 FORMAT(1X,/,' <>',T32,2I3,I6,I5,T50,10I8) */ /* Encode pitch and voicing */ if (voice[1] != 0 && voice[2] != 0) { @@ -303,7 +303,7 @@ j = 32; idel = 16; *irms = min(*irms,1023); - while(idel > 0) { + while (idel > 0) { if (*irms > rmst[j - 1]) { j -= idel; } @@ -366,7 +366,7 @@ irc[10] = enctab[(irc[4] & 30) / 2] & 1; } } -/* IF(LISTL.GE.3)WRITE(FDEBUG,801)VOICE,IPITCH,IRMS,(IRC(J),J=1,ORDER) */ +/* if (LISTL.GE.3)WRITE(FDEBUG,801)VOICE,IPITCH,IRMS,(IRC(J),J=1,ORDER) */ /* 801 FORMAT(1X,'<>',T32,2I3,I6,I5,T50,10I8) */ return 0; } /* encode_ */ Index: codecs/lpc10/f2clib.c =================================================================== --- codecs/lpc10/f2clib.c (revision 228266) +++ codecs/lpc10/f2clib.c (working copy) @@ -44,11 +44,11 @@ n = -n; } u = n; - for(pow = 1; ; ) + for (pow = 1; ; ) { - if(u & 01) + if (u & 01) pow *= x; - if(u >>= 1) + if (u >>= 1) x *= x; else break; Index: codecs/lpc10/pitsyn.c =================================================================== --- codecs/lpc10/pitsyn.c (revision 228266) +++ codecs/lpc10/pitsyn.c (working copy) @@ -442,7 +442,7 @@ RT */ /* to LSAMP. */ - while(TRUE_) { + while (TRUE_) { /* JUSED is the total length of all pitch periods curr ently */ Index: codecs/lpc10/placea.c =================================================================== --- codecs/lpc10/placea.c (revision 228266) +++ codecs/lpc10/placea.c (working copy) @@ -203,13 +203,13 @@ } /* If this placement puts the analysis window above HRANGE, then */ /* move it backward an integer number of pitch periods. */ - while(awin[(*af << 1) + 2] > hrange) { + while (awin[(*af << 1) + 2] > hrange) { awin[(*af << 1) + 1] -= *ipitch; awin[(*af << 1) + 2] -= *ipitch; } /* Similarly if the placement puts the analysis window below LRANGE. */ - while(awin[(*af << 1) + 1] < lrange) { + while (awin[(*af << 1) + 1] < lrange) { awin[(*af << 1) + 1] += *ipitch; awin[(*af << 1) + 2] += *ipitch; } Index: codecs/lpc10/tbdm.c =================================================================== --- codecs/lpc10/tbdm.c (revision 228266) +++ codecs/lpc10/tbdm.c (working copy) @@ -132,7 +132,7 @@ i__3 = *mintau + 3, i__4 = tau[*ltau] - 1; i__2 = min(i__3,i__4); for (i__ = max(i__1,41); i__ <= i__2; ++i__) { - while(tau[ptr] < i__) { + while (tau[ptr] < i__) { ++ptr; } if (tau[ptr] != i__) { Index: contrib/utils/eagi_proxy.c =================================================================== --- contrib/utils/eagi_proxy.c (revision 228266) +++ contrib/utils/eagi_proxy.c (working copy) @@ -118,7 +118,7 @@ bs=be=winbuf; speech_desc=connect_to_host("localhost",SIGNAL_PORT); - if(speech_desc<0) + if (speech_desc<0) { perror("signal socket"); return -1; @@ -126,7 +126,7 @@ command_desc=connect_to_host("localhost",COMMAND_PORT); - if(command_desc<0) + if (command_desc<0) { perror("command socket"); return -1; @@ -136,12 +136,12 @@ pthread_create(&stdin_thread,NULL,readStdin,NULL); pthread_create(&signal_thread,NULL,readSignal,NULL); - while(connected) + while (connected) { pthread_mutex_lock(&command_mutex); ret=read_some(command_desc,buf,BUFSIZE); pthread_mutex_unlock(&command_mutex); - if(ret>0) + if (ret>0) { buf[ret]=0; printf("%s",buf); @@ -160,7 +160,7 @@ void* readStdin(void* ptr) { - while(1)/*read enviornment*/ + while (1)/*read enviornment*/ { fgets(buf,BUFSIZE,stdin); #ifdef SEND_ENVIORNMENT @@ -168,13 +168,13 @@ write_buf(command_desc,buf,strlen(buf)); pthread_mutex_unlock(&command_mutex); #endif - if(feof(stdin) || buf[0]=='\n') + if (feof(stdin) || buf[0]=='\n') { break; } } - while(connected) + while (connected) { fgets(buf,BUFSIZE,stdin); pthread_mutex_lock(&command_mutex); @@ -187,7 +187,7 @@ void* readSignal(void* ptr) { - while(connected) + while (connected) { read_full(3,window,WINSIZE); write_buf(speech_desc,window,WINSIZE); @@ -201,10 +201,10 @@ { int count,pos=0; - while(num) + while (num) { count=read(file,buffer+pos,num); - if(count==0 || (count<0 && errno!=EAGAIN)) + if (count==0 || (count<0 && errno!=EAGAIN)) { connected=0; return; @@ -224,16 +224,16 @@ /* get adress */ - if(!strcmp(name,"localhost")) + if (!strcmp(name,"localhost")) address=htonl(2130706433); /*127.0.0.1*/ else { address=inet_addr(name); /* check if it's an IP that's written in the string */ - if(address==(in_addr_t)-1) + if (address==(in_addr_t)-1) { host_entity = gethostbyname(name); /* search for the host under this name */ - if(!host_entity) + if (!host_entity) { fprintf(stderr,"EAGI proxy: Wrong address!\n"); /* can't find anything*/ return -1; @@ -243,7 +243,7 @@ } desc=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); - if(desc<0) + if (desc<0) { fprintf(stderr,"EAGI proxy: Cannot create socket!\n"); return -1; @@ -256,7 +256,7 @@ host.sin_addr.s_addr=address; res=connect(desc,(struct sockaddr*)&host,sizeof(host)); - if(res<0) + if (res<0) { fprintf(stderr,"EAGI proxy: Cannot connect!\n"); return -1; @@ -283,19 +283,19 @@ unsigned char c; int res,i=0; - for(;;) + for (;;) { res=read(desc,&c,1); - if(res<1) + if (res<1) { - if(errno!=EAGAIN) + if (errno!=EAGAIN) { perror("Error reading"); connected=0; } break; } - if(res==0) + if (res==0) { connected=0; break; @@ -315,9 +315,9 @@ /*NOTE: AMAP -> as much as possible */ - if(be!=bs)/* if data left in buffer */ + if (be!=bs)/* if data left in buffer */ { - if(be>bs)/* if buffer not split */ + if (be>bs)/* if buffer not split */ { ret=write_amap(desc,bs,be-bs);/* write AMAP */ bs+=ret;/* shift the start of the buffer */ @@ -325,7 +325,7 @@ else/* if buffer is split */ { ret=write_amap(desc,bs,end-bs);/* write higher part first */ - if(ret==end-bs)/* if wrote whole of the higher part */ + if (ret==end-bs)/* if wrote whole of the higher part */ { ret=write_amap(desc,winbuf,be-winbuf);/* write lower part */ bs=winbuf+ret;/* shift start to new position */ @@ -334,18 +334,18 @@ } } - if(be==bs)/* if buffer is empty now */ + if (be==bs)/* if buffer is empty now */ { ret=write_amap(desc,buf,size);/* write AMAP of the new data */ buf+=ret;/* shift start of new data */ size-=ret;/* lower size of new data */ } - if(size)/* if new data still remains unsent */ + if (size)/* if new data still remains unsent */ { - if(be>=bs)/* if data not split */ + if (be>=bs)/* if data not split */ { - if(size>end-be)/* if new data size doesn't fit higher end */ + if (size>end-be)/* if new data size doesn't fit higher end */ { size-=end-be;/* reduce new data size by the higher end size */ memcpy(be,buf,end-be);/* copy to higher end */ @@ -356,21 +356,21 @@ { memcpy(be,buf,size);/* copy to higher end */ be+=size;/* shift end by size */ - if(be>=end)/* if end goes beyond the buffer */ + if (be>=end)/* if end goes beyond the buffer */ be=winbuf;/* restart */ size=0;/* everything copied */ } } - if(size)/* if new data still remains */ + if (size)/* if new data still remains */ { - if(size>=bs-be)/* if new data doesn't fit between end and start */ + if (size>=bs-be)/* if new data doesn't fit between end and start */ { fprintf(stderr,"Buffer overflow!\n"); size=bs-be-1;/* reduce the size that we can copy */ } - if(size)/* if we can copy anything */ + if (size)/* if we can copy anything */ { memcpy(be,buf,size);/* copy the new data between end and start */ be+=size;/* shift end by size */ @@ -383,16 +383,16 @@ { int ret; ret=write(desc,buf,size); - if(ret<0) + if (ret<0) { - if(errno!=EAGAIN) + if (errno!=EAGAIN) { perror("Error writing"); connected=0; } return 0; } - if(ret==0) + if (ret==0) connected=0; return ret; @@ -404,14 +404,14 @@ int opts; opts = fcntl(desc,F_GETFL); - if(opts < 0) + if (opts < 0) { perror("fcntl(F_GETFL)"); exit(-1); } opts = (opts | O_NONBLOCK ); - if(fcntl(desc,F_SETFL,opts) < 0) + if (fcntl(desc,F_SETFL,opts) < 0) { perror("fcntl(F_SETFL)"); exit(-1); Index: contrib/utils/rawplayer.c =================================================================== --- contrib/utils/rawplayer.c (revision 228266) +++ contrib/utils/rawplayer.c (working copy) @@ -20,12 +20,12 @@ if ((fd = open(path,O_RDONLY))) { while ((bytes=read(fd, buf, BUFLEN)) > 0) { - if(write(fdout, buf, bytes) < 0){ + if (write(fdout, buf, bytes) < 0){ error = -2; break; } } - if(fd) + if (fd) close(fd); } else return -1; @@ -39,7 +39,7 @@ fdout = fileno(stdout); for (;;) for (x = 1; x < argc ; x++) { - if(deliver_file(argv[x], fdout)) + if (deliver_file(argv[x], fdout)) exit(1); } } Index: contrib/utils/zones2indications.c =================================================================== --- contrib/utils/zones2indications.c (revision 228266) +++ contrib/utils/zones2indications.c (working copy) @@ -52,7 +52,7 @@ printf( "ringcadence = " ); - for(i=0; ; i++) { + for (i=0; ; i++) { if (zone_data->ringcadence[i] == 0) break; if (i != 0) @@ -123,8 +123,8 @@ int opt; char* endptr = NULL; - while((opt = getopt(argc, argv, "ac:hn:")) != -1) { - switch(opt) { + while ((opt = getopt(argc, argv, "ac:hn:")) != -1) { + switch (opt) { case 'a': return print_all(); case 'c': Index: formats/format_gsm.c =================================================================== --- formats/format_gsm.c (revision 228266) +++ formats/format_gsm.c (working copy) @@ -81,7 +81,7 @@ if (!(f->datalen % 65)) { /* This is in MSGSM format, need to be converted */ int len=0; - while(len < f->datalen) { + while (len < f->datalen) { conv65(f->data.ptr + len, gsm); if ((res = fwrite(gsm, 1, 2*GSM_FRAME_SIZE, fs->f)) != 2*GSM_FRAME_SIZE) { ast_log(LOG_WARNING, "Bad write (%d/66): %s\n", res, strerror(errno)); @@ -112,11 +112,11 @@ max = ftello(fs->f); /* have to fudge to frame here, so not fully to sample */ distance = (sample_offset/GSM_SAMPLES) * GSM_FRAME_SIZE; - if(whence == SEEK_SET) + if (whence == SEEK_SET) offset = distance; - else if(whence == SEEK_CUR || whence == SEEK_FORCECUR) + else if (whence == SEEK_CUR || whence == SEEK_FORCECUR) offset = distance + cur; - else if(whence == SEEK_END) + else if (whence == SEEK_END) offset = max - distance; /* Always protect against seeking past the begining. */ offset = (offset < min)?min:offset; Index: formats/format_ogg_vorbis.c =================================================================== --- formats/format_ogg_vorbis.c (revision 228266) +++ formats/format_ogg_vorbis.c (working copy) @@ -97,7 +97,7 @@ result = ogg_sync_pageout(&tmp->oy, &tmp->og); if (result != 1) { - if(bytes < BLOCK_SIZE) { + if (bytes < BLOCK_SIZE) { ast_log(LOG_ERROR, "Run out of data...\n"); } else { ast_log(LOG_ERROR, "Input does not appear to be an Ogg bitstream.\n"); @@ -137,11 +137,11 @@ break; if (result == 1) { ogg_stream_pagein(&tmp->os, &tmp->og); - while(i < 2) { + while (i < 2) { result = ogg_stream_packetout(&tmp->os,&tmp->op); - if(result == 0) + if (result == 0) break; - if(result < 0) { + if (result < 0) { ast_log(LOG_ERROR, "Corrupt secondary header. Exiting.\n"); goto error; } Index: formats/format_pcm.c =================================================================== --- formats/format_pcm.c (revision 228266) +++ formats/format_pcm.c (working copy) @@ -53,7 +53,7 @@ clock_t cur; cur = times( &buf ); - if( cur < 0 ) { + if ( cur < 0 ) { ast_log( LOG_WARNING, "Cannot get current time\n" ); return 0; } Index: formats/format_vox.c =================================================================== --- formats/format_vox.c (revision 228266) +++ formats/format_vox.c (working copy) @@ -83,11 +83,11 @@ /* have to fudge to frame here, so not fully to sample */ distance = sample_offset/2; - if(whence == SEEK_SET) + if (whence == SEEK_SET) offset = distance; - else if(whence == SEEK_CUR || whence == SEEK_FORCECUR) + else if (whence == SEEK_CUR || whence == SEEK_FORCECUR) offset = distance + cur; - else if(whence == SEEK_END) + else if (whence == SEEK_END) offset = max - distance; if (whence != SEEK_FORCECUR) { offset = (offset > max)?max:offset; Index: formats/format_wav.c =================================================================== --- formats/format_wav.c (revision 228266) +++ formats/format_wav.c (working copy) @@ -163,7 +163,7 @@ return -1; } /* Skip any facts and get the first data block */ - for(;;) + for (;;) { char buf[4]; @@ -178,9 +178,9 @@ return -1; } data = ltohl(data); - if(memcmp(buf, "data", 4) == 0 ) + if (memcmp(buf, "data", 4) == 0 ) break; - if(memcmp(buf, "fact", 4) != 0 ) { + if (memcmp(buf, "fact", 4) != 0 ) { ast_log(LOG_WARNING, "Unknown block - not fact or data\n"); return -1; } @@ -376,7 +376,7 @@ tmp = (short *)(s->fr.data.ptr); #if __BYTE_ORDER == __BIG_ENDIAN /* file format is little endian so we need to swap */ - for( x = 0; x < samples; x++) + for ( x = 0; x < samples; x++) tmp[x] = (tmp[x] << 8) | ((tmp[x] & 0xff00) >> 8); #endif Index: funcs/func_channel.c =================================================================== --- funcs/func_channel.c (revision 228266) +++ funcs/func_channel.c (working copy) @@ -372,7 +372,7 @@ locked_string_field_set(chan, userfield, value); else if (!strcasecmp(data, "amaflags")) { ast_channel_lock(chan); - if(isdigit(*value)) { + if (isdigit(*value)) { sscanf(value, "%30d", &chan->amaflags); } else if (!strcasecmp(value,"OMIT")){ chan->amaflags = 1; Index: funcs/func_logic.c =================================================================== --- funcs/func_logic.c (revision 228266) +++ funcs/func_logic.c (working copy) @@ -185,7 +185,7 @@ AST_NONSTANDARD_APP_ARGS(args2, args1.remainder, ':'); if (ast_strlen_zero(args1.expr) || !(args2.iftrue || args2.iffalse)) { - ast_log(LOG_WARNING, "Syntax IF(?[][:]) (expr must be non-null, and either or must be non-null)\n"); + ast_log(LOG_WARNING, "Syntax if (?[][:]) (expr must be non-null, and either or must be non-null)\n"); ast_log(LOG_WARNING, " In this case, ='%s', ='%s', and ='%s'\n", args1.expr, args2.iftrue, args2.iffalse); return -1; } Index: funcs/func_strings.c =================================================================== --- funcs/func_strings.c (revision 228266) +++ funcs/func_strings.c (working copy) @@ -298,7 +298,7 @@ Example: exten => s,1,Set(array=one,two,three) - exten => s,n,While($["${SET(var=${SHIFT(array)})}" != ""]) + exten => s,n,while ($["${SET(var=${SHIFT(array)})}" != ""]) exten => s,n,NoOp(var is ${var}) exten => s,n,EndWhile This would iterate over each value in array, left to right, and @@ -318,7 +318,7 @@ Example: exten => s,1,Set(array=one,two,three) - exten => s,n,While($["${SET(var=${POP(array)})}" != ""]) + exten => s,n,while ($["${SET(var=${POP(array)})}" != ""]) exten => s,n,NoOp(var is ${var}) exten => s,n,EndWhile This would iterate over each value in array, right to left, and Index: main/aescrypt.c =================================================================== --- main/aescrypt.c (revision 228266) +++ main/aescrypt.c (working copy) @@ -122,7 +122,7 @@ aes_32t nr = (kp[45] ^ kp[52] ^ kp[53] ? kp[52] : 14); #ifdef AES_ERR_CHK - if( (nr != 10 || !(kp[0] | kp[3] | kp[4])) + if ( (nr != 10 || !(kp[0] | kp[3] | kp[4])) && (nr != 12 || !(kp[0] | kp[5] | kp[6])) && (nr != 14 || !(kp[0] | kp[7] | kp[8])) ) return aes_error; @@ -132,7 +132,7 @@ #if (ENC_UNROLL == FULL) - switch(nr) + switch (nr) { case 14: round(fwd_rnd, b1, b0, kp + 1 * N_COLS); @@ -159,7 +159,7 @@ #if (ENC_UNROLL == PARTIAL) { aes_32t rnd; - for(rnd = 0; rnd < (nr >> 1) - 1; ++rnd) + for (rnd = 0; rnd < (nr >> 1) - 1; ++rnd) { kp += N_COLS; round(fwd_rnd, b1, b0, kp); @@ -170,7 +170,7 @@ round(fwd_rnd, b1, b0, kp); #else { aes_32t rnd; - for(rnd = 0; rnd < nr - 1; ++rnd) + for (rnd = 0; rnd < nr - 1; ++rnd) { kp += N_COLS; round(fwd_rnd, b1, b0, kp); @@ -246,7 +246,7 @@ const aes_32t *kp = cx->ks + nr * N_COLS; #ifdef AES_ERR_CHK - if( (nr != 10 || !(cx->ks[0] | cx->ks[3] | cx->ks[4])) + if ( (nr != 10 || !(cx->ks[0] | cx->ks[3] | cx->ks[4])) && (nr != 12 || !(cx->ks[0] | cx->ks[5] | cx->ks[6])) && (nr != 14 || !(cx->ks[0] | cx->ks[7] | cx->ks[8])) ) return aes_error; @@ -256,7 +256,7 @@ #if (DEC_UNROLL == FULL) - switch(nr) + switch (nr) { case 14: round(inv_rnd, b1, b0, kp - 1 * N_COLS); @@ -283,7 +283,7 @@ #if (DEC_UNROLL == PARTIAL) { aes_32t rnd; - for(rnd = 0; rnd < (nr >> 1) - 1; ++rnd) + for (rnd = 0; rnd < (nr >> 1) - 1; ++rnd) { kp -= N_COLS; round(inv_rnd, b1, b0, kp); @@ -294,7 +294,7 @@ round(inv_rnd, b1, b0, kp); #else { aes_32t rnd; - for(rnd = 0; rnd < nr - 1; ++rnd) + for (rnd = 0; rnd < nr - 1; ++rnd) { kp -= N_COLS; round(inv_rnd, b1, b0, kp); Index: main/aeskey.c =================================================================== --- main/aeskey.c (revision 228266) +++ main/aeskey.c (working copy) @@ -113,7 +113,7 @@ #if ENC_UNROLL == NONE { aes_32t i; - for(i = 0; i < ((11 * N_COLS - 1) / 4); ++i) + for (i = 0; i < ((11 * N_COLS - 1) / 4); ++i) ke4(cx->ks, i); } #else @@ -150,7 +150,7 @@ #if ENC_UNROLL == NONE { aes_32t i; - for(i = 0; i < (13 * N_COLS - 1) / 6; ++i) + for (i = 0; i < (13 * N_COLS - 1) / 6; ++i) ke6(cx->ks, i); } #else @@ -188,7 +188,7 @@ #if ENC_UNROLL == NONE { aes_32t i; - for(i = 0; i < (15 * N_COLS - 1) / 8; ++i) + for (i = 0; i < (15 * N_COLS - 1) / 8; ++i) ke8(cx->ks, i); } #else @@ -208,7 +208,7 @@ aes_rval aes_encrypt_key(const void *in_key, int key_len, aes_encrypt_ctx cx[1]) { - switch(key_len) + switch (key_len) { #ifdef AES_ERR_CHK case 16: case 128: return aes_encrypt_key128(in_key, cx); @@ -330,10 +330,10 @@ #if DEC_UNROLL == NONE { aes_32t i; - for(i = 0; i < (11 * N_COLS - 1) / 4; ++i) + for (i = 0; i < (11 * N_COLS - 1) / 4; ++i) ke4(cx->ks, i); #if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 10 * N_COLS; ++i) + for (i = N_COLS; i < 10 * N_COLS; ++i) cx->ks[i] = inv_mcol(cx->ks[i]); #endif } @@ -373,10 +373,10 @@ cx->ks[5] = ss[5] = word_in(in_key, 5); { aes_32t i; - for(i = 0; i < (13 * N_COLS - 1) / 6; ++i) + for (i = 0; i < (13 * N_COLS - 1) / 6; ++i) ke6(cx->ks, i); #if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 12 * N_COLS; ++i) + for (i = N_COLS; i < 12 * N_COLS; ++i) cx->ks[i] = inv_mcol(cx->ks[i]); #endif } @@ -419,10 +419,10 @@ cx->ks[7] = ss[7] = word_in(in_key, 7); { aes_32t i; - for(i = 0; i < (15 * N_COLS - 1) / 8; ++i) + for (i = 0; i < (15 * N_COLS - 1) / 8; ++i) ke8(cx->ks, i); #if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 14 * N_COLS; ++i) + for (i = N_COLS; i < 14 * N_COLS; ++i) cx->ks[i] = inv_mcol(cx->ks[i]); #endif } @@ -447,7 +447,7 @@ aes_rval aes_decrypt_key(const void *in_key, int key_len, aes_decrypt_ctx cx[1]) { - switch(key_len) + switch (key_len) { #ifdef AES_ERR_CHK case 16: case 128: return aes_decrypt_key128(in_key, cx); Index: main/aestab.c =================================================================== --- main/aestab.c (revision 228266) +++ main/aestab.c (working copy) @@ -81,20 +81,20 @@ static aes_08t fi(const aes_08t x) { aes_08t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0; - if(x < 2) return x; + if (x < 2) return x; - for(;;) + for (;;) { - if(!n1) return v1; + if (!n1) return v1; - while(n2 >= n1) + while (n2 >= n1) { n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2); } - if(!n2) return v2; + if (!n2) return v2; - while(n1 >= n2) + while (n1 >= n2) { n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1); } @@ -120,7 +120,7 @@ aes_08t pow[512], log[256]; - if(init) return; + if (init) return; /* log and power tables for GF(2^8) finite field with WPOLY as modular polynomial - the simplest primitive root is 0x03, used here to generate the tables @@ -137,16 +137,16 @@ while (w != 1); #else - if(init) return; + if (init) return; #endif - for(i = 0, w = 1; i < RC_LENGTH; ++i) + for (i = 0, w = 1; i < RC_LENGTH; ++i) { t_set(r,c)[i] = bytes2word(w, 0, 0, 0); w = f2(w); } - for(i = 0; i < 256; ++i) + for (i = 0; i < 256; ++i) { aes_08t b; b = fwd_affine(fi((aes_08t)i)); Index: main/ast_expr2.c =================================================================== --- main/ast_expr2.c (revision 228266) +++ main/ast_expr2.c (working copy) @@ -463,7 +463,7 @@ some useful info about the error. Not as easy as it looks, but it is possible. */ #define ast_yyerror(x) ast_yyerror(x,&yyloc,parseio) -#define DESTROY(x) {if((x)->type == AST_EXPR_numeric_string || (x)->type == AST_EXPR_string) free((x)->u.s); (x)->u.s = 0; free(x);} +#define DESTROY(x) {if ((x)->type == AST_EXPR_numeric_string || (x)->type == AST_EXPR_string) free((x)->u.s); (x)->u.s = 0; free(x);} /* Enabling traces. */ @@ -1911,7 +1911,7 @@ #line 374 "ast_expr2.y" { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1); ((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type; - if( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number ) + if ( (yyvsp[(1) - (1)].val)->type == AST_EXPR_number ) ((struct parse_io *)parseio)->val->u.i = (yyvsp[(1) - (1)].val)->u.i; else ((struct parse_io *)parseio)->val->u.s = (yyvsp[(1) - (1)].val)->u.s; @@ -2460,15 +2460,15 @@ if (vp->type != AST_EXPR_string && vp->type != AST_EXPR_numeric_string) return; - if( vp->u.s[0] == '"' && vp->u.s[strlen(vp->u.s)-1] == '"' ) + if ( vp->u.s[0] == '"' && vp->u.s[strlen(vp->u.s)-1] == '"' ) { char *f, *t; f = vp->u.s; t = vp->u.s; - while( *f ) + while ( *f ) { - if( *f && *f != '"' ) + if ( *f && *f != '"' ) *t++ = *f++; else f++; @@ -2536,22 +2536,22 @@ char out[4096]; FILE *infile; - if( !argv[1] ) + if ( !argv[1] ) exit(20); - if( access(argv[1],F_OK)== 0 ) + if ( access(argv[1],F_OK)== 0 ) { int ret; infile = fopen(argv[1],"r"); - if( !infile ) + if ( !infile ) { printf("Sorry, couldn't open %s for reading!\n", argv[1]); exit(10); } - while( fgets(s,sizeof(s),infile) ) + while ( fgets(s,sizeof(s),infile) ) { - if( s[strlen(s)-1] == '\n' ) + if ( s[strlen(s)-1] == '\n' ) s[strlen(s)-1] = 0; ret = ast_expr(s, out, sizeof(out), NULL); @@ -3068,9 +3068,9 @@ { struct val *r; - if( isstring(a) ) + if ( isstring(a) ) { - if( strlen(a->u.s) && strcmp(a->u.s, "\"\"") != 0 && strcmp(a->u.s,"0") != 0 ) + if ( strlen(a->u.s) && strcmp(a->u.s, "\"\"") != 0 && strcmp(a->u.s,"0") != 0 ) { free_value(a); free_value(c); @@ -3086,7 +3086,7 @@ else { (void)to_number(a); - if( a->u.i ) + if ( a->u.i ) { free_value(a); free_value(c); @@ -3141,7 +3141,7 @@ struct val *r; if (!to_number (a)) { - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING,"non-numeric argument\n"); if (!to_number (b)) { free_value(a); @@ -3185,7 +3185,7 @@ struct val *r; if (!to_number (a)) { - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING, "non-numeric argument\n"); if (!to_number (b)) { free_value(a); @@ -3198,7 +3198,7 @@ return (r); } } else if (!to_number(b)) { - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING, "non-numeric argument\n"); free_value(b); return (a); @@ -3220,7 +3220,7 @@ if (!to_number (a) ) { free_value(a); - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING, "non-numeric argument\n"); return make_number(0); } @@ -3239,25 +3239,25 @@ int v1 = 1; struct val *r; - if( !a ) + if ( !a ) { v1 = 0; } else { - switch( a->type ) + switch ( a->type ) { case AST_EXPR_number: - if( a->u.i == 0 ) + if ( a->u.i == 0 ) v1 = 0; break; case AST_EXPR_string: - if( a->u.s == 0 ) + if ( a->u.s == 0 ) v1 = 0; else { - if( a->u.s[0] == 0 ) + if ( a->u.s[0] == 0 ) v1 = 0; else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' ) v1 = 0; @@ -3265,11 +3265,11 @@ break; case AST_EXPR_numeric_string: - if( a->u.s == 0 ) + if ( a->u.s == 0 ) v1 = 0; else { - if( a->u.s[0] == 0 ) + if ( a->u.s[0] == 0 ) v1 = 0; else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' ) v1 = 0; @@ -3303,7 +3303,7 @@ if (!to_number (a) || !to_number (b)) { free_value(a); free_value(b); - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING, "non-numeric argument\n"); return(make_number(0)); } @@ -3336,13 +3336,13 @@ if (!to_number (a)) { free_value(a); free_value(b); - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING, "non-numeric argument\n"); return make_number(0); } else if (!to_number (b)) { free_value(a); free_value(b); - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING, "non-numeric argument\n"); return make_number(INT_MAX); } @@ -3369,7 +3369,7 @@ struct val *r; if (!to_number (a) || !to_number (b)) { - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING, "non-numeric argument\n"); free_value(a); free_value(b); Index: main/ast_expr2f.c =================================================================== --- main/ast_expr2f.c (revision 228266) +++ main/ast_expr2f.c (working copy) @@ -769,7 +769,7 @@ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ - if( errno != EINTR) \ + if ( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ @@ -2297,7 +2297,7 @@ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ + while (YY_CURRENT_BUFFER){ ast_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; ast_yypop_buffer_state(yyscanner); @@ -2556,7 +2556,7 @@ break; } } - if( !found ) + if ( !found ) *s++ = *p++; } *s++ = 0; @@ -2572,7 +2572,7 @@ char *s2 = expr2_token_subst(s); spacebuf[0] = 0; - for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' '; /* uh... assuming yyg is defined, then I can use the yycolumn macro, + for (i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' '; /* uh... assuming yyg is defined, then I can use the yycolumn macro, which is the same thing as... get this: yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column I was tempted to just use yy_buf_pos in the STATE, but..., well: Index: main/astobj2.c =================================================================== --- main/astobj2.c (revision 228266) +++ main/astobj2.c (working copy) @@ -90,7 +90,7 @@ c = backtrace(addresses, N1); strings = backtrace_symbols(addresses,c); ast_verbose("backtrace returned: %d\n", c); - for(i = 0; i < c; i++) { + for (i = 0; i < c; i++) { ast_verbose("%d: %p %s\n", i, addresses[i], strings[i]); } free(strings); Index: main/channel.c =================================================================== --- main/channel.c (revision 228266) +++ main/channel.c (working copy) @@ -3889,9 +3889,9 @@ int count = 0; /*Deadlock avoidance*/ - while(ast_channel_trylock(chan)) { + while (ast_channel_trylock(chan)) { /*cannot goto done since the channel is not locked*/ - if(count++ > 10) { + if (count++ > 10) { ast_debug(1, "Deadlock avoided for write to channel '%s'\n", chan->name); return 0; } @@ -4415,7 +4415,7 @@ case AST_CONTROL_CONGESTION: case AST_CONTROL_ANSWER: *outstate = f->subclass.integer; - timeout = 0; /* trick to force exit from the while() */ + timeout = 0; /* trick to force exit from the while () */ break; /* Ignore these */ Index: main/config.c =================================================================== --- main/config.c (revision 228266) +++ main/config.c (working copy) @@ -1248,7 +1248,7 @@ #endif /* * The following is not a loop, but just a convenient way to define a block - * (using do { } while(0) ), and be able to exit from it with 'continue' + * (using do { } while (0) ), and be able to exit from it with 'continue' * or 'break' in case of errors. Nice trick. */ do { @@ -1722,7 +1722,7 @@ } fprintf(f, ")"); } - for(cmt = cat->sameline; cmt; cmt=cmt->next) + for (cmt = cat->sameline; cmt; cmt=cmt->next) { fprintf(f,"%s", cmt->cmt); } Index: main/db1-ast/recno/rec_delete.c =================================================================== --- main/db1-ast/recno/rec_delete.c (revision 228266) +++ main/db1-ast/recno/rec_delete.c (working copy) @@ -78,7 +78,7 @@ t->bt_pinned = NULL; } - switch(flags) { + switch (flags) { case 0: if ((nrec = *(recno_t *)key->data) == 0) goto einval; Index: main/db1-ast/recno/rec_seq.c =================================================================== --- main/db1-ast/recno/rec_seq.c (revision 228266) +++ main/db1-ast/recno/rec_seq.c (working copy) @@ -76,7 +76,7 @@ t->bt_pinned = NULL; } - switch(flags) { + switch (flags) { case R_CURSOR: if ((nrec = *(recno_t *)key->data) == 0) goto einval; Index: main/editline/chared.c =================================================================== --- main/editline/chared.c (revision 228266) +++ main/editline/chared.c (working copy) @@ -502,7 +502,7 @@ * to make the buffer big enough to hold both old and new stuff. */ if (addlen > sz) { - while(newsz - sz < addlen) + while (newsz - sz < addlen) newsz *= 2; } Index: main/editline/np/unvis.c =================================================================== --- main/editline/np/unvis.c (revision 228266) +++ main/editline/np/unvis.c (working copy) @@ -125,7 +125,7 @@ return (UNVIS_VALID); case S_START: - switch(c) { + switch (c) { case '\\': *cp = c; *astate = S_GROUND; Index: main/editline/readline.c =================================================================== --- main/editline/readline.c (revision 228266) +++ main/editline/readline.c (working copy) @@ -245,7 +245,7 @@ * Find out where the rl_complete function was added; this is * used later to detect that lastcmd was also rl_complete. */ - for(i=EL_NUM_FCNS; i < e->el_map.nfunc; i++) { + for (i=EL_NUM_FCNS; i < e->el_map.nfunc; i++) { if (e->el_map.func[i] == _el_rl_complete) { el_rl_complete_cmdnum = i; break; @@ -748,7 +748,7 @@ ADD_STRING(temp, len); } i = j; - } /* for(i ...) */ + } /* for (i ...) */ if (retval == 2) { add_history(temp); @@ -1414,8 +1414,8 @@ _rl_qsort_string_compare); idx = 1; - for(; count > 0; count--) { - for(i=0; i < limit && matches[idx]; i++, idx++) + for (; count > 0; count--) { + for (i=0; i < limit && matches[idx]; i++, idx++) fprintf(e->el_outfile, "%-*s ", max, matches[idx]); fprintf(e->el_outfile, "\n"); } @@ -1515,7 +1515,7 @@ * matches. */ - for(i=1, maxlen=0; matches[i]; i++) { + for (i=1, maxlen=0; matches[i]; i++) { match_len = strlen(matches[i]); if (match_len > maxlen) maxlen = match_len; Index: main/editline/refresh.c =================================================================== --- main/editline/refresh.c (revision 228266) +++ main/editline/refresh.c (working copy) @@ -163,7 +163,7 @@ int i, lins = el->el_term.t_size.v; char *firstline = el->el_vdisplay[0]; - for(i=1; i < lins; i++) + for (i=1; i < lins; i++) el->el_vdisplay[i-1] = el->el_vdisplay[i]; firstline[0] = '\0'; /* empty the string */ @@ -1003,7 +1003,7 @@ int i, lins = el->el_term.t_size.v; char *firstline = el->el_display[0]; - for(i=1; i < lins; i++) + for (i=1; i < lins; i++) el->el_display[i-1] = el->el_display[i]; re__copy_and_pad(firstline, "", 0); Index: main/enum.c =================================================================== --- main/enum.c (revision 228266) +++ main/enum.c (working copy) @@ -671,7 +671,7 @@ if (!(context = ast_calloc(1, sizeof(*context)))) return -1; - if((p3 = strchr(naptrinput, '*'))) { + if ((p3 = strchr(naptrinput, '*'))) { *p3='\0'; } Index: main/features.c =================================================================== --- main/features.c (revision 228266) +++ main/features.c (working copy) @@ -1149,7 +1149,7 @@ } if (!ast_strlen_zero(courtesytone)) { /* Play courtesy tone if configured */ - if(play_message_in_bridged_call(caller_chan, callee_chan, courtesytone) == -1) { + if (play_message_in_bridged_call(caller_chan, callee_chan, courtesytone) == -1) { return -1; } } @@ -1193,7 +1193,7 @@ snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename); } - for(x = 0; x < strlen(args); x++) { + for (x = 0; x < strlen(args); x++) { if (args[x] == '/') args[x] = '-'; } @@ -1306,7 +1306,7 @@ snprintf(args, len, "%s.%s,b", touch_filename, S_OR(touch_format, "wav")); } - for( x = 0; x < strlen(args); x++) { + for ( x = 0; x < strlen(args); x++) { if (args[x] == '/') args[x] = '-'; } @@ -2139,7 +2139,7 @@ ast_autoservice_start(idle); - if(work && idle) { + if (work && idle) { pbx_builtin_setvar_helper(work, "DYNAMIC_PEERNAME", idle->name); pbx_builtin_setvar_helper(idle, "DYNAMIC_PEERNAME", work->name); pbx_builtin_setvar_helper(work, "DYNAMIC_FEATURENAME", feature->sname); @@ -2406,7 +2406,7 @@ if (!(chan = ast_request(type, format, caller, data, &cause))) { ast_log(LOG_NOTICE, "Unable to request channel %s/%s\n", type, (char *)data); - switch(cause) { + switch (cause) { case AST_CAUSE_BUSY: state = AST_CONTROL_BUSY; break; @@ -2459,7 +2459,7 @@ active_channel = ast_waitfor_n(monitor_chans, 2, &to); /* see if the timeout has been violated */ - if(ast_tvdiff_ms(ast_tvnow(), started) > timeout) { + if (ast_tvdiff_ms(ast_tvnow(), started) > timeout) { state = AST_CONTROL_UNHOLD; ast_log(LOG_NOTICE, "We exceeded our AT-timeout\n"); break; /*doh! timeout*/ @@ -2998,7 +2998,7 @@ f = NULL; config->feature_timer = 0; res = feature_interpret(chan, peer, config, featurecode, sense); - switch(res) { + switch (res) { case AST_FEATURE_RETURN_PASSDIGITS: ast_dtmf_stream(other, who, featurecode, 0, 0); /* Fall through */ @@ -3303,7 +3303,7 @@ if (cp) *cp = 0; ast_copy_string(peername_flat,peername,sizeof(peername_flat)); - for(i=0; peername_flat[i] && i < AST_MAX_EXTENSION; i++) { + for (i=0; peername_flat[i] && i < AST_MAX_EXTENSION; i++) { if (peername_flat[i] == '/') peername_flat[i]= '0'; } @@ -3840,7 +3840,7 @@ ast_log(LOG_DEBUG, "Building parking lot %s\n", name); /* Do some config stuff */ - while(confvar) { + while (confvar) { if (!strcasecmp(confvar->name, "context")) { ast_copy_string(parkinglot->parking_con, confvar->value, sizeof(parkinglot->parking_con)); } else if (!strcasecmp(confvar->name, "parkingtime")) { @@ -4213,7 +4213,7 @@ /* Is this a parkinglot definition ? */ if (!strncasecmp(ctg, "parkinglot_", strlen("parkinglot_"))) { ast_debug(2, "Found configuration section %s, assume parking context\n", ctg); - if(!build_parkinglot(ctg, ast_variable_browse(cfg, ctg))) + if (!build_parkinglot(ctg, ast_variable_browse(cfg, ctg))) ast_log(LOG_ERROR, "Could not build parking lot %s. Configuration error.\n", ctg); else ast_debug(1, "Configured parking context %s\n", ctg); @@ -4253,7 +4253,7 @@ /* Remove the old parking extension */ if (!ast_strlen_zero(old_parking_con) && (con = ast_context_find(old_parking_con))) { - if(ast_context_remove_extension2(con, old_parking_ext, 1, registrar, 0)) + if (ast_context_remove_extension2(con, old_parking_ext, 1, registrar, 0)) notify_metermaids(old_parking_ext, old_parking_con, AST_DEVICE_NOT_INUSE); ast_debug(1, "Removed old parking extension %s@%s\n", old_parking_ext, old_parking_con); } Index: main/frame.c =================================================================== --- main/frame.c (revision 228266) +++ main/frame.c (working copy) @@ -785,7 +785,7 @@ return; if (f->frametype == AST_FRAME_VIDEO) return; - switch(f->frametype) { + switch (f->frametype) { case AST_FRAME_DTMF_BEGIN: strcpy(ftype, "DTMF Begin"); subclass[0] = f->subclass.integer; @@ -1289,7 +1289,7 @@ { enum frame_type type = buf & TYPE_MASK; - switch(type) { + switch (type) { case TYPE_DONTSEND: return 0; break; @@ -1313,7 +1313,7 @@ int pos = 0; int samples = 0; int res; - while(pos < maxlen) { + while (pos < maxlen) { res = g723_len(buf[pos]); if (res <= 0) break; @@ -1492,7 +1492,7 @@ int len = 0; /* XXX Still need speex, and lpc10 XXX */ - switch(format) { + switch (format) { case AST_FORMAT_G723_1: len = (samples / 240) * 20; break; Index: main/fskmodem_int.c =================================================================== --- main/fskmodem_int.c (revision 228266) +++ main/fskmodem_int.c (working copy) @@ -244,7 +244,7 @@ /* NOT USED if (demodulator(zap,&x1)) return -1; - for(;;) { + for (;;) { if (demodulator(zap,&x2)) return -1; if (x1>0 && x2<0) break; @@ -259,7 +259,7 @@ if (idemodulator(fskd, &fskd->xi1, IGET_SAMPLE)) return -1; samples++; - for(;;) { + for (;;) { search_startbit2: if (*len <= 0) { fskd->state = STATE_SEARCH_STARTBIT2; Index: main/global_datastores.c =================================================================== --- main/global_datastores.c (revision 228266) +++ main/global_datastores.c (working copy) @@ -54,11 +54,11 @@ AST_LIST_HEAD(, ast_dialed_interface) *old_list; AST_LIST_HEAD(, ast_dialed_interface) *new_list = NULL; - if(!(old_list = data)) { + if (!(old_list = data)) { return NULL; } - if(!(new_list = ast_calloc(1, sizeof(*new_list)))) { + if (!(new_list = ast_calloc(1, sizeof(*new_list)))) { return NULL; } @@ -66,7 +66,7 @@ AST_LIST_LOCK(old_list); AST_LIST_TRAVERSE(old_list, di, list) { struct ast_dialed_interface *di2 = ast_calloc(1, sizeof(*di2) + strlen(di->interface)); - if(!di2) { + if (!di2) { AST_LIST_UNLOCK(old_list); dialed_interface_destroy(new_list); return NULL; Index: main/loader.c =================================================================== --- main/loader.c (revision 228266) +++ main/loader.c (working copy) @@ -874,7 +874,7 @@ int count = 0; int res = 0; - if(!(resource_heap = ast_heap_create(8, mod_load_cmp, -1))) { + if (!(resource_heap = ast_heap_create(8, mod_load_cmp, -1))) { return -1; } Index: main/logger.c =================================================================== --- main/logger.c (revision 228266) +++ main/logger.c (working copy) @@ -618,7 +618,7 @@ a full Asterisk reload) */ int logger_reload(void) { - if(reload_logger(0)) + if (reload_logger(0)) return RESULT_FAILURE; return RESULT_SUCCESS; } Index: main/manager.c =================================================================== --- main/manager.c (revision 228266) +++ main/manager.c (working copy) @@ -2491,7 +2491,7 @@ } } else { ast_config_destroy(cfg); - switch(result) { + switch (result) { case UNKNOWN_ACTION: astman_send_error(s, m, "Unknown action command"); break; @@ -5101,7 +5101,7 @@ AST_RWLIST_WRLOCK(&users); user = get_manager_by_name_locked(d.username); - if(!user) { + if (!user) { AST_RWLIST_UNLOCK(&users); ast_log(LOG_NOTICE, "%s tried to authenticate with nonexistent user '%s'\n", ast_inet_ntoa(remote_address->sin_addr), d.username); nonce = 0; Index: main/pbx.c =================================================================== --- main/pbx.c (revision 228266) +++ main/pbx.c (working copy) @@ -1198,8 +1198,8 @@ } t1 = ast_hashtab_start_traversal(contexts_table); - while( (c1 = ast_hashtab_next(t1))) { - for(c2=contexts;c2;c2=c2->next) { + while ( (c1 = ast_hashtab_next(t1))) { + for (c2=contexts;c2;c2=c2->next) { if (!strcmp(c1->name, c2->name)) { found = 1; break; @@ -1211,7 +1211,7 @@ } } ast_hashtab_end_traversal(t1); - for(c2=contexts;c2;c2=c2->next) { + for (c2=contexts;c2;c2=c2->next) { c1 = find_context_locked(c2->name); if (!c1) { ast_log(LOG_NOTICE,"Called from: %s:%d: Could not find the %s context in the hashtab\n", file, line, c2->name); @@ -1222,7 +1222,7 @@ /* loop thru all contexts, and verify the exten structure compares to the hashtab structure */ - for(c2=contexts;c2;c2=c2->next) { + for (c2=contexts;c2;c2=c2->next) { c1 = find_context_locked(c2->name); if (c1) { @@ -1230,7 +1230,7 @@ ast_unlock_contexts(); /* is every entry in the root list also in the root_table? */ - for(e1 = c1->root; e1; e1=e1->next) + for (e1 = c1->root; e1; e1=e1->next) { char dummy_name[1024]; ex.exten = dummy_name; @@ -1256,8 +1256,8 @@ } } else { t1 = ast_hashtab_start_traversal(c2->root_table); - while( (e2 = ast_hashtab_next(t1)) ) { - for(e1=c2->root;e1;e1=e1->next) { + while ( (e2 = ast_hashtab_next(t1)) ) { + for (e1=c2->root;e1;e1=e1->next) { if (!strcmp(e1->exten, e2->exten)) { found = 1; break; @@ -1277,9 +1277,9 @@ /* is every entry in the root list also in the root_table? */ /* are the per-extension peer_tables in the right place? */ - for(e1 = c2->root; e1; e1 = e1->next) { + for (e1 = c2->root; e1; e1 = e1->next) { - for(e2=e1;e2;e2=e2->peer) { + for (e2=e1;e2;e2=e2->peer) { ex.priority = e2->priority; if (e2 != e1 && e2->peer_table) { ast_log(LOG_NOTICE,"Called from: %s:%d: The %s context, %s exten, %d priority has a peer_table entry, and shouldn't!\n", file, line, c2->name, e1->exten, e2->priority ); @@ -1316,8 +1316,8 @@ /* is every entry in the peer_table also in the peer list? */ t1 = ast_hashtab_start_traversal(e1->peer_table); - while( (e2 = ast_hashtab_next(t1)) ) { - for(e3=e1;e3;e3=e3->peer) { + while ( (e2 = ast_hashtab_next(t1)) ) { + for (e3=e1;e3;e3=e3->peer) { if (e3->priority == e2->priority) { found = 1; break; @@ -1467,7 +1467,7 @@ * | * NULL * - * In the above, I could easily turn "N" into "23456789", but I think that a quick "if( *z >= '2' && *z <= '9' )" might take + * In the above, I could easily turn "N" into "23456789", but I think that a quick "if ( *z >= '2' && *z <= '9' )" might take * fewer CPU cycles than a call to strchr("23456789",*z), where *z is the char to match... * * traversal is pretty simple: one routine merely traverses the alt list, and for each matching char in the pattern, it calls itself @@ -2459,7 +2459,7 @@ ast_copy_string(item.name, name, sizeof(item.name)); ast_rdlock_contexts(); - if( contexts_table ) { + if ( contexts_table ) { tmp = ast_hashtab_lookup(contexts_table,&item); } else { while ( (tmp = ast_walk_contexts(tmp)) ) { @@ -8725,7 +8725,7 @@ f = ast_read(chan); if (f) ast_frfree(f); - } while(f); + } while (f); } /*! Index: main/say.c =================================================================== --- main/say.c (revision 228266) +++ main/say.c (working copy) @@ -1402,7 +1402,7 @@ 10 and first word of 1[1-9] and 20 and first word of 2[1-9] are different. */ - while(!res && (num || playh)) { + while (!res && (num || playh)) { if (num < 0) { ast_copy_string(fn, "digits/minus", sizeof(fn)); if ( num > INT_MIN ) { @@ -1452,7 +1452,7 @@ } } if (!res) { - if(!ast_streamfile(chan, fn, language)) { + if (!ast_streamfile(chan, fn, language)) { if ((audiofd > -1) && (ctrlfd > -1)) res = ast_waitstream_full(chan, ints, audiofd, ctrlfd); else @@ -2551,7 +2551,7 @@ if (!num) return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd); - while(!res && (num || playh)) { + while (!res && (num || playh)) { if (num < 0) { ast_copy_string(fn, "digits/lop", sizeof(fn)); if ( num > INT_MIN ) { @@ -2600,7 +2600,7 @@ ast_copy_string(fn, "digits/larn", sizeof(fn)); } if (!res) { - if(!ast_streamfile(chan, fn, language)) { + if (!ast_streamfile(chan, fn, language)) { if ((audiofd > -1) && (ctrlfd > -1)) res = ast_waitstream_full(chan, ints, audiofd, ctrlfd); else Index: main/stdtime/localtime.c =================================================================== --- main/stdtime/localtime.c (revision 228266) +++ main/stdtime/localtime.c (working copy) @@ -1403,7 +1403,7 @@ *gmt_off = sp->ttis[sp->types[sp->timecnt -1]].tt_gmtoff; } else { /* I have valid daylight savings information. */ - if(sp->ttis[transition2].tt_isdst) + if (sp->ttis[transition2].tt_isdst) *gmt_off = sp->ttis[transition1].tt_gmtoff; else *gmt_off = sp->ttis[transition2].tt_gmtoff; @@ -1412,7 +1412,7 @@ if (!bounds_exceeded) { *dst_enabled = 1; /* Determine which of the bounds is the start of daylight savings and which is the end */ - if(sp->ttis[transition2].tt_isdst) { + if (sp->ttis[transition2].tt_isdst) { *dst_start = sp->ats[i]; *dst_end = sp->ats[i -1]; } else { Index: main/tdd.c =================================================================== --- main/tdd.c (revision 228266) +++ main/tdd.c (working copy) @@ -232,19 +232,19 @@ #define PUT_BYTE(a) do { \ *(buf++) = (a); \ bytes++; \ -} while(0) +} while (0) #define PUT_AUDIO_SAMPLE(y) do { \ int __pas_idx = (short)(rint(8192.0 * (y))); \ *(buf++) = AST_LIN2MU(__pas_idx); \ bytes++; \ -} while(0) +} while (0) #define PUT_TDD_MARKMS do { \ int x; \ for (x = 0; x < 8; x++) \ PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, 1)); \ -} while(0) +} while (0) #define PUT_TDD_BAUD(bit) do { \ while (scont < tddsb) { \ @@ -252,7 +252,7 @@ scont += 1.0; \ } \ scont -= tddsb; \ -} while(0) +} while (0) #define PUT_TDD_STOP do { \ while (scont < (tddsb * 1.5)) { \ @@ -260,7 +260,7 @@ scont += 1.0; \ } \ scont -= (tddsb * 1.5); \ -} while(0) +} while (0) #define PUT_TDD(byte) do { \ @@ -272,7 +272,7 @@ b >>= 1; \ } \ PUT_TDD_STOP; /* Stop bit */ \ -} while(0); +} while (0); /*! Generate TDD hold tone * \param buf Result buffer @@ -302,7 +302,7 @@ float ci = 0.0; float scont = 0.0; - for(x = 0; str[x]; x++) { + for (x = 0; str[x]; x++) { /* Do synch for each 72th character */ if ( (tdd->charnum++) % 72 == 0) PUT_TDD(tdd->mode ? 27 /* FIGS */ : 31 /* LTRS */); Index: main/translate.c =================================================================== --- main/translate.c (revision 228266) +++ main/translate.c (working copy) @@ -563,7 +563,7 @@ for (x = -1; x < SHOW_TRANS; x++) { struct ast_str *out = ast_str_alloca(125); /*Go ahead and move to next iteration if dealing with an unknown codec*/ - if(x >= 0 && !strcmp(ast_getformatname(1LL << (x)), "unknown")) + if (x >= 0 && !strcmp(ast_getformatname(1LL << (x)), "unknown")) continue; ast_str_set(&out, -1, " "); for (y = -1; y < SHOW_TRANS; y++) { Index: pbx/dundi-parser.c =================================================================== --- pbx/dundi-parser.c (revision 228266) +++ pbx/dundi-parser.c (working copy) @@ -220,7 +220,7 @@ static char *proto2str(int proto, char *buf, int bufsiz) { - switch(proto) { + switch (proto) { case DUNDI_PROTO_NONE: strncpy(buf, "None", bufsiz - 1); break; @@ -387,7 +387,7 @@ char tmp[1024]; if (len < 2) return; - while(len >= 2) { + while (len >= 2) { ie = iedata[0]; ielen = iedata[1]; /* Encrypted data is the remainder */ @@ -643,14 +643,14 @@ ies->expiration = -1; ies->unknowncmd = -1; ies->cause = -1; - while(datalen >= 2) { + while (datalen >= 2) { ie = data[0]; len = data[1]; if (len > datalen - 2) { errorf("Information element length exceeds message size\n"); return -1; } - switch(ie) { + switch (ie) { case DUNDI_IE_EID: case DUNDI_IE_EID_DIRECT: if (len != (int)sizeof(dundi_eid)) { Index: pbx/pbx_config.c =================================================================== --- pbx/pbx_config.c (revision 228266) +++ pbx/pbx_config.c (working copy) @@ -764,7 +764,7 @@ if ((v = ast_variable_browse(cfg, "globals"))) { fprintf(output, "[globals]\n"); - while(v) { + while (v) { fprintf(output, "%s => %s\n", v->name, v->value); v = v->next; } Index: pbx/pbx_dundi.c =================================================================== --- pbx/pbx_dundi.c (revision 228266) +++ pbx/pbx_dundi.c (working copy) @@ -293,7 +293,7 @@ static char *tech2str(int tech) { - switch(tech) { + switch (tech) { case DUNDI_PROTO_NONE: return "None"; case DUNDI_PROTO_IAX: @@ -337,7 +337,7 @@ } } - switch(hdr->cmdresp & 0x7f) { + switch (hdr->cmdresp & 0x7f) { case DUNDI_COMMAND_DPDISCOVER: case DUNDI_COMMAND_EIDQUERY: case DUNDI_COMMAND_PRECACHERQ: @@ -1088,7 +1088,7 @@ if (expiration > 0) { ast_debug(1, "Found cache expiring in %d seconds!\n", expiration); ptr += length + 1; - while((sscanf(ptr, "%30d/%30d/%30d/%n", &(flags.flags), &weight, &tech, &length) == 3)) { + while ((sscanf(ptr, "%30d/%30d/%30d/%n", &(flags.flags), &weight, &tech, &length) == 3)) { ptr += length; term = strchr(ptr, '|'); if (term) { @@ -1164,7 +1164,7 @@ res |= cache_lookup_internal(now, req, key, eid_str_full, lowexpiration); x = 0; if (!req->respcount) { - while(!res2) { + while (!res2) { /* Look and see if we have a hint that would preclude us from looking at this peer for this number. */ if (!(tmp[x] = req->number[x])) @@ -1272,7 +1272,7 @@ unsigned char curblock[16]; int x; memcpy(curblock, iv, sizeof(curblock)); - while(len > 0) { + while (len > 0) { for (x=0;x<16;x++) curblock[x] ^= src[x]; ast_aes_encrypt(curblock, dst, ecx); @@ -1288,7 +1288,7 @@ unsigned char lastblock[16]; int x; memcpy(lastblock, iv, sizeof(lastblock)); - while(len > 0) { + while (len > 0) { ast_aes_decrypt(src, dst, dcx); for (x=0;x<16;x++) dst[x] ^= lastblock[x]; @@ -1517,7 +1517,7 @@ goto return_cleanup; } } - switch(cmd) { + switch (cmd) { case DUNDI_COMMAND_DPDISCOVER: case DUNDI_COMMAND_EIDQUERY: case DUNDI_COMMAND_PRECACHERQ: @@ -2011,10 +2011,10 @@ secret[0] = '\0'; ast_base64encode(secret, tmp, sizeof(tmp), seclen); /* Eliminate potential bad characters */ - while((s = strchr(secret, ';'))) *s = '+'; - while((s = strchr(secret, '/'))) *s = '+'; - while((s = strchr(secret, ':'))) *s = '+'; - while((s = strchr(secret, '@'))) *s = '+'; + while ((s = strchr(secret, ';'))) *s = '+'; + while ((s = strchr(secret, '/'))) *s = '+'; + while ((s = strchr(secret, ':'))) *s = '+'; + while ((s = strchr(secret, '@'))) *s = '+'; } @@ -2292,7 +2292,7 @@ static char *model2str(int model) { - switch(model) { + switch (model) { case DUNDI_MODEL_INBOUND: return "Inbound"; case DUNDI_MODEL_OUTBOUND: @@ -2509,7 +2509,7 @@ break; } if (peer) { - switch(peer->order) { + switch (peer->order) { case 0: order = "Primary"; break; @@ -3024,7 +3024,7 @@ trans->aseqno = trans->iseqno; /* If we have their public key, encrypt */ if (ast_test_flag(trans, FLAG_ENCRYPT)) { - switch(cmdresp) { + switch (cmdresp) { case DUNDI_COMMAND_REGREQ: case DUNDI_COMMAND_REGRESPONSE: case DUNDI_COMMAND_DPDISCOVER: @@ -3399,7 +3399,7 @@ /* Check order first, then check cache, regardless of omissions, this gets us more likely to not have an affected answer. */ - if((nocache || !(res = cache_lookup(dr, &p->eid, dr->crc32, &dr->expiration)))) { + if ((nocache || !(res = cache_lookup(dr, &p->eid, dr->crc32, &dr->expiration)))) { res = 0; /* Make sure we haven't already seen it and that it won't affect our answer */ @@ -3549,7 +3549,7 @@ ast_debug(1, "Waiting for similar request for '%s@%s' for '%s'\n", dr.number,dr.dcontext,ast_eid_to_str(eid_str, sizeof(eid_str), &pending->root_eid)); start = ast_tvnow(); - while(check_request(pending) && (ast_tvdiff_ms(ast_tvnow(), start) < ttlms) && (!chan || !ast_check_hangup(chan))) { + while (check_request(pending) && (ast_tvdiff_ms(ast_tvnow(), start) < ttlms) && (!chan || !ast_check_hangup(chan))) { /* XXX Would be nice to have a way to poll/select here XXX */ /* XXX this is a busy wait loop!!! */ usleep(1); @@ -4620,12 +4620,12 @@ global_storehistory = 0; ast_copy_string(secretpath, "dundi", sizeof(secretpath)); v = ast_variable_browse(cfg, "general"); - while(v) { + while (v) { if (!strcasecmp(v->name, "port")){ sin->sin_port = ntohs(atoi(v->value)); - if(last_port==0){ + if (last_port==0){ last_port=sin->sin_port; - } else if(sin->sin_port != last_port) + } else if (sin->sin_port != last_port) ast_log(LOG_WARNING, "change to port ignored until next asterisk re-start\n"); } else if (!strcasecmp(v->name, "bindaddr")) { struct hostent *hep; @@ -4692,14 +4692,14 @@ AST_LIST_UNLOCK(&peers); mark_mappings(); v = ast_variable_browse(cfg, "mappings"); - while(v) { + while (v) { build_mapping(v->name, v->value); v = v->next; } prune_mappings(); mark_peers(); cat = ast_category_browse(cfg, NULL); - while(cat) { + while (cat) { if (strcasecmp(cat, "general") && strcasecmp(cat, "mappings")) { /* Entries */ if (!ast_str_to_eid(&testeid, cat)) Index: pbx/pbx_gtkconsole.c =================================================================== --- pbx/pbx_gtkconsole.c (revision 228266) +++ pbx/pbx_gtkconsole.c (working copy) @@ -157,7 +157,7 @@ /* make sure we've null terminated whatever we have so far */ c = buf; l = buf; - while(*c) { + while (*c) { if (*c == '\n') { /* Keep the trailing \n */ c++; Index: pbx/pbx_realtime.c =================================================================== --- pbx/pbx_realtime.c (revision 228266) +++ pbx/pbx_realtime.c (working copy) @@ -91,7 +91,7 @@ return NULL; } snprintf(pri, sizeof(pri), "%d", priority); - switch(mode) { + switch (mode) { case MODE_MATCHMORE: ematch = "exten LIKE"; snprintf(rexten, sizeof(rexten), "%s_%%", exten); @@ -111,8 +111,8 @@ if (cfg) { char *cat = ast_category_browse(cfg, NULL); - while(cat) { - switch(mode) { + while (cat) { + switch (mode) { case MODE_MATCHMORE: match = ast_extension_close(cat, exten, 1); break; @@ -234,7 +234,7 @@ char tmp3[EXT_DATA_SIZE]; appdata[0] = 0; /* just in case the substitute var func isn't called */ - if(!ast_strlen_zero(tmp)) + if (!ast_strlen_zero(tmp)) pbx_substitute_variables_helper(chan, tmp, appdata, sizeof(appdata) - 1); ast_verb(3, "Executing %s(\"%s\", \"%s\")\n", term_color(tmp1, app, COLOR_BRCYAN, 0, sizeof(tmp1)), Index: pbx/pbx_spool.c =================================================================== --- pbx/pbx_spool.c (revision 228266) +++ pbx/pbx_spool.c (working copy) @@ -118,7 +118,7 @@ last = last->next; } - while(fgets(buf, sizeof(buf), f)) { + while (fgets(buf, sizeof(buf), f)) { lineno++; /* Trim comments */ c = buf; @@ -141,7 +141,7 @@ } /* Trim trailing white space */ - while(!ast_strlen_zero(buf) && buf[strlen(buf) - 1] < 33) + while (!ast_strlen_zero(buf) && buf[strlen(buf) - 1] < 33) buf[strlen(buf) - 1] = '\0'; if (!ast_strlen_zero(buf)) { c = strchr(buf, ':'); @@ -446,7 +446,7 @@ nanosleep(&ts, NULL); } - for(;;) { + for (;;) { /* Wait a sec */ nanosleep(&ts, NULL); time(&now); Index: phoneprov/000000000000.cfg =================================================================== --- phoneprov/000000000000.cfg (revision 228266) +++ phoneprov/000000000000.cfg (working copy) @@ -1,2 +1,2 @@ - + Index: res/ael/ael.flex =================================================================== --- res/ael/ael.flex (revision 228266) +++ res/ael/ael.flex (working copy) @@ -495,7 +495,7 @@ } parencount--; - if( parencount >= 0){ + if ( parencount >= 0){ yymore(); } else { STORE_LOC; @@ -511,11 +511,11 @@ } {NOARGG}\, { - if( parencount != 0) { /* ast_log(LOG_NOTICE,"Folding in a comma!\n"); */ + if ( parencount != 0) { /* ast_log(LOG_NOTICE,"Folding in a comma!\n"); */ yymore(); } else { STORE_LOC; - if( !strcmp(yytext,"," ) ) + if ( !strcmp(yytext,"," ) ) return COMMA; yylval->str = malloc(yyleng); strncpy(yylval->str, yytext, yyleng); Index: res/ael/ael.tab.c =================================================================== --- res/ael/ael.tab.c (revision 228266) +++ res/ael/ael.tab.c (working copy) @@ -2731,7 +2731,7 @@ /* rebuild the original string-- this is not an app call, it's an unwrapped vardec, with a func call on the LHS */ /* string to big to fit in the buffer? */ tot+=strlen((yyvsp[(1) - (5)].pval)->u1.str); - for(pptr=(yyvsp[(1) - (5)].pval)->u2.arglist;pptr;pptr=pptr->next) { + for (pptr=(yyvsp[(1) - (5)].pval)->u2.arglist;pptr;pptr=pptr->next) { tot+=strlen(pptr->u1.str); tot++; /* for a sep like a comma */ } @@ -2914,7 +2914,7 @@ #line 612 "ael.y" { (yyval.pval) = update_last((yyvsp[(1) - (3)].pval), &(yylsp[(3) - (3)])); - if( (yyval.pval)->type == PV_GOTO ) + if ( (yyval.pval)->type == PV_GOTO ) (yyval.pval)->u1.list = (yyvsp[(2) - (3)].pval); else (yyval.pval)->u2.arglist = (yyvsp[(2) - (3)].pval); @@ -3442,7 +3442,7 @@ break; } } - if( !found ) + if ( !found ) *s++ = *p++; } *s++ = 0; @@ -3501,7 +3501,7 @@ { struct pval *t; - for(t=child_list;t;t=t->next) /* simple stuff */ + for (t=child_list;t;t=t->next) /* simple stuff */ t->dad = dad; } Index: res/ael/ael.y =================================================================== --- res/ael/ael.y (revision 228266) +++ res/ael/ael.y (working copy) @@ -611,7 +611,7 @@ application_call : application_call_head eval_arglist RP { $$ = update_last($1, &@3); - if( $$->type == PV_GOTO ) + if ( $$->type == PV_GOTO ) $$->u1.list = $2; else $$->u2.arglist = $2; @@ -826,7 +826,7 @@ break; } } - if( !found ) + if ( !found ) *s++ = *p++; } *s++ = 0; Index: res/ael/ael_lex.c =================================================================== --- res/ael/ael_lex.c (revision 228266) +++ res/ael/ael_lex.c (working copy) @@ -1130,7 +1130,7 @@ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ - if( errno != EINTR) \ + if ( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ @@ -1838,7 +1838,7 @@ } parencount--; - if( parencount >= 0){ + if ( parencount >= 0){ yymore(); } else { STORE_LOC; @@ -1858,11 +1858,11 @@ YY_RULE_SETUP #line 513 "ael.flex" { - if( parencount != 0) { /* ast_log(LOG_NOTICE,"Folding in a comma!\n"); */ + if ( parencount != 0) { /* ast_log(LOG_NOTICE,"Folding in a comma!\n"); */ yymore(); } else { STORE_LOC; - if( !strcmp(yytext,"," ) ) + if ( !strcmp(yytext,"," ) ) return COMMA; yylval->str = malloc(yyleng); strncpy(yylval->str, yytext, yyleng); @@ -3143,7 +3143,7 @@ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ + while (YY_CURRENT_BUFFER){ ael_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; ael_yypop_buffer_state(yyscanner); Index: res/ael/pval.c =================================================================== --- res/ael/pval.c (revision 228266) +++ res/ael/pval.c (working copy) @@ -334,7 +334,7 @@ break; case PV_SWITCH: - fprintf(fin,"switch( %s ) {\n", item->u1.str); + fprintf(fin,"switch ( %s ) {\n", item->u1.str); print_pval_list(fin,item->u2.statements,depth+1); for (i=0; itype != PV_MACRO && p->type != PV_CONTEXT ) /* early cutout, sort of */ { + while ( p && p->type != PV_MACRO && p->type != PV_CONTEXT ) /* early cutout, sort of */ { /* a break is allowed in WHILE, FOR, CASE, DEFAULT, PATTERN; otherwise, it don't make no sense */ - if( p->type == PV_CASE || p->type == PV_DEFAULT || p->type == PV_PATTERN + if ( p->type == PV_CASE || p->type == PV_DEFAULT || p->type == PV_PATTERN || p->type == PV_WHILE || p->type == PV_FOR ) { return 1; } @@ -1062,10 +1062,10 @@ { pval *p = item; - while( p && p->type != PV_MACRO && p->type != PV_CONTEXT ) /* early cutout, sort of */ { + while ( p && p->type != PV_MACRO && p->type != PV_CONTEXT ) /* early cutout, sort of */ { /* a break is allowed in WHILE, FOR, CASE, DEFAULT, PATTERN; otherwise, it don't make no sense */ - if( p->type == PV_WHILE || p->type == PV_FOR ) { + if ( p->type == PV_WHILE || p->type == PV_FOR ) { return 1; } p = p->dad; @@ -1081,8 +1081,8 @@ { struct pval *curr; curr = item; - while( curr ) { - if( curr->type == PV_MACRO ) { + while ( curr ) { + if ( curr->type == PV_MACRO ) { return curr; } curr = curr->dad; @@ -1094,8 +1094,8 @@ { struct pval *curr; curr = item; - while( curr ) { - if( curr->type == PV_MACRO || curr->type == PV_CONTEXT ) { + while ( curr ) { + if ( curr->type == PV_MACRO || curr->type == PV_CONTEXT ) { return curr; } curr = curr->dad; @@ -1116,14 +1116,14 @@ curr = item; - while( curr ) { - if( curr->type == PV_MACRO || curr->type == PV_EXTENSION ) { + while ( curr ) { + if ( curr->type == PV_MACRO || curr->type == PV_EXTENSION ) { alright = 1; break; } curr = curr->dad; } - if( !alright ) + if ( !alright ) { ast_log(LOG_ERROR,"Error: file %s, line %d-%d: Label %s is not within an extension or macro!\n", item->filename, item->startline, item->endline, item->u1.str); @@ -1137,14 +1137,14 @@ /* printf("==== check_label: ====\n"); */ - if( !current_extension ) + if ( !current_extension ) curr = current_context; else curr = current_extension; x = find_first_label_in_current_context((char *)item->u1.str, curr); /* printf("Hey, check_label found with item = %x, and x is %x, and currcont is %x, label name is %s\n", item,x, current_context, (char *)item->u1.str); */ - if( x && x != item ) + if ( x && x != item ) { ast_log(LOG_ERROR,"Error: file %s, line %d-%d: Duplicate label %s! Previously defined at file %s, line %d.\n", item->filename, item->startline, item->endline, item->u1.str, x->filename, x->startline); @@ -1318,9 +1318,9 @@ errs++; } else { struct pval *mac = in_macro(item); /* is this goto inside a macro? */ - if( mac ) { /* yes! */ + if ( mac ) { /* yes! */ struct pval *targ = in_context(found); - if( mac != targ ) + if ( mac != targ ) { ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: It's bad form to have a goto in a macro to a target outside the macro!\n", item->filename, item->startline, item->endline); @@ -1357,9 +1357,9 @@ } } else { struct pval *mac = in_macro(item); /* is this goto inside a macro? */ - if( mac ) { /* yes! */ + if ( mac ) { /* yes! */ struct pval *targ = in_context(x); - if( mac != targ ) + if ( mac != targ ) { ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: It's bad form to have a goto in a macro to a target outside the macro!\n", item->filename, item->startline, item->endline); @@ -2079,7 +2079,7 @@ break; case ARGD_ENUM: - if( !is->u1.str || strlen(is->u1.str) == 0 ) + if ( !is->u1.str || strlen(is->u1.str) == 0 ) return 1; /* a null arg in the call will match an enum, I guess! */ for (ac=should->choices; ac; ac=ac->next) { if (strcmp(ac->name,is->u1.str) == 0) @@ -2628,7 +2628,7 @@ item->u2.val == variable value to assign */ /* the RHS of a vardec is encapsulated in a $[] expr. Is it legal? */ - if( !in_globals ) { /* don't check stuff inside the globals context; no wrapping in $[ ] there... */ + if ( !in_globals ) { /* don't check stuff inside the globals context; no wrapping in $[ ] there... */ snprintf(errmsg,sizeof(errmsg), "file %s, line %d, columns %d-%d, variable declaration expr '%s':", item->filename, item->startline, item->startcol, item->endcol, item->u2.val); ast_expr_register_extra_error_info(errmsg); ast_expr(item->u2.val, expr_output, sizeof(expr_output),NULL); @@ -2941,7 +2941,7 @@ exten->plist_last->next = prio; exten->plist_last = prio; } - if( !prio->exten ) + if ( !prio->exten ) prio->exten = exten; /* don't override the switch value */ /* The following code will cause all priorities within an extension to have ${EXTEN} or ${EXTEN: replaced with ~~EXTEN~~, which is @@ -3016,8 +3016,8 @@ { pval *p = label; - while( p && p->type != PV_MACRO && p->type != PV_CONTEXT ) /* early cutout, sort of */ { - if( p->type == PV_CASE || p->type == PV_DEFAULT || p->type == PV_PATTERN ) { + while ( p && p->type != PV_MACRO && p->type != PV_CONTEXT ) /* early cutout, sort of */ { + if ( p->type == PV_CASE || p->type == PV_DEFAULT || p->type == PV_PATTERN ) { return 1; } @@ -3035,12 +3035,12 @@ static void remove_spaces_before_equals(char *str) { char *p; - while( str && *str && *str != '=' ) + while ( str && *str && *str != '=' ) { - if( *str == ' ' || *str == '\n' || *str == '\r' || *str == '\t' ) + if ( *str == ' ' || *str == '\n' || *str == '\r' || *str == '\t' ) { p = str; - while( *p ) + while ( *p ) { *p = *(p+1); p++; @@ -3463,7 +3463,7 @@ pr = new_prio(); pr->type = AEL_APPCALL; p->u2.goto_target = get_goto_target(p); - if( p->u2.goto_target ) { + if ( p->u2.goto_target ) { p->u3.goto_target_in_case = label_inside_case(p->u2.goto_target); } @@ -4245,7 +4245,7 @@ strcpy(appargs, pr->appargs); else appargs[0] = 0; - switch( pr->type ) { + switch ( pr->type ) { case AEL_APPCALL: /* easy case. Everything is all set up */ break; @@ -4313,13 +4313,13 @@ { /* travel to the end of the list... */ struct ael_extension *lptr; - if( !*list ) { + if ( !*list ) { *list = newmem; return; } lptr = *list; - while( lptr->next_exten ) { + while ( lptr->next_exten ) { lptr = lptr->next_exten; } /* lptr should now pointing to the last element in the list; it has a null next_exten pointer */ @@ -4328,7 +4328,7 @@ static pval *get_extension_or_contxt(pval *p) { - while( p && p->type != PV_EXTENSION && p->type != PV_CONTEXT && p->type != PV_MACRO ) { + while ( p && p->type != PV_EXTENSION && p->type != PV_CONTEXT && p->type != PV_MACRO ) { p = p->dad; } @@ -4338,7 +4338,7 @@ static pval *get_contxt(pval *p) { - while( p && p->type != PV_CONTEXT && p->type != PV_MACRO ) { + while ( p && p->type != PV_CONTEXT && p->type != PV_MACRO ) { p = p->dad; } @@ -4349,12 +4349,12 @@ static void fix_gotos_in_extensions(struct ael_extension *exten) { struct ael_extension *e; - for(e=exten;e;e=e->next_exten) { + for (e=exten;e;e=e->next_exten) { struct ael_priority *p; - for(p=e->plist;p;p=p->next) { + for (p=e->plist;p;p=p->next) { - if( p->origin && p->origin->type == PV_GOTO && p->origin->u3.goto_target_in_case ) { + if ( p->origin && p->origin->type == PV_GOTO && p->origin->u3.goto_target_in_case ) { /* fix the extension of the goto target to the actual extension in the post-compiled dialplan */ @@ -4381,7 +4381,7 @@ else printf("WHAT? The goto doesn't fall into one of three cases for GOTO????\n"); - if( apparg_save ) { + if ( apparg_save ) { free(apparg_save); } } @@ -4476,7 +4476,7 @@ exten->name = strdup(p2->u1.str); exten->context = context; - if( (s3=strchr(exten->name, '/') ) != 0 ) + if ( (s3=strchr(exten->name, '/') ) != 0 ) { *s3 = 0; exten->cidmatch = s3+1; Index: res/res_adsi.c =================================================================== --- res/res_adsi.c (revision 228266) +++ res/res_adsi.c (working copy) @@ -146,7 +146,7 @@ len -= amt; } - while(len) { + while (len) { amt = len; /* If we don't get anything at all back in a second, forget about it */ @@ -204,7 +204,7 @@ return -1; } - while(retries < maxretries) { + while (retries < maxretries) { if (!(chan->adsicpe & ADSI_FLAG_DATAMODE)) { /* Generate CAS (no SAS) */ ast_gen_cas(buf, 0, 680, AST_FORMAT_ULAW); @@ -215,7 +215,7 @@ /* Wait For DTMF result */ waittime = 500; - for(;;) { + for (;;) { if (((res = ast_waitfor(chan, waittime)) < 1)) { /* Didn't get back DTMF A in time */ ast_debug(1, "No ADSI CPE detected (%d)\n", res); @@ -554,7 +554,7 @@ memset(buf, 0, sizeof(buf)); - while(bytes <= maxlen) { + while (bytes <= maxlen) { /* Wait up to a second for a digit */ if (!(res = ast_waitfordigit(chan, 1000))) break; @@ -919,7 +919,7 @@ unsigned char buf[4096]; int bytes = 0, res, x; - for(x = 0; lines[x]; x++) + for (x = 0; lines[x]; x++) bytes += ast_adsi_display(buf + bytes, ADSI_INFO_PAGE, x+1, alignments[x], 0, lines[x], ""); bytes += ast_adsi_set_line(buf + bytes, ADSI_INFO_PAGE, 1); if (voice) Index: res/res_agi.c =================================================================== --- res/res_agi.c (revision 228266) +++ res/res_agi.c (working copy) @@ -1575,7 +1575,7 @@ /* Send any parameters to the fastagi server that have been passed via the agi application */ /* Agi application paramaters take the form of: AGI(/path/to/example/script|${EXTEN}) */ - for(count = 1; count < argc; count++) + for (count = 1; count < argc; count++) ast_agi_send(fd, chan, "agi_arg_%d: %s\n", count, argv[count]); /* End with empty return */ @@ -2162,7 +2162,7 @@ ast_dsp_free(sildet); return RESULT_FAILURE; } - switch(f->frametype) { + switch (f->frametype) { case AST_FRAME_DTMF: if (strchr(argv[4], f->subclass.integer)) { /* This is an interrupting chracter, so rewind to chop off any small @@ -2289,7 +2289,7 @@ ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argv[2]); if ((app_to_exec = pbx_findapp(argv[1]))) { - if(!strcasecmp(argv[1], PARK_APP_NAME)) { + if (!strcasecmp(argv[1], PARK_APP_NAME)) { ast_masq_park_call(chan, NULL, 0, NULL); } if (ast_compat_res_agi && !ast_strlen_zero(argv[2])) { @@ -3087,8 +3087,8 @@ char *cur; cur = s; - while(*s) { - switch(*s) { + while (*s) { + switch (*s) { case '"': /* If it's escaped, put a literal quote */ if (escaped) @@ -3184,7 +3184,7 @@ "Command: %s\r\n" "ResultCode: %d\r\n" "Result: %s\r\n", chan->name, command_id, ami_cmd, resultcode, ami_res); - switch(res) { + switch (res) { case RESULT_SHOWUSAGE: ast_agi_send(agi->fd, chan, "520-Invalid command syntax. Proper usage follows:\n"); ast_agi_send(agi->fd, chan, "%s", c->usage); @@ -3469,7 +3469,7 @@ { char *cur = str; - while(*cur) { + while (*cur) { switch (*cur) { case '<': fprintf(htmlfile, "%s", "<"); Index: res/res_calendar.c =================================================================== --- res/res_calendar.c (revision 228266) +++ res/res_calendar.c (working copy) @@ -444,7 +444,7 @@ AST_LIST_LOCK(&techs); AST_LIST_TRAVERSE(&techs, iter, list) { - if(!strcasecmp(tech->type, iter->type)) { + if (!strcasecmp(tech->type, iter->type)) { ast_log(LOG_WARNING, "Already have a handler for calendar type '%s'\n", tech->type); AST_LIST_UNLOCK(&techs); return -1; @@ -1325,7 +1325,7 @@ } } - if((ret = cal->tech->write_event(event))) { + if ((ret = cal->tech->write_event(event))) { ast_log(LOG_WARNING, "Writing event to calendar '%s' failed!\n", cal->name); } @@ -1355,7 +1355,7 @@ struct ao2_iterator i; struct ast_calendar *cal; - switch(cmd) { + switch (cmd) { case CLI_INIT: e->command = "calendar show calendars"; e->usage = @@ -1406,7 +1406,7 @@ int which = 0; char *ret = NULL; - switch(cmd) { + switch (cmd) { case CLI_INIT: e->command = "calendar show calendar"; e->usage = @@ -1476,7 +1476,7 @@ static char *handle_dump_sched(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - switch(cmd) { + switch (cmd) { case CLI_INIT: e->command = "calendar dump sched"; e->usage = Index: res/res_calendar_icalendar.c =================================================================== --- res/res_calendar_icalendar.c (revision 228266) +++ res/res_calendar_icalendar.c (working copy) @@ -436,7 +436,7 @@ ao2_unlock(cal); /* The only writing from another thread will be if unload is true */ - for(;;) { + for (;;) { struct timeval tv = ast_tvnow(); struct timespec ts = {0,}; Index: res/res_config_odbc.c =================================================================== --- res/res_config_odbc.c (revision 228266) +++ res/res_config_odbc.c (working copy) @@ -154,7 +154,7 @@ op = !strchr(newparam, ' ') ? " =" : ""; snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?%s", table, newparam, op, strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : ""); - while((newparam = va_arg(aq, const char *))) { + while ((newparam = va_arg(aq, const char *))) { op = !strchr(newparam, ' ') ? " =" : ""; snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " AND %s%s ?%s", newparam, op, strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : ""); @@ -220,7 +220,7 @@ return NULL; } stringp = rowdata; - while(stringp) { + while (stringp) { chunk = strsep(&stringp, ";"); if (!ast_strlen_zero(ast_strip(chunk))) { if (prev) { @@ -302,7 +302,7 @@ op = !strchr(newparam, ' ') ? " =" : ""; snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?%s", table, newparam, op, strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : ""); - while((newparam = va_arg(aq, const char *))) { + while ((newparam = va_arg(aq, const char *))) { op = !strchr(newparam, ' ') ? " =" : ""; snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " AND %s%s ?%s", newparam, op, strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : ""); @@ -368,7 +368,7 @@ continue; } stringp = rowdata; - while(stringp) { + while (stringp) { chunk = strsep(&stringp, ";"); if (!ast_strlen_zero(ast_strip(chunk))) { if (initfield && !strcmp(initfield, coltitle)) @@ -441,7 +441,7 @@ } snprintf(sql, sizeof(sql), "UPDATE %s SET %s=?", table, newparam); - while((newparam = va_arg(aq, const char *))) { + while ((newparam = va_arg(aq, const char *))) { newval = va_arg(aq, const char *); if ((tableptr && (column = ast_odbc_find_column(tableptr, newparam))) || count > 63) { snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), ", %s=?", newparam); @@ -728,7 +728,7 @@ return -1; snprintf(sql, sizeof(sql), "DELETE FROM %s WHERE ", table); - while((newparam = va_arg(aq, const char *))) { + while ((newparam = va_arg(aq, const char *))) { snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%s=? AND ", newparam); newval = va_arg(aq, const char *); } Index: res/res_config_pgsql.c =================================================================== --- res/res_config_pgsql.c (revision 228266) +++ res/res_config_pgsql.c (working copy) @@ -1283,7 +1283,7 @@ static int load_module(void) { - if(!parse_config(0)) + if (!parse_config(0)) return AST_MODULE_LOAD_DECLINE; ast_config_engine_register(&pgsql_engine); Index: res/res_crypto.c =================================================================== --- res/res_crypto.c (revision 228266) +++ res/res_crypto.c (working copy) @@ -178,7 +178,7 @@ } MD5Init(&md5); - while(!feof(f)) { + while (!feof(f)) { /* Calculate a "whatever" quality md5sum of the key */ char buf[256] = ""; if (!fgets(buf, sizeof(buf), f)) { @@ -326,7 +326,7 @@ return -1; } - while(srclen) { + while (srclen) { /* Process chunks 128 bytes at a time */ if ((res = RSA_private_decrypt(128, src, dst, key->rsa, RSA_PKCS1_OAEP_PADDING)) < 0) return -1; @@ -352,7 +352,7 @@ return -1; } - while(srclen) { + while (srclen) { bytes = srclen; if (bytes > 128 - 41) bytes = 128 - 41; @@ -456,7 +456,7 @@ /* Load new keys */ if ((dir = opendir(ast_config_AST_KEY_DIR))) { - while((ent = readdir(dir))) { + while ((ent = readdir(dir))) { try_load_key(ast_config_AST_KEY_DIR, ent->d_name, ifd, ofd, ¬e); } closedir(dir); Index: res/res_jabber.c =================================================================== --- res/res_jabber.c (revision 228266) +++ res/res_jabber.c (working copy) @@ -432,10 +432,10 @@ node = pak->from->full; if (!version) version = "none supplied."; - while(list) { + while (list) { if (!strcasecmp(list->node, node)) { res = list->versions; - while(res) { + while (res) { if (!strcasecmp(res->version, version)) return res; res = res->next; @@ -2397,7 +2397,7 @@ struct aji_client *client = ASTOBJ_REF((struct aji_client *) data); int res = IKS_HOOK; - while(res != IKS_OK) { + while (res != IKS_OK) { ast_debug(3, "JABBER: Connecting.\n"); res = aji_reconnect(client); sleep(4); @@ -2405,7 +2405,7 @@ do { if (res == IKS_NET_RWERR || client->timeout == 0) { - while(res != IKS_OK) { + while (res != IKS_OK) { ast_debug(3, "JABBER: reconnecting.\n"); res = aji_reconnect(client); sleep(4); Index: res/res_monitor.c =================================================================== --- res/res_monitor.c (revision 228266) +++ res/res_monitor.c (working copy) @@ -244,7 +244,7 @@ #define LOCK_IF_NEEDED(lock, needed) do { \ if (needed) \ ast_channel_lock(lock); \ - } while(0) + } while (0) #define UNLOCK_IF_NEEDED(lock, needed) do { \ if (needed) \ Index: res/res_musiconhold.c =================================================================== --- res/res_musiconhold.c (revision 228266) +++ res/res_musiconhold.c (working copy) @@ -555,7 +555,7 @@ deadline.tv_sec = 0; deadline.tv_usec = 0; - for(;/* ever */;) { + for (;/* ever */;) { pthread_testcancel(); /* Spawn mp3 player if it's not there */ if (class->srcfd < 0) { Index: res/res_phoneprov.c =================================================================== --- res/res_phoneprov.c (revision 228266) +++ res/res_phoneprov.c (working copy) @@ -1236,7 +1236,7 @@ struct ao2_iterator i; struct http_route *route; - switch(cmd) { + switch (cmd) { case CLI_INIT: e->command = "phoneprov show routes"; e->usage = Index: res/res_pktccops.c =================================================================== --- res/res_pktccops.c (revision 228266) +++ res/res_pktccops.c (working copy) @@ -403,7 +403,7 @@ } else if (sendmsg->object != NULL) { bufpos = 8; pobject = sendmsg->object; - while(pobject != NULL) { + while (pobject != NULL) { ast_debug(3, "COPS: Sending Object : cnum: %i ctype %i len: %i\n", pobject->cnum, pobject->ctype, pobject->length); if (sendmsg->length < bufpos + pobject->length) { ast_log(LOG_WARNING, "COPS: Invalid msg size len: %i objectlen: %i\n", sendmsg->length, pobject->length); @@ -1121,7 +1121,7 @@ char statedesc[16]; int katimer; - switch(cmd) { + switch (cmd) { case CLI_INIT: e->command = "pktccops show cmtses"; e->usage = @@ -1157,7 +1157,7 @@ struct cops_gate *gate; char state_desc[16]; - switch(cmd) { + switch (cmd) { case CLI_INIT: e->command = "pktccops show gates"; e->usage = @@ -1206,7 +1206,7 @@ char start[32]; char stop[32]; - switch(cmd) { + switch (cmd) { case CLI_INIT: e->command = "pktccops show pools"; e->usage = Index: res/res_snmp.c =================================================================== --- res/res_snmp.c (revision 228266) +++ res/res_snmp.c (working copy) @@ -95,7 +95,7 @@ static int load_module(void) { - if(!load_config()) + if (!load_config()) return AST_MODULE_LOAD_DECLINE; ast_verb(1, "Loading [Sub]Agent Module\n"); Index: res/res_timing_timerfd.c =================================================================== --- res/res_timing_timerfd.c (revision 228266) +++ res/res_timing_timerfd.c (working copy) @@ -218,7 +218,7 @@ return -1; } - if(!our_timer->is_continuous) { + if (!our_timer->is_continuous) { /* No reason to do anything if we're not * in continuous mode */ Index: static-http/prototype.js =================================================================== --- static-http/prototype.js (revision 228266) +++ static-http/prototype.js (working copy) @@ -3105,7 +3105,7 @@ valueL += element.offsetLeft || 0; element = element.offsetParent; if (element) { - if(element.tagName=='BODY') break; + if (element.tagName=='BODY') break; var p = Element.getStyle(element, 'position'); if (p == 'relative' || p == 'absolute') break; } @@ -3219,10 +3219,10 @@ } // set position - if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; - if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; - if(options.setWidth) target.style.width = source.offsetWidth + 'px'; - if(options.setHeight) target.style.height = source.offsetHeight + 'px'; + if (options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; + if (options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; + if (options.setWidth) target.style.width = source.offsetWidth + 'px'; + if (options.setHeight) target.style.height = source.offsetHeight + 'px'; }, absolutize: function(element) { Index: utils/ael_main.c =================================================================== --- utils/ael_main.c (revision 228266) +++ utils/ael_main.c (working copy) @@ -60,13 +60,13 @@ struct ast_context *next; }; -#define ADD_LAST(headptr,memptr) if(!headptr){ headptr=(memptr); (headptr##_last)=(memptr);} else {(headptr##_last)->next = (memptr); (headptr##_last) = (memptr);} +#define ADD_LAST(headptr,memptr) if (!headptr){ headptr=(memptr); (headptr##_last)=(memptr);} else {(headptr##_last)->next = (memptr); (headptr##_last) = (memptr);} void destroy_namelist(struct namelist *x); void destroy_namelist(struct namelist *x) { struct namelist *z,*z2; - for(z=x; z; z = z2) + for (z=x; z; z = z2) { z2 = z->next; z->next = 0; @@ -204,7 +204,7 @@ void ast_cli_register_multiple(void) { - if(!no_comp) + if (!no_comp) printf("Executed ast_cli_register_multiple();\n"); } @@ -240,43 +240,43 @@ application = "(null)"; } - if(!no_comp) + if (!no_comp) printf("Executed ast_add_extension2(context=%s, rep=%d, exten=%s, priority=%d, label=%s, callerid=%s, appl=%s, data=%s, FREE, registrar=%s);\n", con->name, replace, extension, priority, label, callerid, application, (data?(char*)data:"(null)"), registrar); - if( dump_extensions && dumpfile ) { + if ( dump_extensions && dumpfile ) { struct namelist *n; - if( FIRST_TIME ) { + if ( FIRST_TIME ) { FIRST_TIME = 0; - if( globalvars ) + if ( globalvars ) fprintf(dumpfile,"[globals]\n"); - for(n=globalvars;n;n=n->next) { + for (n=globalvars;n;n=n->next) { fprintf(dumpfile, "%s\n", n->name); } } /* print out each extension , possibly the context header also */ - if( con != last_context ) { + if ( con != last_context ) { fprintf(dumpfile,"\n\n[%s]\n", con->name); last_context = con; - for(n=con->ignorepats;n;n=n->next) { + for (n=con->ignorepats;n;n=n->next) { fprintf(dumpfile, "ignorepat => %s\n", n->name); } - for(n=con->includes;n;n=n->next) { + for (n=con->includes;n;n=n->next) { fprintf(dumpfile, "include => %s\n", n->name); } - for(n=con->switches;n;n=n->next) { + for (n=con->switches;n;n=n->next) { fprintf(dumpfile, "switch => %s/%s\n", n->name, n->name2); } - for(n=con->eswitches;n;n=n->next) { + for (n=con->eswitches;n;n=n->next) { fprintf(dumpfile, "eswitch => %s/%s\n", n->name, n->name2); } } - if( data ) { + if ( data ) { filter_newlines((char*)data); filter_leading_space_from_exprs((char*)data); /* in previous versions, commas were converted to '|' to separate @@ -284,14 +284,14 @@ code here to insert backslashes (escapes) before any commas that may have been embedded in the app args. This code is no more. */ - if( strcmp(label,"(null)") != 0 ) + if ( strcmp(label,"(null)") != 0 ) fprintf(dumpfile,"exten => %s,%d(%s),%s(%s)\n", extension, priority, label, application, (char*)data); else fprintf(dumpfile,"exten => %s,%d,%s(%s)\n", extension, priority, application, (char*)data); } else { - if( strcmp(label,"(null)") != 0 ) + if ( strcmp(label,"(null)") != 0 ) fprintf(dumpfile,"exten => %s,%d(%s),%s\n", extension, priority, label, application); else fprintf(dumpfile,"exten => %s,%d,%s\n", extension, priority, application); @@ -306,10 +306,10 @@ void pbx_builtin_setvar(void *chan, void *data) { struct namelist *x = create_name(data); - if(!no_comp) + if (!no_comp) printf("Executed pbx_builtin_setvar(chan, data=%s);\n", (char*)data); - if( dump_extensions ) { + if ( dump_extensions ) { x = create_name(data); ADD_LAST(globalvars,x); } @@ -348,9 +348,9 @@ void ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar) { - if(!no_comp) + if (!no_comp) printf("Executed ast_context_add_ignorepat2(con, value=%s, registrar=%s);\n", value, registrar); - if( dump_extensions ) { + if ( dump_extensions ) { struct namelist *x; x = create_name(value); ADD_LAST(con->ignorepats,x); @@ -359,9 +359,9 @@ void ast_context_add_include2(struct ast_context *con, const char *value, const char *registrar) { - if(!no_comp) + if (!no_comp) printf("Executed ast_context_add_include2(con, value=%s, registrar=%s);\n", value, registrar); - if( dump_extensions ) { + if ( dump_extensions ) { struct namelist *x; x = create_name((char*)value); ADD_LAST(con->includes,x); @@ -370,13 +370,13 @@ void ast_context_add_switch2(struct ast_context *con, const char *value, const char *data, int eval, const char *registrar) { - if(!no_comp) + if (!no_comp) printf("Executed ast_context_add_switch2(con, value=%s, data=%s, eval=%d, registrar=%s);\n", value, data, eval, registrar); - if( dump_extensions ) { + if ( dump_extensions ) { struct namelist *x; x = create_name((char*)value); strncpy(x->name2,data,100); - if( eval ) { + if ( eval ) { ADD_LAST(con->switches,x); @@ -389,32 +389,32 @@ void ast_merge_contexts_and_delete(void) { - if(!no_comp) + if (!no_comp) printf("Executed ast_merge_contexts_and_delete();\n"); } void ast_context_verify_includes(void) { - if(!no_comp) + if (!no_comp) printf("Executed ast_context_verify_includes();\n"); } struct ast_context * ast_walk_contexts(void) { - if(!no_comp) + if (!no_comp) printf("Executed ast_walk_contexts();\n"); return 0; } void ast_cli_unregister_multiple(void) { - if(!no_comp) + if (!no_comp) printf("Executed ast_cli_unregister_multiple();\n"); } void ast_context_destroy(void) { - if( !no_comp) + if ( !no_comp) printf("Executed ast_context_destroy();\n"); } @@ -425,9 +425,9 @@ while ( u && *u ) { - if( *u == '$' && *(u+1) == '[' ) { + if ( *u == '$' && *(u+1) == '[' ) { t = u+2; - while( *t == '\n' || *t == '\r' || *t == '\t' || *t == ' ' ) { + while ( *t == '\n' || *t == '\r' || *t == '\t' || *t == ' ' ) { v = t; while ( *v ) { *v = *(v+1); @@ -444,8 +444,8 @@ { /* remove all newlines, returns */ char *t=str; - while( t && *t ) { - if( *t == '\n' || *t == '\r' ) { + while ( t && *t ) { + if ( *t == '\n' || *t == '\r' ) { *t = ' '; /* just replace newlines and returns with spaces; they act as token separators, and just blindly removing them could be harmful. */ @@ -465,30 +465,30 @@ struct namelist *n; struct ast_context *lp,*lp2; - for(i=1;inext ) { /* print out any contexts that didn't have any + for ( lp = context_list; lp; lp = lp->next ) { /* print out any contexts that didn't have any extensions in them */ - if( lp->extension_count == 0 ) { + if ( lp->extension_count == 0 ) { fprintf(dumpfile,"\n\n[%s]\n", lp->name); - for(n=lp->ignorepats;n;n=n->next) { + for (n=lp->ignorepats;n;n=n->next) { fprintf(dumpfile, "ignorepat => %s\n", n->name); } - for(n=lp->includes;n;n=n->next) { + for (n=lp->includes;n;n=n->next) { fprintf(dumpfile, "include => %s\n", n->name); } - for(n=lp->switches;n;n=n->next) { + for (n=lp->switches;n;n=n->next) { fprintf(dumpfile, "switch => %s/%s\n", n->name, n->name2); } - for(n=lp->eswitches;n;n=n->next) { + for (n=lp->eswitches;n;n=n->next) { fprintf(dumpfile, "eswitch => %s/%s\n", n->name, n->name2); } } } } - if( dump_extensions && dumpfile ) + if ( dump_extensions && dumpfile ) fclose(dumpfile); - for( lp = context_list; lp; lp = lp2 ) { /* free the ast_context structs */ + for ( lp = context_list; lp; lp = lp2 ) { /* free the ast_context structs */ lp2 = lp->next; lp->next = 0; Index: utils/astman.c =================================================================== --- utils/astman.c (revision 228266) +++ utils/astman.c (working copy) @@ -365,7 +365,7 @@ if (mout) *mout = NULL; - for(;;) { + for (;;) { res = get_input(s, m.headers[m.hdrcount]); if (res == 1) { #if 0 @@ -613,7 +613,7 @@ try_status(); hide_doing(); - for(;;) { + for (;;) { newtFormRun(form, &es); if (has_input(&session) || (es.reason == NEWT_EXIT_FDREADY)) { if (input_check(&session, NULL)) { Index: utils/extconf.c =================================================================== --- utils/extconf.c (revision 228266) +++ utils/extconf.c (working copy) @@ -188,7 +188,7 @@ #define __ast_mutex_logger(...) do { if (canlog) ast_log(LOG_ERROR, __VA_ARGS__); else fprintf(stderr, __VA_ARGS__); } while (0) #ifdef THREAD_CRASH -#define DO_THREAD_CRASH do { *((int *)(0)) = 1; } while(0) +#define DO_THREAD_CRASH do { *((int *)(0)) = 1; } while (0) #else #define DO_THREAD_CRASH do { } while (0) #endif @@ -1324,7 +1324,7 @@ execl("/bin/sh", "/bin/sh", "-c", s, (char *) NULL); _exit(1); } else if (pid > 0) { - for(;;) { + for (;;) { res = wait4(pid, &status, 0, &rusage); if (res > -1) { res = WIFEXITED(status) ? WEXITSTATUS(status) : -1; @@ -2298,7 +2298,7 @@ \li AST_LIST_INSERT_TAIL() */ #define AST_LIST_TRAVERSE(head,var,field) \ - for((var) = (head)->first; (var); (var) = (var)->field.next) + for ((var) = (head)->first; (var); (var) = (var)->field.next) #define AST_RWLIST_TRAVERSE AST_LIST_TRAVERSE @@ -2682,7 +2682,7 @@ int bracketed = 0; for (x=0; n[x]; x++) { - switch(n[x]) { + switch (n[x]) { case '[': bracketed++; n[y++] = n[x]; @@ -3463,7 +3463,7 @@ if (withcomments && lline_buffer && lline_buffer[0] ) { newcat->sameline = ALLOC_COMMENT(lline_buffer); } - if( withcomments ) + if ( withcomments ) CB_RESET(); /* If there are options or categories to inherit from, process them now */ @@ -3508,7 +3508,7 @@ /* A directive */ cur++; c = cur; - while(*c && (*c > 32)) c++; + while (*c && (*c > 32)) c++; if (*c) { *c = '\0'; /* Find real argument */ @@ -3518,7 +3518,7 @@ } else c = NULL; do_include = !strcasecmp(cur, "include"); - if(!do_include) + if (!do_include) do_exec = !strcasecmp(cur, "exec"); else do_exec = 0; @@ -3533,7 +3533,7 @@ struct ast_config_include *inclu; /* Strip off leading and trailing "'s and <>'s */ - while((*c == '<') || (*c == '>') || (*c == '\"')) c++; + while ((*c == '<') || (*c == '>') || (*c == '\"')) c++; /* Get rid of leading mess */ cur = c; cur2 = cur; @@ -3560,9 +3560,9 @@ inclu = ast_include_new(cfg, configfile, cur, do_exec, cur2, lineno, real_inclusion_name, sizeof(real_inclusion_name)); do_include = ast_config_internal_load(cur, cfg, withcomments, real_inclusion_name) ? 1 : 0; - if(!ast_strlen_zero(exec_file)) + if (!ast_strlen_zero(exec_file)) unlink(exec_file); - if(!do_include) + if (!do_include) return 0; /* ast_log(LOG_WARNING, "Done reading in included file %s withcomments=%d\n", cur, withcomments); */ @@ -3606,7 +3606,7 @@ if (withcomments && lline_buffer && lline_buffer[0] ) { v->sameline = ALLOC_COMMENT(lline_buffer); } - if( withcomments ) + if ( withcomments ) CB_RESET(); } else { @@ -3709,7 +3709,7 @@ ast_log(LOG_DEBUG, "Parsing %s\n", fn); if (option_verbose > 1) ast_verbose("Found\n"); - while(!feof(f)) { + while (!feof(f)) { lineno++; if (fgets(buf, sizeof(buf), f)) { if ( withcomments ) { @@ -3728,7 +3728,7 @@ /* Yuck, gotta memmove */ memmove(comment_p - 1, comment_p, strlen(comment_p) + 1); new_buf = comment_p; - } else if(comment_p[1] == COMMENT_TAG && comment_p[2] == COMMENT_TAG && (comment_p[3] != '-')) { + } else if (comment_p[1] == COMMENT_TAG && comment_p[2] == COMMENT_TAG && (comment_p[3] != '-')) { /* Meta-Comment start detected ";--" */ if (comment < MAX_NESTED_COMMENTS) { *comment_p = '\0'; @@ -3773,7 +3773,7 @@ new_buf = comment_p + 1; } } - if( withcomments && comment && !process_buf ) + if ( withcomments && comment && !process_buf ) { CB_ADD(buf); /* the whole line is a comment, store it */ } @@ -3790,7 +3790,7 @@ } } fclose(f); - } while(0); + } while (0); if (comment) { ast_log(LOG_WARNING,"Unterminated comment detected beginning on line %d\n", nest[comment]); } @@ -4019,7 +4019,7 @@ /* since each var, cat, and associated comments can come from any file, we have to be mobile, and open each file, print, and close it on an entry-by-entry basis */ - while(cat) { + while (cat) { set_fn(fn, sizeof(fn), cat->file, configfile); f = fopen(fn, "a"); if (!f) @@ -4049,7 +4049,7 @@ if (!cat->precomments) fprintf(f,"\n"); fprintf(f, "[%s]", cat->name); - for(cmt = cat->sameline; cmt; cmt=cmt->next) { + for (cmt = cat->sameline; cmt; cmt=cmt->next) { fprintf(f,"%s", cmt->cmt); } if (!cat->sameline) @@ -4057,7 +4057,7 @@ fclose(f); var = cat->root; - while(var) { + while (var) { set_fn(fn, sizeof(fn), var->file, configfile); f = fopen(fn, "a"); if (!f) @@ -4537,7 +4537,7 @@ int count=0; while (*src && (count < len - 1)) { - switch(*src) { + switch (*src) { case ' ': /* otherwise exten => [a-b],1,... doesn't work */ /* case '-': */ @@ -6173,7 +6173,7 @@ { struct ast_context *con; - if(!pbx_load_config(config_filename)) + if (!pbx_load_config(config_filename)) return -1 /* AST_MODULE_LOAD_DECLINE*/; /* pbx_load_users(); */ /* does this affect the dialplan? */ Index: utils/frame.c =================================================================== --- utils/frame.c (revision 228266) +++ utils/frame.c (working copy) @@ -644,7 +644,7 @@ { if (s != NULL) error ("Error parsing option -%s:\n\t", s); - switch( code) + switch ( code) { case ME_NOINT: message = "Integer expected"; Index: utils/hashtest.c =================================================================== --- utils/hashtest.c (revision 228266) +++ utils/hashtest.c (working copy) @@ -209,7 +209,7 @@ printf("hashtest thread created... test beginning\n"); /* main test routine-- a global hashtab exists, pound it like crazy */ - for(its=0;its<100000;its++) + for (its=0;its<100000;its++) { void *seed2 = &seed; int op = my_rand(0,100, seed2); @@ -266,7 +266,7 @@ srand(glob_seed); /* create threads, each running hashtest */ - for(i=0;itech, tmp) && !strcasecmp(chan->location, s)) { if (debug) printf("Found '%s'/'%s'\n", chan->tech, chan->location); @@ -516,7 +516,7 @@ int offhook = 0; struct channel *chan; chan = channels; - while(chan) { + while (chan) { if (chan->subs) { offhook++; break; @@ -534,7 +534,7 @@ struct subchannel *sub, *prev; prev = NULL; sub = chan->subs; - while(sub) { + while (sub) { if (!strcasecmp(sub->name, name)) { if (prev) prev->next = sub->next; @@ -553,7 +553,7 @@ { struct subchannel *sub; sub = chan->subs; - while(sub) { + while (sub) { if (!strcasecmp(sub->name, name)) return; sub = sub->next; @@ -608,7 +608,7 @@ if (!strncasecmp(resp, "Event: ", strlen("Event: "))) { strncpy(event, resp + strlen("Event: "), sizeof(event) - 1); /* Consume the rest of the non-event */ - while((resp = get_line()) && strlen(resp)) { + while ((resp = get_line()) && strlen(resp)) { if (!strncasecmp(resp, "Channel: ", strlen("Channel: "))) strncpy(channel, resp + strlen("Channel: "), sizeof(channel) - 1); if (!strncasecmp(resp, "Newname: ", strlen("Newname: "))) @@ -630,7 +630,7 @@ } } else { /* Consume the rest of the non-event */ - while((resp = get_line()) && strlen(resp)); + while ((resp = get_line()) && strlen(resp)); } if (!resp) { fprintf(stderr, "disconnected (7)\n"); @@ -649,8 +649,8 @@ int main(int argc, char *argv[]) { int x; - while((x = getopt(argc, argv, "fhd")) > 0) { - switch(x) { + while ((x = getopt(argc, argv, "fhd")) > 0) { + switch (x) { case 'd': debug = 1; needfork = 0; @@ -697,10 +697,10 @@ #endif } #endif - for(;;) { + for (;;) { if (wait_event()) { fclose(astf); - while(connect_asterisk()) { + while (connect_asterisk()) { sleep(5); } if (login_asterisk()) { Index: utils/refcounter.c =================================================================== --- utils/refcounter.c (revision 228266) +++ utils/refcounter.c (working copy) @@ -189,7 +189,7 @@ if (curr_obj->destroy_count > 1 ) printf("Problem: Object %x destroyed more than once!\n", curr_obj->addr); printf("Object %x history:\n", curr_obj->addr); - for(h=curr_obj->hist;h;h=h->next) { + for (h=curr_obj->hist;h;h=h->next) { printf(" %s", h->desc); } printf("==============\n");