]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
clang compiler warnings: Fix pointer-bool-converesion warnings
authorMatthew Jordan <mjordan@digium.com>
Wed, 8 Apr 2015 11:44:32 +0000 (11:44 +0000)
committerMatthew Jordan <mjordan@digium.com>
Wed, 8 Apr 2015 11:44:32 +0000 (11:44 +0000)
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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434286 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_minivm.c
apps/app_queue.c
channels/chan_pjsip.c
res/res_smdi.c

index fc4f9a274f9db46dc2c0fe4c81d52dd96f57ed7e..45d04d8ba6e4752489743b81ec2e3a05fe28da04 100644 (file)
@@ -1838,7 +1838,8 @@ static int notify_new_message(struct ast_channel *chan, const char *templatename
                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 @@ static int notify_new_message(struct ast_channel *chan, const char *templatename
 
 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;
 }
index 9e5b8f51947273d3a0cd09e108f30135315f7c07..2e6b10c4d00166616e963fc17f36029e0a5dbc10 100644 (file)
@@ -6684,7 +6684,7 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a
                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");
@@ -9088,7 +9088,7 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
                                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, ")");
index 3ccaef03c974d9dec1958155c9683d137d9d1deb..c9d09dbeb17c491d5048db4644f950f0e5e730be 100644 (file)
@@ -1892,12 +1892,6 @@ static int sendtext(void *obj)
                .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");
 
        ast_sip_create_request("MESSAGE", data->session->inv_session->dlg, data->session->endpoint, NULL, NULL, &tdata);
index c7e0ab29ab2587869cb9a28621a40c2b69b1ab1d..7a63fe46aa0bec33a9871ddced2db76bc4ec7cb6 100644 (file)
@@ -873,10 +873,10 @@ static int smdi_md_q_cmp_fn(void *obj, void *arg, int flags)
 
        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;