Issue 113185 - sw: && || ambiguity in docftn.cxx
Summary: sw: && || ambiguity in docftn.cxx
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: DEV300m84
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: 3.4.0
Assignee: caolanm
QA Contact: issues@sw
URL:
Keywords:
Depends on:
Blocks: 96084
  Show dependency tree
 
Reported: 2010-07-16 11:27 UTC by caolanm
Modified: 2017-05-20 10:22 UTC (History)
2 users (show)

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


Attachments
version 1, keep logic silence gcc warnings (907 bytes, patch)
2010-07-16 11:27 UTC, caolanm
no flags Details | Diff
version 2, change logic, small possibility that is what was intended (838 bytes, patch)
2010-07-16 11:28 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 2010-07-16 11:27:18 UTC
in sw/source/core/doc/docftn we have...

BOOL bExtra   = !bNumChg &&   
  rInfo.aFmt.GetNumberingType() != GetEndNoteInfo().aFmt.GetNumberingType()||
  rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix() ||
  rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix();

by precedence this is...

BOOL bExtra = 
  (
    !bNumChg && rInfo.aFmt.GetNumberingType() !=
    GetEndNoteInfo().aFmt.GetNumberingType()
  )
  || rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix()
  || rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix();

but there's a small possibility we might have meant

BOOL bExtra = !bNumChg &&
(
  rInfo.aFmt.GetNumberingType() != GetEndNoteInfo().aFmt.GetNumberingType() ||
  rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix() ||
  rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix()
);
Comment 1 caolanm 2010-07-16 11:27:43 UTC
Created attachment 70644 [details]
version 1, keep logic silence gcc warnings
Comment 2 caolanm 2010-07-16 11:28:04 UTC
Created attachment 70645 [details]
version 2, change logic, small possibility that is what was intended
Comment 3 mst.ooo 2010-07-20 17:52:41 UTC
.
Comment 4 mst.ooo 2010-07-20 18:00:23 UTC
after some digging around i think that the bExtra variable is an optimization to
prevent calling an expensive update function.
thus the conditional is indeed buggy, and the second fix is the right one.
i've added a bit of comment for future maintainers.

fixed in cws sw34bf01
http://hg.services.openoffice.org/hg/cws/sw34bf01/rev/f5a2e2bba058
Comment 5 mst.ooo 2010-10-07 11:06:53 UTC
please verify
Comment 6 caolanm 2010-10-07 11:13:32 UTC
verified