DiscussionsIssue archiveOCCT:Foundation Classes

Archived issue #0023132

Suspicious code snippets

CommunityOCCT:Foundation Classesclosed11 public notes

Search issues

Description

I'm sending you a bunch of suspicios lines found some time ago while removing warnings. I didn't know the 100% proper fix, maybe you could take a look. Probably the "dead code" ones are intended, and the code was left there unused.
---
src\Aspect\Aspect.cxx , line 116
"cast truncates constant value" warning.
Changing to 0xFEE0u is warning-clean, but I don't know if it works.
--
if you search all around the code RWStepBasic for the string
 ent->Init(hasAprefix,aPrefix,aName);
you will see that in all these functions, in case of error, the failure message is added, but the values are used anyway.
In case of error the used variables have an undefined value.
--
TopOpeBRepTool\TopOpeBRepTool_mkTondgE.cxx , line 367

the return statement makes the remaining code in the scope never executed. Is this intended?
---
GeomFill\GeomFill_LocationGuide.cxx, line 745
the return statement makes the whole scope dead code. Is this intended?
----
src\IntTools\IntTools_EdgeFace.cxx

Line 901 : you see there's a return 0 in a scope, that makes the remaining of the function dead code. Is it intended?
---------
src\BRepFill\BRepFill_OffsetWire.cxx , line 622

  if (CT2d->BasisCurve()->IsKind(STANDARD_TYPE(Geom2d_Circle)) &&
      ( Abs(f-l) >= M_PI) ) {
    return 0; //

the return makes the remaining scope dead code. Is it intended?
--------
src\TopOpeBRep\TopOpeBRep_ShapeIntersector2d.cxx , line 281
the NextFFCouple() line is never executed
---
src\V2d\V2d_RectangularGraphicGrid.cxx , line 71
 alpha = Standard_ShortReal ( alpha - 1.57/2.0 );
that is probably PI / 4
and in the line above the two 1.57 are just PI / 2
maybe the 1.41 is sqrt(2) ?
---
src\IFSelect\IFSelect_WorkSession.cxx , line 2825

  thecheckana = TCollection_AsciiString (' ',nb+1);
probably the constructor parameters are reversed, should be nb+1,' '
---

Public activity

11 archived notes

Participants are labeled by their role within this record.

01Commenter 1
I suggest we create separate issues (children of this one) per problem type / OCCT module, to simplify code review.
02Author
should I do that?
how can I create a "child" issue? or the relationship is assigned after the creation?
03Commenter 3
Author: I hope Dmitry will create child issues, though if you wish you can do this as well. The relationships between issues are set after the issues are created (see block 'Relationships').
04Author
I cannot set the relashionships, probably I don't have the rights.
I have added other issues related to this one, you may want to set these related to this one too.
05Commenter 5
Dear OAN,
Fix is is integrated into branch CR23132.
Please, review.
06Commenter 3
Dear JGV,
please review the changes.
07Commenter 7
No remarks
08Commenter 4
Dear Commenter 2,
Branch CR23132(and products from GIT master) was compiled on Linux and Windows platforms and tested.

Regression:
boolean bfuse_complex Q8 Q9
caf named_shape E8
caf driver A8

Improvements:
Not detected

Testing case:
Not needed
09Commenter 9
Dear apn,
I've fixed the mistake that led to fails in test cases, that you mentioned.
Please, test.
10Commenter 10
Dear Commenter 2,
Branch CR23132 (and products from occt GIT master) was compiled on Linux and Windows platforms and tested.

Regressions:
Not detected

Improvements:
Not detected

Testing cases:
Not needed

11Commenter 11
Dear Commenter 2,
Branch CR23132 (and products from occt GIT master) was compiled on Linux and Windows platforms and retested.

Regressions:
Not detected

Improvements:
Not detected

Testing cases:
Not needed

Related records