Index: abstract_jb.c =================================================================== --- abstract_jb.c (revision 48974) +++ abstract_jb.c (working copy) @@ -399,7 +399,7 @@ res = jbimpl->get(jbobj, &f, now, interpolation_len); - switch(res) { + switch (res) { case JB_IMPL_OK: /* deliver the frame */ ast_write(chan, f); Index: acl.c =================================================================== --- acl.c (revision 48974) +++ acl.c (working copy) @@ -311,7 +311,7 @@ return ast_get_ip_or_srv(sin, value, NULL); } -int ast_ouraddrfor(struct in_addr *them, struct in_addr *us) +int ast_ouraddrfor (struct in_addr *them, struct in_addr *us) { int s; struct sockaddr_in sin; @@ -364,7 +364,7 @@ } } /* A.ROOT-SERVERS.NET. */ - if (inet_aton("198.41.0.4", &saddr) && !ast_ouraddrfor(&saddr, ourip)) + if (inet_aton("198.41.0.4", &saddr) && !ast_ouraddrfor (&saddr, ourip)) return 0; return -1; } Index: aescrypt.c =================================================================== --- aescrypt.c (revision 48974) +++ aescrypt.c (working copy) @@ -120,7 +120,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; @@ -130,7 +130,7 @@ #if (ENC_UNROLL == FULL) - switch(nr) + switch (nr) { case 14: round(fwd_rnd, b1, b0, kp + 1 * N_COLS); @@ -157,7 +157,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); @@ -168,7 +168,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); @@ -244,7 +244,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; @@ -254,7 +254,7 @@ #if (DEC_UNROLL == FULL) - switch(nr) + switch (nr) { case 14: round(inv_rnd, b1, b0, kp - 1 * N_COLS); @@ -281,7 +281,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); @@ -292,7 +292,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: aeskey.c =================================================================== --- aeskey.c (revision 48974) +++ aeskey.c (working copy) @@ -111,7 +111,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 @@ -148,7 +148,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 @@ -186,7 +186,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 @@ -206,7 +206,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); @@ -328,10 +328,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 } @@ -371,10 +371,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 } @@ -417,10 +417,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 } @@ -445,7 +445,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: aestab.c =================================================================== --- aestab.c (revision 48974) +++ aestab.c (working copy) @@ -79,20 +79,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); } @@ -118,7 +118,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 @@ -135,16 +135,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: alaw.c =================================================================== --- alaw.c (revision 48974) +++ alaw.c (working copy) @@ -87,12 +87,12 @@ /* * Set up mu-law conversion table */ - for(i = 0;i < 256;i++) + for (i = 0;i < 256;i++) { __ast_alaw[i] = alaw2linear(i); } /* set up the reverse (mu-law) conversion table */ - for(i = -32768; i < 32768; i++) + for (i = -32768; i < 32768; i++) { __ast_lin2a[((unsigned short)i) >> 3] = linear2alaw(i); } Index: app.c =================================================================== --- app.c (revision 48974) +++ app.c (working copy) @@ -246,7 +246,7 @@ res = ast_autoservice_start(peer); if (!res) - res = ast_waitfor(chan, 100); + res = ast_waitfor (chan, 100); /* ast_waitfor will return the number of remaining ms on success */ if (res < 0) @@ -611,12 +611,12 @@ we read a digit or get a hangup */ struct ast_frame *f; for (;;) { - res = ast_waitfor(chan, 2000); + res = ast_waitfor (chan, 2000); if (!res) { if (option_debug) ast_log(LOG_DEBUG, "One waitfor failed, trying another\n"); /* Try one more time in case of masq */ - res = ast_waitfor(chan, 2000); + res = ast_waitfor (chan, 2000); if (!res) { ast_log(LOG_WARNING, "No audio available on %s??\n", chan->name); res = -1; @@ -1099,7 +1099,7 @@ char *c; char *n; - switch(option->action) { + switch (option->action) { case AST_ACTION_UPONE: return RES_UPONE; case AST_ACTION_EXIT: @@ -1210,8 +1210,8 @@ return -1; } } - while(!res) { - while(menu->options[pos].option) { + while (!res) { + while (menu->options[pos].option) { if (!strcasecmp(menu->options[pos].option, exten)) { res = ivr_dispatch(chan, menu->options + pos, exten, cbdata); if (option_debug) Index: asterisk.c =================================================================== --- asterisk.c (revision 48974) +++ asterisk.c (working copy) @@ -670,7 +670,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; @@ -778,7 +778,7 @@ ast_copy_string(hostname, "", sizeof(hostname)); snprintf(tmp, sizeof(tmp), "%s/%ld/%s\n", hostname, (long)ast_mainpid, ASTERISK_VERSION); fdprint(con->fd, tmp); - for(;;) { + for (;;) { fds[0].fd = con->fd; fds[0].events = POLLIN; fds[0].revents = 0; Index: ast_expr2.c =================================================================== --- ast_expr2.c (revision 48974) +++ ast_expr2.c (working copy) @@ -261,7 +261,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. */ @@ -1695,7 +1695,7 @@ #line 175 "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_integer ) + if ( (yyvsp[(1) - (1)].val)->type == AST_EXPR_integer ) ((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; @@ -2123,11 +2123,11 @@ return(NULL); } - for(i = 1, isint = isdigit(s[0]) || s[0] == '-'; + for (i = 1, isint = isdigit(s[0]) || s[0] == '-'; isint && i < strlen(s); i++) { - if(!isdigit(s[i])) + if (!isdigit(s[i])) isint = 0; } @@ -2189,15 +2189,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++; @@ -2265,22 +2265,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)); @@ -2446,9 +2446,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); @@ -2464,7 +2464,7 @@ else { (void)to_integer(a); - if( a->u.i ) + if ( a->u.i ) { free_value(a); free_value(c); @@ -2519,7 +2519,7 @@ struct val *r; if (!to_integer (a)) { - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING,"non-numeric argument\n"); if (!to_integer (b)) { free_value(a); @@ -2563,7 +2563,7 @@ struct val *r; if (!to_integer (a)) { - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING, "non-numeric argument\n"); if (!to_integer (b)) { free_value(a); @@ -2576,7 +2576,7 @@ return (r); } } else if (!to_integer(b)) { - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING, "non-numeric argument\n"); free_value(b); return (a); @@ -2598,7 +2598,7 @@ if (!to_integer (a) ) { free_value(a); - if( !extra_error_message_supplied ) + if ( !extra_error_message_supplied ) ast_log(LOG_WARNING, "non-numeric argument\n"); return make_integer(0); } @@ -2617,25 +2617,25 @@ int v1 = 1; struct val *r; - if( !a ) + if ( !a ) { v1 = 0; } else { - switch( a->type ) + switch ( a->type ) { case AST_EXPR_integer: - 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; @@ -2643,11 +2643,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; @@ -2681,7 +2681,7 @@ if (!to_integer (a) || !to_integer (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_integer(0)); } @@ -2714,13 +2714,13 @@ if (!to_integer (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_integer(0); } else if (!to_integer (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_integer(INT_MAX); } @@ -2747,7 +2747,7 @@ struct val *r; if (!to_integer (a) || !to_integer (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: ast_expr2f.c =================================================================== --- ast_expr2f.c (revision 48974) +++ ast_expr2f.c (working copy) @@ -1577,7 +1577,7 @@ errno=0; \ while ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ { \ - if( errno != EINTR) \ + if ( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ @@ -3021,7 +3021,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); @@ -3252,7 +3252,7 @@ break; } } - if( !found ) + if ( !found ) *s++ = *p++; } *s++ = 0; @@ -3268,7 +3268,7 @@ char *s2 = expr2_token_subst((char *)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: autoservice.c =================================================================== --- autoservice.c (revision 48974) +++ autoservice.c (working copy) @@ -64,7 +64,7 @@ static void *autoservice_run(void *ign) { - for(;;) { + for (;;) { struct ast_channel *mons[MAX_AUTOMONS]; struct ast_channel *chan; struct asent *as; @@ -148,7 +148,7 @@ AST_LIST_UNLOCK(&aslist); /* Wait for it to un-block */ - while(ast_test_flag(chan, AST_FLAG_BLOCKING)) + while (ast_test_flag(chan, AST_FLAG_BLOCKING)) usleep(1000); return res; } Index: callerid.c =================================================================== --- callerid.c (revision 48974) +++ callerid.c (working copy) @@ -335,7 +335,7 @@ cid->skipflag = 0 ; /* caller id retrieval */ - switch(cid->sawflag) { + switch (cid->sawflag) { case 0: /* DLE */ if (b == 0x10) { cid->sawflag = 1; @@ -552,7 +552,7 @@ /* Ignore invalid bytes */ if (b > 0xff) continue; - switch(cid->sawflag) { + switch (cid->sawflag) { case 0: /* Look for flag */ if (b == 'U') cid->sawflag = 2; @@ -599,7 +599,7 @@ /* MDMF */ /* Go through each element and process */ for (x = 0; x < cid->pos;) { - switch(cid->rawdata[x++]) { + switch (cid->rawdata[x++]) { case 1: /* Date */ break; @@ -868,7 +868,7 @@ int bracketed = 0; for (x=0; n[x]; x++) { - switch(n[x]) { + switch (n[x]) { case '[': bracketed++; n[y++] = n[x]; Index: cdr.c =================================================================== --- cdr.c (revision 48974) +++ cdr.c (working copy) @@ -288,7 +288,7 @@ struct varshead *headp; int x; - for(x = 0; cdr_readonly_vars[x]; x++) { + for (x = 0; cdr_readonly_vars[x]; x++) { if (!strcasecmp(name, cdr_readonly_vars[x])) { ast_log(LOG_ERROR, "Attempt to set the '%s' read-only variable!.\n", name); return -1; @@ -493,7 +493,7 @@ int res = 0; for (; cdr; cdr = cdr->next) { - switch(cause) { + switch (cause) { case AST_CAUSE_BUSY: ast_cdr_busy(cdr); break; @@ -624,7 +624,7 @@ /*! Converts AMA flag to printable string */ char *ast_cdr_flags2str(int flag) { - switch(flag) { + switch (flag) { case AST_CDR_OMIT: return "OMIT"; case AST_CDR_BILLING: @@ -945,7 +945,7 @@ int schedms; int numevents = 0; - for(;;) { + for (;;) { struct timeval now; schedms = ast_sched_wait(sched); /* this shouldn't happen, but provide a 1 second default just in case */ Index: channel.c =================================================================== --- channel.c (revision 48974) +++ channel.c (working copy) @@ -508,7 +508,7 @@ { char *buf; - switch(state) { + switch (state) { case AST_STATE_DOWN: return "Down"; case AST_STATE_RESERVED: @@ -540,7 +540,7 @@ /*! \brief Gives the string form of a given transfer capability */ char *ast_transfercapability2str(int transfercapability) { - switch(transfercapability) { + switch (transfercapability) { case AST_TRANS_CAP_SPEECH: return "SPEECH"; case AST_TRANS_CAP_DIGITAL: @@ -983,7 +983,7 @@ while (ms > 0) { if (cond && ((*cond)(data) == 0)) return 0; - ms = ast_waitfor(chan, ms); + ms = ast_waitfor (chan, ms); if (ms < 0) return -1; if (ms > 0) { @@ -1626,7 +1626,7 @@ ast_channel_unlock(chan); return -1; } - switch(chan->_state) { + switch (chan->_state) { case AST_STATE_RINGING: case AST_STATE_RING: if (chan->tech->answer) @@ -1867,7 +1867,7 @@ return ast_waitfor_nandfds(c, n, NULL, 0, NULL, NULL, ms); } -int ast_waitfor(struct ast_channel *c, int ms) +int ast_waitfor (struct ast_channel *c, int ms) { int oldms = ms; /* -1 if no timeout */ @@ -1929,13 +1929,13 @@ if (!f) return -1; - switch(f->frametype) { + switch (f->frametype) { case AST_FRAME_DTMF: res = f->subclass; ast_frfree(f); return res; case AST_FRAME_CONTROL: - switch(f->subclass) { + switch (f->subclass) { case AST_CONTROL_HANGUP: ast_frfree(f); return -1; @@ -2358,7 +2358,7 @@ struct ast_frame *f; if (ast_check_hangup(chan)) break; - res = ast_waitfor(chan, timeout); + res = ast_waitfor (chan, timeout); if (res <= 0) /* timeout or error */ break; timeout = res; /* update timeout */ @@ -2518,7 +2518,7 @@ if (chan->fout & DEBUGCHAN_FLAG) ast_frame_dump(chan->name, fr, ">>"); CHECK_BLOCKING(chan); - switch(fr->frametype) { + switch (fr->frametype) { case AST_FRAME_CONTROL: res = (chan->tech->indicate == NULL) ? 0 : chan->tech->indicate(chan, fr->subclass, fr->data, fr->datalen); @@ -2780,7 +2780,7 @@ res = 1; /* mark success in case chan->_state is already AST_STATE_UP */ while (timeout && chan->_state != AST_STATE_UP) { struct ast_frame *f; - res = ast_waitfor(chan, timeout); + res = ast_waitfor (chan, timeout); if (res <= 0) /* error, timeout, or done */ break; if (timeout > -1) @@ -2801,7 +2801,7 @@ case AST_CONTROL_CONGESTION: case AST_CONTROL_ANSWER: *outstate = f->subclass; - timeout = 0; /* trick to force exit from the while() */ + timeout = 0; /* trick to force exit from the while () */ break; /* Ignore these */ @@ -4172,7 +4172,7 @@ return res; /* Give us some wiggle room */ - while (chan->generatordata && ast_waitfor(chan, 100) >= 0) { + while (chan->generatordata && ast_waitfor (chan, 100) >= 0) { struct ast_frame *f = ast_read(chan); if (f) ast_frfree(f); Index: cli.c =================================================================== --- cli.c (revision 48974) +++ cli.c (working copy) @@ -164,7 +164,7 @@ for (x = e->args; x < a->argc; x++) { int res = ast_module_reload(a->argv[x]); /* XXX reload has multiple error returns, including -1 on error and 2 on success */ - switch(res) { + switch (res) { case 0: ast_cli(a->fd, "No such module '%s'\n", a->argv[x]); break; @@ -778,7 +778,7 @@ ast_cli(fd, "%s is not a known channel\n", argv[3]); return RESULT_SUCCESS; } - if(c->cdr) { + if (c->cdr) { elapsed_seconds = now.tv_sec - c->cdr->start.tv_sec; hour = elapsed_seconds / 3600; min = (elapsed_seconds % 3600) / 60; @@ -835,9 +835,9 @@ ( c-> data ? S_OR(c->data, "(Empty)") : "(None)"), (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)")); - if(pbx_builtin_serialize_variables(c, &out)) + if (pbx_builtin_serialize_variables(c, &out)) ast_cli(fd," Variables:\n%s\n", out->str); - if(c->cdr && ast_cdr_serialize_variables(c->cdr, &out, '=', '\n', 1)) + if (c->cdr && ast_cdr_serialize_variables(c->cdr, &out, '=', '\n', 1)) ast_cli(fd," CDR Variables:\n%s\n", out->str); ast_channel_unlock(c); @@ -1175,7 +1175,7 @@ struct ast_cli_entry *cand = NULL, *e=NULL; struct cli_iterator i = { NULL, NULL}; - while( (e = cli_next(&i)) ) { + while ( (e = cli_next(&i)) ) { /* word-by word regexp comparison */ char * const *src = cmds; char * const *dst = e->cmda; Index: config.c =================================================================== --- config.c (revision 48974) +++ config.c (working copy) @@ -215,7 +215,7 @@ { struct ast_variable *vn; - while(v) { + while (v) { vn = v; v = v->next; free(vn); @@ -525,7 +525,7 @@ { struct ast_category *prev=NULL, *cat; cat = cfg->root; - while(cat) { + while (cat) { if (cat->name == category) { ast_variables_destroy(cat->root); if (prev) { @@ -546,7 +546,7 @@ prev = NULL; cat = cfg->root; - while(cat) { + while (cat) { if (!strcasecmp(cat->name, category)) { ast_variables_destroy(cat->root); if (prev) { @@ -575,7 +575,7 @@ return; cat = cfg->root; - while(cat) { + while (cat) { ast_variables_destroy(cat->root); catn = cat; cat = cat->next; @@ -629,7 +629,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 */ @@ -674,7 +674,7 @@ /* A directive */ cur++; c = cur; - while(*c && (*c > 32)) c++; + while (*c && (*c > 32)) c++; if (*c) { *c = '\0'; /* Find real argument */ @@ -684,7 +684,7 @@ } else c = NULL; do_include = !strcasecmp(cur, "include"); - if(!do_include) + if (!do_include) do_exec = !strcasecmp(cur, "exec"); else do_exec = 0; @@ -695,7 +695,7 @@ if (do_include || do_exec) { if (c) { /* 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; while (!ast_strlen_zero(cur)) { @@ -716,9 +716,9 @@ exec_file[0] = '\0'; /* A #include */ do_include = ast_config_internal_load(cur, cfg, withcomments) ? 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; } else { @@ -761,7 +761,7 @@ if (withcomments && lline_buffer && lline_buffer[0] ) { v->sameline = ALLOC_COMMENT(lline_buffer); } - if( withcomments ) + if ( withcomments ) CB_RESET(); } else { @@ -844,7 +844,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 ) { @@ -863,7 +863,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'; @@ -908,7 +908,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 */ } @@ -925,7 +925,7 @@ } } fclose(f); - } while(0); + } while (0); if (comment) { ast_log(LOG_WARNING,"Unterminated comment detected beginning on line %d\n", nest[comment]); } @@ -988,7 +988,7 @@ fprintf(f, ";! Creation Date: %s", date); fprintf(f, ";!\n"); cat = cfg->root; - while(cat) { + while (cat) { /* Dump section with any appropriate comment */ for (cmt = cat->precomments; cmt; cmt=cmt->next) { @@ -998,14 +998,14 @@ 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) fprintf(f,"\n"); var = cat->root; - while(var) { + while (var) { for (cmt = var->precomments; cmt; cmt=cmt->next) { if (cmt->cmt[0] != ';' || cmt->cmt[1] != '!') Index: devicestate.c =================================================================== --- devicestate.c (revision 48974) +++ devicestate.c (working copy) @@ -237,7 +237,7 @@ } if (provider) { - if(option_debug > 2) + if (option_debug > 2) ast_log(LOG_DEBUG, "Checking if I can find provider for \"%s\" - number: %s\n", provider, number); return getproviderstate(provider, number); } @@ -310,7 +310,7 @@ AST_LIST_LOCK(&devstate_provs); AST_LIST_TRAVERSE_SAFE_BEGIN(&devstate_provs, devprov, list) { - if(option_debug > 4) + if (option_debug > 4) ast_log(LOG_DEBUG, "Checking provider %s with %s\n", devprov->label, provider); if (!strcasecmp(devprov->label, provider)) { @@ -435,7 +435,7 @@ struct state_change *cur; AST_LIST_LOCK(&state_changes); - for(;;) { + for (;;) { /* the list lock will _always_ be held at this point in the loop */ cur = AST_LIST_REMOVE_HEAD(&state_changes, list); if (cur) { Index: dsp.c =================================================================== --- dsp.c (revision 48974) +++ dsp.c (working copy) @@ -1055,7 +1055,7 @@ int pass; int newstate = DSP_TONE_STATE_SILENCE; int res = 0; - while(len) { + while (len) { /* Take the lesser of the number of samples we need and what we have */ pass = len; if (pass > dsp->gsamp_size - dsp->gsamps) @@ -1077,7 +1077,7 @@ printf("%.2e %.2e %.2e %.2e %.2e %.2e %.2e %.2e %.2e\n", hz[HZ_350], hz[HZ_425], hz[HZ_440], hz[HZ_480], hz[HZ_620], hz[HZ_950], hz[HZ_1400], hz[HZ_1800], dsp->genergy); #endif - switch(dsp->progmode) { + switch (dsp->progmode) { case PROG_MODE_NA: if (pair_there(hz[HZ_480], hz[HZ_620], hz[HZ_350], hz[HZ_440], dsp->genergy)) { newstate = DSP_TONE_STATE_BUSY; @@ -1421,7 +1421,7 @@ #define FIX_INF(inf) do { \ if (writeback) { \ - switch(inf->subclass) { \ + switch (inf->subclass) { \ case AST_FORMAT_SLINEAR: \ break; \ case AST_FORMAT_ULAW: \ @@ -1434,7 +1434,7 @@ break; \ } \ } \ - } while(0) + } while (0) if (!af) return NULL; @@ -1443,7 +1443,7 @@ odata = af->data; len = af->datalen; /* Make sure we have short data */ - switch(af->subclass) { + switch (af->subclass) { case AST_FORMAT_SLINEAR: shortdata = af->data; len = af->datalen / 2; @@ -1576,7 +1576,7 @@ if ((dsp->features & DSP_FEATURE_CALL_PROGRESS)) { res = __ast_dsp_call_progress(dsp, shortdata, len); if (res) { - switch(res) { + switch (res) { case AST_CONTROL_ANSWER: case AST_CONTROL_BUSY: case AST_CONTROL_RINGING: Index: enum.c =================================================================== --- enum.c (revision 48974) +++ enum.c (working copy) @@ -445,7 +445,7 @@ tmp[newpos++] = '.'; } if (*p2) { - while(*p2 && newpos < 128){ + while (*p2 && newpos < 128){ tmp[newpos++] = *p2; p2++; } @@ -465,7 +465,7 @@ if (chan && ast_autoservice_start(chan) < 0) return -1; - if(suffix) { + if (suffix) { ast_copy_string(tmp + newpos, suffix, sizeof(tmp) - newpos); ret = ast_search_dns(&context, tmp, C_IN, T_NAPTR, enum_callback); ast_log(LOG_DEBUG, "ast_get_enum: ast_search_dns(%s) returned %d\n", tmp, ret); @@ -634,7 +634,7 @@ /* Destroy existing list */ ast_mutex_lock(&enumlock); s = toplevs; - while(s) { + while (s) { sl = s; s = s->next; free(sl); @@ -644,7 +644,7 @@ if (cfg) { sl = NULL; v = ast_variable_browse(cfg, "general"); - while(v) { + while (v) { if (!strcasecmp(v->name, "search")) { s = enum_newtoplev(v->value); if (s) { Index: file.c =================================================================== --- file.c (revision 48974) +++ file.c (working copy) @@ -610,7 +610,7 @@ struct ast_filestream *s = data; int whennext = 0; - while(!whennext) { + while (!whennext) { struct ast_frame *fr = s->fmt->read(s, &whennext); if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) { if (fr) @@ -1007,7 +1007,7 @@ if (ms < 0) ms = 1000; if (cmdfd < 0) { - res = ast_waitfor(c, ms); + res = ast_waitfor (c, ms); if (res < 0) { ast_log(LOG_WARNING, "Select failed (%s)\n", strerror(errno)); return res; @@ -1032,7 +1032,7 @@ struct ast_frame *fr = ast_read(c); if (!fr) return -1; - switch(fr->frametype) { + switch (fr->frametype) { case AST_FRAME_DTMF_END: if (context) { const char exten[2] = { fr->subclass, '\0' }; @@ -1053,7 +1053,7 @@ } break; case AST_FRAME_CONTROL: - switch(fr->subclass) { + switch (fr->subclass) { case AST_CONTROL_HANGUP: case AST_CONTROL_BUSY: case AST_CONTROL_CONGESTION: Index: frame.c =================================================================== --- frame.c (revision 48974) +++ frame.c (working copy) @@ -518,7 +518,7 @@ int x; char *ret = "unknown"; for (x = 0; x < sizeof(AST_FORMAT_LIST) / sizeof(AST_FORMAT_LIST[0]); x++) { - if(AST_FORMAT_LIST[x].visible && AST_FORMAT_LIST[x].bits == format) { + if (AST_FORMAT_LIST[x].visible && AST_FORMAT_LIST[x].bits == format) { ret = AST_FORMAT_LIST[x].name; break; } @@ -567,7 +567,7 @@ int x; for (x = 0; x < sizeof(ast_codec_alias_table) / sizeof(ast_codec_alias_table[0]); x++) { - if(!strcmp(in,ast_codec_alias_table[x].alias)) + if (!strcmp(in,ast_codec_alias_table[x].alias)) return ast_codec_alias_table[x].realname; } return in; @@ -579,11 +579,11 @@ all = strcasecmp(name, "all") ? 0 : 1; for (x = 0; x < sizeof(AST_FORMAT_LIST) / sizeof(AST_FORMAT_LIST[0]); x++) { - if(AST_FORMAT_LIST[x].visible && (all || + if (AST_FORMAT_LIST[x].visible && (all || !strcasecmp(AST_FORMAT_LIST[x].name,name) || !strcasecmp(AST_FORMAT_LIST[x].name,ast_expand_codec_alias(name)))) { format |= AST_FORMAT_LIST[x].bits; - if(!all) + if (!all) break; } } @@ -596,7 +596,7 @@ int x; char *ret = "unknown"; for (x = 0; x < sizeof(AST_FORMAT_LIST) / sizeof(AST_FORMAT_LIST[0]); x++) { - if(AST_FORMAT_LIST[x].visible && AST_FORMAT_LIST[x].bits == codec) { + if (AST_FORMAT_LIST[x].visible && AST_FORMAT_LIST[x].bits == codec) { ret = AST_FORMAT_LIST[x].desc; break; } @@ -707,7 +707,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; @@ -720,7 +720,7 @@ break; case AST_FRAME_CONTROL: strcpy(ftype, "Control"); - switch(f->subclass) { + switch (f->subclass) { case AST_CONTROL_HANGUP: strcpy(subclass, "Hangup"); break; @@ -787,7 +787,7 @@ break; case AST_FRAME_HTML: strcpy(ftype, "HTML"); - switch(f->subclass) { + switch (f->subclass) { case AST_HTML_URL: strcpy(subclass, "URL"); ast_copy_string(moreinfo, f->data, sizeof(moreinfo)); @@ -922,7 +922,7 @@ int x, differential = (int) 'A', mem; char *from, *to; - if(right) { + if (right) { from = pref->order; to = buf; mem = size; @@ -934,7 +934,7 @@ memset(to, 0, mem); for (x = 0; x < 32 ; x++) { - if(!from[x]) + if (!from[x]) break; to[x] = right ? (from[x] + differential) : (from[x] - differential); } @@ -950,24 +950,24 @@ total_len = size; buf[0] = '('; total_len--; - for(x = 0; x < 32 ; x++) { - if(total_len <= 0) + for (x = 0; x < 32 ; x++) { + if (total_len <= 0) break; - if(!(codec = ast_codec_pref_index(pref,x))) + if (!(codec = ast_codec_pref_index(pref,x))) break; - if((formatname = ast_getformatname(codec))) { + if ((formatname = ast_getformatname(codec))) { slen = strlen(formatname); - if(slen > total_len) + if (slen > total_len) break; strncat(buf,formatname,total_len); total_len -= slen; } - if(total_len && x < 31 && ast_codec_pref_index(pref , x + 1)) { + if (total_len && x < 31 && ast_codec_pref_index(pref , x + 1)) { strncat(buf,"|",total_len); total_len--; } } - if(total_len) { + if (total_len) { strncat(buf,")",total_len); total_len--; } @@ -980,7 +980,7 @@ int slot = 0; - if((index >= 0) && (index < sizeof(pref->order))) { + if ((index >= 0) && (index < sizeof(pref->order))) { slot = pref->order[index]; } @@ -995,7 +995,7 @@ int slot; int size; - if(!pref->order[0]) + if (!pref->order[0]) return; memcpy(&oldorder, pref, sizeof(oldorder)); @@ -1004,9 +1004,9 @@ for (x = 0; x < sizeof(AST_FORMAT_LIST) / sizeof(AST_FORMAT_LIST[0]); x++) { slot = oldorder.order[x]; size = oldorder.framing[x]; - if(! slot) + if (! slot) break; - if(AST_FORMAT_LIST[slot-1].bits != format) { + if (AST_FORMAT_LIST[slot-1].bits != format) { pref->order[y] = slot; pref->framing[y++] = size; } @@ -1022,15 +1022,15 @@ ast_codec_pref_remove(pref, format); for (x = 0; x < sizeof(AST_FORMAT_LIST) / sizeof(AST_FORMAT_LIST[0]); x++) { - if(AST_FORMAT_LIST[x].bits == format) { + if (AST_FORMAT_LIST[x].bits == format) { newindex = x + 1; break; } } - if(newindex) { + if (newindex) { for (x = 0; x < sizeof(AST_FORMAT_LIST) / sizeof(AST_FORMAT_LIST[0]); x++) { - if(!pref->order[x]) { + if (!pref->order[x]) { pref->order[x] = newindex; break; } @@ -1047,31 +1047,31 @@ int x, index = -1; for (x = 0; x < sizeof(AST_FORMAT_LIST) / sizeof(AST_FORMAT_LIST[0]); x++) { - if(AST_FORMAT_LIST[x].bits == format) { + if (AST_FORMAT_LIST[x].bits == format) { index = x; break; } } - if(index < 0) + if (index < 0) return -1; /* size validation */ - if(!framems) + if (!framems) framems = AST_FORMAT_LIST[index].def_ms; - if(AST_FORMAT_LIST[index].inc_ms && framems % AST_FORMAT_LIST[index].inc_ms) /* avoid division by zero */ + if (AST_FORMAT_LIST[index].inc_ms && framems % AST_FORMAT_LIST[index].inc_ms) /* avoid division by zero */ framems -= framems % AST_FORMAT_LIST[index].inc_ms; - if(framems < AST_FORMAT_LIST[index].min_ms) + if (framems < AST_FORMAT_LIST[index].min_ms) framems = AST_FORMAT_LIST[index].min_ms; - if(framems > AST_FORMAT_LIST[index].max_ms) + if (framems > AST_FORMAT_LIST[index].max_ms) framems = AST_FORMAT_LIST[index].max_ms; for (x = 0; x < sizeof(AST_FORMAT_LIST) / sizeof(AST_FORMAT_LIST[0]); x++) { - if(pref->order[x] == (index + 1)) { + if (pref->order[x] == (index + 1)) { pref->framing[x] = framems; break; } @@ -1087,7 +1087,7 @@ struct ast_format_list fmt = { 0, }; for (x = 0; x < sizeof(AST_FORMAT_LIST) / sizeof(AST_FORMAT_LIST[0]); x++) { - if(AST_FORMAT_LIST[x].bits == format) { + if (AST_FORMAT_LIST[x].bits == format) { fmt = AST_FORMAT_LIST[x]; index = x; break; @@ -1095,23 +1095,23 @@ } for (x = 0; x < sizeof(AST_FORMAT_LIST) / sizeof(AST_FORMAT_LIST[0]); x++) { - if(pref->order[x] == (index + 1)) { + if (pref->order[x] == (index + 1)) { framems = pref->framing[x]; break; } } /* size validation */ - if(!framems) + if (!framems) framems = AST_FORMAT_LIST[index].def_ms; - if(AST_FORMAT_LIST[index].inc_ms && framems % AST_FORMAT_LIST[index].inc_ms) /* avoid division by zero */ + if (AST_FORMAT_LIST[index].inc_ms && framems % AST_FORMAT_LIST[index].inc_ms) /* avoid division by zero */ framems -= framems % AST_FORMAT_LIST[index].inc_ms; - if(framems < AST_FORMAT_LIST[index].min_ms) + if (framems < AST_FORMAT_LIST[index].min_ms) framems = AST_FORMAT_LIST[index].min_ms; - if(framems > AST_FORMAT_LIST[index].max_ms) + if (framems > AST_FORMAT_LIST[index].max_ms) framems = AST_FORMAT_LIST[index].max_ms; fmt.cur_ms = framems; @@ -1134,7 +1134,7 @@ break; } } - if(ret & AST_FORMAT_AUDIO_MASK) + if (ret & AST_FORMAT_AUDIO_MASK) return ret; if (option_debug > 3) @@ -1193,7 +1193,7 @@ { enum frame_type type = buf & TYPE_MASK; - switch(type) { + switch (type) { case TYPE_DONTSEND: return 0; break; @@ -1217,7 +1217,7 @@ int pos = 0; int samples = 0; int res; - while(pos < maxlen) { + while (pos < maxlen) { res = g723_len(buf[pos]); if (res <= 0) break; @@ -1339,7 +1339,7 @@ int ast_codec_get_samples(struct ast_frame *f) { int samples=0; - switch(f->subclass) { + switch (f->subclass) { case AST_FORMAT_SPEEX: samples = speex_samples(f->data, f->datalen); break; @@ -1384,7 +1384,7 @@ int len = 0; /* XXX Still need speex, g723, and lpc10 XXX */ - switch(format) { + switch (format) { case AST_FORMAT_G723_1: len = (samples / 240) * 20; break; Index: fskmodem.c =================================================================== --- fskmodem.c (revision 48974) +++ fskmodem.c (working copy) @@ -226,7 +226,7 @@ int samples = 0; int olen; - switch(fskd->state) { + switch (fskd->state) { /* Pick up where we left off */ case STATE_SEARCH_STARTBIT2: goto search_startbit2; @@ -243,7 +243,7 @@ of a transmission (what a LOSING design), we cant do it this elegantly */ /* if (demodulator(zap,&x1)) return(-1); - for(;;) { + for (;;) { if (demodulator(zap,&x2)) return(-1); if (x1>0 && x2<0) break; x1 = x2; @@ -256,7 +256,7 @@ if (demodulator(fskd, &fskd->x1, GET_SAMPLE)) return -1; samples++; - for(;;) { + for (;;) { search_startbit2: if (!*len) { fskd->state = STATE_SEARCH_STARTBIT2; @@ -278,7 +278,7 @@ fskd->state = STATE_SEARCH_STARTBIT3; return 0; } - for(;i;i--) { + for (;i;i--) { if (demodulator(fskd, &fskd->x1, GET_SAMPLE)) return(-1); #if 0 Index: image.c =================================================================== --- image.c (revision 48974) +++ image.c (working copy) @@ -128,7 +128,7 @@ ast_copy_string(tmp, i->exts, sizeof(tmp)); stringp=tmp; e = strsep(&stringp, "|"); - while(e) { + while (e) { make_filename(buf, sizeof(buf), filename, preflang, e); if ((len = file_exists(buf))) { found = i; Index: io.c =================================================================== --- io.c (revision 48974) +++ io.c (working copy) @@ -269,7 +269,7 @@ * At least one event */ origcnt = ioc->fdcnt; - for(x = 0; x < origcnt; x++) { + for (x = 0; x < origcnt; x++) { /* Yes, it is possible for an entry to be deleted and still have an event waiting if it occurs after the original calling id */ if (ioc->fds[x].revents && ioc->ior[x].id) { Index: jitterbuf.c =================================================================== --- jitterbuf.c (revision 48974) +++ jitterbuf.c (working copy) @@ -781,7 +781,7 @@ if (thists && thists < lastts) jb_warn("XXXX timestamp roll-back!!!\n"); lastts = thists; #endif - if(ret == JB_INTERP) + if (ret == JB_INTERP) frameout->ms = jb->info.last_voice_ms; return ret; Index: logger.c =================================================================== --- logger.c (revision 48974) +++ logger.c (working copy) @@ -214,7 +214,7 @@ * syslog.facility => level,level,level */ facility = strchr(channel, '.'); - if(!facility++ || !facility) { + if (!facility++ || !facility) { facility = "local0"; } @@ -283,14 +283,14 @@ openlog("asterisk", LOG_PID, chan->facility); } else { if (channel[0] == '/') { - if(!ast_strlen_zero(hostname)) { + if (!ast_strlen_zero(hostname)) { snprintf(chan->filename, sizeof(chan->filename) - 1,"%s.%s", channel, hostname); } else { ast_copy_string(chan->filename, channel, sizeof(chan->filename)); } } - if(!ast_strlen_zero(hostname)) { + if (!ast_strlen_zero(hostname)) { snprintf(chan->filename, sizeof(chan->filename), "%s/%s.%s", ast_config_AST_LOG_DIR, channel, hostname); } else { snprintf(chan->filename, sizeof(chan->filename), "%s/%s", ast_config_AST_LOG_DIR, channel); @@ -523,7 +523,7 @@ static int handle_logger_reload(int fd, int argc, char *argv[]) { - if(reload_logger(0)) { + if (reload_logger(0)) { ast_cli(fd, "Failed to reload the logger\n"); return RESULT_FAILURE; } else @@ -532,7 +532,7 @@ static int handle_logger_rotate(int fd, int argc, char *argv[]) { - if(reload_logger(1)) { + if (reload_logger(1)) { ast_cli(fd, "Failed to reload the logger and rotate log files\n"); return RESULT_FAILURE; } else Index: pbx.c =================================================================== --- pbx.c (revision 48974) +++ pbx.c (working copy) @@ -230,7 +230,7 @@ static int pbx_builtin_congestion(struct ast_channel *, void *); static int pbx_builtin_busy(struct ast_channel *, void *); static int pbx_builtin_noop(struct ast_channel *, void *); -static int pbx_builtin_gotoif(struct ast_channel *, void *); +static int pbx_builtin_gotoif (struct ast_channel *, void *); static int pbx_builtin_gotoiftime(struct ast_channel *, void *); static int pbx_builtin_execiftime(struct ast_channel *, void *); static int pbx_builtin_saynumber(struct ast_channel *, void *); @@ -532,7 +532,7 @@ return tmp; } -static struct ast_switch *pbx_findswitch(const char *sw) +static struct ast_switch *pbx_findswitch (const char *sw) { struct ast_switch *asw; @@ -984,7 +984,7 @@ } /* Check alternative switches */ AST_LIST_TRAVERSE(&tmp->alts, sw, list) { - struct ast_switch *asw = pbx_findswitch(sw->name); + struct ast_switch *asw = pbx_findswitch (sw->name); ast_switch_f *aswf = NULL; char *datap; @@ -1457,7 +1457,7 @@ nextexp = NULL; nextthing = strchr(whereweare, '$'); if (nextthing) { - switch(nextthing[1]) { + switch (nextthing[1]) { case '{': nextvar = nextthing; pos = nextvar - whereweare; @@ -1561,7 +1561,7 @@ needsub = 0; /* Find the end of it */ - while(brackets && *vare) { + while (brackets && *vare) { if ((vare[0] == '$') && (vare[1] == '[')) { needsub++; brackets++; @@ -2400,7 +2400,7 @@ if (c->cdr && ast_opt_end_cdr_before_h_exten) ast_cdr_end(c->cdr); set_ext_pri(c, "h", 1); - while(ast_exists_extension(c, c->context, c->exten, c->priority, c->cid.cid_num)) { + while (ast_exists_extension(c, c->context, c->exten, c->priority, c->cid.cid_num)) { if ((res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->cid.cid_num))) { /* Something bad happened, or a hangup has been requested. */ if (option_debug) @@ -2609,7 +2609,7 @@ * structure, leave context list locked and call ast_context_remove_switch2 * which removes switch, unlock contexts list and return ... */ -int ast_context_remove_switch(const char *context, const char *sw, const char *data, const char *registrar) +int ast_context_remove_switch (const char *context, const char *sw, const char *data, const char *registrar) { int ret = -1; /* default error return */ struct ast_context *c = find_context_locked(context); @@ -2861,7 +2861,7 @@ * Append to the list. We don't have a tail pointer because we need * to scan the list anyways to check for duplicates during insertion. */ -int ast_register_switch(struct ast_switch *sw) +int ast_register_switch (struct ast_switch *sw) { struct ast_switch *tmp; @@ -2879,7 +2879,7 @@ return 0; } -void ast_unregister_switch(struct ast_switch *sw) +void ast_unregister_switch (struct ast_switch *sw) { AST_RWLIST_WRLOCK(&switches); AST_RWLIST_REMOVE(&switches, sw, list); @@ -4244,7 +4244,7 @@ * EBUSY - can't lock * ENOENT - no existence of context */ -int ast_context_add_switch(const char *context, const char *sw, const char *data, int eval, const char *registrar) +int ast_context_add_switch (const char *context, const char *sw, const char *data, int eval, const char *registrar) { int ret = -1; struct ast_context *c = find_context_locked(context); @@ -4534,7 +4534,7 @@ int count=0; while (*src && (count < len - 1)) { - switch(*src) { + switch (*src) { case ' ': /* otherwise exten => [a-b],1,... doesn't work */ /* case '-': */ @@ -4789,7 +4789,7 @@ struct ast_app *app; while (timeout && (chan->_state != AST_STATE_UP)) { - res = ast_waitfor(chan, timeout); + res = ast_waitfor (chan, timeout); if (res < 1) break; if (timeout > -1) @@ -4938,7 +4938,7 @@ if (option_verbose > 3) ast_verbose(VERBOSE_PREFIX_4 "Channel %s was never answered.\n", chan->name); - if(chan->cdr) { /* update the cdr */ + if (chan->cdr) { /* update the cdr */ /* here we update the status of the call, which sould be busy. * if that fails then we set the status to failed */ if (ast_cdr_disposition(chan->cdr, chan->hangupcause)) @@ -5070,7 +5070,7 @@ ast_log(LOG_WARNING, "%s already has a call record??\n", chan->name); } else { chan->cdr = ast_cdr_alloc(); /* allocate a cdr for the channel */ - if(!chan->cdr) { + if (!chan->cdr) { /* allocation of the cdr failed */ free(chan->pbx); res = -1; @@ -5264,13 +5264,13 @@ waittime = waitsec * 1000.0; ast_safe_sleep(chan, waittime); } else do { - res = ast_waitfor(chan, -1); + res = ast_waitfor (chan, -1); if (res < 0) return; f = ast_read(chan); if (f) ast_frfree(f); - } while(f); + } while (f); } /*! @@ -5867,7 +5867,7 @@ return 1; } -static int pbx_builtin_gotoif(struct ast_channel *chan, void *data) +static int pbx_builtin_gotoif (struct ast_channel *chan, void *data) { char *condition, *branch1, *branch2, *branch; int rc; Index: rtp.c =================================================================== --- rtp.c (revision 48974) +++ rtp.c (working copy) @@ -275,7 +275,7 @@ static const char *stun_msg2str(int msg) { - switch(msg) { + switch (msg) { case STUN_BINDREQ: return "Binding Request"; case STUN_BINDRESP: @@ -294,7 +294,7 @@ static const char *stun_attr2str(int msg) { - switch(msg) { + switch (msg) { case STUN_MAPPED_ADDRESS: return "Mapped Address"; case STUN_RESPONSE_ADDRESS: @@ -331,7 +331,7 @@ if (stundebug) ast_verbose("Found STUN Attribute %s (%04x), length %d\n", stun_attr2str(ntohs(attr->attr)), ntohs(attr->attr), ntohs(attr->len)); - switch(ntohs(attr->attr)) { + switch (ntohs(attr->attr)) { case STUN_USERNAME: state->username = (const char *) (attr->value); break; @@ -439,7 +439,7 @@ len = ntohs(hdr->msglen); data += sizeof(struct stun_header); memset(&st, 0, sizeof(st)); - while(len) { + while (len) { if (len < sizeof(struct stun_attr)) { if (option_debug) ast_log(LOG_DEBUG, "Runt Attribute (got %zd, expecting %zd)\n", len, sizeof(struct stun_attr)); @@ -471,7 +471,7 @@ resp->msglen = 0; attr = (struct stun_attr *)resp->ies; if (!len) { - switch(ntohs(hdr->msgtype)) { + switch (ntohs(hdr->msgtype)) { case STUN_BINDREQ: if (stundebug) ast_verbose("STUN Bind Request, username: %s\n", @@ -1503,7 +1503,7 @@ /* Lock channels */ ast_channel_lock(c0); if (c1) { - while(ast_channel_trylock(c1)) { + while (ast_channel_trylock(c1)) { ast_channel_unlock(c0); usleep(1); ast_channel_lock(c0); @@ -1578,7 +1578,7 @@ /* Lock channels */ ast_channel_lock(dest); - while(ast_channel_trylock(src)) { + while (ast_channel_trylock(src)) { ast_channel_unlock(dest); usleep(1); ast_channel_lock(dest); @@ -2748,7 +2748,7 @@ ast_smoother_feed(rtp->smoother, _f); } - while((f = ast_smoother_read(rtp->smoother))) + while ((f = ast_smoother_read(rtp->smoother))) ast_rtp_raw_write(rtp, f, codec); } else { /* Don't buffer outgoing frames; send them one-per-packet: */ @@ -3201,7 +3201,7 @@ /* Lock channels */ ast_channel_lock(c0); - while(ast_channel_trylock(c1)) { + while (ast_channel_trylock(c1)) { ast_channel_unlock(c0); usleep(1); ast_channel_lock(c0); Index: say.c =================================================================== --- say.c (revision 48974) +++ say.c (working copy) @@ -442,7 +442,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) { snprintf(fn, sizeof(fn), "digits/minus"); if ( num > INT_MIN ) { @@ -487,7 +487,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 @@ -545,7 +545,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) { snprintf(fn, sizeof(fn), "digits/minus"); if ( num > INT_MIN ) { @@ -609,7 +609,7 @@ num -= left * (exp10_int(length-1)); } 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 { @@ -638,7 +638,7 @@ if (options && !strncasecmp(options, "n",1)) cn = -1; - while(!res && (num || playh || playa )) { + while (!res && (num || playh || playa )) { /* The grammar for Danish numbers is the same as for English except * for the following: * - 1 exists in both commune ("en", file "1N") and neuter ("et", file "1") @@ -719,7 +719,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 @@ -752,7 +752,7 @@ if (options && (!strncasecmp(options, "f",1))) mf = -1; - while(!res && num) { + while (!res && num) { /* The grammar for German numbers is the same as for English except * for the following: * - numbers 20 through 99 are said in reverse order, i.e. 21 is @@ -850,7 +850,7 @@ res = -1; } 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 @@ -885,7 +885,7 @@ if (!num) return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd); - while(!res && (num || playh || playa )) { + while (!res && (num || playh || playa )) { if (num < 0) { snprintf(fn, sizeof(fn), "digits/minus"); if ( num > INT_MIN ) { @@ -937,7 +937,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 @@ -1042,7 +1042,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 @@ -1073,7 +1073,7 @@ if (options && !strncasecmp(options, "f",1)) mf = -1; - while(!res && (num || playh || playa)) { + while (!res && (num || playh || playa)) { if (num < 0) { snprintf(fn, sizeof(fn), "digits/minus"); if ( num > INT_MIN ) { @@ -1135,7 +1135,7 @@ res = -1; } 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 @@ -1213,7 +1213,7 @@ mf = -1; /* Do we have work to do? */ - while(!res && (num || (state>0) )) { + while (!res && (num || (state>0) )) { /* first type of work: play a second sound. In this loop * we can only play one sound file at a time. Thus playing * a second one requires repeating the loop just for the @@ -1285,7 +1285,7 @@ res = -1; } 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 @@ -1332,7 +1332,7 @@ So the right file is provided. */ - while(!res && (num || playh)) { + while (!res && (num || playh)) { if (num < 0) { snprintf(fn, sizeof(fn), "digits/minus"); if ( num > INT_MIN ) { @@ -1439,7 +1439,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 @@ -1517,7 +1517,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 @@ -1546,7 +1546,7 @@ if (options && !strncasecmp(options, "n",1)) cn = -1; - while(!res && (num || playh || playa )) { + while (!res && (num || playh || playa )) { /* The grammar for Norwegian numbers is the same as for English except * for the following: * - 1 exists in both commune ("en", file "1") and neuter ("ett", file "1N") @@ -1610,7 +1610,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 @@ -1935,7 +1935,7 @@ if (options && !strncasecmp(options, "f",1)) mf = -1; - while(!res && num ) { + while (!res && num ) { if (num < 0) { snprintf(fn, sizeof(fn), "digits/minus"); if ( num > INT_MIN ) { @@ -2028,7 +2028,7 @@ return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd); if (options && !strncasecmp(options, "n",1)) cn = -1; - while(!res && (num || playh)) { + while (!res && (num || playh)) { if (num < 0) { snprintf(fn, sizeof(fn), "digits/minus"); if ( num > INT_MIN ) { @@ -2078,7 +2078,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 @@ -2099,7 +2099,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) { snprintf(fn, sizeof(fn), "digits/minus"); if ( num > INT_MIN ) { @@ -2144,7 +2144,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 @@ -2192,7 +2192,7 @@ if (!num) return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd); - while(!res && (num)) { + while (!res && (num)) { if (num < 0) { snprintf(fn, sizeof(fn), "digits/minus"); if ( num > INT_MIN ) { @@ -2201,7 +2201,7 @@ num = 0; } } else if (num < 20) { - if(options && strlen(options) == 1 && num < 3) { + if (options && strlen(options) == 1 && num < 3) { snprintf(fn, sizeof(fn), "digits/%d%s", num, options); } else { snprintf(fn, sizeof(fn), "digits/%d", num); @@ -2287,7 +2287,7 @@ int res = 0, t = 0; char fn[256] = ""; - while(!res && num) { + while (!res && num) { if (num < 0) { snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */ if ( num > INT_MIN ) { @@ -2399,7 +2399,7 @@ if (!num) return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd); - while(!res && num) { + while (!res && num) { if (num < 0) { snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */ if ( num > INT_MIN ) { @@ -2563,7 +2563,7 @@ if (!num) return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd); - while(!res && num) { + while (!res && num) { if (num < 0) { snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */ if ( num > INT_MIN ) { @@ -5260,7 +5260,7 @@ } else { snprintf(nextmsg,sizeof(nextmsg), "digits/h-%dh", tm.tm_mday - (tm.tm_mday % 10)); res = wait_file(chan,ints,nextmsg,lang); - if(!res) { + if (!res) { snprintf(nextmsg,sizeof(nextmsg), "digits/h-%d", tm.tm_mday % 10); res = wait_file(chan,ints,nextmsg,lang); } @@ -6207,7 +6207,7 @@ return ast_waitstream(chan, ints); } - while(!res && num ) { + while (!res && num ) { i++; if (num < 13) { snprintf(fn, sizeof(fn), "digits/%d", num); @@ -6251,7 +6251,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 Index: tdd.c =================================================================== --- tdd.c (revision 48974) +++ tdd.c (working copy) @@ -215,35 +215,35 @@ #define PUT_BYTE(a) do { \ *(buf++) = (a); \ bytes++; \ -} while(0) +} while (0) #define PUT_AUDIO_SAMPLE(y) do { \ int index = (short)(rint(8192.0 * (y))); \ *(buf++) = AST_LIN2MU(index); \ 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) { \ + while (scont < tddsb) { \ PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, bit)); \ scont += 1.0; \ } \ scont -= tddsb; \ -} while(0) +} while (0) #define PUT_TDD_STOP do { \ - while(scont < (tddsb * 1.5)) { \ + while (scont < (tddsb * 1.5)) { \ PUT_AUDIO_SAMPLE(tdd_getcarrier(&cr, &ci, 1)); \ scont += 1.0; \ } \ scont -= (tddsb * 1.5); \ -} while(0) +} while (0) #define PUT_TDD(byte) do { \ @@ -255,7 +255,7 @@ b >>= 1; \ } \ PUT_TDD_STOP; /* Stop bit */ \ -} while(0); +} while (0); int tdd_generate(struct tdd_state *tdd, unsigned char *buf, const char *str) { @@ -271,7 +271,7 @@ float ci = 0.0; float scont = 0.0; - for(x = 0; str[x]; x++) { + for (x = 0; str[x]; x++) { c = toupper(str[x]); #if 0 printf("%c",c); fflush(stdout); Index: utils.c =================================================================== --- utils.c (revision 48974) +++ utils.c (working copy) @@ -192,7 +192,7 @@ pure integer */ s = host; res = 0; - while(s && *s) { + while (s && *s) { if (*s == '.') dots++; else if (!isdigit(*s)) @@ -329,7 +329,7 @@ unsigned int byte = 0; unsigned int bits = 0; int incnt = 0; - while(*src && (cnt < max)) { + while (*src && (cnt < max)) { /* Shift in 6 bits of input */ byte <<= 6; byte |= (b2a[(int)(*src)]) & 0x3f;