Issue 96083 - goodies: dubious && and ||
Summary: goodies: dubious && and ||
Status: CLOSED FIXED
Alias: None
Product: Draw
Classification: Application
Component: code (show other issues)
Version: DEV300m31
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 3.2
Assignee: sven.jacobi
QA Contact: issues@graphics
URL:
Keywords:
Depends on:
Blocks: 96084
  Show dependency tree
 
Reported: 2008-11-11 09:09 UTC by caolanm
Modified: 2017-05-20 11:43 UTC (History)
1 user (show)

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


Attachments
I bet this is what we really mean (2.06 KB, patch)
2008-11-11 09:10 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 09:09:52 UTC
X && Y || Z
binds operator precedence-wise as...
(X && Y) || Z

There are three suspicious cases of this in goodies

i.e.

source/filter.vcl/eps/eps.cxx
while ( ( --nSecurityCount ) && ( *pDest == ' ' ) || ( *pDest == 0x9 ) ) pDest++;

i.e. means...

while ( (( --nSecurityCount ) && ( *pDest == ' ' )) || ( *pDest == 0x9 ) ) pDest++;


source/filter.vcl/ieps/ieps.cxx
while ( ( --nSecurityCount ) && ( **pBuf == ' ' ) || ( **pBuf == 0x9 ) ) (*pBuf)++;

i.e. means

while ( (( --nSecurityCount ) && ( **pBuf == ' ' )) || ( **pBuf == 0x9 ) )
(*pBuf)++;

and

if( bEnlarge &&
    rCropLeftTop.Width() < 0 ||
    rCropLeftTop.Height() < 0 ||
    rCropRightBottom.Width() < 0 ||
    rCropRightBottom.Height() < 0 )

i.e. means

if( (bEnlarge &&
    rCropLeftTop.Width() < 0) ||
    rCropLeftTop.Height() < 0 ||
    rCropRightBottom.Width() < 0 ||
    rCropRightBottom.Height() < 0 )

Those meanings look very suspicious to me, I suspect that the intention is as
the attached patch changes them to be.
Comment 1 caolanm 2008-11-11 09:10:26 UTC
Created attachment 57865 [details]
I bet this is what we really mean
Comment 2 ooo 2008-11-17 10:38:15 UTC
KA=>SJ: could you verify this patch, please?
Comment 3 sven.jacobi 2008-11-20 19:18:43 UTC
This patch has been applied to cws[sjfixes10]
Comment 4 caolanm 2009-03-23 12:56:03 UTC
This patch didn't end up in integrated-DEV300m40 sjfixes10 

is it in some other workspace ? (eis doesn't list it anywhere)
Comment 5 sven.jacobi 2009-03-23 14:44:29 UTC
sj@cmc: I am helpless, the patch does not make it into the master. I committed
the patch again in cws[impress169] rev 269872.
Comment 6 sven.jacobi 2009-05-05 16:16:18 UTC
The patch has been verified by af in cws[impress169]