1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0027772: Foundation Classes - define Standard_Boolean using C++ type "bool" instead of "unsigned int"

Code has been updated to remove no-op casts and implicit casts to Standard_Boolean.

Places of inproper use of Standard_Boolean instead of Standard_Integer
have been corrected:
- Bnd_Box, Bnd_Box2d
  Bit flags are now defined as private enum
- HLRAlgo_BiPoint, HLRAlgo_EdgesBlock, HLRBRep_EdgeData, HLRBRep_FaceData
  Bit flags are now defined as enum
- HLRAlgo_EdgeStatus, HLRBRep_BiPnt2D, HLRBRep_BiPoint
  Bit flags are now defined as bool fields
- HLRAlgo_PolyData
  Bit flags are now defined as Standard_Integer
- OSD_DirectoryIterator, OSD_FileIterator
  Boolean flag is now defined as Standard_Boolean
- ShapeAnalysis_Surface::SurfaceNewton()
  now returns Standard_Integer (values 0, 1 or 3)
- ChFi2d_FilletAlgo
  now uses TColStd_SequenceOfBoolean instead of TColStd_SequenceOfInteger
  for storing boolean flags

Method IFSelect_Dispatch::PacketsCount() has been dropped from interface.

ShapeFix_Solid::Status() has been fixed to decode requested status
instead of returning integer value.

TopOpeBRepBuild_Builder1 now defines map storing Standard_Boolean values
instead of Standard_Integer.

Persistence for Standard_Boolean type has been corrected
to keep backward compatibility:
- BinMDataStd, BinTools, FSD_BinaryFile

Broken Draw Harness commands vdisplaymode and verasemode have been removed.

BRepMesh_FastDiscretFace::initDataStructure() - workaround old gcc limitations

BRepMesh_IncrementalMesh::clear() - avoid ambiguity
This commit is contained in:
kgv
2016-08-25 14:58:51 +03:00
committed by abv
parent 3fe9ce0edd
commit dde6883382
211 changed files with 1324 additions and 2667 deletions

View File

@@ -336,7 +336,7 @@ static Standard_Boolean GetDangleShapes(const TopoDS_Shape& ShapeIn,
const TopTools_ListOfShape& ancestors = subShapeAndAncestors.FindFromIndex(i);
if (ancestors.Extent() == 1) Dangles.Bind(ancestors.First(), mayBeDangle);
}
return Dangles.Extent();
return !Dangles.IsEmpty();
}
//=======================================================================

View File

@@ -383,7 +383,7 @@ static Standard_Integer Collect (Draw_Interpretor& di,
if (!DDF::GetDF(arg[1],DF)) return 1;
if (!DDF::Find(DF,arg[2],TNaming_NamedShape::GetID(),A)) return 1;
if (nb >= 4) {
OnlyModif = Draw::Atoi(arg[3]);
OnlyModif = (Draw::Atoi(arg[3]) != 0);
}
TNaming_Tool::Collect(A,MNS,OnlyModif);
for (TNaming_MapIteratorOfMapOfNamedShape it(MNS); it.More(); it.Next()) {
@@ -484,7 +484,7 @@ static Standard_Integer CheckIter (Draw_Interpretor& di,
const TopoDS_Shape& aShape = DBRep::Get(arg[3]);
aNB.Generated(aShape);
TNaming_Iterator aNameIter(aLabel);
if(nb == 5) aNew = (Standard_Boolean) atoi(arg[4]);
if(nb == 5) aNew = (Draw::Atoi (arg[4]) != 0);
if(aNew) {
TNaming_NewShapeIterator aNewShapeIter(aNameIter);
di << "DNaming_CheckIterator : New It is OK\n";

View File

@@ -97,7 +97,7 @@ Standard_Integer DNaming_Line3DDriver::Execute(Handle(TFunction_Logbook)& theLog
}
const Standard_Integer aType = DNaming::GetInteger(aFunction, LINE3D_TYPE)->Get();
Standard_Boolean isClosed(aType);
Standard_Boolean isClosed = (aType != 0);
Standard_Integer aCounter(0), aLength = DNaming::GetInteger(aFunction, LINE3D_PNTNB)->Get();
if(aLength < 2) {
aFunction->SetFailure(WRONG_ARGUMENT);

View File

@@ -682,10 +682,10 @@ static Standard_Integer DNaming_AttachShape (Draw_Interpretor& di,
aResultLabel.ForgetAllAttributes(Standard_True);
Standard_Boolean aKeepOrientation(Standard_False);
if (nb >= 6)
aKeepOrientation = (Standard_Boolean) Draw::Atoi(a[5]);
aKeepOrientation = Draw::Atoi(a[5]) != 0;
Standard_Boolean aGeometry(Standard_False);
if (nb == 7)
aGeometry = (Standard_Boolean) Draw::Atoi(a[6]);
aGeometry = Draw::Atoi(a[6]) != 0;
Handle(TNaming_NamedShape) aCont = DNaming::GetObjectValue(aContext);
#ifdef OCCT_DEBUG
if(aCont.IsNull() || aCont->IsEmpty())
@@ -759,10 +759,10 @@ static Standard_Integer DNaming_XAttachShape (Draw_Interpretor& di,
aResultLabel.ForgetAllAttributes(Standard_True);
Standard_Boolean aKeepOrientation(Standard_False);
if (nb >= 5)
aKeepOrientation = (Standard_Boolean) Draw::Atoi(a[4]);
aKeepOrientation = Draw::Atoi(a[4]) != 0;
Standard_Boolean aGeometry(Standard_False);
if (nb == 6)
aGeometry = (Standard_Boolean) Draw::Atoi(a[5]);
aGeometry = Draw::Atoi(a[5]) != 0;
Handle(TNaming_NamedShape) aCont = DNaming::GetObjectValue(aContext);
if(aCont.IsNull() || aCont->IsEmpty())
@@ -1536,17 +1536,17 @@ static Standard_Integer DNaming_PntOffset (Draw_Interpretor& theDI,
Handle(TFunction_Function) aFun = GetFunction(objLabel,funGUID);
if(!aFun.IsNull()) {
Standard_Real value(0.0);
Standard_Boolean isDX = (strcmp(theArg[3],"skip"));
Standard_Boolean isDX = strcmp(theArg[3],"skip") != 0;
if(isDX) {
value = Draw::Atof(theArg[3]);
DNaming::GetReal(aFun,PNT_DX)->Set(value);
}
Standard_Boolean isDY = (strcmp(theArg[4],"skip"));
Standard_Boolean isDY = strcmp(theArg[4],"skip") != 0;
if(isDY) {
value = Draw::Atof(theArg[4]);
DNaming::GetReal(aFun,PNT_DY)->Set(value);
}
Standard_Boolean isDZ = (strcmp(theArg[5],"skip"));
Standard_Boolean isDZ = strcmp(theArg[5],"skip") != 0;
if(isDZ) {
value = Draw::Atof(theArg[5]);
DNaming::GetReal(aFun,PNT_DZ)->Set(value);
@@ -1903,11 +1903,11 @@ static Standard_Integer DNaming_TestSingle (Draw_Interpretor& theDI,
Standard_Boolean XSelection(Standard_False);
Standard_Boolean Geometry(Standard_False);
if(theNb == 4)
Orientation = (Standard_Boolean)Draw::Atoi(theArg[3]);
Orientation = Draw::Atoi(theArg[3]) != 0;
if(theNb == 5)
XSelection = (Standard_Boolean)Draw::Atoi(theArg[4]);
XSelection = Draw::Atoi(theArg[4]) != 0;
if (theNb == 6)
Geometry = (Standard_Boolean) Draw::Atoi(theArg[5]);
Geometry = Draw::Atoi(theArg[5]) != 0;
Handle(TNaming_NamedShape) aNS = DNaming::GetObjectValue( aCntObj);
if(!aNS.IsNull() && !aNS->IsEmpty()) {
@@ -2042,11 +2042,11 @@ static Standard_Integer DNaming_Multiple (Draw_Interpretor& theDI,
Standard_Boolean XSelection(Standard_False);
Standard_Boolean Geometry(Standard_False);
if(theNb == 4)
Orientation = (Standard_Boolean)Draw::Atoi(theArg[3]);
Orientation = Draw::Atoi(theArg[3]) != 0;
if(theNb == 5)
XSelection = (Standard_Boolean)Draw::Atoi(theArg[4]);
XSelection = Draw::Atoi(theArg[4]) != 0;
if (theNb == 6)
Geometry = (Standard_Boolean) Draw::Atoi(theArg[5]);
Geometry = Draw::Atoi(theArg[5]) != 0;
Handle(TNaming_NamedShape) aNS = DNaming::GetObjectValue( aCntObj);
if(!aNS.IsNull() && !aNS->IsEmpty()) {

View File

@@ -123,7 +123,7 @@ static Standard_Integer DNaming_Select (Draw_Interpretor& di, Standard_Integer n
}
if (n > 4) {
Standard_Boolean Orient(Standard_False);
if(n == 6) Orient = (Standard_Boolean)Draw::Atoi(a[5]);
if(n == 6) Orient = (Draw::Atoi(a[5]) != 0);
TopoDS_Shape S = DBRep::Get(a[3], TopAbs_SHAPE);
TopoDS_Shape C = DBRep::Get(a[4], TopAbs_SHAPE);
SL.Select (S, C, geometry, Orient);