diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-05-05 22:44:52 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-05-05 22:44:52 +0000 |
commit | 09c11738f2b456ec92a8aa499c704692899b8cd0 (patch) | |
tree | 2b7d632f7f42d434363d7dee71d987562eb56ed9 /res | |
parent | 8a4c82c4b72f96bb402a8ffb77b22bb9eb80c266 (diff) |
Merged revisions 317474 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r317474 | russell | 2011-05-05 17:36:33 -0500 (Thu, 05 May 2011) | 2 lines
Fix more "set but unused" warnings.
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@317475 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_config_odbc.c | 28 | ||||
-rw-r--r-- | res/res_config_sqlite.c | 4 | ||||
-rw-r--r-- | res/res_crypto.c | 6 | ||||
-rw-r--r-- | res/res_jabber.c | 28 |
4 files changed, 32 insertions, 34 deletions
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index b31241235..8154ecc2b 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -151,7 +151,7 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl char coltitle[256]; char rowdata[2048]; char *op; - const char *newparam, *newval; + const char *newparam; char *stringp; char *chunk; SQLSMALLINT collen; @@ -193,7 +193,7 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl ast_string_field_free_memory(&cps); return NULL; } - newval = va_arg(aq, const char *); + va_arg(aq, const char *); op = !strchr(newparam, ' ') ? " =" : ""; snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?%s", table, newparam, op, strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : ""); @@ -201,7 +201,7 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl op = !strchr(newparam, ' ') ? " =" : ""; snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " AND %s%s ?%s", newparam, op, strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : ""); - newval = va_arg(aq, const char *); + va_arg(aq, const char *); } va_end(aq); @@ -317,7 +317,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char * char rowdata[2048]; const char *initfield=NULL; char *op; - const char *newparam, *newval; + const char *newparam; char *stringp; char *chunk; SQLSMALLINT collen; @@ -358,7 +358,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char * initfield = ast_strdupa(newparam); if ((op = strchr(initfield, ' '))) *op = '\0'; - newval = va_arg(aq, const char *); + va_arg(aq, const char *); op = !strchr(newparam, ' ') ? " =" : ""; snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s ?%s", table, newparam, op, strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : ""); @@ -366,7 +366,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char * op = !strchr(newparam, ' ') ? " =" : ""; snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " AND %s%s ?%s", newparam, op, strcasestr(newparam, "LIKE") && !ast_odbc_backslash_is_escape(obj) ? " ESCAPE '\\'" : ""); - newval = va_arg(aq, const char *); + va_arg(aq, const char *); } if (initfield) snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ORDER BY %s", initfield); @@ -476,7 +476,7 @@ static int update_odbc(const char *database, const char *table, const char *keyf SQLHSTMT stmt; char sql[256]; SQLLEN rowcount=0; - const char *newparam, *newval; + const char *newparam; int res, count = 1; va_list aq; struct custom_prepare_struct cps = { .sql = sql, .extra = lookup }; @@ -509,7 +509,7 @@ static int update_odbc(const char *database, const char *table, const char *keyf ast_string_field_free_memory(&cps); return -1; } - newval = va_arg(aq, const char *); + va_arg(aq, const char *); if (tableptr && !(column = ast_odbc_find_column(tableptr, newparam))) { ast_log(LOG_WARNING, "Key field '%s' does not exist in table '%s@%s'. Update will fail\n", newparam, table, database); @@ -517,7 +517,7 @@ static int update_odbc(const char *database, const char *table, const char *keyf snprintf(sql, sizeof(sql), "UPDATE %s SET %s=?", table, newparam); while((newparam = va_arg(aq, const char *))) { - newval = va_arg(aq, const char *); + va_arg(aq, const char *); if ((tableptr && (column = ast_odbc_find_column(tableptr, newparam))) || count > 63) { snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), ", %s=?", newparam); } else { /* the column does not exist in the table */ @@ -716,7 +716,7 @@ static int store_odbc(const char *database, const char *table, va_list ap) char keys[256]; char vals[256]; SQLLEN rowcount=0; - const char *newparam, *newval; + const char *newparam; int res; va_list aq; struct custom_prepare_struct cps = { .sql = sql, .extra = NULL }; @@ -737,13 +737,13 @@ static int store_odbc(const char *database, const char *table, va_list ap) ast_odbc_release_obj(obj); return -1; } - newval = va_arg(aq, const char *); + va_arg(aq, const char *); snprintf(keys, sizeof(keys), "%s", newparam); ast_copy_string(vals, "?", sizeof(vals)); while ((newparam = va_arg(aq, const char *))) { snprintf(keys + strlen(keys), sizeof(keys) - strlen(keys), ", %s", newparam); snprintf(vals + strlen(vals), sizeof(vals) - strlen(vals), ", ?"); - newval = va_arg(aq, const char *); + va_arg(aq, const char *); } va_end(aq); snprintf(sql, sizeof(sql), "INSERT INTO %s (%s) VALUES (%s)", table, keys, vals); @@ -791,7 +791,7 @@ static int destroy_odbc(const char *database, const char *table, const char *key SQLHSTMT stmt; char sql[256]; SQLLEN rowcount=0; - const char *newparam, *newval; + const char *newparam; int res; va_list aq; struct custom_prepare_struct cps = { .sql = sql, .extra = lookup }; @@ -810,7 +810,7 @@ static int destroy_odbc(const char *database, const char *table, const char *key snprintf(sql, sizeof(sql), "DELETE FROM %s WHERE ", table); while((newparam = va_arg(aq, const char *))) { snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%s=? AND ", newparam); - newval = va_arg(aq, const char *); + va_arg(aq, const char *); } va_end(aq); snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%s=?", keyfield); diff --git a/res/res_config_sqlite.c b/res/res_config_sqlite.c index 744a07bac..75d353cd5 100644 --- a/res/res_config_sqlite.c +++ b/res/res_config_sqlite.c @@ -1618,7 +1618,7 @@ static int realtime_require_handler(const char *unused, const char *tablename, v struct sqlite_cache_tables *tbl = find_table(tablename); struct sqlite_cache_columns *col; char *elm; - int type, size, res = 0; + int type, res = 0; if (!tbl) { return -1; @@ -1626,7 +1626,7 @@ static int realtime_require_handler(const char *unused, const char *tablename, v while ((elm = va_arg(ap, char *))) { type = va_arg(ap, require_type); - size = va_arg(ap, int); + va_arg(ap, int); /* Check if the field matches the criteria */ AST_RWLIST_TRAVERSE(&tbl->columns, col, list) { if (strcmp(col->name, elm) == 0) { diff --git a/res/res_crypto.c b/res/res_crypto.c index 4886b4f1a..e25b8a4d6 100644 --- a/res/res_crypto.c +++ b/res/res_crypto.c @@ -99,7 +99,8 @@ static int pw_cb(char *buf, int size, int rwflag, void *userdata) { struct ast_key *key = (struct ast_key *)userdata; char prompt[256]; - int res, tmp; + int tmp; + int res; if (key->infd < 0) { /* Note that we were at least called */ @@ -118,6 +119,9 @@ static int pw_cb(char *buf, int size, int rwflag, void *userdata) tmp = ast_hide_password(key->infd); memset(buf, 0, size); res = read(key->infd, buf, size); + if (res == -1) { + ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno)); + } ast_restore_tty(key->infd, tmp); if (buf[strlen(buf) -1] == '\n') { buf[strlen(buf) - 1] = '\0'; diff --git a/res/res_jabber.c b/res/res_jabber.c index 951eb3edf..47fbcadce 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -2873,7 +2873,6 @@ static int aji_register_transport2(void *data, ikspak *pak) */ static void aji_pruneregister(struct aji_client *client) { - int res = 0; iks *removeiq = iks_new("iq"); iks *removequery = iks_new("query"); iks *removeitem = iks_new("item"); @@ -2890,10 +2889,10 @@ static void aji_pruneregister(struct aji_client *client) /* For an aji_buddy, both AUTOPRUNE and AUTOREGISTER will never * be called at the same time */ if (ast_test_flag(&iterator->flags, AJI_AUTOPRUNE)) { /* If autoprune is set on jabber.conf */ - res = ast_aji_send(client, iks_make_s10n(IKS_TYPE_UNSUBSCRIBE, iterator->name, + ast_aji_send(client, iks_make_s10n(IKS_TYPE_UNSUBSCRIBE, iterator->name, "GoodBye. Your status is no longer needed by Asterisk the Open Source PBX" " so I am no longer subscribing to your presence.\n")); - res = ast_aji_send(client, iks_make_s10n(IKS_TYPE_UNSUBSCRIBED, iterator->name, + ast_aji_send(client, iks_make_s10n(IKS_TYPE_UNSUBSCRIBED, iterator->name, "GoodBye. You are no longer in the Asterisk config file so I am removing" " your access to my presence.\n")); iks_insert_attrib(removeiq, "from", client->jid->full); @@ -2901,9 +2900,9 @@ static void aji_pruneregister(struct aji_client *client) iks_insert_attrib(removequery, "xmlns", "jabber:iq:roster"); iks_insert_attrib(removeitem, "jid", iterator->name); iks_insert_attrib(removeitem, "subscription", "remove"); - res = ast_aji_send(client, removeiq); + ast_aji_send(client, removeiq); } else if (ast_test_flag(&iterator->flags, AJI_AUTOREGISTER)) { - res = ast_aji_send(client, iks_make_s10n(IKS_TYPE_SUBSCRIBE, iterator->name, + ast_aji_send(client, iks_make_s10n(IKS_TYPE_SUBSCRIBE, iterator->name, "Greetings! I am the Asterisk Open Source PBX and I want to subscribe to your presence\n")); ast_clear_flag(&iterator->flags, AJI_AUTOREGISTER); } @@ -3287,7 +3286,6 @@ static int aji_handle_pubsub_event(void *data, ikspak *pak) */ static void aji_create_affiliations(struct aji_client *client, const char *node) { - int res = 0; iks *modify_affiliates = aji_pubsub_iq_create(client, "set"); iks *pubsub, *affiliations, *affiliate; pubsub = iks_insert(modify_affiliates, "pubsub"); @@ -3301,7 +3299,7 @@ static void aji_create_affiliations(struct aji_client *client, const char *node) iks_insert_attrib(affiliate, "affiliation", "owner"); ASTOBJ_UNLOCK(iterator); }); - res = ast_aji_send(client, modify_affiliates); + ast_aji_send(client, modify_affiliates); iks_delete(modify_affiliates); } @@ -3503,13 +3501,12 @@ static int aji_handle_pubsub_error(void *data, ikspak *pak) */ static void aji_request_pubsub_nodes(struct aji_client *client, const char *collection) { - int res = 0; iks *request = aji_build_node_request(client, collection); iks_filter_add_rule(client->f, aji_receive_node_list, client, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_SUBTYPE, IKS_TYPE_RESULT, IKS_RULE_ID, client->mid, IKS_RULE_DONE); - res = ast_aji_send(client, request); + ast_aji_send(client, request); iks_delete(request); } @@ -3646,13 +3643,12 @@ static char *aji_cli_purge_pubsub_nodes(struct ast_cli_entry *e, int cmd, struct static void aji_pubsub_purge_nodes(struct aji_client *client, const char* collection_name) { - int res = 0; iks *request = aji_build_node_request(client, collection_name); ast_aji_send(client, request); iks_filter_add_rule(client->f, aji_delete_node_list, client, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_SUBTYPE, IKS_TYPE_RESULT, IKS_RULE_ID, client->mid, IKS_RULE_DONE); - res = ast_aji_send(client, request); + ast_aji_send(client, request); iks_delete(request); } @@ -3772,15 +3768,14 @@ const char *leaf_name) static iks* aji_create_pubsub_node(struct aji_client *client, const char *node_type, const char *name, const char *collection_name) { - int res = 0; iks *node = aji_pubsub_iq_create(client, "set"); - iks *pubsub, *create, *configure; + iks *pubsub, *create; pubsub = iks_insert(node, "pubsub"); iks_insert_attrib(pubsub, "xmlns", "http://jabber.org/protocol/pubsub"); create = iks_insert(pubsub, "create"); iks_insert_attrib(create, "node", name); - configure = aji_build_node_config(pubsub, node_type, collection_name); - res = ast_aji_send(client, node); + aji_build_node_config(pubsub, node_type, collection_name); + ast_aji_send(client, node); aji_create_affiliations(client, name); iks_delete(node); return 0; @@ -3924,7 +3919,6 @@ static char *aji_cli_create_leafnode(struct ast_cli_entry *e, int cmd, struct as */ static void aji_set_presence(struct aji_client *client, char *to, char *from, int level, char *desc) { - int res = 0; iks *presence = iks_make_pres(level, desc); iks *cnode = iks_new("c"); iks *priority = iks_new("priority"); @@ -3945,7 +3939,7 @@ static void aji_set_presence(struct aji_client *client, char *to, char *from, in iks_insert_attrib(cnode, "ext", "voice-v1"); iks_insert_attrib(cnode, "xmlns", "http://jabber.org/protocol/caps"); iks_insert_node(presence, cnode); - res = ast_aji_send(client, presence); + ast_aji_send(client, presence); } else { ast_log(LOG_ERROR, "Out of memory.\n"); } |