Author: mjordan
Date: Wed Apr  8 06:45:05 2015
New Revision: 434287

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

This patch fixes several warnings pointed out by the clang compiler.
* chan_pjsip: Removed check for data->text, as it will always be non-NULL.
* 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.
* res_smdi: Wrapped search_msg->mesg_desk_term with calls to ast_strlen_zero.

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

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

Merged revisions 434285 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 434286 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    trunk/   (props changed)
    trunk/apps/app_minivm.c
    trunk/apps/app_queue.c
    trunk/channels/chan_pjsip.c
    trunk/res/res_smdi.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/apps/app_minivm.c
URL: 
http://svnview.digium.com/svn/asterisk/trunk/apps/app_minivm.c?view=diff&rev=434287&r1=434286&r2=434287
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Wed Apr  8 06:45:05 2015
@@ -1838,7 +1838,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);
                }
@@ -1867,9 +1868,8 @@
 
 notify_cleanup:
        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: trunk/apps/app_queue.c
URL: 
http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=434287&r1=434286&r2=434287
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed Apr  8 06:45:05 2015
@@ -6725,7 +6725,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");
@@ -9213,7 +9213,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, ")");

Modified: trunk/channels/chan_pjsip.c
URL: 
http://svnview.digium.com/svn/asterisk/trunk/channels/chan_pjsip.c?view=diff&rev=434287&r1=434286&r2=434287
==============================================================================
--- trunk/channels/chan_pjsip.c (original)
+++ trunk/channels/chan_pjsip.c Wed Apr  8 06:45:05 2015
@@ -1940,12 +1940,6 @@
                .subtype = "plain",
                .body_text = data->text
        };
-
-       /* NOT ast_strlen_zero, because a zero-length message is specifically
-        * allowed by RFC 3428 (See section 10, Examples) */
-       if (!data->text) {
-               return 0;
-       }
 
        ast_debug(3, "Sending in dialog SIP message\n");
 

Modified: trunk/res/res_smdi.c
URL: 
http://svnview.digium.com/svn/asterisk/trunk/res/res_smdi.c?view=diff&rev=434287&r1=434286&r2=434287
==============================================================================
--- trunk/res/res_smdi.c (original)
+++ trunk/res/res_smdi.c Wed Apr  8 06:45:05 2015
@@ -873,10 +873,10 @@
 
        switch (flags & OBJ_SEARCH_MASK) {
        case OBJ_SEARCH_OBJECT:
-               if (search_msg->mesg_desk_num) {
+               if (!ast_strlen_zero(search_msg->mesg_desk_num)) {
                        cmp = strcmp(msg->mesg_desk_num, 
search_msg->mesg_desk_num);
                }
-               if (search_msg->mesg_desk_term) {
+               if (!ast_strlen_zero(search_msg->mesg_desk_term)) {
                        cmp |= strcmp(msg->mesg_desk_term, 
search_msg->mesg_desk_term);
                }
                break;


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to