Coding - Moving to Sprintf call (#675)

- Updates function calls from `sprintf` to `Sprintf` across the entire codebase
- Updates comments and documentation references to reflect the new function name
- Adds format attribute annotations to the `Sprintf` function declaration for better compiler validation
This commit is contained in:
Pasukhin Dmitry
2025-08-17 12:45:30 +01:00
committed by GitHub
parent 45eefc4134
commit 5ae60b51d3
130 changed files with 522 additions and 503 deletions
@@ -688,7 +688,7 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
// Temporary
// char* name = new char[100];
// sprintf(name, "c%d", i);
// Sprintf(name, "c%d", i);
// DrawTrSurf::Set(name, tab(i-1));
if (i > 1)
@@ -550,7 +550,7 @@ void BRepAlgo_Loop::Perform()
std::cout << "NewLoop" << std::endl;
NbLoops++;
#ifdef DRAW
sprintf(name, "FLoop_%d", NbLoops);
Sprintf(name, "FLoop_%d", NbLoops);
DBRep::Set(name, myFace);
Standard_Integer NbEdges = 1;
#endif
@@ -558,7 +558,7 @@ void BRepAlgo_Loop::Perform()
{
const TopoDS_Edge& E = TopoDS::Edge(itl.Value());
#ifdef DRAW
sprintf(name, "EEE_%d_%d", NbLoops, NbEdges++);
Sprintf(name, "EEE_%d_%d", NbLoops, NbEdges++);
DBRep::Set(name, E);
#endif
}
@@ -566,7 +566,7 @@ void BRepAlgo_Loop::Perform()
{
const TopoDS_Edge& E = TopoDS::Edge(itl.Value());
#ifdef DRAW
sprintf(name, "EEE_%d_%d", NbLoops, NbEdges++);
Sprintf(name, "EEE_%d_%d", NbLoops, NbEdges++);
DBRep::Set(name, E);
#endif
}
@@ -632,7 +632,7 @@ void BRepAlgo_Loop::Perform()
TopoDS_Edge& E = TopoDS::Edge(itl.Value());
if (Done.Add(E))
{
sprintf(name, "EEC_%d_%d", NbLoops, NbEdges++);
Sprintf(name, "EEC_%d_%d", NbLoops, NbEdges++);
DBRep::Set(name, E);
}
}
@@ -763,7 +763,7 @@ void BRepAlgo_Loop::Perform()
#ifdef DRAW
if (AffichLoop)
{
sprintf(name, "NW_%d_%d", NbLoops, NbWires++);
Sprintf(name, "NW_%d_%d", NbLoops, NbWires++);
DBRep::Set(name, NW);
}
#endif
@@ -647,7 +647,7 @@ void BRepFill_Evolved::ElementaryPerform(const TopoDS_Face& Sp,
if (AffichEdge)
{
char name[100];
sprintf(name, "PROFIL_%d", ++NbPROFILS);
Sprintf(name, "PROFIL_%d", ++NbPROFILS);
DBRep::Set(name, Pr);
}
#endif
@@ -962,7 +962,7 @@ void BRepFill_Evolved::ElementaryPerform(const TopoDS_Face& Sp,
if (AffichEdge)
{
char name[100];
sprintf(name, "ARCEDGE_%d_%d_%d", i, vv, Ti);
Sprintf(name, "ARCEDGE_%d_%d_%d", i, vv, Ti);
DBRep::Set(name, CurrentEdge);
}
#endif
@@ -1141,7 +1141,7 @@ void BRepFill_Evolved::ElementaryPerform(const TopoDS_Face& Sp,
if (AffichEdge)
{
char name[100];
sprintf(name, "PAREDGE_%d_%d", ++NbEDGES, k);
Sprintf(name, "PAREDGE_%d_%d", ++NbEDGES, k);
DBRep::Set(name, aSeqOfShape.Value(k));
}
#endif
@@ -1185,7 +1185,7 @@ void BRepFill_Evolved::ElementaryPerform(const TopoDS_Face& Sp,
if (AffichEdge)
{
char name[100];
sprintf(name, "PAREDGE_%d_%d", ++NbEDGES, k);
Sprintf(name, "PAREDGE_%d_%d", ++NbEDGES, k);
DBRep::Set(name, aSeqOfShape.Value(k));
}
#endif
@@ -1278,7 +1278,7 @@ void BRepFill_Evolved::ElementaryPerform(const TopoDS_Face& Sp,
{
std::cout << " End of construction of an elementary volevo." << std::endl;
char name[100];
sprintf(name, "VEVO_%d", ++NbVEVOS);
Sprintf(name, "VEVO_%d", ++NbVEVOS);
DBRep::Set(name, myShape);
}
#endif
@@ -1391,7 +1391,7 @@ void BRepFill_Evolved::PlanarPerform(const TopoDS_Face& Sp,
for (; it.More(); it.Next())
{
char name[100];
sprintf(name, "PARALI_%d", ++k);
Sprintf(name, "PARALI_%d", ++k);
DBRep::Set(name, it.Value());
}
}
@@ -1501,7 +1501,7 @@ void BRepFill_Evolved::VerticalPerform(const TopoDS_Face& Sp,
if (AffichEdge)
{
char name[100];
sprintf(name, "PARALI_%d", ++NbVEVOS);
Sprintf(name, "PARALI_%d", ++NbVEVOS);
DBRep::Set(name, Base);
}
#endif
@@ -1511,7 +1511,7 @@ void BRepFill_Evolved::VerticalPerform(const TopoDS_Face& Sp,
if (AffichEdge)
{
char name[100];
sprintf(name, "PRISM_%d", NbVEVOS);
Sprintf(name, "PRISM_%d", NbVEVOS);
DBRep::Set(name, PS.Shape());
}
#endif
@@ -1803,7 +1803,7 @@ void BRepFill_Evolved::PrepareSpine(TopoDS_Face& WorkSpine,
if (AffichEdge)
{
char name[100];
sprintf(name, "workspine");
Sprintf(name, "workspine");
DBRep::Set(name, WorkSpine);
}
#endif
@@ -2280,9 +2280,9 @@ void BRepFill_Evolved::MakePipe(const TopoDS_Edge& SE, const gp_Ax3& AxeRef)
if (AffichGeom)
{
char name[100];
sprintf(name, "EVOLBASE_%d", ++NbFACES);
Sprintf(name, "EVOLBASE_%d", ++NbFACES);
DBRep::Set(name, SE);
sprintf(name, "EVOLPROF_%d", NbFACES);
Sprintf(name, "EVOLPROF_%d", NbFACES);
DBRep::Set(name, GenProf);
}
#endif
@@ -2294,7 +2294,7 @@ void BRepFill_Evolved::MakePipe(const TopoDS_Edge& SE, const gp_Ax3& AxeRef)
if (AffichGeom)
{
char name[100];
sprintf(name, "EVOL_%d", ++NbFACES);
Sprintf(name, "EVOL_%d", ++NbFACES);
DBRep::Set(name, Pipe.Shape());
}
#endif
@@ -2367,13 +2367,13 @@ void BRepFill_Evolved::MakeRevol(const TopoDS_Edge& SE,
if (AffichGeom)
{
char name[100];
sprintf(name, "EVOLBASE_%d", ++NbFACES);
Sprintf(name, "EVOLBASE_%d", ++NbFACES);
DrawTrSurf::Set(name, new Geom_Line(AxeRev));
// DrawTrSurf::Set(name,new Geom_Line(AxeRev));
sprintf(name, "EVOLPROF_%d", NbFACES);
Sprintf(name, "EVOLPROF_%d", NbFACES);
DBRep::Set(name, GenProf);
sprintf(name, "EVOL_%d", NbFACES);
Sprintf(name, "EVOL_%d", NbFACES);
DBRep::Set(name, Rev.Shape());
}
#endif
@@ -2463,10 +2463,10 @@ void BRepFill_Evolved::TransformInitWork(const TopLoc_Location& LS, const TopLoc
if (AffichEdge)
{
char name[100];
sprintf(name, "movedspine");
Sprintf(name, "movedspine");
TopoDS_Face SL = mySpine;
DBRep::Set(name, SL);
sprintf(name, "movedprofile");
Sprintf(name, "movedprofile");
TopoDS_Wire PL = myProfile;
DBRep::Set(name, PL);
}
@@ -2673,7 +2673,7 @@ void TrimFace(const TopoDS_Face& Face,
std::cout << " : " << NB << " edges within the restriction" << std::endl;
for (Standard_Integer j = 1; j <= NB; j++)
{
sprintf(name, "TRIMEDGE_%d_%d", NbTRIMFACES, j);
Sprintf(name, "TRIMEDGE_%d_%d", NbTRIMFACES, j);
DBRep::Set(name, TopoDS::Edge(TheEdges.Value(j)));
}
}
@@ -502,11 +502,11 @@ void BRepFill_MultiLine::Curves(Handle(Geom_Curve)& Curve,
if (AffichCurve)
{
char name[100];
sprintf(name, "C2_%d", NbProj);
Sprintf(name, "C2_%d", NbProj);
DrawTrSurf::Set(name, TLine);
sprintf(name, "C3_%d", NbProj);
Sprintf(name, "C3_%d", NbProj);
DrawTrSurf::Set(name, Curve);
sprintf(name, "SS_%d", NbProj);
Sprintf(name, "SS_%d", NbProj);
DrawTrSurf::Set(name, Plane);
NbProj++;
}
@@ -380,7 +380,7 @@ BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S,
{
NBSECT++;
char name[256];
sprintf(name, "WIRE_%d", NBSECT);
Sprintf(name, "WIRE_%d", NBSECT);
DBRep::Set(name, TopoDS::Wire(S.Value(i)));
}
#endif
@@ -562,7 +562,7 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal& P, const Standard_Bo
if (Affich)
{
char* name = new char[100];
sprintf(name, "Ref_Surf");
Sprintf(name, "Ref_Surf");
DrawTrSurf::Set(name, mySurface);
}
#endif
@@ -824,7 +824,7 @@ void BRepFill_OffsetWire::PerformWithBiLo(const TopoDS_Face& Spine,
if (AffichGeom)
{
char name[256];
sprintf(name, "BISSEC_%d", NbBISSEC++);
Sprintf(name, "BISSEC_%d", NbBISSEC++);
DrawTrSurf::Set(name, Bisec.Value());
}
#endif
@@ -2052,7 +2052,7 @@ void MakeCircle(const TopoDS_Edge& E,
if (AffichGeom && !OE.IsNull())
{
char name[256];
sprintf(name, "OFFSET_%d", ++NbOFFSET);
Sprintf(name, "OFFSET_%d", ++NbOFFSET);
DBRep::Set(name, OE);
}
#endif
@@ -2182,7 +2182,7 @@ void MakeOffset(const TopoDS_Edge& E,
if (AffichGeom && !OE.IsNull())
{
char name[256];
sprintf(name, "OFFSET_%d", ++NbOFFSET);
Sprintf(name, "OFFSET_%d", ++NbOFFSET);
DBRep::Set(name, OE);
// Standard_Real ii = 0;
}
@@ -2443,7 +2443,7 @@ void TrimEdge(const TopoDS_Edge& E,
if (AffichEdge)
{
char name[256];
sprintf(name, "TRIMEDGE_%d", NbTRIMEDGES);
Sprintf(name, "TRIMEDGE_%d", NbTRIMEDGES);
DBRep::Set(name, NewEdge);
}
if (Affich2d)
@@ -2454,7 +2454,7 @@ void TrimEdge(const TopoDS_Edge& E,
Handle(Geom2d_Curve) C;
BRep_Tool::CurveOnSurface(NewEdge, C, Surf, L, f, l);
char name[256];
sprintf(name, "OFFSET2d_%d", NbTRIMEDGES++);
Sprintf(name, "OFFSET2d_%d", NbTRIMEDGES++);
Handle(Geom2d_TrimmedCurve) C2d = new Geom2d_TrimmedCurve(C, f, l);
Handle(DrawTrSurf_Curve2d) dr = new DrawTrSurf_Curve2d(C2d, Standard_False);
dr->SetColor(Draw_bleu);
@@ -1107,7 +1107,7 @@ void BRepFill_PipeShell::Prepare()
for (Standard_Integer i = 1; i <= WSeq.Length(); i++)
{
NBSECT++;
sprintf(name, "WSeq_%d", NBSECT);
Sprintf(name, "WSeq_%d", NBSECT);
DBRep::Set(name, TopoDS::Wire(WSeq.Value(i)));
}
}
@@ -798,11 +798,11 @@ static TopoDS_Edge BuildEdge(Handle(Geom_Curve)& C3d,
{ // Error of construction !!
#ifdef DRAW
char name[100];
sprintf(name, "firstvertex_error");
Sprintf(name, "firstvertex_error");
DBRep::Set(name, VF);
sprintf(name, "lastvertex_error");
Sprintf(name, "lastvertex_error");
DBRep::Set(name, VL);
sprintf(name, "curve3d_error");
Sprintf(name, "curve3d_error");
char* Temp = name;
DrawTrSurf::Set(Temp, C3d);
// DrawTrSurf::Set(name, C3d);
@@ -1573,11 +1573,11 @@ static TopoDS_Edge BuildEdge(const Handle(Geom_Surface)& S,
{ // Erreur de construction !!
#ifdef DRAW
char name[100];
sprintf(name, "firstvertex_error");
Sprintf(name, "firstvertex_error");
DBRep::Set(name, VFirst);
sprintf(name, "lastvertex_error");
Sprintf(name, "lastvertex_error");
DBRep::Set(name, VLast);
sprintf(name, "curve3d_error");
Sprintf(name, "curve3d_error");
char* Temp = name;
DrawTrSurf::Set(Temp, Iso);
// DrawTrSurf::Set(name,Iso);
@@ -2129,11 +2129,11 @@ Standard_Boolean BRepFill_Sweep::BuildWire(const BRepFill_TransitionStyle /*Tran
{ // Error of construction !!
#ifdef DRAW
char name[100];
sprintf(name, "firstvertex_error");
Sprintf(name, "firstvertex_error");
DBRep::Set(name, myVEdges->Value(1, ipath));
sprintf(name, "lastvertex_error");
Sprintf(name, "lastvertex_error");
DBRep::Set(name, myVEdges->Value(1, ipath + 1));
sprintf(name, "curve3d_error");
Sprintf(name, "curve3d_error");
char* Temp = name;
DrawTrSurf::Set(Temp, Iso);
// DrawTrSurf::Set(name,Iso);
@@ -2145,11 +2145,11 @@ Standard_Boolean BRepFill_Sweep::BuildWire(const BRepFill_TransitionStyle /*Tran
#ifdef DRAW
if (Affich)
{
sprintf(name, "Surf_%d", ipath);
Sprintf(name, "Surf_%d", ipath);
char* Temp = name;
DrawTrSurf::Set(Temp, S);
// DrawTrSurf::Set(name, S);
sprintf(name, "Edge_%d", ipath);
Sprintf(name, "Edge_%d", ipath);
DBRep::Set(name, E);
}
#endif
@@ -2292,7 +2292,7 @@ Standard_Boolean BRepFill_Sweep::BuildShell(const BRepFill_TransitionStyle /*Tra
#ifdef DRAW
if (Affich)
{
sprintf(name, "Surf_%d_%d", isec, IPath);
Sprintf(name, "Surf_%d_%d", isec, IPath);
char* Temp = name;
DrawTrSurf::Set(Temp, TabS(isec, ipath));
}
@@ -2869,7 +2869,7 @@ Standard_Boolean BRepFill_Sweep::BuildShell(const BRepFill_TransitionStyle /*Tra
{
for (isec = 1; isec <= NbLaw + 1; isec++)
{
sprintf(name, "uedge_%d_%d", isec, IPath);
Sprintf(name, "uedge_%d_%d", isec, IPath);
DBRep::Set(name, UEdge(isec, ipath));
}
}
@@ -2878,13 +2878,13 @@ Standard_Boolean BRepFill_Sweep::BuildShell(const BRepFill_TransitionStyle /*Tra
{
for (isec = 1; isec <= NbLaw; isec++)
{
sprintf(name, "vedge_%d_%d", isec, IPath);
Sprintf(name, "vedge_%d_%d", isec, IPath);
DBRep::Set(name, VEdge(isec, ipath));
}
for (isec = 1; isec <= NbLaw + 1; isec++)
{
sprintf(name, "vertex_%d_%d", isec, IPath);
Sprintf(name, "vertex_%d_%d", isec, IPath);
DBRep::Set(name, Vertex(isec, ipath));
}
}
@@ -3675,9 +3675,9 @@ Standard_Boolean BRepFill_Sweep::PerformCorner(const Standard_Integer
char name[100];
DBRep::Set("TrimmedShell", TheShape);
for (jj=1; jj <=myFaces->ColLength(); jj++){
sprintf(name,"Tfaces_%d_%d", jj, I1);
Sprintf(name,"Tfaces_%d_%d", jj, I1);
DBRep::Set(name, myFaces->Value(jj, I1));
sprintf(name,"Tfaces_%d_%d", jj, I2);
Sprintf(name,"Tfaces_%d_%d", jj, I2);
DBRep::Set(name, myFaces->Value(jj, I2));
}
}
@@ -331,19 +331,19 @@ void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1,
f = AC1.FirstParameter();
l = AC1.LastParameter();
char name[32];
sprintf(name, "C1_%d", ++intind);
Sprintf(name, "C1_%d", ++intind);
DrawTrSurf::Set(name, new Geom2d_TrimmedCurve(C1, f, l));
f = AC2.FirstParameter();
l = AC2.LastParameter();
sprintf(name, "C2_%d", intind);
Sprintf(name, "C2_%d", intind);
DrawTrSurf::Set(name, new Geom2d_TrimmedCurve(C2, f, l));
f = myBis.FirstParameter();
l = myBis.LastParameter();
sprintf(name, "BIS%d", intind);
Sprintf(name, "BIS%d", intind);
DrawTrSurf::Set(name, new Geom2d_TrimmedCurve(myBis.Curve(), f, l));
sprintf(name, "E1_%d", intind);
Sprintf(name, "E1_%d", intind);
DBRep::Set(name, Edge1);
sprintf(name, "E2_%d", intind);
Sprintf(name, "E2_%d", intind);
DBRep::Set(name, Edge2);
}
#endif
@@ -97,19 +97,19 @@ BRepFill_TrimSurfaceTool::BRepFill_TrimSurfaceTool(const Handle(Geom2d_Curve)& B
#ifdef DRAW
char name[256];
sprintf(name, "FACE1_%d", NBCALL);
Sprintf(name, "FACE1_%d", NBCALL);
DBRep::Set(name, myFace1);
sprintf(name, "FACE2_%d", NBCALL);
Sprintf(name, "FACE2_%d", NBCALL);
DBRep::Set(name, myFace2);
sprintf(name, "EDGE1_%d", NBCALL);
Sprintf(name, "EDGE1_%d", NBCALL);
DBRep::Set(name, myEdge1);
sprintf(name, "EDGE2_%d", NBCALL);
Sprintf(name, "EDGE2_%d", NBCALL);
DBRep::Set(name, myEdge2);
sprintf(name, "BISSEC_%d", NBCALL);
Sprintf(name, "BISSEC_%d", NBCALL);
DrawTrSurf::Set(name, myBis);
#endif
}
@@ -403,10 +403,10 @@ void BRepFill_TrimSurfaceTool::IntersectWith(const TopoDS_Edge& EdgeOnF1,
{
char name[256];
Standard_Integer i1 = 0, i2 = 2;
sprintf(name, "EdgeOnF1_%d_%d", i1, NBCALL);
Sprintf(name, "EdgeOnF1_%d_%d", i1, NBCALL);
DBRep::Set(name, EdgeOnF1);
sprintf(name, "EdgeOnF2_%d_%d", i2, NBCALL);
Sprintf(name, "EdgeOnF2_%d_%d", i2, NBCALL);
DBRep::Set(name, EdgeOnF2);
}
@@ -330,11 +330,11 @@ Standard_Boolean TopOpeBRepTool_CurveTool::MakeCurves(const Standard_Real
#ifdef IFV
char name[16];
char* nm = &name[0];
sprintf(name, "C3D_%d", ++NbCalls);
Sprintf(name, "C3D_%d", ++NbCalls);
DrawTrSurf::Set(nm, C3D);
sprintf(name, "PC1_%d", NbCalls);
Sprintf(name, "PC1_%d", NbCalls);
DrawTrSurf::Set(nm, PC1);
sprintf(name, "PC2_%d", NbCalls);
Sprintf(name, "PC2_%d", NbCalls);
DrawTrSurf::Set(nm, PC2);
#endif
//*/
@@ -515,13 +515,13 @@ Standard_Boolean TopOpeBRepTool_CurveTool::MakeCurves(const Standard_Real
iparmax = NbPol;
#ifdef IFV
sprintf(name, "C3Dmod_%d", NbCalls);
Sprintf(name, "C3Dmod_%d", NbCalls);
nm = &name[0];
DrawTrSurf::Set(nm, C3D);
sprintf(name, "PC1mod_%d", NbCalls);
Sprintf(name, "PC1mod_%d", NbCalls);
nm = &name[0];
DrawTrSurf::Set(nm, PC1);
sprintf(name, "PC2mod_%d", NbCalls);
Sprintf(name, "PC2mod_%d", NbCalls);
nm = &name[0];
DrawTrSurf::Set(nm, PC2);
#endif
@@ -743,18 +743,18 @@ Standard_Boolean TopOpeBRepTool_CurveTool::MakeCurves(const Standard_Real
}
#ifdef IFV
sprintf(name, "C3Dnew_%d", NbCalls);
Sprintf(name, "C3Dnew_%d", NbCalls);
nm = &name[0];
DrawTrSurf::Set(nm, C3Dnew);
if (CompPC1)
{
sprintf(name, "PC1new_%d", NbCalls);
Sprintf(name, "PC1new_%d", NbCalls);
nm = &name[0];
DrawTrSurf::Set(nm, PC1new);
}
if (CompPC2)
{
sprintf(name, "PC2new_%d", NbCalls);
Sprintf(name, "PC2new_%d", NbCalls);
nm = &name[0];
DrawTrSurf::Set(nm, PC2new);
}