Archived issue #0032683

Coding Rules, XCAFDoc_Editor::CloneMetaData() - unexpected bitwise operations

Open CASCADEOCCT:Codingclosed7 public notes

Search issues

Description

XCAFDoc_Editor::CloneMetaData() implementation (#0028104) contains the following code:
  const Standard_Boolean toCopyColor = theToCopyColor & XCAFDoc_DocumentTool::CheckColorTool(theSrcLabel);
  const Standard_Boolean toCopyLayer = theToCopyLayer & XCAFDoc_DocumentTool::CheckLayerTool(theSrcLabel);
  const Standard_Boolean toCopyMaterial = theToCopyMaterial & XCAFDoc_DocumentTool::CheckMaterialTool(theSrcLabel);
  const Standard_Boolean toCopyVisMaterial = XCAFDoc_DocumentTool::CheckVisMaterialTool(theSrcLabel);


It seems that bitwise operators are used mistakenly instead of Boolean operators.

Steps to reproduce

N/A

Public activity

7 archived notes

Participants are labeled by their role within this record.

01Author
In addition, the tool messes up the Name of cloned label ignoring XCAFDoc_ShapeTool::AutoNaming() value and unconditionally generating some mess.

  // Name
  Handle(TDataStd_Name) aNameAttr;
  theSrcLabel.FindAttribute(TDataStd_Name::GetID(), aNameAttr);
  Handle(XCAFDoc_ShapeTool) aDstShapeTool = XCAFDoc_DocumentTool::ShapeTool(theDstLabel);
...
  else
  {
    Standard_SStream Stream;
    TopoDS_Shape aShape = aDstShapeTool->GetShape(theDstLabel);
    TopAbs::Print(aShape.ShapeType(), Stream);
    TCollection_AsciiString aName(Stream.str().c_str());
    TDataStd_Name::Set(theDstLabel, TCollection_ExtendedString(aName));


02Commenter 1
Branch [archived branch] has been created by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Fri Nov 26 01:26:49 2021 +0300

    0032683: Coding Rules, XCAFDoc_Editor::CloneMetaData() - unexpected bitwise operations
    
    Fixed problem with incorrect bitwise operators.
    Removed forced naming via cloning metadata
03Commenter 2
04Commenter 1
Branch [archived branch] has been updated forcibly by Commenter 2.

[revision removed]
05Commenter 3
All necessary changes are applied, no remarks.

Dear bugmaster,
please integrate.
OCCT - CR32683
Products - NOT.
06Commenter 6
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18166.60000000042 / 18390.6500000004 [-1.22%]
Products
Total CPU difference: 11658.820000000103 / 11648.280000000103 [+0.09%]
Windows-64-VC14:
OCCT
Total CPU difference: 19937.84375 / 19928.171875 [+0.05%]
Products
Total CPU difference: 13069.28125 / 13059.03125 [+0.08%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
07Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records