[asterisk-commits] wdoekes: trunk r354429 - in /trunk: addons/ addons/ooh323c/src/ apps/ channel...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 8 14:49:59 CST 2012


Author: wdoekes
Date: Wed Feb  8 14:49:48 2012
New Revision: 354429

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=354429
Log:
Avoid cppcheck warnings; removing unused vars and a bit of cleanup.

Patch by: Clod Patry
Review: https://reviewboard.asterisk.org/r/1651

Modified:
    trunk/addons/chan_mobile.c
    trunk/addons/chan_ooh323.c
    trunk/addons/ooh323c/src/memheap.c
    trunk/apps/app_alarmreceiver.c
    trunk/apps/app_chanspy.c
    trunk/apps/app_dial.c
    trunk/apps/app_disa.c
    trunk/apps/app_minivm.c
    trunk/apps/app_osplookup.c
    trunk/apps/app_queue.c
    trunk/apps/app_voicemail.c
    trunk/channels/chan_dahdi.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_misdn.c
    trunk/channels/chan_skinny.c
    trunk/channels/chan_usbradio.c
    trunk/formats/format_h263.c
    trunk/funcs/func_env.c
    trunk/funcs/func_odbc.c
    trunk/funcs/func_strings.c
    trunk/main/acl.c
    trunk/main/ast_expr2.fl
    trunk/main/ast_expr2f.c
    trunk/main/pbx.c
    trunk/main/udptl.c
    trunk/utils/astman.c

Modified: trunk/addons/chan_mobile.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/chan_mobile.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/addons/chan_mobile.c (original)
+++ trunk/addons/chan_mobile.c Wed Feb  8 14:49:48 2012
@@ -2975,7 +2975,6 @@
 
 static sdp_session_t *sdp_register(void)
 {
-
 	uint32_t service_uuid_int[] = {0, 0, 0, GENERIC_AUDIO_SVCLASS_ID};
 	uint8_t rfcomm_channel = 1;
 	const char *service_name = "Asterisk PABX";
@@ -3021,8 +3020,12 @@
 
 	if (!(session = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY)))
 		ast_log(LOG_WARNING, "Failed to connect sdp and create session.\n");
-	else
-		sdp_record_register(session, record, 0);
+	else {
+		if (sdp_record_register(session, record, 0) < 0) {
+			ast_log(LOG_WARNING, "Failed to sdp_record_register error: %d\n", errno);
+			return NULL;
+		}
+	}
 
 	sdp_data_free(channel);
 	sdp_list_free(rfcomm_list, 0);
@@ -4083,18 +4086,17 @@
 static void *do_sco_listen(void *data)
 {
 	struct adapter_pvt *adapter = (struct adapter_pvt *) data;
-	int res;
 
 	while (!check_unloading()) {
 		/* check for new sco connections */
-		if ((res = ast_io_wait(adapter->accept_io, 0)) == -1) {
+		if (ast_io_wait(adapter->accept_io, 0) == -1) {
 			/* handle errors */
 			ast_log(LOG_ERROR, "ast_io_wait() failed for adapter %s\n", adapter->id);
 			break;
 		}
 
 		/* handle audio data */
-		if ((res = ast_io_wait(adapter->io, 1)) == -1) {
+		if (ast_io_wait(adapter->io, 1) == -1) {
 			ast_log(LOG_ERROR, "ast_io_wait() failed for audio on adapter %s\n", adapter->id);
 			break;
 		}

Modified: trunk/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/chan_ooh323.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/addons/chan_ooh323.c (original)
+++ trunk/addons/chan_ooh323.c Wed Feb  8 14:49:48 2012
@@ -3518,7 +3518,6 @@
 
 static int load_module(void)
 {
-	int res;
 	struct ooAliases * pNewAlias = NULL;
 	struct ooh323_peer *peer = NULL;
 	struct ast_format tmpfmt;
@@ -3566,7 +3565,7 @@
 	}
 
 
-	if (!(res = reload_config(0))) {
+	if (!reload_config(0)) {
 		/* Make sure we can register our OOH323 channel type */
 		if (ast_channel_register(&ooh323_tech)) {
 			ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
@@ -3622,10 +3621,10 @@
 		ast_mutex_lock(&peerl.lock);
 		peer = peerl.peers;
 		while (peer) {
-         if(peer->h323id) ooH323EpAddAliasH323ID(peer->h323id);
-         if(peer->email)  ooH323EpAddAliasEmailID(peer->email);
-         if(peer->e164)   ooH323EpAddAliasDialedDigits(peer->e164);
-         if(peer->url)    ooH323EpAddAliasURLID(peer->url);
+			if(peer->h323id) ooH323EpAddAliasH323ID(peer->h323id);
+			if(peer->email)  ooH323EpAddAliasEmailID(peer->email);
+			if(peer->e164)   ooH323EpAddAliasDialedDigits(peer->e164);
+         		if(peer->url)    ooH323EpAddAliasURLID(peer->url);
 			peer = peer->next;
 		}
 		ast_mutex_unlock(&peerl.lock);
@@ -3667,7 +3666,7 @@
   
 		/* Create H.323 listener */
 		if (ooCreateH323Listener() != OO_OK) {
-         ast_log(LOG_ERROR, "OOH323 Listener Creation failure. "
+         		ast_log(LOG_ERROR, "OOH323 Listener Creation failure. "
                             "OOH323 DISABLED\n");
 		
 			ooH323EpDestroy();
@@ -3675,7 +3674,7 @@
 		}
 
 		if (ooh323c_start_stack_thread() < 0) {
-         ast_log(LOG_ERROR, "Failed to start OOH323 stack thread. "
+			ast_log(LOG_ERROR, "Failed to start OOH323 stack thread. "
                             "OOH323 DISABLED\n");
 			ooH323EpDestroy();
 			return 1;
@@ -4186,7 +4185,6 @@
 	/* XXX Deal with Video */
 	struct ooh323_pvt *p;
 	struct ast_sockaddr tmp;
-	int mode;
 
 	if (gH323Debug)
 		ast_verb(0, "---   ooh323_set_peer - %s\n", ast_channel_name(chan));
@@ -4195,7 +4193,10 @@
 		return 0;
 	}
 
-	mode = ooh323_convertAsteriskCapToH323Cap(&chan->writeformat); 
+	if (ooh323_convertAsteriskCapToH323Cap(&chan->writeformat) < 0) {
+		ast_log(LOG_WARNING, "Unknown format.\n");
+		return -1;
+	}
 	p = (struct ooh323_pvt *) chan->tech_pvt;
 	if (!p) {
 		ast_log(LOG_ERROR, "No Private Structure, this is bad\n");

Modified: trunk/addons/ooh323c/src/memheap.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/memheap.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/addons/ooh323c/src/memheap.c (original)
+++ trunk/addons/ooh323c/src/memheap.c Wed Feb  8 14:49:48 2012
@@ -726,7 +726,7 @@
    OSMemLink** ppMemLink;
    OSMemBlk* pMemBlk;
    OSMemElemDescr* pElem;
-   OSMemLink* pMemLink, *pPrevMemLink = 0;
+   OSMemLink* pMemLink;
    void *newMem_p;
    unsigned nbytes, nunits;
 
@@ -758,7 +758,6 @@
          *(int*)(((char*)pMemLink) + sizeof (OSMemLink)) = nbytes_;
          return pMemLink->pMemBlk;
       }
-      pPrevMemLink = pMemLink;
    }
 
    /* Round number of bytes to nearest 8-byte boundary */

Modified: trunk/apps/app_alarmreceiver.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_alarmreceiver.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/apps/app_alarmreceiver.c (original)
+++ trunk/apps/app_alarmreceiver.c Wed Feb  8 14:49:48 2012
@@ -251,7 +251,7 @@
 			break;
 		}
 
-		if ((r = ast_waitfor(chan, -1) < 0)) {
+		if ((r = ast_waitfor(chan, -1)) < 0) {
 			ast_debug(1, "Waitfor returned %d\n", r);
 			continue;
 		}

Modified: trunk/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_chanspy.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Wed Feb  8 14:49:48 2012
@@ -614,7 +614,7 @@
 	   has arrived, since the spied-on channel could have gone away while
 	   we were waiting
 	*/
-	while ((res = ast_waitfor(chan, -1) > -1) && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) {
+	while (ast_waitfor(chan, -1) > -1 && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) {
 		if (!(f = ast_read(chan)) || ast_check_hangup(chan)) {
 			running = -1;
 			break;
@@ -771,7 +771,6 @@
 	int waitms;
 	int res;
 	char *ptr;
-	int num;
 	int num_spyed_upon = 1;
 	struct ast_channel_iterator *iter = NULL;
 
@@ -962,6 +961,7 @@
 					res = ast_app_sayname(chan, local_mailbox, local_context);
 				}
 				if (!ast_test_flag(flags, OPTION_NAME) || res < 0) {
+					int num;
 					if (!ast_test_flag(flags, OPTION_NOTECH)) {
 						if (ast_fileexists(peer_name, NULL, NULL) > 0) {
 							res = ast_streamfile(chan, peer_name, ast_channel_language(chan));
@@ -976,8 +976,9 @@
 							res = ast_say_character_str(chan, peer_name, "", ast_channel_language(chan));
 						}
 					}
-					if ((num = atoi(ptr)))
-						ast_say_digits(chan, atoi(ptr), "", ast_channel_language(chan));
+					if ((num = atoi(ptr))) {
+						ast_say_digits(chan, num, "", ast_channel_language(chan));
+					}
 				}
 			}
 

Modified: trunk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_dial.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Wed Feb  8 14:49:48 2012
@@ -1706,7 +1706,6 @@
 	char callerid[60];
 	int res;
 	char *l;
-	int silencethreshold;
 
 	if (chan->caller.id.number.valid
 		&& !ast_strlen_zero(chan->caller.id.number.str)) {
@@ -1781,7 +1780,7 @@
 			   "At the tone, please say your name:"
 
 			*/
-			silencethreshold = ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE);
+			int silencethreshold = ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE);
 			ast_answer(chan);
 			res = ast_play_and_record(chan, "priv-recordintro", pa->privintro, 4, "sln", &duration, NULL, silencethreshold, 2000, 0);  /* NOTE: I've reduced the total time to 4 sec */
 									/* don't think we'll need a lock removed, we took care of

Modified: trunk/apps/app_disa.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_disa.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/apps/app_disa.c (original)
+++ trunk/apps/app_disa.c Wed Feb  8 14:49:48 2012
@@ -214,7 +214,7 @@
 			break;
 		}
 
-		if ((res = ast_waitfor(chan, -1) < 0)) {
+		if ((res = ast_waitfor(chan, -1)) < 0) {
 			ast_debug(1, "Waitfor returned %d\n", res);
 			continue;
 		}

Modified: trunk/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_minivm.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Wed Feb  8 14:49:48 2012
@@ -3343,7 +3343,6 @@
 static int minivm_counter_func_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
 	char *username, *domain, *countername;
-	struct minivm_account *vmu = NULL;
 	char userpath[BUFSIZ];
 	int res;
 
@@ -3381,7 +3380,7 @@
 	}
 
 	/* If we can't find account or if the account is temporary, return. */
-	if (!ast_strlen_zero(username) && !(vmu = find_account(domain, username, FALSE))) {
+	if (!ast_strlen_zero(username) && !find_account(domain, username, FALSE)) {
 		ast_log(LOG_ERROR, "Minivm account does not exist: %s@%s\n", username, domain);
 		return 0;
 	}

Modified: trunk/apps/app_osplookup.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_osplookup.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/apps/app_osplookup.c (original)
+++ trunk/apps/app_osplookup.c Wed Feb  8 14:49:48 2012
@@ -614,7 +614,6 @@
 	float min;			/* Minimum */
 	float max;			/* Maximum */
 	float avg;			/* Average */
-	float ndev;			/* Normal deviation */
 	float sdev;			/* Standard deviation */
 };
 
@@ -1452,7 +1451,7 @@
 
 	if (callid == NULL) {
 		ast_log(LOG_ERROR, "Invalid parameters\n");
-		res = OSP_ERROR;
+		return OSP_ERROR;
 	}
 
 	callid->len = sizeof(callid->buf);
@@ -1463,6 +1462,7 @@
 	case OSP_CALLID_SIP:
 	case OSP_CALLID_IAX:
 		res = OSP_FAILED;
+		break;
 	default:
 		res = OSP_ERROR;
 		break;
@@ -1529,7 +1529,7 @@
 
 	if (results == NULL) {
 		ast_log(LOG_ERROR, "Invalid parameters\n");
-		res = OSP_ERROR;
+		return OSP_ERROR;
 	}
 
 	osp_convert_inout(results->dest, dest, sizeof(dest));
@@ -1787,7 +1787,7 @@
 /*!
  * \brief OSP Lookup Next function
  * \param name OSP provider name
- * \param cause Asterisk hangup cuase
+ * \param cause Asterisk hangup cause
  * \param results Lookup results, in/output
  * \return OSP_OK Found , OSP_FAILED No route, OSP_ERROR Error
  */
@@ -1809,7 +1809,7 @@
 
 	if (results == NULL) {
 		ast_log(LOG_ERROR, "Invalid parameters\n");
-		res = OSP_ERROR;
+		return OSP_ERROR;
 	}
 
 	results->outtech[0] = '\0';

Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed Feb  8 14:49:48 2012
@@ -4860,10 +4860,10 @@
 		/* Begin Monitoring */
 		if (qe->parent->monfmt && *qe->parent->monfmt) {
 			if (!qe->parent->montype) {
-				const char *monexec, *monargs;
+				const char *monexec;
 				ast_debug(1, "Starting Monitor as requested.\n");
 				ast_channel_lock(qe->chan);
-				if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || (monargs = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS"))) {
+				if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS")) {
 					which = qe->chan;
 					monexec = monexec ? ast_strdupa(monexec) : NULL;
 				}

Modified: trunk/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Wed Feb  8 14:49:48 2012
@@ -1949,9 +1949,8 @@
 	*vms_p->introfn = '\0';
 
 	ast_mutex_lock(&vms_p->lock);
-	init_mailstream(vms_p, GREETINGS_FOLDER);
-	if (!vms_p->mailstream) {
-		ast_log(AST_LOG_ERROR, "IMAP mailstream is NULL\n");
+	if (init_mailstream(vms_p, GREETINGS_FOLDER) || !vms_p->mailstream) {
+		ast_log(AST_LOG_ERROR, "IMAP mailstream is NULL or can't init_mailstream\n");
 		ast_mutex_unlock(&vms_p->lock);
 		return -1;
 	}
@@ -2570,7 +2569,7 @@
  */
 static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt, char *dir, char *flag)
 {
-	struct vm_state *sendvms = NULL, *destvms = NULL;
+	struct vm_state *sendvms = NULL;
 	char messagestring[10]; /*I guess this could be a problem if someone has more than 999999999 messages...*/
 	if (msgnum >= recip->maxmsg) {
 		ast_log(LOG_WARNING, "Unable to copy mail, mailbox %s is full\n", recip->mailbox);
@@ -2580,7 +2579,7 @@
 		ast_log(LOG_ERROR, "Couldn't get vm_state for originator's mailbox!!\n");
 		return -1;
 	}
-	if (!(destvms = get_vm_state_by_imapuser(recip->imapuser, 0))) {
+	if (!get_vm_state_by_imapuser(recip->imapuser, 0)) {
 		ast_log(LOG_ERROR, "Couldn't get vm_state for destination mailbox!\n");
 		return -1;
 	}
@@ -2704,7 +2703,7 @@
 {
 	SEARCHPGM *pgm;
 	SEARCHHEADER *hdr;
-	int ret, urgent = 0;
+	int urgent = 0;
 
 	/* If Urgent, then look at INBOX */
 	if (box == 11) {
@@ -2720,7 +2719,7 @@
 	vms->imapversion = vmu->imapversion;
 	ast_debug(3, "Before init_mailstream, user is %s\n", vmu->imapuser);
 
-	if ((ret = init_mailstream(vms, box)) || !vms->mailstream) {
+	if (init_mailstream(vms, box) || !vms->mailstream) {
 		ast_log(AST_LOG_ERROR, "Could not initialize mailstream\n");
 		return -1;
 	}
@@ -3047,7 +3046,7 @@
 
 static char *get_user_by_mailbox(char *mailbox, char *buf, size_t len)
 {
-	char *start, *quote, *eol_pnt;
+	char *start, *eol_pnt;
 
 	if (ast_strlen_zero(mailbox))
 		return NULL;
@@ -3057,15 +3056,16 @@
 
 	ast_copy_string(buf, start+6, len);
 
-	if (!(quote = strchr(buf, '\"'))) {
-		if (!(eol_pnt = strchr(buf, '/')))
-			eol_pnt = strchr(buf,'}');
-		*eol_pnt = '\0';
+	if (!(quote = strchr(buf, '"'))) {
+		if ((eol_pnt = strchr(buf, '/')) || (eol_pnt = strchr(buf, '}'))) {
+			*eol_pnt = '\0';
+		}
 		return buf;
 	} else {
-		eol_pnt = strchr(buf+1,'\"');
-		*eol_pnt = '\0';
-		return buf+1;
+		if ((eol_pnt = strchr(quote + 1, '"'))) {
+			*eol_pnt = '\0';
+		}
+		return quote + 1;
 	}
 }
 
@@ -6347,8 +6347,8 @@
 		COPY(dir, msg, ddir, x, username, context, sfn, dfn);
 	}
 	ast_unlock_path(ddir);
+	return 0;
 #endif
-	return 0;
 }
 
 static int adsi_logo(unsigned char *buf)
@@ -7344,10 +7344,10 @@
 			prompt_played++;
 			if (res || prompt_played > 4)
 				break;
-			if ((res = ast_readstring(chan, username, sizeof(username) - 1, 2000, 10000, "#") < 0))
+			if ((res = ast_readstring(chan, username, sizeof(username) - 1, 2000, 10000, "#")) < 0)
 				break;
 		}
-		
+
 		/* start all over if no username */
 		if (ast_strlen_zero(username))
 			continue;
@@ -12775,7 +12775,7 @@
 		context = "default";
 	}
 
-	if ((res = sayname(chan, args_copy, context) < 0)) {
+	if ((res = sayname(chan, args_copy, context)) < 0) {
 		ast_debug(3, "Greeting not found for '%s@%s', falling back to mailbox number.\n", args_copy, context);
 		res = ast_stream_and_wait(chan, "vm-extension", AST_DIGIT_ANY);
 		if (!res) {

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Feb  8 14:49:48 2012
@@ -12060,6 +12060,7 @@
 		}
 		if (ioctl(fd, DAHDI_GET_PARAMS, &p)) {
 			ast_log(LOG_WARNING, "Failed to get channel parameters for channel %d: %s\n", channels[y], strerror(errno));
+			close(fd);
 			return -1;
 		}
 		if (ioctl(fd, DAHDI_SPANSTAT, &si)) {
@@ -18898,9 +18899,6 @@
 	int size,res,fd,len,x;
 	int bytes=0;
 	/* Initial carrier (imaginary) */
-	float cr = 1.0;
-	float ci = 0.0;
-	float scont = 0.0;
 	int idx;
 
 	if (!text[0]) {

Modified: trunk/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed Feb  8 14:49:48 2012
@@ -3099,7 +3099,7 @@
 
 	snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, (unsigned long)ast_random());
 
-	if ((res = stat(s, &stbuf) < 0)) {
+	if (stat(s, &stbuf) < 0) {
 		ast_log(LOG_WARNING, "Failed to stat '%s': %s\n", s, strerror(errno));
 		return -1;
 	}

Modified: trunk/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_misdn.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Wed Feb  8 14:49:48 2012
@@ -7406,7 +7406,6 @@
 static int misdn_write(struct ast_channel *ast, struct ast_frame *frame)
 {
 	struct chan_list *ch;
-	int i  = 0;
 
 	if (!ast || !(ch = MISDN_ASTERISK_TECH_PVT(ast))) {
 		return -1;

Modified: trunk/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Wed Feb  8 14:49:48 2012
@@ -275,7 +275,8 @@
 	uint32_t maxStreams;
 	uint32_t space;
 	uint8_t protocolVersion;
-	char space2[3] ;
+	/*! \brief space2 is used for newer version of skinny */
+	char space2[3];
 };
 
 #define IP_PORT_MESSAGE 0x0002
@@ -459,6 +460,7 @@
 	uint32_t packetSize;
 	uint32_t payloadType;
 	struct media_qualifier qualifier;
+	/*! \brief space2 is used for newer version of skinny */
 	uint32_t space2[19];
 };
 

Modified: trunk/channels/chan_usbradio.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_usbradio.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/channels/chan_usbradio.c (original)
+++ trunk/channels/chan_usbradio.c Wed Feb  8 14:49:48 2012
@@ -387,7 +387,6 @@
  */
 struct sound {
 	int ind;
-	char *desc;
 	short *data;
 	int datalen;
 	int samplen;

Modified: trunk/formats/format_h263.c
URL: http://svnview.digium.com/svn/asterisk/trunk/formats/format_h263.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/formats/format_h263.c (original)
+++ trunk/formats/format_h263.c Wed Feb  8 14:49:48 2012
@@ -56,9 +56,8 @@
 static int h263_open(struct ast_filestream *s)
 {
 	unsigned int ts;
-	int res;
 
-	if ((res = fread(&ts, 1, sizeof(ts), s->f)) < sizeof(ts)) {
+	if (fread(&ts, 1, sizeof(ts), s->f) < sizeof(ts)) {
 		ast_log(LOG_WARNING, "Empty file!\n");
 		return -1;
 	}

Modified: trunk/funcs/func_env.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_env.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/funcs/func_env.c (original)
+++ trunk/funcs/func_env.c Wed Feb  8 14:49:48 2012
@@ -474,7 +474,6 @@
 	int64_t flength, i; /* iterator needs to be signed, so it can go negative and terminate the loop */
 	int64_t offset_offset = -1, length_offset = -1;
 	char dos_state = 0;
-	size_t readlen;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(filename);
 		AST_APP_ARG(offset);
@@ -636,7 +635,7 @@
 				/* Don't let previous values influence current counts, due to short reads */
 				memset(fbuf, 0, sizeof(fbuf));
 			}
-			if (fread(fbuf, 1, sizeof(fbuf), ff) && !feof(ff)) {
+			if (fread(fbuf, 1, sizeof(fbuf), ff) < sizeof(fbuf) && !feof(ff)) {
 				ast_log(LOG_ERROR, "Short read?!!\n");
 				fclose(ff);
 				return -1;
@@ -688,8 +687,10 @@
 		ast_debug(3, "offset=%" PRId64 ", length=%" PRId64 ", offset_offset=%" PRId64 ", length_offset=%" PRId64 "\n", offset, length, offset_offset, length_offset);
 		for (i = offset_offset; i < flength; i += sizeof(fbuf)) {
 			char *pos;
-			if ((readlen = fread(fbuf, 1, sizeof(fbuf), ff)) < sizeof(fbuf) && !feof(ff)) {
+			if (fread(fbuf, 1, sizeof(fbuf), ff) < sizeof(fbuf) && !feof(ff)) {
 				ast_log(LOG_ERROR, "Short read?!!\n");
+				fclose(ff);
+				return -1;
 			}
 			for (pos = fbuf; pos < fbuf + sizeof(fbuf); pos++) {
 				LINE_COUNTER(pos, format, current_length);

Modified: trunk/funcs/func_odbc.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_odbc.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/funcs/func_odbc.c (original)
+++ trunk/funcs/func_odbc.c Wed Feb  8 14:49:48 2012
@@ -1504,7 +1504,7 @@
 	AST_RWLIST_WRLOCK(&queries);
 
 	AST_RWLIST_UNLOCK(&queries);
-	return 0;
+	return res;
 }
 
 static int reload(void)

Modified: trunk/funcs/func_strings.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_strings.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/funcs/func_strings.c (original)
+++ trunk/funcs/func_strings.c Wed Feb  8 14:49:48 2012
@@ -584,7 +584,6 @@
 		AST_APP_ARG(delimiter);
 		AST_APP_ARG(fieldvalue);
 	);
-	const char *ptr;
 	struct ast_str *orig_list = ast_str_thread_get(&tmp_buf, 16);
 	const char *begin, *cur, *next;
 	int dlen, flen, first = 1;
@@ -624,7 +623,7 @@
 	}
 
 	/* If the string isn't there, just copy out the string and be done with it. */
-	if (!(ptr = strstr(ast_str_buffer(orig_list), args.fieldvalue))) {
+	if (!strstr(ast_str_buffer(orig_list), args.fieldvalue)) {
 		if (buf) {
 			ast_copy_string(buf, ast_str_buffer(orig_list), len);
 		} else {

Modified: trunk/main/acl.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/acl.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/main/acl.c (original)
+++ trunk/main/acl.c Wed Feb  8 14:49:48 2012
@@ -127,9 +127,9 @@
 	struct ifaddrs *ifap, *ifaphead;
 	int rtnerr;
 	const struct sockaddr_in *sin;
+	int best_score = -100;
 #endif /* BSD_OR_LINUX */
 	struct in_addr best_addr;
-	int best_score = -100;
 	memset(&best_addr, 0, sizeof(best_addr));
 
 #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__) || defined(__GLIBC__)

Modified: trunk/main/ast_expr2.fl
URL: http://svnview.digium.com/svn/asterisk/trunk/main/ast_expr2.fl?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/main/ast_expr2.fl (original)
+++ trunk/main/ast_expr2.fl Wed Feb  8 14:49:48 2012
@@ -437,35 +437,38 @@
 }
 
 int ast_yyerror (const char *s,  yyltype *loc, struct parse_io *parseio )
-{	
+{
 	struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner);
 	char spacebuf[8000]; /* best safe than sorry */
-	char spacebuf2[8000]; /* best safe than sorry */
 	int i=0;
 	char *s2 = expr2_token_subst(s);
 	spacebuf[0] = 0;
-	
-	for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' ';  /* uh... assuming yyg is defined, then I can use the yycolumn macro,
-																								which is the same thing as... get this:
-													yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
-													I was tempted to just use yy_buf_pos in the STATE, but..., well:
-														a. the yy_buf_pos is the current position in the buffer, which
-															may not relate to the entire string/buffer because of the
-															buffering.
-														b. but, analysis of the situation is that when you use the
-															yy_scan_string func, it creates a single buffer the size of
-															string, so the two would be the same... 
-													so, in the end, the yycolumn macro is available, shorter, therefore easier. */
-	spacebuf2[i++]='^';
-	spacebuf2[i]= 0;
+
+	for (i = 0; i < (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); i++) {
+		spacebuf[i] = ' ';
+	}
+	/* uh... assuming yyg is defined, then I can use the yycolumn macro,
+	which is the same thing as... get this:
+	yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
+	I was tempted to just use yy_buf_pos in the STATE, but..., well:
+	a. the yy_buf_pos is the current position in the buffer, which
+		may not relate to the entire string/buffer because of the
+		buffering.
+	b. but, analysis of the situation is that when you use the
+		yy_scan_string func, it creates a single buffer the size of
+		string, so the two would be the same...
+		so, in the end, the yycolumn macro is available, shorter, therefore easier. */
+
+	spacebuf[i++] = '^';
+	spacebuf[i] = 0;
 
 #ifdef STANDALONE3
 	/* easier to read in the standalone version */
-	printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",  
-			(extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
+	printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
+			(extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
 #else
-	ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",  
-			(extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
+	ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
+			(extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
 #endif
 #ifndef STANDALONE
 	ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n");

Modified: trunk/main/ast_expr2f.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/ast_expr2f.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/main/ast_expr2f.c (original)
+++ trunk/main/ast_expr2f.c Wed Feb  8 14:49:48 2012
@@ -2586,35 +2586,38 @@
 }
 
 int ast_yyerror (const char *s,  yyltype *loc, struct parse_io *parseio )
-{	
+{
 	struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner);
 	char spacebuf[8000]; /* best safe than sorry */
-	char spacebuf2[8000]; /* best safe than sorry */
 	int i=0;
 	char *s2 = expr2_token_subst(s);
 	spacebuf[0] = 0;
-	
-	for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' ';  /* uh... assuming yyg is defined, then I can use the yycolumn macro,
-																								which is the same thing as... get this:
-													yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
-													I was tempted to just use yy_buf_pos in the STATE, but..., well:
-														a. the yy_buf_pos is the current position in the buffer, which
-															may not relate to the entire string/buffer because of the
-															buffering.
-														b. but, analysis of the situation is that when you use the
-															ast_yy_scan_string func, it creates a single buffer the size of
-															string, so the two would be the same... 
-													so, in the end, the yycolumn macro is available, shorter, therefore easier. */
-	spacebuf2[i++]='^';
-	spacebuf2[i]= 0;
+
+	for (i = 0; i < (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); i++) {
+		spacebuf[i] = ' ';
+	}
+	/* uh... assuming yyg is defined, then I can use the yycolumn macro,
+	which is the same thing as... get this:
+	yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
+	I was tempted to just use yy_buf_pos in the STATE, but..., well:
+	a. the yy_buf_pos is the current position in the buffer, which
+		may not relate to the entire string/buffer because of the
+		buffering.
+	b. but, analysis of the situation is that when you use the
+		ast_yy_scan_string func, it creates a single buffer the size of
+		string, so the two would be the same...
+		so, in the end, the yycolumn macro is available, shorter, therefore easier. */
+
+	spacebuf[i++] = '^';
+	spacebuf[i] = 0;
 
 #ifdef STANDALONE3
 	/* easier to read in the standalone version */
-	printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",  
-			(extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
+	printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
+			(extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
 #else
-	ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",  
-			(extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
+	ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
+			(extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
 #endif
 #ifndef STANDALONE
 	ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n");

Modified: trunk/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/pbx.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Wed Feb  8 14:49:48 2012
@@ -3891,7 +3891,7 @@
 {
 	/* Substitutes variables into buf, based on string templ */
 	char *cp4 = NULL;
-	const char *tmp, *whereweare;
+	const char *whereweare;
 	int orig_size = 0;
 	int offset, offset2, isfunction;
 	const char *nextvar, *nextexp, *nextthing;
@@ -3901,7 +3901,7 @@
 	struct ast_str *substr1 = ast_str_create(16), *substr2 = NULL, *substr3 = ast_str_create(16);
 
 	ast_str_reset(*buf);
-	whereweare = tmp = templ;
+	whereweare = templ;
 	while (!ast_strlen_zero(whereweare)) {
 		/* reset our buffer */
 		ast_str_reset(substr3);
@@ -4082,7 +4082,7 @@
 {
 	/* Substitutes variables into cp2, based on string cp1, cp2 NO LONGER NEEDS TO BE ZEROED OUT!!!!  */
 	char *cp4 = NULL;
-	const char *tmp, *whereweare, *orig_cp2 = cp2;
+	const char *whereweare, *orig_cp2 = cp2;
 	int length, offset, offset2, isfunction;
 	char *workspace = NULL;
 	char *ltmp = NULL, *var = NULL;
@@ -4091,7 +4091,7 @@
 	int pos, brackets, needsub, len;
 
 	*cp2 = 0; /* just in case nothing ends up there */
-	whereweare=tmp=cp1;
+	whereweare = cp1;
 	while (!ast_strlen_zero(whereweare) && count) {
 		/* Assume we're copying the whole remaining string */
 		pos = strlen(whereweare);

Modified: trunk/main/udptl.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/udptl.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/main/udptl.c (original)
+++ trunk/main/udptl.c Wed Feb  8 14:49:48 2012
@@ -1045,7 +1045,6 @@
 {
 	unsigned int seq;
 	unsigned int len = f->datalen;
-	int res;
 	/* if no max datagram size is provided, use default value */
 	const int bufsize = (s->far_max_datagram > 0) ? s->far_max_datagram : DEFAULT_FAX_MAX_DATAGRAM;
 	uint8_t buf[bufsize];
@@ -1083,12 +1082,14 @@
 	len = udptl_build_packet(s, buf, sizeof(buf), f->data.ptr, len);
 
 	if ((signed int) len > 0 && !ast_sockaddr_isnull(&s->them)) {
-		if ((res = ast_sendto(s->fd, buf, len, 0, &s->them)) < 0)
+		if (ast_sendto(s->fd, buf, len, 0, &s->them) < 0) {
 			ast_log(LOG_NOTICE, "UDPTL (%s): Transmission error to %s: %s\n",
 				LOG_TAG(s), ast_sockaddr_stringify(&s->them), strerror(errno));
-		if (udptl_debug_test_addr(&s->them))
+		}
+		if (udptl_debug_test_addr(&s->them)) {
 			ast_verb(1, "UDPTL (%s): packet to %s (seq %d, len %d)\n",
 				LOG_TAG(s), ast_sockaddr_stringify(&s->them), seq, len);
+		}
 	}
 		
 	return 0;

Modified: trunk/utils/astman.c
URL: http://svnview.digium.com/svn/asterisk/trunk/utils/astman.c?view=diff&rev=354429&r1=354428&r2=354429
==============================================================================
--- trunk/utils/astman.c (original)
+++ trunk/utils/astman.c Wed Feb  8 14:49:48 2012
@@ -155,12 +155,11 @@
 {
 	char stuff[4096];
 	va_list ap;
-	int res;
 
 	va_start(ap, fmt);
 	vsnprintf(stuff, sizeof(stuff), fmt, ap);
 	va_end(ap);
-	if ((res = write(fd, stuff, strlen(stuff))) < 0) {
+	if (write(fd, stuff, strlen(stuff)) < 0) {
 		fprintf(stderr, "write() failed: %s\n", strerror(errno));
 	}
 }




More information about the asterisk-commits mailing list