Issue 96112 - sw: ambiguous && ||
Summary: sw: ambiguous && ||
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: DEV300m35
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: Oliver Specht
QA Contact: issues@sw
URL:
Keywords:
Depends on:
Blocks: 96084
  Show dependency tree
 
Reported: 2008-11-11 16:49 UTC by caolanm
Modified: 2013-08-07 14:43 UTC (History)
1 user (show)

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


Attachments
suspicious code (924 bytes, patch)
2008-11-11 16:50 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 16:49:42 UTC
In sw/source/ui/uiview/srcview.cxx
we have

if ( rHint.ISA(SfxSimpleHint) &&
 (((SfxSimpleHint&) rHint).GetId() == SFX_HINT_MODECHANGED) ||
  (((SfxSimpleHint&) rHint).GetId() == SFX_HINT_TITLECHANGED &&
  !GetDocShell()->IsReadOnly() && aEditWin.IsReadonly()))

operator precedence means that this means...

if (
    (
     rHint.ISA(SfxSimpleHint) &&
     (((SfxSimpleHint&) rHint).GetId() == SFX_HINT_MODECHANGED)
    ) ||
    (
     ((SfxSimpleHint&) rHint).GetId() == SFX_HINT_TITLECHANGED &&
     !GetDocShell()->IsReadOnly() && aEditWin.IsReadonly()
    )
   )

which doesn't look quite right, in that if rHint fails ISA SfxSimpleHint then we
move to the other leg and cast it to a SfxSimpleHint anyway.

Not sure what we actually intend here, attached is one possibility.
Comment 1 caolanm 2008-11-11 16:50:01 UTC
Created attachment 57898 [details]
suspicious code
Comment 2 andreas.martens 2009-01-19 08:11:33 UTC
Fixed in CWS sw31bf02.
Comment 3 andreas.martens 2009-01-19 08:12:04 UTC
.
Comment 4 andreas.martens 2009-01-23 13:31:18 UTC
Ready for QA ;-)
Comment 5 Oliver Specht 2009-01-26 09:03:32 UTC
verified in cws sw31bf02
Comment 6 caolanm 2009-03-23 16:21:28 UTC
closed, integrated