[asterisk-commits] seanbright: branch seanbright/resolve-shadow-warnings r114305 - in /team/sean...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Apr 19 12:37:43 CDT 2008


Author: seanbright
Date: Sat Apr 19 12:37:43 2008
New Revision: 114305

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114305
Log:
More channels.

Modified:
    team/seanbright/resolve-shadow-warnings/channels/chan_sip.c
    team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c
    team/seanbright/resolve-shadow-warnings/channels/chan_unistim.c
    team/seanbright/resolve-shadow-warnings/channels/xpmr/xpmr.c
    team/seanbright/resolve-shadow-warnings/include/asterisk/strings.h

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_sip.c?view=diff&rev=114305&r1=114304&r2=114305
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_sip.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_sip.c Sat Apr 19 12:37:43 2008
@@ -2035,7 +2035,7 @@
 /* Realtime device support */
 static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *username, const char *fullcontact, int expirey, int deprecated_username);
 static struct sip_user *realtime_user(const char *username);
-static void update_peer(struct sip_peer *p, int expiry);
+static void update_peer(struct sip_peer *p, int expire);
 static struct ast_variable *get_insecure_variable_from_config(struct ast_config *config);
 static const char *get_name_from_variable(struct ast_variable *var, const char *newpeername);
 static struct sip_peer *realtime_peer(const char *peername, struct sockaddr_in *sin);
@@ -3753,26 +3753,26 @@
 }
 
 /*! \brief Update peer data in database (if used) */
-static void update_peer(struct sip_peer *p, int expiry)
+static void update_peer(struct sip_peer *p, int expire)
 {
 	int rtcachefriends = ast_test_flag(&p->flags[1], SIP_PAGE2_RTCACHEFRIENDS);
 	if (sip_cfg.peer_rtupdate &&
 	    (p->is_realtime || rtcachefriends)) {
-		realtime_update_peer(p->name, &p->addr, p->username, rtcachefriends ? p->fullcontact : NULL, expiry, p->deprecated_username);
-	}
-}
-
-static struct ast_variable *get_insecure_variable_from_config(struct ast_config *config)
+		realtime_update_peer(p->name, &p->addr, p->username, rtcachefriends ? p->fullcontact : NULL, expire, p->deprecated_username);
+	}
+}
+
+static struct ast_variable *get_insecure_variable_from_config(struct ast_config *cfg)
 {
 	struct ast_variable *var = NULL;
 	struct ast_flags flags = {0};
 	char *cat = NULL;
 	const char *insecure;
-	while ((cat = ast_category_browse(config, cat))) {
-		insecure = ast_variable_retrieve(config, cat, "insecure");
+	while ((cat = ast_category_browse(cfg, cat))) {
+		insecure = ast_variable_retrieve(cfg, cat, "insecure");
 		set_insecure_flags(&flags, insecure, -1);
 		if (ast_test_flag(&flags, SIP_INSECURE_PORT)) {
-			var = ast_category_root(config, cat);
+			var = ast_category_root(cfg, cat);
 			break;
 		}
 	}
@@ -6099,9 +6099,9 @@
  * code to determine whether this is the pvt that we are looking for.
  * Return FALSE if not found, true otherwise. p is unlocked.
  */
-static int find_call_cb(void *__p, void *__arg, int flags)
-{
-	struct sip_pvt *p = __p;
+static int find_call_cb(void *__pvt, void *__arg, int flags)
+{
+	struct sip_pvt *p = __pvt;
 	struct find_call_cb_arg *arg = __arg;
 	/* In pedantic, we do not want packets with bad syntax to be connected to a PVT */
 	int found = FALSE;
@@ -8280,7 +8280,7 @@
 	char subject[256];				/* Subject of the session */
 	char owner[256];				/* Session owner/creator */
 	char connection[256];				/* Connection data */
-	char *stime = "t=0 0\r\n"; 			/* Time the session is active */
+	char *session_time = "t=0 0\r\n"; 			/* Time the session is active */
 	char bandwidth[256] = "";			/* Max bitrate */
 	char *hold;
 	struct ast_str *m_audio = ast_str_alloca(256);  /* Media declaration line for audio */
@@ -8509,7 +8509,7 @@
  		ast_str_append(&m_text, 0, "\r\n");
 
  	len = strlen(version) + strlen(subject) + strlen(owner) +
-		strlen(connection) + strlen(stime);
+		strlen(connection) + strlen(session_time);
 	if (needaudio)
 		len += m_audio->used + a_audio->used + strlen(hold);
  	if (needvideo) /* only if video response is appropriate */
@@ -8525,7 +8525,7 @@
 	add_line(resp, connection);
 	if (needvideo)	 	/* only if video response is appropriate */
 		add_line(resp, bandwidth);
-	add_line(resp, stime);
+	add_line(resp, session_time);
 	if (needaudio) {
 		add_line(resp, m_audio->str);
 		add_line(resp, a_audio->str);
@@ -8576,11 +8576,11 @@
 {
 	long offset;
 	int x;
-	struct ast_str *dup = dst->data;
+	struct ast_str *duplicate = dst->data;
 
 	/* First copy stuff */
 	memcpy(dst, src, sizeof(*dst));
-	dst->data = dup;
+	dst->data = duplicate;
 
 	/* All these + 1's are to account for the need to include the NULL terminator
 	 * Using typical string functions like ast_copy_string or ast_str_set will not
@@ -9939,7 +9939,7 @@
 {
 	char data[256];
 	struct in_addr in;
-	int expiry;
+	int expire;
 	int port;
 	char *scan, *addr, *port_str, *expiry_str, *username, *contact;
 
@@ -9964,7 +9964,7 @@
 		return;
 
 	if (expiry_str)
-		expiry = atoi(expiry_str);
+		expire = atoi(expiry_str);
 	else
 		return;
 
@@ -9974,7 +9974,7 @@
 		ast_copy_string(peer->fullcontact, contact, sizeof(peer->fullcontact));
 
 	ast_debug(2, "SIP Seeding peer from astdb: '%s' at %s@%s:%d for %d\n",
-	    peer->name, peer->username, ast_inet_ntoa(in), port, expiry);
+	    peer->name, peer->username, ast_inet_ntoa(in), port, expire);
 
 	memset(&peer->addr, 0, sizeof(peer->addr));
 	peer->addr.sin_family = AF_INET;
@@ -9985,7 +9985,7 @@
 		AST_SCHED_REPLACE(peer->pokeexpire, sched, ast_random() % 5000 + 1, sip_poke_peer_s, peer);
 	} else
 		sip_poke_peer(peer);
-	AST_SCHED_REPLACE(peer->expire, sched, (expiry + 10) * 1000, expire_register, peer);
+	AST_SCHED_REPLACE(peer->expire, sched, (expire + 10) * 1000, expire_register, peer);
 	register_peer_exten(peer, TRUE);
 }
 
@@ -10073,7 +10073,7 @@
 	char contact[SIPBUFSIZE]; 
 	char data[SIPBUFSIZE];
 	const char *expires = get_header(req, "Expires");
-	int expiry = atoi(expires);
+	int expire = atoi(expires);
 	char *curi, *host, *pt, *curi2;
 	int port;
 	const char *useragent;
@@ -10087,11 +10087,11 @@
 		char *s = strcasestr(contact, ";expires=");
 		if (s) {
 			expires = strsep(&s, ";"); /* trim ; and beyond */
-			if (sscanf(expires + 9, "%d", &expiry) != 1)
-				expiry = default_expiry;
+			if (sscanf(expires + 9, "%d", &expire) != 1)
+				expire = default_expiry;
 		} else {
 			/* Nothing has been specified */
-			expiry = default_expiry;
+			expire = default_expiry;
 		}
 	}
 
@@ -10113,7 +10113,7 @@
 		if (peer->expire > -1 && !ast_strlen_zero(peer->fullcontact))
 			pvt->expiry = ast_sched_when(sched, peer->expire);
 		return PARSE_REGISTER_QUERY;
-	} else if (!strcasecmp(curi, "*") || !expiry) {	/* Unregister this peer */
+	} else if (!strcasecmp(curi, "*") || !expire) {	/* Unregister this peer */
 		/* This means remove all registrations and return OK */
 		memset(&peer->addr, 0, sizeof(peer->addr));
 		AST_SCHED_DEL(sched, peer->expire);
@@ -10174,14 +10174,14 @@
 		ast_copy_string(peer->username, curi, sizeof(peer->username));
 
 	AST_SCHED_DEL(sched, peer->expire);
-	if (expiry > max_expiry)
-		expiry = max_expiry;
-	if (expiry < min_expiry)
-		expiry = min_expiry;
+	if (expire > max_expiry)
+		expire = max_expiry;
+	if (expire < min_expiry)
+		expire = min_expiry;
 	peer->expire = peer->is_realtime ? -1 :
-		ast_sched_add(sched, (expiry + 10) * 1000, expire_register, peer);
-	pvt->expiry = expiry;
-	snprintf(data, sizeof(data), "%s:%d:%d:%s:%s", ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expiry, peer->username, peer->fullcontact);
+		ast_sched_add(sched, (expire + 10) * 1000, expire_register, peer);
+	pvt->expiry = expire;
+	snprintf(data, sizeof(data), "%s:%d:%d:%s:%s", ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expire, peer->username, peer->fullcontact);
 	/* Saving TCP connections is useless, we won't be able to reconnect */
 	if (!peer->rt_fromcontact && (peer->socket.type & SIP_TRANSPORT_UDP)) 
 		ast_db_put("SIP/Registry", peer->name, data);
@@ -10190,7 +10190,7 @@
 	/* Is this a new IP address for us? */
 	if (inaddrcmp(&peer->addr, &oldsin)) {
 		sip_poke_peer(peer);
-		ast_verb(3, "Registered SIP '%s' at %s port %d expires %d\n", peer->name, ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expiry);
+		ast_verb(3, "Registered SIP '%s' at %s port %d expires %d\n", peer->name, ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expire);
 		register_peer_exten(peer, TRUE);
 	}
 	
@@ -13426,7 +13426,7 @@
 		ast_cli(fd, "\n");
 		peer = unref_peer(peer, "sip_show_peer: unref_peer: done with peer ptr");
 	} else  if (peer && type == 1) { /* manager listing */
-		char buf[256];
+		char buffer[256];
 		struct ast_str *mailbox_str = ast_str_alloca(512);
 		astman_append(s, "Channeltype: SIP\r\n");
 		astman_append(s, "ObjectName: %s\r\n", peer->name);
@@ -13444,9 +13444,9 @@
 		if (!ast_strlen_zero(peer->fromdomain))
 			astman_append(s, "SIP-FromDomain: %s\r\n", peer->fromdomain);
 		astman_append(s, "Callgroup: ");
-		astman_append(s, "%s\r\n", ast_print_group(buf, sizeof(buf), peer->callgroup));
+		astman_append(s, "%s\r\n", ast_print_group(buffer, sizeof(buffer), peer->callgroup));
 		astman_append(s, "Pickupgroup: ");
-		astman_append(s, "%s\r\n", ast_print_group(buf, sizeof(buf), peer->pickupgroup));
+		astman_append(s, "%s\r\n", ast_print_group(buffer, sizeof(buffer), peer->pickupgroup));
 		peer_mailboxes_to_str(&mailbox_str, peer);
 		astman_append(s, "VoiceMailbox: %s\r\n", mailbox_str->str);
 		astman_append(s, "TransferMode: %s\r\n", transfermode2str(peer->allowtransfer));
@@ -15166,12 +15166,11 @@
 				ast_copy_string(buf, v->value, sizeof(buf));
 	} else  if (!strncasecmp(colname, "codec[", 6)) {
 		char *codecnum;
-		int index = 0, codec = 0;
+		int codec = 0;
 		
 		codecnum = colname + 6;	/* move past the '[' */
 		codecnum = strsep(&codecnum, "]"); /* trim trailing ']' if any */
-		index = atoi(codecnum);
-		if((codec = ast_codec_pref_index(&peer->prefs, index))) {
+		if((codec = ast_codec_pref_index(&peer->prefs, atoi(codecnum)))) {
 			ast_copy_string(buf, ast_getformatname(codec), len);
 		}
 	}
@@ -17501,11 +17500,11 @@
 			p->invitestate = INV_PROCEEDING;
 			ast_setstate(c, AST_STATE_RING);
 			if (strcmp(p->exten, ast_pickup_ext())) {	/* Call to extension -start pbx on this call */
-				enum ast_pbx_result res;
-
-				res = ast_pbx_start(c);
-
-				switch(res) {
+				enum ast_pbx_result result;
+
+				result = ast_pbx_start(c);
+
+				switch(result) {
 				case AST_PBX_FAILED:
 					ast_log(LOG_WARNING, "Failed to start PBX :(\n");
 					p->invitestate = INV_COMPLETED;
@@ -17527,7 +17526,7 @@
 					break;
 				}
 
-				if (res) {
+				if (result) {
 
 					/* Unlock locks so ast_hangup can do its magic */
 					ast_channel_unlock(c);
@@ -18376,7 +18375,7 @@
 	int firststate = AST_EXTENSION_REMOVED;
 	struct sip_peer *authpeer = NULL;
 	const char *eventheader = get_header(req, "Event");	/* Get Event package name */
-	const char *accept = get_header(req, "Accept");
+	const char *acceptheader = get_header(req, "Accept");
 	int resubscribe = (p->subscribed != NONE);
 	char *temp, *event;
 	struct ao2_iterator i;
@@ -18507,16 +18506,16 @@
 		*/
 		if (strstr(p->useragent, "Polycom")) {
 			p->subscribed = XPIDF_XML;
-		} else if (strstr(accept, "application/pidf+xml")) {
+		} else if (strstr(acceptheader, "application/pidf+xml")) {
 			p->subscribed = PIDF_XML;         /* RFC 3863 format */
-		} else if (strstr(accept, "application/dialog-info+xml")) {
+		} else if (strstr(acceptheader, "application/dialog-info+xml")) {
 			p->subscribed = DIALOG_INFO_XML;
 			/* IETF draft: draft-ietf-sipping-dialog-package-05.txt */
-		} else if (strstr(accept, "application/cpim-pidf+xml")) {
+		} else if (strstr(acceptheader, "application/cpim-pidf+xml")) {
 			p->subscribed = CPIM_PIDF_XML;    /* RFC 3863 format */
-		} else if (strstr(accept, "application/xpidf+xml")) {
+		} else if (strstr(acceptheader, "application/xpidf+xml")) {
 			p->subscribed = XPIDF_XML;        /* Early pre-RFC 3863 format with MSN additions (Microsoft Messenger) */
-		} else if (ast_strlen_zero(accept)) {
+		} else if (ast_strlen_zero(acceptheader)) {
 			if (p->subscribed == NONE) { /* if the subscribed field is not already set, and there is no accept header... */
 				transmit_response(p, "489 Bad Event", req);
   
@@ -18530,19 +18529,19 @@
 		} else {
 			/* Can't find a format for events that we know about */
 			char mybuf[200];
-			snprintf(mybuf, sizeof(mybuf), "489 Bad Event (format %s)", accept);
+			snprintf(mybuf, sizeof(mybuf), "489 Bad Event (format %s)", acceptheader);
 			transmit_response(p, mybuf, req);
  
 			ast_log(LOG_WARNING, "SUBSCRIBE failure: unrecognized format: '%s' pvt: subscribed: %d, stateid: %d, laststate: %d, dialogver: %d, subscribecont: '%s', subscribeuri: '%s'\n",
-				accept, (int)p->subscribed, p->stateid, p->laststate, p->dialogver, p->subscribecontext, p->subscribeuri);
+				acceptheader, (int)p->subscribed, p->stateid, p->laststate, p->dialogver, p->subscribecontext, p->subscribeuri);
 			p->needdestroy = 1;
 			return 0;
 		}
 	} else if (!strcmp(event, "message-summary")) { 
-		if (!ast_strlen_zero(accept) && strcmp(accept, "application/simple-message-summary")) {
+		if (!ast_strlen_zero(acceptheader) && strcmp(acceptheader, "application/simple-message-summary")) {
 			/* Format requested that we do not support */
 			transmit_response(p, "406 Not Acceptable", req);
-			ast_debug(2, "Received SIP mailbox subscription for unknown format: %s\n", accept);
+			ast_debug(2, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader);
 			p->needdestroy = 1;
 			if (authpeer)
 				unref_peer(authpeer, "unref_peer, from handle_request_subscribe (authpeer 3)");
@@ -21477,17 +21476,17 @@
 			auto_sip_domains = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "domain")) {
 			char *domain = ast_strdupa(v->value);
-			char *context = strchr(domain, ',');
-
-			if (context)
-				*context++ = '\0';
-
-			if (ast_strlen_zero(context))
+			char *cntx = strchr(domain, ',');
+
+			if (cntx)
+				*cntx++ = '\0';
+
+			if (ast_strlen_zero(cntx))
 				ast_debug(1, "No context specified at line %d for domain '%s'\n", v->lineno, domain);
 			if (ast_strlen_zero(domain))
 				ast_log(LOG_WARNING, "Empty domain specified at line %d\n", v->lineno);
 			else
-				add_sip_domain(ast_strip(domain), SIP_DOMAIN_CONFIG, context ? ast_strip(context) : "");
+				add_sip_domain(ast_strip(domain), SIP_DOMAIN_CONFIG, cntx ? ast_strip(cntx) : "");
 		} else if (!strcasecmp(v->name, "register")) {
 			if (sip_register(v->value, v->lineno) == 0)
 				registry_count++;

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c?view=diff&rev=114305&r1=114304&r2=114305
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c Sat Apr 19 12:37:43 2008
@@ -91,12 +91,14 @@
 #define DEFAULT_SKINNY_BACKLOG	2
 #define SKINNY_MAX_PACKET	1000
 
-static unsigned int tos = 0;
-static unsigned int tos_audio = 0;
-static unsigned int tos_video = 0;
-static unsigned int cos = 0;
-static unsigned int cos_audio = 0;
-static unsigned int cos_video = 0;
+static struct {
+	unsigned int tos;
+	unsigned int tos_audio;
+	unsigned int tos_video;
+	unsigned int cos;
+	unsigned int cos_audio;
+	unsigned int cos_video;
+} qos = { 0, 0, 0, 0, 0, 0 };
 
 static int keep_alive = 120;
 static char vmexten[AST_MAX_EXTENSION];		/* Voicemail pilot number */
@@ -961,7 +963,7 @@
 struct hostent *hp;
 static int skinnysock = -1;
 static pthread_t accept_t;
-static char context[AST_MAX_CONTEXT] = "default";
+static char global_context[AST_MAX_CONTEXT] = "default";
 static char language[MAX_LANGUAGE] = "";
 static char mohinterpret[MAX_MUSICCLASS] = "default";
 static char mohsuggest[MAX_MUSICCLASS] = "";
@@ -2963,7 +2965,7 @@
 			} else if (!strcasecmp(v->name, "vmexten")) {
 				ast_copy_string(device_vmexten, v->value, sizeof(device_vmexten));
 			} else if (!strcasecmp(v->name, "context")) {
-				ast_copy_string(context, v->value, sizeof(context));
+				ast_copy_string(global_context, v->value, sizeof(global_context));
 			} else if (!strcasecmp(v->name, "regexten")) {
 				ast_copy_string(regexten, v->value, sizeof(regexten));
 			} else if (!strcasecmp(v->name, "allow")) {
@@ -3073,7 +3075,7 @@
 					ast_copy_string(l->name, v->value, sizeof(l->name));
 
 					/* XXX Should we check for uniqueness?? XXX */
-					ast_copy_string(l->context, context, sizeof(l->context));
+					ast_copy_string(l->context, global_context, sizeof(l->context));
 					ast_copy_string(l->cid_num, cid_num, sizeof(l->cid_num));
 					ast_copy_string(l->cid_name, cid_name, sizeof(l->cid_name));
 					ast_copy_string(l->label, linelabel, sizeof(l->label));
@@ -3165,11 +3167,11 @@
 		ast_channel_set_fd(sub->owner, 3, ast_rtcp_fd(sub->vrtp));
 	}
 	if (sub->rtp) {
-		ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "Skinny RTP");
+		ast_rtp_setqos(sub->rtp, qos.tos_audio, qos.cos_audio, "Skinny RTP");
 		ast_rtp_setnat(sub->rtp, l->nat);
 	}
 	if (sub->vrtp) {
-		ast_rtp_setqos(sub->vrtp, tos_video, cos_video, "Skinny VRTP");
+		ast_rtp_setqos(sub->vrtp, qos.tos_video, qos.cos_video, "Skinny VRTP");
 		ast_rtp_setnat(sub->vrtp, l->nat);
 	}
 	/* Set Frame packetization */
@@ -4632,13 +4634,13 @@
 
 static int handle_time_date_req_message(struct skinny_req *req, struct skinnysession *s)
 {
-	struct timeval tv = ast_tvnow();
+	struct timeval now = ast_tvnow();
 	struct ast_tm cmtime;
 
 	if (!(req = req_alloc(sizeof(struct definetimedate_message), DEFINETIMEDATE_MESSAGE)))
 		return -1;
 
-	ast_localtime(&tv, &cmtime, NULL);
+	ast_localtime(&now, &cmtime, NULL);
 	req->data.definetimedate.year = htolel(cmtime.tm_year+1900);
 	req->data.definetimedate.month = htolel(cmtime.tm_mon+1);
 	req->data.definetimedate.dayofweek = htolel(cmtime.tm_wday);
@@ -4647,7 +4649,7 @@
 	req->data.definetimedate.minute = htolel(cmtime.tm_min);
 	req->data.definetimedate.seconds = htolel(cmtime.tm_sec);
 	req->data.definetimedate.milliseconds = htolel(cmtime.tm_usec / 1000);
-	req->data.definetimedate.timestamp = htolel(tv.tv_sec);
+	req->data.definetimedate.timestamp = htolel(now.tv_sec);
 	transmit_response(s, req);
 	return 1;
 }
@@ -5875,22 +5877,22 @@
 		} else if (!strcasecmp(v->name, "dateformat")) {
 			memcpy(date_format, v->value, sizeof(date_format));
                 } else if (!strcasecmp(v->name, "tos")) {
-                        if (ast_str2tos(v->value, &tos))
+                        if (ast_str2tos(v->value, &qos.tos))
                     		ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
                 } else if (!strcasecmp(v->name, "tos_audio")) {
-                        if (ast_str2tos(v->value, &tos_audio))
+                        if (ast_str2tos(v->value, &qos.tos_audio))
                     		ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
                 } else if (!strcasecmp(v->name, "tos_video")) {
-                        if (ast_str2tos(v->value, &tos_video))
+                        if (ast_str2tos(v->value, &qos.tos_video))
                     		ast_log(LOG_WARNING, "Invalid tos_video value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos")) {
-		        if (ast_str2cos(v->value, &cos))
+		        if (ast_str2cos(v->value, &qos.cos))
 		                ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos_audio")) {
-		        if (ast_str2cos(v->value, &cos_audio))
+		        if (ast_str2cos(v->value, &qos.cos_audio))
 		                ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos_video")) {
-		        if (ast_str2cos(v->value, &cos_video))
+		        if (ast_str2cos(v->value, &qos.cos_video))
 		                ast_log(LOG_WARNING, "Invalid cos_video value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "allow")) {
 			ast_parse_allow_disallow(&default_prefs, &default_capability, v->value, 1);
@@ -5980,7 +5982,7 @@
 			}
 			ast_verb(2, "Skinny listening on %s:%d\n",
 					ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
-			ast_netsock_set_qos(skinnysock, tos, cos, "Skinny");
+			ast_netsock_set_qos(skinnysock, qos.tos, qos.cos, "Skinny");
 			ast_pthread_create_background(&accept_t,NULL, accept_thread, NULL);
 		}
 	}

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_unistim.c?view=diff&rev=114305&r1=114304&r2=114305
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_unistim.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_unistim.c Sat Apr 19 12:37:43 2008
@@ -180,7 +180,7 @@
 
 #define FAV_MAX_LENGTH		  0x0A
 
-static void dummy(char *dummy, ...)
+static void dummy(char *unused, ...)
 {
 	return;
 }
@@ -206,17 +206,21 @@
 static enum autoprovision autoprovisioning = AUTOPROVISIONING_NO;
 static int unistim_keepalive;
 static int unistimsock = -1;
-static unsigned int tos = 0;
-static unsigned int tos_audio = 0;
-static unsigned int cos = 0;
-static unsigned int cos_audio = 0;
+
+static struct {
+	unsigned int tos;
+	unsigned int tos_audio;
+	unsigned int cos;
+	unsigned int cos_audio;
+} qos = { 0, 0, 0, 0 };
+
 static struct io_context *io;
 static struct sched_context *sched;
 static struct sockaddr_in public_ip = { 0, };
 /*! give the IP address for the last packet received */
-static struct sockaddr_in addr_from;
+static struct sockaddr_in address_from;
 /*! size of the sockaddr_in (in WSARecvFrom) */
-static unsigned int size_addr_from = sizeof(addr_from);
+static unsigned int size_addr_from = sizeof(address_from);
 /*! Receive buffer address */
 static unsigned char *buff;
 static int unistim_reloading = 0;
@@ -661,7 +665,7 @@
 #define BUFFSEND unsigned char buffsend[64] = { 0x00, 0x00, 0xaa, 0xbb, 0x02, 0x01 }
 
 const static char tdesc[] = "UNISTIM Channel Driver";
-const static char type[] = "USTM";
+const static char channel_type[] = "USTM";
 
 /*! Protos */
 static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state);
@@ -690,7 +694,7 @@
 static void change_callerid(struct unistimsession *pte, int type, char *callerid);
 
 static const struct ast_channel_tech unistim_tech = {
-	.type = type,
+	.type = channel_type,
 	.description = tdesc,
 	.capabilities = CAPABILITY,
 	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
@@ -721,9 +725,9 @@
 
 static unsigned int get_tick_count(void)
 {
-	struct timeval tv = ast_tvnow();
-
-	return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
+	struct timeval now = ast_tvnow();
+
+	return (now.tv_sec * 1000) + (now.tv_usec / 1000);
 }
 
 /* Send data to a phone without retransmit nor buffering */
@@ -1354,13 +1358,13 @@
 static void send_date_time(struct unistimsession *pte)
 {
 	BUFFSEND;
-	struct timeval tv = ast_tvnow();
+	struct timeval now = ast_tvnow();
 	struct ast_tm atm = { 0, };
 
 	if (unistimdebug)
 		ast_verb(0, "Sending Time & Date\n");
 	memcpy(buffsend + SIZE_HEADER, packet_send_date_time, sizeof(packet_send_date_time));
-	ast_localtime(&tv, &atm, NULL);
+	ast_localtime(&now, &atm, NULL);
 	buffsend[10] = (unsigned char) atm.tm_mon + 1;
 	buffsend[11] = (unsigned char) atm.tm_mday;
 	buffsend[12] = (unsigned char) atm.tm_hour;
@@ -1371,13 +1375,13 @@
 static void send_date_time2(struct unistimsession *pte)
 {
 	BUFFSEND;
-	struct timeval tv = ast_tvnow();
+	struct timeval now = ast_tvnow();
 	struct ast_tm atm = { 0, };
 
 	if (unistimdebug)
 		ast_verb(0, "Sending Time & Date #2\n");
 	memcpy(buffsend + SIZE_HEADER, packet_send_date_time2, sizeof(packet_send_date_time2));
-	ast_localtime(&tv, &atm, NULL);
+	ast_localtime(&now, &atm, NULL);
 	if (pte->device)
 		buffsend[9] = pte->device->datetimeformat;
 	else
@@ -1392,13 +1396,13 @@
 static void send_date_time3(struct unistimsession *pte)
 {
 	BUFFSEND;
-	struct timeval tv = ast_tvnow();
+	struct timeval now = ast_tvnow();
 	struct ast_tm atm = { 0, };
 
 	if (unistimdebug)
 		ast_verb(0, "Sending Time & Date #3\n");
 	memcpy(buffsend + SIZE_HEADER, packet_send_date_time3, sizeof(packet_send_date_time3));
-	ast_localtime(&tv, &atm, NULL);
+	ast_localtime(&now, &atm, NULL);
 	buffsend[10] = (unsigned char) atm.tm_mon + 1;
 	buffsend[11] = (unsigned char) atm.tm_mday;
 	buffsend[12] = (unsigned char) atm.tm_hour;
@@ -1690,7 +1694,7 @@
 	char count = 0, *histbuf;
 	int size;
 	FILE *f, *f2;
-	struct timeval tv = ast_tvnow();
+	struct timeval now = ast_tvnow();
 	struct ast_tm atm = { 0, };
 
 	if (!pte->device)
@@ -1711,7 +1715,7 @@
 		}
 	}
 
-	ast_localtime(&tv, &atm, NULL);
+	ast_localtime(&now, &atm, NULL);
 	if (ismissed) {
 		if (way == 'i')
 			strcpy(tmp2, "Miss");
@@ -2062,7 +2066,7 @@
 		sub->owner->fds[1] = ast_rtcp_fd(sub->rtp);
 	}
 	if (sub->rtp) {
-		ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "UNISTIM RTP");
+		ast_rtp_setqos(sub->rtp, qos.tos_audio, qos.cos_audio, "UNISTIM RTP");
 		ast_rtp_setnat(sub->rtp, sub->parent->parent->nat);
 	}
 
@@ -2374,11 +2378,11 @@
 	} else {					/* We already have a call, so we switch in a threeway call */
 
 		if (s->device->moh) {
-			struct unistim_subchannel *sub;
+			struct unistim_subchannel *subchannel;
 			struct unistim_line *p = s->device->lines;
-			sub = p->subs[SUB_REAL];
-
-			if (!sub->owner) {
+			subchannel = p->subs[SUB_REAL];
+
+			if (!subchannel->owner) {
 				ast_log(LOG_WARNING, "Unable to find subchannel for music on hold\n");
 				return;
 			}
@@ -2395,7 +2399,7 @@
 			if (s->device->silence_generator) {
 				if (unistimdebug)
 					ast_verb(0, "Stopping silence generator\n");
-				ast_channel_stop_silence_generator(sub->owner,
+				ast_channel_stop_silence_generator(subchannel->owner,
 												   s->device->silence_generator);
 				s->device->silence_generator = NULL;
 			}
@@ -5313,16 +5317,16 @@
 		else if (!strcasecmp(v->name, "port"))
 			unistim_port = atoi(v->value);
                 else if (!strcasecmp(v->name, "tos")) {
-                        if (ast_str2tos(v->value, &tos))
+                        if (ast_str2tos(v->value, &qos.tos))
                             ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
                 } else if (!strcasecmp(v->name, "tos_audio")) {
-                        if (ast_str2tos(v->value, &tos_audio))
+                        if (ast_str2tos(v->value, &qos.tos_audio))
                             ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
                 } else if (!strcasecmp(v->name, "cos")) {
-                        if (ast_str2cos(v->value, &cos))
+                        if (ast_str2cos(v->value, &qos.cos))
                             ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
                 } else if (!strcasecmp(v->name, "cos_audio")) {
-                        if (ast_str2cos(v->value, &cos_audio))
+                        if (ast_str2cos(v->value, &qos.cos_audio))
                             ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "autoprovisioning")) {
 			if (!strcasecmp(v->value, "no"))
@@ -5501,7 +5505,7 @@
 		unistimsock = -1;
 	} else {
 		ast_verb(2, "UNISTIM Listening on %s:%d\n", ast_inet_ntoa(bindaddr.sin_addr), htons(bindaddr.sin_port));
-		ast_netsock_set_qos(unistimsock, tos, cos, "UNISTIM");
+		ast_netsock_set_qos(unistimsock, qos.tos, qos.cos, "UNISTIM");
 	}
 	return 0;
 }
@@ -5547,7 +5551,7 @@
 }
 
 static struct ast_rtp_protocol unistim_rtp = {
-	.type = type,
+	.type = channel_type,
 	.get_rtp_info = unistim_get_rtp_peer,
 	.get_vrtp_info = unistim_get_vrtp_peer,
 	.set_rtp_peer = unistim_set_rtp_peer,
@@ -5579,7 +5583,7 @@
 
 	/* Make sure we can register our unistim channel type */
 	if (ast_channel_register(&unistim_tech)) {
-		ast_log(LOG_ERROR, "Unable to register channel type '%s'\n", type);
+		ast_log(LOG_ERROR, "Unable to register channel type '%s'\n", channel_type);
 		goto chanreg_failed;
 	} 
 

Modified: team/seanbright/resolve-shadow-warnings/channels/xpmr/xpmr.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/xpmr/xpmr.c?view=diff&rev=114305&r1=114304&r2=114305
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/xpmr/xpmr.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/xpmr/xpmr.c Sat Apr 19 12:37:43 2008
@@ -424,7 +424,7 @@
 	i32	i;
 	i32 temp0,temp1;
  	i16 x0;
-	i32 y0;
+	i32 _y0;
 	i16 a0,a1;
 	i16 b0;
 	i16 *coef;
@@ -454,8 +454,8 @@
 		temp0 =	x0 * a1;
 		   x0 = input[i];
 		temp1 = input[i] * a0;
-		   y0 = (temp0 + temp1)/calcAdjust;
-		output[i]=(y0*outputGain)/M_Q8;
+		   _y0 = (temp0 + temp1)/calcAdjust;
+		output[i]=(_y0*outputGain)/M_Q8;
     }
 
 	x[0]=x0;
@@ -1817,7 +1817,7 @@
 
 	#if XPMR_DEBUG0 == 1
 	{
-	    t_tdet     	*ptdet;
+	    t_tdet     	*_ptdet;
 		TRACEX((" configure tracing\n"));
 		
 		pChan->rxCtcss->pDebug0=calloc(numSamples,2);
@@ -1825,10 +1825,10 @@
 		pChan->rxCtcss->pDebug2=calloc(numSamples,2);
 
 		for(i=0;i<CTCSS_NUM_CODES;i++){
-			ptdet=&(pChan->rxCtcss->tdet[i]);
-			ptdet->pDebug0=calloc(numSamples,2);
-			ptdet->pDebug1=calloc(numSamples,2);
-			ptdet->pDebug2=calloc(numSamples,2);
+			_ptdet=&(pChan->rxCtcss->tdet[i]);
+			_ptdet->pDebug0=calloc(numSamples,2);
+			_ptdet->pDebug1=calloc(numSamples,2);
+			_ptdet->pDebug2=calloc(numSamples,2);
 		}
 
 		// buffer, 2 bytes per sample, and 16 channels

Modified: team/seanbright/resolve-shadow-warnings/include/asterisk/strings.h
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/include/asterisk/strings.h?view=diff&rev=114305&r1=114304&r2=114305
==============================================================================
--- team/seanbright/resolve-shadow-warnings/include/asterisk/strings.h (original)
+++ team/seanbright/resolve-shadow-warnings/include/asterisk/strings.h Sat Apr 19 12:37:43 2008
@@ -417,13 +417,13 @@
 
 #define ast_str_alloca(init_len)			\
 	({						\
-		struct ast_str *buf;			\
-		buf = alloca(sizeof(*buf) + init_len);	\
-		buf->len = init_len;			\
-		buf->used = 0;				\
-		buf->ts = DS_ALLOCA;			\
-		buf->str[0] = '\0';			\
-		(buf);					\
+		struct ast_str *__ast_str_buf;			\
+		__ast_str_buf = alloca(sizeof(*__ast_str_buf) + init_len);	\
+		__ast_str_buf->len = init_len;			\
+		__ast_str_buf->used = 0;				\
+		__ast_str_buf->ts = DS_ALLOCA;			\
+		__ast_str_buf->str[0] = '\0';			\
+		(__ast_str_buf);					\
 	})
 
 /*!




More information about the asterisk-commits mailing list