[haiku-bugs] [Haiku] #12892: [Patch] Tracker: Fix -Wlogical-not-parentheses

  • From: "mt" <trac@xxxxxxxxxxxx>
  • Date: Sun, 31 Jul 2016 11:00:19 -0000

#12892: [Patch] Tracker: Fix -Wlogical-not-parentheses
--------------------------------+------------------------------
 Reporter:  mt                  |        Owner:  nobody
     Type:  bug                 |       Status:  new
 Priority:  normal              |    Milestone:  Unscheduled
Component:  Kits/libtracker.so  |      Version:  R1/Development
 Keywords:                      |   Blocked By:
 Blocking:                      |  Has a Patch:  0
 Platform:  All                 |
--------------------------------+------------------------------
 * Modify if conditions [1], since BDirectory.InitCheck() returns B_NO_INIT
 on failture, but negating B_NO_INIT can"t be B_OK.
 * Modify if conditions [2], since BString.ICompare() returns 0 > or < 0 on
 on failture, negating it may not be 0.
 [1] http://cgit.haiku-
 
os.org/haiku/tree/src/kits/tracker/NodePreloader.cpp?id=8a12a74e81e7969b2b963f95bb27779b80dc9ad4#n168
 [2] http://cgit.haiku-
 
os.org/haiku/tree/src/kits/tracker/OpenWithWindow.cpp?id=8a12a74e81e7969b2b963f95bb27779b80dc9ad4#n639
 {{{
 /home/haiku/haiku/haiku/src/kits/tracker/NodePreloader.cpp:168:6: warning:
 logical not is only applied to the left hand side of this comparison
 [-Wlogical-not-parentheses]
         if (!dir.InitCheck() == B_OK)
             ^                ~~
 /home/haiku/haiku/haiku/src/kits/tracker/NodePreloader.cpp:168:6: note:
 add parentheses after the '!' to evaluate the comparison first
         if (!dir.InitCheck() == B_OK)
             ^
              (                      )
 /home/haiku/haiku/haiku/src/kits/tracker/NodePreloader.cpp:168:6: note:
 add parentheses around left hand side expression to silence this warning
         if (!dir.InitCheck() == B_OK)
             ^
             (               )

 /home/haiku/haiku/haiku/src/kits/tracker/OpenWithWindow.cpp:639:27:
 warning: logical not is only applied to the left hand side of this
 comparison [-Wlogical-not-parentheses]
         if (mimeType.Length() && !mimeType.ICompare(B_FILE_MIMETYPE) == 0)
                                  ^                                   ~~
 /home/haiku/haiku/haiku/src/kits/tracker/OpenWithWindow.cpp:639:27: note:
 add parentheses after the '!' to evaluate the comparison first
         if (mimeType.Length() && !mimeType.ICompare(B_FILE_MIMETYPE) == 0)
                                  ^
                                   (                                      )
 /home/haiku/haiku/haiku/src/kits/tracker/OpenWithWindow.cpp:639:27: note:
 add parentheses around left hand side expression to silence this warning
         if (mimeType.Length() && !mimeType.ICompare(B_FILE_MIMETYPE) == 0)
                                  ^
                                  (                                  )
 }}}

--
Ticket URL: <https://dev.haiku-os.org/ticket/12892>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: