mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 19:52:48 +00:00
Continue merging in changes from resolve-shadow-warnings. funcs/ this time.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@136302 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -170,13 +170,13 @@ static struct ast_custom_function config_function = {
|
|||||||
|
|
||||||
static int unload_module(void)
|
static int unload_module(void)
|
||||||
{
|
{
|
||||||
struct config_item *cur;
|
struct config_item *current;
|
||||||
int res = ast_custom_function_unregister(&config_function);
|
int res = ast_custom_function_unregister(&config_function);
|
||||||
|
|
||||||
AST_RWLIST_WRLOCK(&configs);
|
AST_RWLIST_WRLOCK(&configs);
|
||||||
while ((cur = AST_RWLIST_REMOVE_HEAD(&configs, entry))) {
|
while ((current = AST_RWLIST_REMOVE_HEAD(&configs, entry))) {
|
||||||
ast_config_destroy(cur->cfg);
|
ast_config_destroy(current->cfg);
|
||||||
ast_free(cur);
|
ast_free(current);
|
||||||
}
|
}
|
||||||
AST_RWLIST_UNLOCK(&configs);
|
AST_RWLIST_UNLOCK(&configs);
|
||||||
|
|
||||||
|
@@ -626,25 +626,25 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
|
|||||||
|
|
||||||
if (((tmp = ast_variable_retrieve(cfg, catg, "writehandle"))) || ((tmp = ast_variable_retrieve(cfg, catg, "dsn")))) {
|
if (((tmp = ast_variable_retrieve(cfg, catg, "writehandle"))) || ((tmp = ast_variable_retrieve(cfg, catg, "dsn")))) {
|
||||||
char *tmp2 = ast_strdupa(tmp);
|
char *tmp2 = ast_strdupa(tmp);
|
||||||
AST_DECLARE_APP_ARGS(write,
|
AST_DECLARE_APP_ARGS(writeconf,
|
||||||
AST_APP_ARG(dsn)[5];
|
AST_APP_ARG(dsn)[5];
|
||||||
);
|
);
|
||||||
AST_STANDARD_APP_ARGS(write, tmp2);
|
AST_STANDARD_APP_ARGS(writeconf, tmp2);
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
if (!ast_strlen_zero(write.dsn[i]))
|
if (!ast_strlen_zero(writeconf.dsn[i]))
|
||||||
ast_copy_string((*query)->writehandle[i], write.dsn[i], sizeof((*query)->writehandle[i]));
|
ast_copy_string((*query)->writehandle[i], writeconf.dsn[i], sizeof((*query)->writehandle[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tmp = ast_variable_retrieve(cfg, catg, "readhandle"))) {
|
if ((tmp = ast_variable_retrieve(cfg, catg, "readhandle"))) {
|
||||||
char *tmp2 = ast_strdupa(tmp);
|
char *tmp2 = ast_strdupa(tmp);
|
||||||
AST_DECLARE_APP_ARGS(read,
|
AST_DECLARE_APP_ARGS(readconf,
|
||||||
AST_APP_ARG(dsn)[5];
|
AST_APP_ARG(dsn)[5];
|
||||||
);
|
);
|
||||||
AST_STANDARD_APP_ARGS(read, tmp2);
|
AST_STANDARD_APP_ARGS(readconf, tmp2);
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
if (!ast_strlen_zero(read.dsn[i]))
|
if (!ast_strlen_zero(readconf.dsn[i]))
|
||||||
ast_copy_string((*query)->readhandle[i], read.dsn[i], sizeof((*query)->readhandle[i]));
|
ast_copy_string((*query)->readhandle[i], readconf.dsn[i], sizeof((*query)->readhandle[i]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* If no separate readhandle, then use the writehandle for reading */
|
/* If no separate readhandle, then use the writehandle for reading */
|
||||||
|
@@ -609,14 +609,14 @@ static struct ast_custom_function quote_function = {
|
|||||||
|
|
||||||
|
|
||||||
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf,
|
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf,
|
||||||
size_t len)
|
size_t buflen)
|
||||||
{
|
{
|
||||||
int length = 0;
|
int length = 0;
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
length = strlen(data);
|
length = strlen(data);
|
||||||
|
|
||||||
snprintf(buf, len, "%d", length);
|
snprintf(buf, buflen, "%d", length);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -629,30 +629,30 @@ static struct ast_custom_function len_function = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int acf_strftime(struct ast_channel *chan, const char *cmd, char *parse,
|
static int acf_strftime(struct ast_channel *chan, const char *cmd, char *parse,
|
||||||
char *buf, size_t len)
|
char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
AST_DECLARE_APP_ARGS(args,
|
AST_DECLARE_APP_ARGS(args,
|
||||||
AST_APP_ARG(epoch);
|
AST_APP_ARG(epoch);
|
||||||
AST_APP_ARG(timezone);
|
AST_APP_ARG(timezone);
|
||||||
AST_APP_ARG(format);
|
AST_APP_ARG(format);
|
||||||
);
|
);
|
||||||
struct timeval tv;
|
struct timeval when;
|
||||||
struct ast_tm tm;
|
struct ast_tm tm;
|
||||||
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
|
||||||
AST_STANDARD_APP_ARGS(args, parse);
|
AST_STANDARD_APP_ARGS(args, parse);
|
||||||
|
|
||||||
ast_get_timeval(args.epoch, &tv, ast_tvnow(), NULL);
|
ast_get_timeval(args.epoch, &when, ast_tvnow(), NULL);
|
||||||
ast_localtime(&tv, &tm, args.timezone);
|
ast_localtime(&when, &tm, args.timezone);
|
||||||
|
|
||||||
if (!args.format)
|
if (!args.format)
|
||||||
args.format = "%c";
|
args.format = "%c";
|
||||||
|
|
||||||
if (ast_strftime(buf, len, args.format, &tm) <= 0)
|
if (ast_strftime(buf, buflen, args.format, &tm) <= 0)
|
||||||
ast_log(LOG_WARNING, "C function strftime() output nothing?!!\n");
|
ast_log(LOG_WARNING, "C function strftime() output nothing?!!\n");
|
||||||
|
|
||||||
buf[len - 1] = '\0';
|
buf[buflen - 1] = '\0';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -673,7 +673,7 @@ static struct ast_custom_function strftime_function = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int acf_strptime(struct ast_channel *chan, const char *cmd, char *data,
|
static int acf_strptime(struct ast_channel *chan, const char *cmd, char *data,
|
||||||
char *buf, size_t len)
|
char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
AST_DECLARE_APP_ARGS(args,
|
AST_DECLARE_APP_ARGS(args,
|
||||||
AST_APP_ARG(timestring);
|
AST_APP_ARG(timestring);
|
||||||
@@ -704,11 +704,11 @@ static int acf_strptime(struct ast_channel *chan, const char *cmd, char *data,
|
|||||||
if (!strptime(args.timestring, args.format, &t.time)) {
|
if (!strptime(args.timestring, args.format, &t.time)) {
|
||||||
ast_log(LOG_WARNING, "C function strptime() output nothing?!!\n");
|
ast_log(LOG_WARNING, "C function strptime() output nothing?!!\n");
|
||||||
} else {
|
} else {
|
||||||
struct timeval tv;
|
struct timeval when;
|
||||||
/* Since strptime(3) does not check DST, force ast_mktime() to calculate it. */
|
/* Since strptime(3) does not check DST, force ast_mktime() to calculate it. */
|
||||||
t.atm.tm_isdst = -1;
|
t.atm.tm_isdst = -1;
|
||||||
tv = ast_mktime(&t.atm, args.timezone);
|
when = ast_mktime(&t.atm, args.timezone);
|
||||||
snprintf(buf, len, "%d", (int) tv.tv_sec);
|
snprintf(buf, buflen, "%d", (int) when.tv_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -730,7 +730,7 @@ static struct ast_custom_function strptime_function = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int function_eval(struct ast_channel *chan, const char *cmd, char *data,
|
static int function_eval(struct ast_channel *chan, const char *cmd, char *data,
|
||||||
char *buf, size_t len)
|
char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
if (ast_strlen_zero(data)) {
|
if (ast_strlen_zero(data)) {
|
||||||
ast_log(LOG_WARNING, "EVAL requires an argument: EVAL(<string>)\n");
|
ast_log(LOG_WARNING, "EVAL requires an argument: EVAL(<string>)\n");
|
||||||
@@ -739,7 +739,7 @@ static int function_eval(struct ast_channel *chan, const char *cmd, char *data,
|
|||||||
|
|
||||||
if (chan)
|
if (chan)
|
||||||
ast_autoservice_start(chan);
|
ast_autoservice_start(chan);
|
||||||
pbx_substitute_variables_helper(chan, data, buf, len - 1);
|
pbx_substitute_variables_helper(chan, data, buf, buflen - 1);
|
||||||
if (chan)
|
if (chan)
|
||||||
ast_autoservice_stop(chan);
|
ast_autoservice_stop(chan);
|
||||||
|
|
||||||
@@ -762,11 +762,11 @@ static struct ast_custom_function eval_function = {
|
|||||||
.read = function_eval,
|
.read = function_eval,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int keypadhash(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
|
static int keypadhash(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
char *bufptr, *dataptr;
|
char *bufptr, *dataptr;
|
||||||
|
|
||||||
for (bufptr = buf, dataptr = data; bufptr < buf + len - 1; dataptr++) {
|
for (bufptr = buf, dataptr = data; bufptr < buf + buflen - 1; dataptr++) {
|
||||||
if (*dataptr == '1') {
|
if (*dataptr == '1') {
|
||||||
*bufptr++ = '1';
|
*bufptr++ = '1';
|
||||||
} else if (strchr("AaBbCc2", *dataptr)) {
|
} else if (strchr("AaBbCc2", *dataptr)) {
|
||||||
@@ -792,7 +792,7 @@ static int keypadhash(struct ast_channel *chan, const char *cmd, char *data, cha
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf[len - 1] = '\0';
|
buf[buflen - 1] = '\0';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -805,11 +805,11 @@ static struct ast_custom_function keypadhash_function = {
|
|||||||
.desc = "Example: ${KEYPADHASH(Les)} returns \"537\"\n",
|
.desc = "Example: ${KEYPADHASH(Les)} returns \"537\"\n",
|
||||||
};
|
};
|
||||||
|
|
||||||
static int string_toupper(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
|
static int string_toupper(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
char *bufptr = buf, *dataptr = data;
|
char *bufptr = buf, *dataptr = data;
|
||||||
|
|
||||||
while ((bufptr < buf + len - 1) && (*bufptr++ = toupper(*dataptr++)));
|
while ((bufptr < buf + buflen - 1) && (*bufptr++ = toupper(*dataptr++)));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -822,11 +822,11 @@ static struct ast_custom_function toupper_function = {
|
|||||||
.desc = "Example: ${TOUPPER(Example)} returns \"EXAMPLE\"\n",
|
.desc = "Example: ${TOUPPER(Example)} returns \"EXAMPLE\"\n",
|
||||||
};
|
};
|
||||||
|
|
||||||
static int string_tolower(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
|
static int string_tolower(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
char *bufptr = buf, *dataptr = data;
|
char *bufptr = buf, *dataptr = data;
|
||||||
|
|
||||||
while ((bufptr < buf + len - 1) && (*bufptr++ = tolower(*dataptr++)));
|
while ((bufptr < buf + buflen - 1) && (*bufptr++ = tolower(*dataptr++)));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -87,7 +87,7 @@ static int timeout_write(struct ast_channel *chan, const char *cmd, char *data,
|
|||||||
long sec;
|
long sec;
|
||||||
char timestr[64];
|
char timestr[64];
|
||||||
struct ast_tm myt;
|
struct ast_tm myt;
|
||||||
struct timeval tv;
|
struct timeval when;
|
||||||
|
|
||||||
if (!chan)
|
if (!chan)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -101,21 +101,21 @@ static int timeout_write(struct ast_channel *chan, const char *cmd, char *data,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((sscanf(value, "%ld%lf", &sec, &x) == 0) || sec < 0)
|
if ((sscanf(value, "%ld%lf", &sec, &x) == 0) || sec < 0)
|
||||||
tv.tv_sec = 0;
|
when.tv_sec = 0;
|
||||||
else {
|
else {
|
||||||
tv.tv_sec = sec;
|
when.tv_sec = sec;
|
||||||
tv.tv_usec = x * 1000000;
|
when.tv_usec = x * 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (*data) {
|
switch (*data) {
|
||||||
case 'a':
|
case 'a':
|
||||||
case 'A':
|
case 'A':
|
||||||
ast_channel_setwhentohangup_tv(chan, tv);
|
ast_channel_setwhentohangup_tv(chan, when);
|
||||||
if (VERBOSITY_ATLEAST(3)) {
|
if (VERBOSITY_ATLEAST(3)) {
|
||||||
if (!ast_tvzero(chan->whentohangup)) {
|
if (!ast_tvzero(chan->whentohangup)) {
|
||||||
tv = ast_tvadd(tv, ast_tvnow());
|
when = ast_tvadd(when, ast_tvnow());
|
||||||
ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S.%3q %Z",
|
ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S.%3q %Z",
|
||||||
ast_localtime(&tv, &myt, NULL));
|
ast_localtime(&when, &myt, NULL));
|
||||||
ast_verbose("Channel will hangup at %s.\n", timestr);
|
ast_verbose("Channel will hangup at %s.\n", timestr);
|
||||||
} else {
|
} else {
|
||||||
ast_verbose("Channel hangup cancelled.\n");
|
ast_verbose("Channel hangup cancelled.\n");
|
||||||
@@ -126,7 +126,7 @@ static int timeout_write(struct ast_channel *chan, const char *cmd, char *data,
|
|||||||
case 'r':
|
case 'r':
|
||||||
case 'R':
|
case 'R':
|
||||||
if (chan->pbx) {
|
if (chan->pbx) {
|
||||||
chan->pbx->rtimeoutms = tv.tv_sec * 1000 + tv.tv_usec / 1000.0;
|
chan->pbx->rtimeoutms = when.tv_sec * 1000 + when.tv_usec / 1000.0;
|
||||||
ast_verb(3, "Response timeout set to %.3f\n", chan->pbx->rtimeoutms / 1000.0);
|
ast_verb(3, "Response timeout set to %.3f\n", chan->pbx->rtimeoutms / 1000.0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -134,7 +134,7 @@ static int timeout_write(struct ast_channel *chan, const char *cmd, char *data,
|
|||||||
case 'd':
|
case 'd':
|
||||||
case 'D':
|
case 'D':
|
||||||
if (chan->pbx) {
|
if (chan->pbx) {
|
||||||
chan->pbx->dtimeoutms = tv.tv_sec * 1000 + tv.tv_usec / 1000.0;
|
chan->pbx->dtimeoutms = when.tv_sec * 1000 + when.tv_usec / 1000.0;
|
||||||
ast_verb(3, "Digit timeout set to %.3f\n", chan->pbx->dtimeoutms / 1000.0);
|
ast_verb(3, "Digit timeout set to %.3f\n", chan->pbx->dtimeoutms / 1000.0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user