formatting fixes (bug #4736)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6162 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Russell Bryant 20 years ago
parent 4817bc599d
commit 324f7d150f

111
pbx.c

@ -226,9 +226,7 @@ static struct pbx_builtin {
} builtins[] = } builtins[] =
{ {
/* These applications are built into the PBX core and do not /* These applications are built into the PBX core and do not
need separate modules need separate modules */
*/
{ "AbsoluteTimeout", pbx_builtin_atimeout, { "AbsoluteTimeout", pbx_builtin_atimeout,
"Set absolute maximum time of call", "Set absolute maximum time of call",
@ -750,11 +748,11 @@ struct ast_context *ast_context_find(const char *name)
return tmp; return tmp;
} }
#define STATUS_NO_CONTEXT 1 #define STATUS_NO_CONTEXT 1
#define STATUS_NO_EXTENSION 2 #define STATUS_NO_EXTENSION 2
#define STATUS_NO_PRIORITY 3 #define STATUS_NO_PRIORITY 3
#define STATUS_NO_LABEL 4 #define STATUS_NO_LABEL 4
#define STATUS_SUCCESS 5 #define STATUS_SUCCESS 5
static int matchcid(const char *cidpattern, const char *callerid) static int matchcid(const char *cidpattern, const char *callerid)
{ {
@ -763,7 +761,6 @@ static int matchcid(const char *cidpattern, const char *callerid)
/* If the Caller*ID pattern is empty, then we're matching NO Caller*ID, so /* If the Caller*ID pattern is empty, then we're matching NO Caller*ID, so
failing to get a number should count as a match, otherwise not */ failing to get a number should count as a match, otherwise not */
if (!ast_strlen_zero(cidpattern)) if (!ast_strlen_zero(cidpattern))
failresult = 0; failresult = 0;
else else
@ -939,15 +936,15 @@ void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, c
if (abs(offset) > strlen(*ret)) { /* Offset beyond string */ if (abs(offset) > strlen(*ret)) { /* Offset beyond string */
if (offset >= 0) if (offset >= 0)
offset=strlen(*ret); offset = strlen(*ret);
else else
offset=-strlen(*ret); offset =- strlen(*ret);
} }
if ((offset < 0 && offset2 > -offset) || (offset >= 0 && offset+offset2 > strlen(*ret))) { if ((offset < 0 && offset2 > -offset) || (offset >= 0 && offset+offset2 > strlen(*ret))) {
if (offset >= 0) if (offset >= 0)
offset2=strlen(*ret)-offset; offset2 = strlen(*ret)-offset;
else else
offset2=strlen(*ret)+offset; offset2 = strlen(*ret)+offset;
} }
if (offset >= 0) if (offset >= 0)
*ret += offset; *ret += offset;
@ -1113,7 +1110,7 @@ icky:
ast_log(LOG_WARNING,"Comparing variable '%s' with '%s'\n",var,ast_var_name(variables)); ast_log(LOG_WARNING,"Comparing variable '%s' with '%s'\n",var,ast_var_name(variables));
#endif #endif
if (strcasecmp(ast_var_name(variables),var)==0) { if (strcasecmp(ast_var_name(variables),var)==0) {
*ret=ast_var_value(variables); *ret = ast_var_value(variables);
if (*ret) { if (*ret) {
ast_copy_string(workspace, *ret, workspacelen); ast_copy_string(workspace, *ret, workspacelen);
*ret = workspace; *ret = workspace;
@ -1281,7 +1278,7 @@ int ast_custom_function_register(struct ast_custom_function *acf)
/* try to lock functions list ... */ /* try to lock functions list ... */
if (ast_mutex_lock(&acflock)) { if (ast_mutex_lock(&acflock)) {
ast_log(LOG_ERROR, "Unable to lock function list\n"); ast_log(LOG_ERROR, "Unable to lock function list. Failed registering function %s\n", acf->name);
return -1; return -1;
} }
@ -1309,31 +1306,31 @@ char *ast_func_read(struct ast_channel *chan, const char *in, char *workspace, s
struct ast_custom_function *acfptr; struct ast_custom_function *acfptr;
function = ast_strdupa(in); function = ast_strdupa(in);
if (function) { if (!function) {
if ((args = strchr(function, '('))) { ast_log(LOG_ERROR, "Out of memory\n");
*args = '\0'; return ret;
args++; }
if ((p = strrchr(args, ')'))) { if ((args = strchr(function, '('))) {
*p = '\0'; *args = '\0';
} else { args++;
ast_log(LOG_WARNING, "Can't find trailing parenthesis?\n"); if ((p = strrchr(args, ')'))) {
} *p = '\0';
} else { } else {
ast_log(LOG_WARNING, "Function doesn't contain parentheses. Assuming null argument.\n"); ast_log(LOG_WARNING, "Can't find trailing parenthesis?\n");
} }
} else {
ast_log(LOG_WARNING, "Function doesn't contain parentheses. Assuming null argument.\n");
}
if ((acfptr = ast_custom_function_find(function))) { if ((acfptr = ast_custom_function_find(function))) {
/* run the custom function */ /* run the custom function */
if (acfptr->read) { if (acfptr->read) {
return acfptr->read(chan, function, args, workspace, len); return acfptr->read(chan, function, args, workspace, len);
} else {
ast_log(LOG_ERROR, "Function %s cannot be read\n", function);
}
} else { } else {
ast_log(LOG_ERROR, "Function %s not registered\n", function); ast_log(LOG_ERROR, "Function %s cannot be read\n", function);
} }
} else { } else {
ast_log(LOG_ERROR, "Out of memory\n"); ast_log(LOG_ERROR, "Function %s not registered\n", function);
} }
return ret; return ret;
} }
@ -1344,31 +1341,31 @@ void ast_func_write(struct ast_channel *chan, const char *in, const char *value)
struct ast_custom_function *acfptr; struct ast_custom_function *acfptr;
function = ast_strdupa(in); function = ast_strdupa(in);
if (function) { if (!function) {
if ((args = strchr(function, '('))) { ast_log(LOG_ERROR, "Out of memory\n");
*args = '\0'; return;
args++; }
if ((p = strrchr(args, ')'))) { if ((args = strchr(function, '('))) {
*p = '\0'; *args = '\0';
} else { args++;
ast_log(LOG_WARNING, "Can't find trailing parenthesis?\n"); if ((p = strrchr(args, ')'))) {
} *p = '\0';
} else { } else {
ast_log(LOG_WARNING, "Function doesn't contain parentheses. Assuming null argument.\n"); ast_log(LOG_WARNING, "Can't find trailing parenthesis?\n");
} }
} else {
ast_log(LOG_WARNING, "Function doesn't contain parentheses. Assuming null argument.\n");
}
if ((acfptr = ast_custom_function_find(function))) { if ((acfptr = ast_custom_function_find(function))) {
/* run the custom function */ /* run the custom function */
if (acfptr->write) { if (acfptr->write) {
acfptr->write(chan, function, args, value); acfptr->write(chan, function, args, value);
} else {
ast_log(LOG_ERROR, "Function %s cannot be written to\n", function);
}
} else { } else {
ast_log(LOG_ERROR, "Function %s not registered\n", function); ast_log(LOG_ERROR, "Function %s is read-only, it cannot be written to\n", function);
} }
} else { } else {
ast_log(LOG_ERROR, "Out of memory\n"); ast_log(LOG_ERROR, "Function %s not registered\n", function);
} }
} }
@ -1443,7 +1440,7 @@ static void pbx_substitute_variables_helper_full(struct ast_channel *c, const ch
len = vare - vars - 1; len = vare - vars - 1;
/* Skip totally over variable name */ /* Skip totally over variable name */
whereweare += ( len + 3); whereweare += (len + 3);
/* Store variable name (and truncate) */ /* Store variable name (and truncate) */
memset(var, 0, sizeof(var)); memset(var, 0, sizeof(var));
@ -3113,7 +3110,7 @@ static int handle_show_applications(int fd, int argc, char *argv[])
/* Match all words on command line */ /* Match all words on command line */
int i; int i;
printapp = 1; printapp = 1;
for (i=3;i<argc;i++) { for (i=3; i<argc; i++) {
if (!strcasestr(a->description, argv[i])) { if (!strcasestr(a->description, argv[i])) {
printapp = 0; printapp = 0;
} else { } else {
@ -3668,10 +3665,10 @@ static void get_timerange(struct ast_timing *i, char *times)
/* Do the last one */ /* Do the last one */
i->minmask[x/30] |= (1 << (x % 30)); i->minmask[x/30] |= (1 << (x % 30));
#else #else
for (cth=0;cth<24;cth++) { for (cth=0; cth<24; cth++) {
/* Initialize masks to blank */ /* Initialize masks to blank */
i->minmask[cth] = 0; i->minmask[cth] = 0;
for (ctm=0;ctm<30;ctm++) { for (ctm=0; ctm<30; ctm++) {
if ( if (
/* First hour with more than one hour */ /* First hour with more than one hour */
(((cth == s1) && (ctm >= s2)) && (((cth == s1) && (ctm >= s2)) &&
@ -3789,7 +3786,7 @@ static unsigned int get_day(char *day)
} else } else
e = s; e = s;
mask = 0; mask = 0;
for (x=s;x!=e;x = (x + 1) % 31) { for (x=s; x!=e; x = (x + 1) % 31) {
mask |= (1 << x); mask |= (1 << x);
} }
mask |= (1 << x); mask |= (1 << x);

Loading…
Cancel
Save