Opened 8 years ago

Closed 8 years ago

#12892 closed bug (fixed)

[Patch] Tracker: Fix -Wlogical-not-parentheses

Reported by: mt Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Kits/libtracker.so Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

  • 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)
                                 ^
                                 (                                  )

Attachments (1)

0027-Tracker-Fix-Wlogical-not-parentheses.patch (1.3 KB ) - added by mt 8 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 by mt, 8 years ago

patch: 01

comment:2 by pulkomandy, 8 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev50503.

Note: See TracTickets for help on using tickets.