[asterisk-commits] mjordan: branch 11 r434285 - in /branches/11/apps: app_minivm.c app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 8 06:42:13 CDT 2015


Author: mjordan
Date: Wed Apr  8 06:42:10 2015
New Revision: 434285

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=434285
Log:
clang compiler warnings: Fix pointer-bool-converesion warnings

This patch fixes several warnings pointed out by the clang compiler.
* app_minivm: Fixed evaluation of etemplate->locale, which will always
  evaluate to 'true'. This patch changes the evaluation to use
  ast_strlen_zero.
* app_queue:
  - Fixed evaluation of qe->parent->monfmt, which always evaluates to
    true. Instead, we just check to see if the dereferenced pointer
    evaluates to true.
  - Fixed evaluation of mem->state_interface, wrapping it with a call to
    ast_strlen_zero.

Review: https://reviewboard.asterisk.org/r/4541

ASTERISK-24917
Reported by: dkdegroot
patches:
  rb4541.patch submitted by dkdegroot (License 6600)

Modified:
    branches/11/apps/app_minivm.c
    branches/11/apps/app_queue.c

Modified: branches/11/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_minivm.c?view=diff&rev=434285&r1=434284&r2=434285
==============================================================================
--- branches/11/apps/app_minivm.c (original)
+++ branches/11/apps/app_minivm.c Wed Apr  8 06:42:10 2015
@@ -1819,7 +1819,8 @@
 		etemplate = message_template_find(vmu->ptemplate);
 		if (!etemplate)
 			etemplate = message_template_find("pager-default");
-		if (etemplate->locale) {
+
+		if (!ast_strlen_zero(etemplate->locale)) {
 			ast_copy_string(oldlocale, setlocale(LC_TIME, ""), sizeof(oldlocale));
 			setlocale(LC_TIME, etemplate->locale);
 		}
@@ -1830,9 +1831,8 @@
 	ast_manager_event(chan, EVENT_FLAG_CALL, "MiniVoiceMail", "Action: SentNotification\rn\nMailbox: %s@%s\r\nCounter: %s\r\n", vmu->username, vmu->domain, counter);
 
 	run_externnotify(chan, vmu);		/* Run external notification */
-
-	if (etemplate->locale) {
-		setlocale(LC_TIME, oldlocale); /* Rest to old locale */
+	if (!ast_strlen_zero(etemplate->locale)) {
+		setlocale(LC_TIME, oldlocale);	/* Reset to old locale */
 	}
 	return res;
 }

Modified: branches/11/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_queue.c?view=diff&rev=434285&r1=434284&r2=434285
==============================================================================
--- branches/11/apps/app_queue.c (original)
+++ branches/11/apps/app_queue.c Wed Apr  8 06:42:10 2015
@@ -5697,7 +5697,7 @@
 		ast_channel_unlock(qe->chan);
 
 		/* Begin Monitoring */
-		if (qe->parent->monfmt && *qe->parent->monfmt) {
+		if (*qe->parent->monfmt) {
 			if (!qe->parent->montype) {
 				const char *monexec;
 				ast_debug(1, "Starting Monitor as requested.\n");
@@ -8388,7 +8388,7 @@
 				ast_str_set(&out, 0, "      %s", mem->membername);
 				if (strcasecmp(mem->membername, mem->interface)) {
 					ast_str_append(&out, 0, " (%s", mem->interface);
-					if (mem->state_interface) {
+					if (!ast_strlen_zero(mem->state_interface)) {
 						ast_str_append(&out, 0, " from %s", mem->state_interface);
 					}
 					ast_str_append(&out, 0, ")");




More information about the asterisk-commits mailing list