port gcc 4.3.x warning fixes from trunk to this branch

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@153743 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2008-11-03 00:39:04 +00:00
parent e23be17786
commit fa635ea4b0
48 changed files with 2915 additions and 765 deletions

View File

@@ -592,6 +592,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
{
const char *tmp;
int i;
int res;
if (!cfg || !catg) {
return EINVAL;
@@ -681,9 +682,13 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
}
if ((tmp = ast_variable_retrieve(cfg, catg, "prefix")) && !ast_strlen_zero(tmp)) {
asprintf((char **)&((*query)->acf->name), "%s_%s", tmp, catg);
if (asprintf((char **)&((*query)->acf->name), "%s_%s", tmp, catg) < 0) {
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
}
} else {
asprintf((char **)&((*query)->acf->name), "ODBC_%s", catg);
if (asprintf((char **)&((*query)->acf->name), "ODBC_%s", catg) < 0) {
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
}
}
if (!((*query)->acf->name)) {
@@ -693,7 +698,10 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
return ENOMEM;
}
asprintf((char **)&((*query)->acf->syntax), "%s(<arg1>[...[,<argN>]])", (*query)->acf->name);
if (asprintf((char **)&((*query)->acf->syntax), "%s(<arg1>[...[,<argN>]])", (*query)->acf->name) < 0) {
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
(*query)->acf->syntax = NULL;
}
if (!((*query)->acf->syntax)) {
ast_free((char *)(*query)->acf->name);
@@ -704,29 +712,31 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
}
(*query)->acf->synopsis = "Runs the referenced query with the specified arguments";
res = 0;
if (!ast_strlen_zero((*query)->sql_read) && !ast_strlen_zero((*query)->sql_write)) {
asprintf((char **)&((*query)->acf->desc),
"Runs the following query, as defined in func_odbc.conf, performing\n"
"substitution of the arguments into the query as specified by ${ARG1},\n"
"${ARG2}, ... ${ARGn}. When setting the function, the values are provided\n"
"either in whole as ${VALUE} or parsed as ${VAL1}, ${VAL2}, ... ${VALn}.\n"
"\nRead:\n%s\n\nWrite:\n%s\n",
(*query)->sql_read,
(*query)->sql_write);
res = asprintf((char **)&((*query)->acf->desc),
"Runs the following query, as defined in func_odbc.conf, performing\n"
"substitution of the arguments into the query as specified by ${ARG1},\n"
"${ARG2}, ... ${ARGn}. When setting the function, the values are provided\n"
"either in whole as ${VALUE} or parsed as ${VAL1}, ${VAL2}, ... ${VALn}.\n"
"\nRead:\n%s\n\nWrite:\n%s\n",
(*query)->sql_read,
(*query)->sql_write);
} else if (!ast_strlen_zero((*query)->sql_read)) {
asprintf((char **)&((*query)->acf->desc),
"Runs the following query, as defined in func_odbc.conf, performing\n"
"substitution of the arguments into the query as specified by ${ARG1},\n"
"${ARG2}, ... ${ARGn}. This function may only be read, not set.\n\nSQL:\n%s\n",
(*query)->sql_read);
res = asprintf((char **)&((*query)->acf->desc),
"Runs the following query, as defined in func_odbc.conf, performing\n"
"substitution of the arguments into the query as specified by ${ARG1},\n"
"${ARG2}, ... ${ARGn}. This function may only be read, not set.\n\nSQL:\n%s\n",
(*query)->sql_read);
} else if (!ast_strlen_zero((*query)->sql_write)) {
asprintf((char **)&((*query)->acf->desc),
"Runs the following query, as defined in func_odbc.conf, performing\n"
"substitution of the arguments into the query as specified by ${ARG1},\n"
"${ARG2}, ... ${ARGn}. The values are provided either in whole as\n"
"${VALUE} or parsed as ${VAL1}, ${VAL2}, ... ${VALn}.\n"
"This function may only be set.\nSQL:\n%s\n",
(*query)->sql_write);
res = asprintf((char **)&((*query)->acf->desc),
"Runs the following query, as defined in func_odbc.conf, performing\n"
"substitution of the arguments into the query as specified by ${ARG1},\n"
"${ARG2}, ... ${ARGn}. The values are provided either in whole as\n"
"${VALUE} or parsed as ${VAL1}, ${VAL2}, ... ${VALn}.\n"
"This function may only be set.\nSQL:\n%s\n",
(*query)->sql_write);
} else {
ast_free((char *)(*query)->acf->syntax);
ast_free((char *)(*query)->acf->name);
@@ -736,7 +746,13 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
return EINVAL;
}
if (! ((*query)->acf->desc)) {
if (res < 0) {
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
(*query)->acf->desc = NULL;
}
if (!((*query)->acf->desc)) {
ast_free((char *)(*query)->acf->syntax);
ast_free((char *)(*query)->acf->name);
ast_free((*query)->acf);