Formatting cleanup

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@17369 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Olle Johansson
2006-04-04 18:34:21 +00:00
parent 654500ebca
commit 42fddfa075

View File

@@ -755,7 +755,7 @@ static inline int pri_grab(struct zt_pvt *pvt, struct zt_pri *pri)
int res; int res;
/* Grab the lock first */ /* Grab the lock first */
do { do {
res = ast_mutex_trylock(&pri->lock); res = ast_mutex_trylock(&pri->lock);
if (res) { if (res) {
ast_mutex_unlock(&pvt->lock); ast_mutex_unlock(&pvt->lock);
/* Release the lock and try again */ /* Release the lock and try again */
@@ -1117,11 +1117,11 @@ static char *alarm2str(int alarm)
static char *event2str(int event) static char *event2str(int event)
{ {
static char buf[256]; static char buf[256];
if ((event < (sizeof(events) / sizeof(events[0]))) && (event > -1)) if ((event < (sizeof(events) / sizeof(events[0]))) && (event > -1))
return events[event]; return events[event];
sprintf(buf, "Event %d", event); /* safe */ sprintf(buf, "Event %d", event); /* safe */
return buf; return buf;
} }
#ifdef ZAPATA_PRI #ifdef ZAPATA_PRI
@@ -1137,16 +1137,16 @@ static char *dialplan2str(int dialplan)
#ifdef ZAPATA_R2 #ifdef ZAPATA_R2
static int str2r2prot(char *swtype) static int str2r2prot(char *swtype)
{ {
if (!strcasecmp(swtype, "ar")) if (!strcasecmp(swtype, "ar"))
return MFCR2_PROT_ARGENTINA; return MFCR2_PROT_ARGENTINA;
/*endif*/ /*endif*/
if (!strcasecmp(swtype, "cn")) if (!strcasecmp(swtype, "cn"))
return MFCR2_PROT_CHINA; return MFCR2_PROT_CHINA;
/*endif*/ /*endif*/
if (!strcasecmp(swtype, "kr")) if (!strcasecmp(swtype, "kr"))
return MFCR2_PROT_KOREA; return MFCR2_PROT_KOREA;
/*endif*/ /*endif*/
return -1; return -1;
} }
#endif #endif
@@ -10138,38 +10138,38 @@ static struct zt_pvt *find_channel(int channel)
static int action_zapdndon(struct mansession *s, struct message *m) static int action_zapdndon(struct mansession *s, struct message *m)
{ {
struct zt_pvt *p = NULL; struct zt_pvt *p = NULL;
char *channel = astman_get_header(m, "ZapChannel"); char *channel = astman_get_header(m, "ZapChannel");
if (ast_strlen_zero(channel)) { if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified"); astman_send_error(s, m, "No channel specified");
return 0; return 0;
} }
p = find_channel(atoi(channel)); p = find_channel(atoi(channel));
if (!p) { if (!p) {
astman_send_error(s, m, "No such channel"); astman_send_error(s, m, "No such channel");
return 0; return 0;
} }
p->dnd = 1; p->dnd = 1;
astman_send_ack(s, m, "DND Enabled"); astman_send_ack(s, m, "DND Enabled");
return 0; return 0;
} }
static int action_zapdndoff(struct mansession *s, struct message *m) static int action_zapdndoff(struct mansession *s, struct message *m)
{ {
struct zt_pvt *p = NULL; struct zt_pvt *p = NULL;
char *channel = astman_get_header(m, "ZapChannel"); char *channel = astman_get_header(m, "ZapChannel");
if (ast_strlen_zero(channel)) { if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified"); astman_send_error(s, m, "No channel specified");
return 0; return 0;
} }
p = find_channel(atoi(channel)); p = find_channel(atoi(channel));
if (!p) { if (!p) {
astman_send_error(s, m, "No such channel"); astman_send_error(s, m, "No such channel");
return 0; return 0;
} }
p->dnd = 0; p->dnd = 0;
astman_send_ack(s, m, "DND Disabled"); astman_send_ack(s, m, "DND Disabled");
return 0; return 0;
} }
static int action_transfer(struct mansession *s, struct message *m) static int action_transfer(struct mansession *s, struct message *m)
@@ -11056,7 +11056,7 @@ static int setup_zap(int reload)
int i; int i;
struct zt_ring_cadence new_cadence; struct zt_ring_cadence new_cadence;
int cid_location = -1; int cid_location = -1;
int firstcadencepos = 0; int firstcadencepos = 0;
char original_args[80]; char original_args[80];
int cadence_is_ok = 1; int cadence_is_ok = 1;
@@ -11072,27 +11072,27 @@ static int setup_zap(int reload)
/* Ring cadences cannot be negative */ /* Ring cadences cannot be negative */
for (i=0;i<element_count;i++) { for (i=0;i<element_count;i++) {
if (c[i] == 0) { if (c[i] == 0) {
ast_log(LOG_ERROR, "Ring or silence duration cannot be zero: %s\n", original_args); ast_log(LOG_ERROR, "Ring or silence duration cannot be zero: %s\n", original_args);
cadence_is_ok = 0; cadence_is_ok = 0;
break; break;
} else if (c[i] < 0) { } else if (c[i] < 0) {
if (i % 2 == 1) { if (i % 2 == 1) {
/* Silence duration, negative possibly okay */ /* Silence duration, negative possibly okay */
if (cid_location == -1) { if (cid_location == -1) {
cid_location = i; cid_location = i;
c[i] *= -1; c[i] *= -1;
} else { } else {
ast_log(LOG_ERROR, "CID location specified twice: %s\n",original_args); ast_log(LOG_ERROR, "CID location specified twice: %s\n",original_args);
cadence_is_ok = 0; cadence_is_ok = 0;
break; break;
} }
} else { } else {
if (firstcadencepos == 0) { if (firstcadencepos == 0) {
firstcadencepos = i; /* only recorded to avoid duplicate specification */ firstcadencepos = i; /* only recorded to avoid duplicate specification */
/* duration will be passed negative to the zaptel driver */ /* duration will be passed negative to the zaptel driver */
} else { } else {
ast_log(LOG_ERROR, "First cadence position specified twice: %s\n",original_args); ast_log(LOG_ERROR, "First cadence position specified twice: %s\n",original_args);
cadence_is_ok = 0; cadence_is_ok = 0;
break; break;
} }