[svn-commits] file: trunk r51486 - /trunk/main/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Mon Jan 22 17:11:33 MST 2007
Author: file
Date: Mon Jan 22 18:11:32 2007
New Revision: 51486
URL: http://svn.digium.com/view/asterisk?view=rev&rev=51486
Log:
Cosmetic changes. Make main source files better conform to coding guidelines and standards. (issue #8679 reported by johann8384)
Modified:
trunk/main/abstract_jb.c
trunk/main/alaw.c
trunk/main/app.c
trunk/main/asterisk.c
trunk/main/autoservice.c
trunk/main/callerid.c
trunk/main/cdr.c
trunk/main/channel.c
trunk/main/cli.c
trunk/main/config.c
trunk/main/devicestate.c
trunk/main/dsp.c
trunk/main/enum.c
trunk/main/file.c
trunk/main/frame.c
trunk/main/fskmodem.c
trunk/main/image.c
trunk/main/io.c
trunk/main/jitterbuf.c
trunk/main/logger.c
trunk/main/pbx.c
trunk/main/say.c
trunk/main/utils.c
Modified: trunk/main/abstract_jb.c
URL: http://svn.digium.com/view/asterisk/trunk/main/abstract_jb.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/abstract_jb.c (original)
+++ trunk/main/abstract_jb.c Mon Jan 22 18:11:32 2007
@@ -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);
Modified: trunk/main/alaw.c
URL: http://svn.digium.com/view/asterisk/trunk/main/alaw.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/alaw.c (original)
+++ trunk/main/alaw.c Mon Jan 22 18:11:32 2007
@@ -42,23 +42,19 @@
};
pcm_val = linear;
- if (pcm_val >= 0)
- {
- /* Sign (7th) bit = 1 */
- mask = AMI_MASK | 0x80;
- }
- else
- {
- /* Sign bit = 0 */
- mask = AMI_MASK;
- pcm_val = -pcm_val;
+ if (pcm_val >= 0) {
+ /* Sign (7th) bit = 1 */
+ mask = AMI_MASK | 0x80;
+ } else {
+ /* Sign bit = 0 */
+ mask = AMI_MASK;
+ pcm_val = -pcm_val;
}
/* Convert the scaled magnitude to segment number. */
- for (seg = 0; seg < 8; seg++)
- {
- if (pcm_val <= seg_end[seg])
- break;
+ for (seg = 0; seg < 8; seg++) {
+ if (pcm_val <= seg_end[seg])
+ break;
}
/* Combine the sign, segment, and quantization bits. */
return ((seg << 4) | ((pcm_val >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask;
@@ -74,7 +70,7 @@
i = ((alaw & 0x0F) << 4);
seg = (((int) alaw & 0x70) >> 4);
if (seg)
- i = (i + 0x100) << (seg - 1);
+ i = (i + 0x100) << (seg - 1);
return (short int) ((alaw & 0x80) ? i : -i);
}
@@ -87,15 +83,13 @@
/*
* 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++)
- {
+ }
+ /* set up the reverse (mu-law) conversion table */
+ for (i = -32768; i < 32768; i++) {
__ast_lin2a[((unsigned short)i) >> 3] = linear2alaw(i);
- }
+ }
}
Modified: trunk/main/app.c
URL: http://svn.digium.com/view/asterisk/trunk/main/app.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/app.c (original)
+++ trunk/main/app.c Mon Jan 22 18:11:32 2007
@@ -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)
Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Mon Jan 22 18:11:32 2007
@@ -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, "<Unknown>", 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;
Modified: trunk/main/autoservice.c
URL: http://svn.digium.com/view/asterisk/trunk/main/autoservice.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/autoservice.c (original)
+++ trunk/main/autoservice.c Mon Jan 22 18:11:32 2007
@@ -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;
}
Modified: trunk/main/callerid.c
URL: http://svn.digium.com/view/asterisk/trunk/main/callerid.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/callerid.c (original)
+++ trunk/main/callerid.c Mon Jan 22 18:11:32 2007
@@ -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;
@@ -793,24 +793,24 @@
}
}
sum = 0;
- for (x=0; x<len; x++)
+ for (x = 0; x < len; x++)
sum += msg[x];
sum = (256 - (sum & 255));
msg[len++] = sum;
/* Wait a half a second */
- for (x=0; x<4000; x++)
+ for (x = 0; x < 4000; x++)
PUT_BYTE(0x7f);
/* Transmit 30 0x55's (looks like a square wave) for channel seizure */
- for (x=0; x<30; x++)
+ for (x = 0; x < 30; x++)
PUT_CLID(0x55);
/* Send 170ms of callerid marks */
- for (x=0; x<170; x++)
+ for (x = 0; x < 170; x++)
PUT_CLID_MARKMS;
- for (x=0; x<len; x++) {
+ for (x = 0; x < len; x++) {
PUT_CLID(msg[x]);
}
/* Send 50 more ms of marks */
- for (x=0; x<50; x++)
+ for (x = 0; x < 50; x++)
PUT_CLID_MARKMS;
return bytes;
}
@@ -829,14 +829,14 @@
len = callerid_genmsg(msg, sizeof(msg), number, name, flags);
if (!callwaiting) {
/* Wait a half a second */
- for (x=0; x<4000; x++)
+ for (x = 0; x < 4000; x++)
PUT_BYTE(0x7f);
/* Transmit 30 0x55's (looks like a square wave) for channel seizure */
- for (x=0; x<30; x++)
+ for (x = 0; x < 30; x++)
PUT_CLID(0x55);
}
/* Send 150ms of callerid marks */
- for (x=0; x<150; x++)
+ for (x = 0; x < 150; x++)
PUT_CLID_MARKMS;
/* Send 0x80 indicating MDMF format */
PUT_CLID(0x80);
@@ -844,7 +844,7 @@
PUT_CLID(len);
sum = 0x80 + strlen(msg);
/* Put each character of message and update checksum */
- for (x=0; x<len; x++) {
+ for (x = 0; x < len; x++) {
PUT_CLID(msg[x]);
sum += msg[x];
}
@@ -852,7 +852,7 @@
PUT_CLID(256 - (sum & 255));
/* Send 50 more ms of marks */
- for (x=0; x<50; x++)
+ for (x = 0; x < 50; x++)
PUT_CLID_MARKMS;
return bytes;
@@ -867,8 +867,8 @@
int x, y=0;
int bracketed = 0;
- for (x=0; n[x]; x++) {
- switch(n[x]) {
+ for (x = 0; n[x]; x++) {
+ switch (n[x]) {
case '[':
bracketed++;
n[y++] = n[x];
@@ -904,7 +904,7 @@
if (ast_strlen_zero(exten))
return 0;
- for (x=0; exten[x]; x++)
+ for (x = 0; exten[x]; x++)
if (!strchr(valid, exten[x]))
return 0;
return 1;
Modified: trunk/main/cdr.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cdr.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Mon Jan 22 18:11:32 2007
@@ -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 */
Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Mon Jan 22 18:11:32 2007
@@ -505,7 +505,7 @@
{
char *buf;
- switch(state) {
+ switch (state) {
case AST_STATE_DOWN:
return "Down";
case AST_STATE_RESERVED:
@@ -537,7 +537,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:
@@ -1627,7 +1627,7 @@
return -1;
}
- switch(chan->_state) {
+ switch (chan->_state) {
case AST_STATE_RINGING:
case AST_STATE_RING:
if (chan->tech->answer)
@@ -1941,13 +1941,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;
@@ -2545,7 +2545,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);
Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Mon Jan 22 18:11:32 2007
@@ -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;
Modified: trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/trunk/main/config.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Mon Jan 22 18:11:32 2007
@@ -218,7 +218,7 @@
{
struct ast_variable *vn;
- while(v) {
+ while (v) {
vn = v;
v = v->next;
free(vn);
@@ -529,7 +529,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) {
@@ -550,7 +550,7 @@
prev = NULL;
cat = cfg->root;
- while(cat) {
+ while (cat) {
if (!strcasecmp(cat->name, category)) {
ast_variables_destroy(cat->root);
if (prev) {
@@ -579,7 +579,7 @@
return;
cat = cfg->root;
- while(cat) {
+ while (cat) {
ast_variables_destroy(cat->root);
catn = cat;
cat = cat->next;
@@ -633,7 +633,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 */
@@ -678,7 +678,7 @@
/* A directive */
cur++;
c = cur;
- while(*c && (*c > 32)) c++;
+ while (*c && (*c > 32)) c++;
if (*c) {
*c = '\0';
/* Find real argument */
@@ -688,7 +688,7 @@
} else
c = NULL;
do_include = !strcasecmp(cur, "include");
- if(!do_include)
+ if (!do_include)
do_exec = !strcasecmp(cur, "exec");
else
do_exec = 0;
@@ -699,7 +699,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)) {
@@ -720,9 +720,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 {
@@ -765,7 +765,7 @@
if (withcomments && lline_buffer && lline_buffer[0] ) {
v->sameline = ALLOC_COMMENT(lline_buffer);
}
- if( withcomments )
+ if ( withcomments )
CB_RESET();
} else {
@@ -851,7 +851,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 ) {
@@ -870,7 +870,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';
@@ -915,7 +915,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 */
}
@@ -932,7 +932,7 @@
}
}
fclose(f);
- } while(0);
+ } while (0);
if (comment) {
ast_log(LOG_WARNING,"Unterminated comment detected beginning on line %d\n", nest[comment]);
}
@@ -995,7 +995,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)
{
@@ -1005,14 +1005,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] != '!')
Modified: trunk/main/devicestate.c
URL: http://svn.digium.com/view/asterisk/trunk/main/devicestate.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/devicestate.c (original)
+++ trunk/main/devicestate.c Mon Jan 22 18:11:32 2007
@@ -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) {
Modified: trunk/main/dsp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/dsp.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/dsp.c (original)
+++ trunk/main/dsp.c Mon Jan 22 18:11:32 2007
@@ -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: \
@@ -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:
Modified: trunk/main/enum.c
URL: http://svn.digium.com/view/asterisk/trunk/main/enum.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/enum.c (original)
+++ trunk/main/enum.c Mon Jan 22 18:11:32 2007
@@ -445,7 +445,7 @@
tmp[newpos++] = '.';
}
if (*p2) {
- while(*p2 && newpos < 128){
+ while (*p2 && newpos < 128){
tmp[newpos++] = *p2;
p2++;
}
@@ -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) {
Modified: trunk/main/file.c
URL: http://svn.digium.com/view/asterisk/trunk/main/file.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/file.c (original)
+++ trunk/main/file.c Mon Jan 22 18:11:32 2007
@@ -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)
@@ -1031,7 +1031,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' };
@@ -1052,7 +1052,7 @@
}
break;
case AST_FRAME_CONTROL:
- switch(fr->subclass) {
+ switch (fr->subclass) {
case AST_CONTROL_HANGUP:
case AST_CONTROL_BUSY:
case AST_CONTROL_CONGESTION:
Modified: trunk/main/frame.c
URL: http://svn.digium.com/view/asterisk/trunk/main/frame.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/frame.c (original)
+++ trunk/main/frame.c Mon Jan 22 18:11:32 2007
@@ -534,7 +534,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;
}
@@ -583,7 +583,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;
@@ -595,11 +595,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;
}
}
@@ -612,7 +612,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;
}
@@ -938,7 +938,7 @@
int x, differential = (int) 'A', mem;
char *from, *to;
- if(right) {
+ if (right) {
from = pref->order;
to = buf;
mem = size;
@@ -950,7 +950,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);
}
@@ -967,23 +967,23 @@
buf[0] = '(';
total_len--;
for(x = 0; x < 32 ; x++) {
- if(total_len <= 0)
- break;
- if(!(codec = ast_codec_pref_index(pref,x)))
- break;
- if((formatname = ast_getformatname(codec))) {
+ if (total_len <= 0)
+ break;
+ if (!(codec = ast_codec_pref_index(pref,x)))
+ break;
+ 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--;
}
@@ -996,7 +996,7 @@
int slot = 0;
- if((index >= 0) && (index < sizeof(pref->order))) {
+ if ((index >= 0) && (index < sizeof(pref->order))) {
slot = pref->order[index];
}
@@ -1011,7 +1011,7 @@
int slot;
int size;
- if(!pref->order[0])
+ if (!pref->order[0])
return;
memcpy(&oldorder, pref, sizeof(oldorder));
@@ -1020,9 +1020,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)
- break;
- if(AST_FORMAT_LIST[slot-1].bits != format) {
+ if (! slot)
+ break;
+ if (AST_FORMAT_LIST[slot-1].bits != format) {
pref->order[y] = slot;
pref->framing[y++] = size;
}
@@ -1038,15 +1038,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;
}
@@ -1063,31 +1063,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;
}
@@ -1103,7 +1103,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;
@@ -1111,23 +1111,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;
@@ -1150,7 +1150,7 @@
break;
}
}
- if(ret & AST_FORMAT_AUDIO_MASK)
+ if (ret & AST_FORMAT_AUDIO_MASK)
return ret;
if (option_debug > 3)
Modified: trunk/main/fskmodem.c
URL: http://svn.digium.com/view/asterisk/trunk/main/fskmodem.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/fskmodem.c (original)
+++ trunk/main/fskmodem.c Mon Jan 22 18:11:32 2007
@@ -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
Modified: trunk/main/image.c
URL: http://svn.digium.com/view/asterisk/trunk/main/image.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/image.c (original)
+++ trunk/main/image.c Mon Jan 22 18:11:32 2007
@@ -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;
Modified: trunk/main/io.c
URL: http://svn.digium.com/view/asterisk/trunk/main/io.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/io.c (original)
+++ trunk/main/io.c Mon Jan 22 18:11:32 2007
@@ -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) {
Modified: trunk/main/jitterbuf.c
URL: http://svn.digium.com/view/asterisk/trunk/main/jitterbuf.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/jitterbuf.c (original)
+++ trunk/main/jitterbuf.c Mon Jan 22 18:11:32 2007
@@ -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;
Modified: trunk/main/logger.c
URL: http://svn.digium.com/view/asterisk/trunk/main/logger.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Mon Jan 22 18:11:32 2007
@@ -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
Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Mon Jan 22 18:11:32 2007
@@ -1460,7 +1460,7 @@
nextexp = NULL;
nextthing = strchr(whereweare, '$');
if (nextthing) {
- switch(nextthing[1]) {
+ switch (nextthing[1]) {
case '{':
nextvar = nextthing;
pos = nextvar - whereweare;
@@ -1564,7 +1564,7 @@
needsub = 0;
/* Find the end of it */
- while(brackets && *vare) {
+ while (brackets && *vare) {
if ((vare[0] == '$') && (vare[1] == '[')) {
needsub++;
brackets++;
@@ -2403,7 +2403,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)
@@ -4539,7 +4539,7 @@
int count=0;
while (*src && (count < len - 1)) {
- switch(*src) {
+ switch (*src) {
case ' ':
/* otherwise exten => [a-b],1,... doesn't work */
/* case '-': */
@@ -4941,7 +4941,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))
@@ -5073,7 +5073,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;
Modified: trunk/main/say.c
URL: http://svn.digium.com/view/asterisk/trunk/main/say.c?view=diff&rev=51486&r1=51485&r2=51486
==============================================================================
--- trunk/main/say.c (original)
+++ trunk/main/say.c Mon Jan 22 18:11:32 2007
@@ -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)) {
[... 164 lines stripped ...]
More information about the svn-commits
mailing list