]> 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:42:10 +0000 (11:42 +0000)
committerMatthew Jordan <mjordan@digium.com>
Wed, 8 Apr 2015 11:42:10 +0000 (11:42 +0000)
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)

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

apps/app_minivm.c
apps/app_queue.c

index 26db3969b595979bcfcd3833641aba4e365445f8..ecdf9c677507aee8a34f085de8bf9293c35fa634 100644 (file)
@@ -1819,7 +1819,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);
                }
@@ -1830,9 +1831,8 @@ static int notify_new_message(struct ast_channel *chan, const char *templatename
        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;
 }
index d0511b959513882e0195b9d6e84ef6e2edab1dbe..907e396f37b8ceacc8cda6fcccc6bd26567acf6f 100644 (file)
@@ -5697,7 +5697,7 @@ static int try_calling(struct queue_ent *qe, const struct ast_flags opts, char *
                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 @@ 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, ")");