Issue 96163 - sd: ambiguous && ||
Summary: sd: ambiguous && ||
Status: CLOSED FIXED
Alias: None
Product: Draw
Classification: Application
Component: code (show other issues)
Version: DEV300m35
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 3.1
Assignee: sven.jacobi
QA Contact: issues@graphics
URL:
Keywords:
Depends on:
Blocks: 96084
  Show dependency tree
 
Reported: 2008-11-12 16:36 UTC by caolanm
Modified: 2009-05-29 10:35 UTC (History)
1 user (show)

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


Attachments
I suspect this was what was intended (2.63 KB, patch)
2008-11-12 16:38 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-12 16:36:57 UTC
In three places 
source/filter/grf/sdgrffilter.cxx
source/ui/view/drviews8.cxx
source/ui/view/drviews9.cxx
we have the pattern of..

if ((aSize.Height() > aPageSize.Height()) ||
        (aSize.Width()  > aPageSize.Width()) &&
        aSize.Height() && aPageSize.Height())

which by operator precedence is equivalent to

if (
    (aSize.Height() > aPageSize.Height()) ||
    (
     (aSize.Width() > aPageSize.Width()) &&
     aSize.Height() && aPageSize.Height()
    )
   )

That doesn't looks quite right, I suspect we intend

if (
    (
     (aSize.Height() > aPageSize.Height()) ||
     (aSize.Width() > aPageSize.Width())
    ) &&
    aSize.Height() && aPageSize.Height()
   )

If so, then the attached patch fixes the three places using this pattern.
Otherwise some extra brackets to make the logic explicit might be called for
Comment 1 caolanm 2008-11-12 16:38:04 UTC
Created attachment 57945 [details]
I suspect this was what was intended
Comment 2 ooo 2008-11-17 10:40:16 UTC
KA=>SJ: could you verify this patch, please?
Comment 3 sven.jacobi 2008-11-20 18:16:24 UTC
the patch has been applied in cws[sjfixes10]
Comment 4 caolanm 2009-05-29 10:35:24 UTC
closing