Issue 96089 - vcl: ambiguous && || sequence
Summary: vcl: ambiguous && || sequence
Status: CLOSED FIXED
Alias: None
Product: gsl
Classification: Code
Component: code (show other issues)
Version: DEV300m35
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 3.1
Assignee: caolanm
QA Contact: issues@gsl
URL:
Keywords:
Depends on:
Blocks: 96084
  Show dependency tree
 
Reported: 2008-11-11 11:32 UTC by caolanm
Modified: 2008-12-12 11:49 UTC (History)
1 user (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
dodgy code (1.60 KB, patch)
2008-11-11 11:32 UTC, caolanm
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description caolanm 2008-11-11 11:32:02 UTC
X && Y || Z
binds operator precedence-wise as
(X && Y) || Z
not
X && (Y || Z)

so I am a little suspicious about...

vcl/source/window/menu.cxx
if ( ImplIsVisible( i ) && ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType
== MENUITEM_STRINGIMAGE ))
which means
if ( (ImplIsVisible( i ) && ( pData->eType == MENUITEM_IMAGE )) || (
pData->eType == MENUITEM_STRINGIMAGE ))
is that what we really mean, or do we mean
if ( ImplIsVisible( i ) && (( pData->eType == MENUITEM_IMAGE ) || ( pData->eType
== MENUITEM_STRINGIMAGE )))
seeing as both MENUITEMs refer to "image"s of one type of another ?

similarly in unx/gtk/gdi/salnativewidgets-gtk.cxx
there is a confusing sequence of && || where one of them (the menu) section is
slightly different to the other ones, which makes me suspicious that it might be
intended to be the same as the others.

If they're currently correct, then lets just stick some brackets around it to
confirm it, but if not then the following patch might be what was intended. Just
a guess though
Comment 1 caolanm 2008-11-11 11:32:27 UTC
Created attachment 57869 [details]
dodgy code
Comment 2 philipp.lohmann 2008-11-11 17:17:05 UTC
committed in CWS vcl96

thanks for noticing.
Comment 3 philipp.lohmann 2008-11-17 12:31:57 UTC
please verify in CWS vcl96
Comment 4 caolanm 2008-11-17 14:01:01 UTC
verified
Comment 5 caolanm 2008-12-12 11:49:41 UTC
seen in DEV300_m37