fix various coding guidelines issues (issue #7345, with additional changes)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@34631 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant 2006-06-18 20:51:14 +00:00
parent c18da28251
commit 7ec13047bc

View file

@ -479,13 +479,10 @@ static int jingle_is_answered(struct jingle *client, ikspak *pak)
struct jingle_pvt *tmp; struct jingle_pvt *tmp;
ast_log(LOG_DEBUG, "The client is %s\n", client->name); ast_log(LOG_DEBUG, "The client is %s\n", client->name);
tmp = client->p;
/* Make sure our new call doesn't exist yet */ /* Make sure our new call doesn't exist yet */
while (tmp) { for (tmp = client->p; tmp; tmp = tmp->next) {
if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid)) { if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid))
break; break;
}
tmp = tmp->next;
} }
if (tmp) { if (tmp) {
@ -502,13 +499,10 @@ static int jingle_hangup_farend(struct jingle *client, ikspak *pak)
struct jingle_pvt *tmp; struct jingle_pvt *tmp;
ast_log(LOG_DEBUG, "The client is %s\n", client->name); ast_log(LOG_DEBUG, "The client is %s\n", client->name);
tmp = client->p;
/* Make sure our new call doesn't exist yet */ /* Make sure our new call doesn't exist yet */
while (tmp) { for (tmp = client->p; tmp; tmp = tmp->next) {
if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid)) { if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid))
break; break;
}
tmp = tmp->next;
} }
if (tmp) { if (tmp) {
@ -536,21 +530,18 @@ static int jingle_create_candidates(struct jingle *client, struct jingle_pvt *p,
iq = iks_new("iq"); iq = iks_new("iq");
jingle = iks_new(GOOGLE_NODE); jingle = iks_new(GOOGLE_NODE);
candidate = iks_new("candidate"); candidate = iks_new("candidate");
ours1 = (struct jingle_candidate *) ast_calloc(1, sizeof(struct jingle_candidate)); if (!iq || !jingle || !candidate) {
ours2 = (struct jingle_candidate *) ast_calloc(1, sizeof(struct jingle_candidate)); ast_log(LOG_ERROR, "Memory allocation error\n");
if (!iq || !jingle || !candidate || !ours1 || !ours2) {
ast_log(LOG_WARNING, "out of memory!\n");
goto safeout; goto safeout;
} }
ours1 = ast_calloc(1, sizeof(*ours1));
ours2 = ast_calloc(1, sizeof(*ours2));
iks_insert_node(iq, jingle); iks_insert_node(iq, jingle);
iks_insert_node(jingle, candidate); iks_insert_node(jingle, candidate);
while (p) { for (; p; p = p->next) {
if (!strcasecmp(p->sid, sid)) { if (!strcasecmp(p->sid, sid))
break; break;
}
p = p->next;
} }
if (!p) { if (!p) {
@ -596,8 +587,7 @@ static int jingle_create_candidates(struct jingle *client, struct jingle_pvt *p,
dest.sin_port = sin.sin_port; dest.sin_port = sin.sin_port;
tmp = p->ourcandidates; for (tmp = p->ourcandidates; tmp; tmp = tmp->next) {
while (tmp) { /*send standard candidates */
snprintf(port, sizeof(port), "%d", tmp->port); snprintf(port, sizeof(port), "%d", tmp->port);
snprintf(preference, sizeof(preference), "%.2f", tmp->preference); snprintf(preference, sizeof(preference), "%.2f", tmp->preference);
iks_insert_attrib(iq, "from", c->jid->full); iks_insert_attrib(iq, "from", c->jid->full);
@ -628,7 +618,6 @@ static int jingle_create_candidates(struct jingle *client, struct jingle_pvt *p,
iks_insert_attrib(candidate, "network", "0"); iks_insert_attrib(candidate, "network", "0");
iks_insert_attrib(candidate, "generation", "0"); iks_insert_attrib(candidate, "generation", "0");
iks_send(c->p, iq); iks_send(c->p, iq);
tmp = tmp->next;
} }
p->laststun = 0; p->laststun = 0;
@ -958,23 +947,18 @@ static int jingle_add_candidate(struct jingle *client, ikspak *pak)
struct aji_client *c = client->connection; struct aji_client *c = client->connection;
struct jingle_candidate *newcandidate = NULL; struct jingle_candidate *newcandidate = NULL;
iks *traversenodes = NULL, *receipt = NULL; iks *traversenodes = NULL, *receipt = NULL;
newcandidate = newcandidate = ast_calloc(1, sizeof(*newcandidate));
(struct jingle_candidate *) ast_calloc(1, sizeof(struct jingle_candidate));
if (!newcandidate) if (!newcandidate)
return 0; return 0;
memset(newcandidate, 0, sizeof(struct jingle_candidate)); for (tmp = client->p; tmp; tmp = tmp->next) {
tmp = client->p;
while (tmp) {
if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid)) { if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid)) {
p = tmp; p = tmp;
break; break;
} }
tmp = tmp->next;
} }
if (!p) { if (!p)
return -1; return -1;
}
traversenodes = pak->query; traversenodes = pak->query;
while(traversenodes) { while(traversenodes) {
@ -983,11 +967,9 @@ static int jingle_add_candidate(struct jingle *client, ikspak *pak)
continue; continue;
} }
if(!strcasecmp(iks_name(traversenodes), "candidate")) { if(!strcasecmp(iks_name(traversenodes), "candidate")) {
newcandidate = newcandidate = ast_calloc(1, sizeof(*newcandidate));
(struct jingle_candidate *) ast_calloc(1, sizeof(struct jingle_candidate));
if (!newcandidate) if (!newcandidate)
return 0; return 0;
memset(newcandidate, 0, sizeof(struct jingle_candidate));
ast_copy_string(newcandidate->name, iks_find_attrib(traversenodes, "name"), ast_copy_string(newcandidate->name, iks_find_attrib(traversenodes, "name"),
sizeof(newcandidate->name)); sizeof(newcandidate->name));
ast_copy_string(newcandidate->ip, iks_find_attrib(traversenodes, "address"), ast_copy_string(newcandidate->ip, iks_find_attrib(traversenodes, "address"),