1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

2 Commits

Author SHA1 Message Date
aln
a28be1eb2a Fixed errors 2022-06-30 00:22:19 +03:00
aln
835f8451ac Fixed memleak and va_end_missing issues 2022-06-28 17:03:14 +03:00
25 changed files with 55 additions and 36 deletions

View File

@@ -1948,7 +1948,7 @@ int mcrcomm_(integer *kop,
/* Local variables */
intptr_t ideb;
doublereal dtab[32000];
intptr_t itab[160] /* was [4][40] */;
intptr_t itab[160] = {0} /* was [4][40] */;
intptr_t ipre;
integer i__, j, k;
@@ -2522,7 +2522,7 @@ int AdvApp2Var_SysBase::mcrlist_(integer *ier) const
/* Local variables */
char cfmt[1];
doublereal dfmt;
doublereal dfmt = 0.0; // unused
integer ifmt, i__, nufmt, ntotal;
char subrou[7];
@@ -2667,7 +2667,7 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit,
integer i__1, i__2;
/* Local variables */
doublereal dfmt;
doublereal dfmt = 0.0; // unused
integer ifmt, iver;
char subr[7];
integer ksys , ibyte, irest, ier;

View File

@@ -77,7 +77,8 @@ static void ComputeTrsf2d(const Handle(TheWLine)& theline,
for(Standard_Integer i=1; i<=aNbPnts; i++)
{
const IntSurf_PntOn2S POn2S = theline->Point(i);
Standard_Real U,V;
Standard_Real U = 0.0;
Standard_Real V = 0.0;
(POn2S.*pfunc)(U,V);
aUmin = Min(U, aUmin);
aVmin = Min(V, aVmin);

View File

@@ -51,7 +51,7 @@ Standard_Boolean BinMDF_TagSourceDriver::Paste
BinObjMgt_RRelocationTable& ) const
{
Handle(TDF_TagSource) aTag = Handle(TDF_TagSource)::DownCast(theTarget);
Standard_Integer aValue;
const Standard_Integer aValue = -1;
Standard_Boolean ok = theSource >> aValue;
if (ok)
aTag->Set(aValue);

View File

@@ -73,7 +73,7 @@ Standard_Boolean BinMDataStd_IntPackedMapDriver::Paste
}
if(aSize) {
Handle(TColStd_HPackedMapOfInteger) aHMap = new TColStd_HPackedMapOfInteger ();
Standard_Integer aKey;
const Standard_Integer aKey = -1;
for(Standard_Integer i = 0; i< aSize; i++) {
Standard_Boolean ok = Source >> aKey;
if (!ok) {

View File

@@ -54,7 +54,7 @@ Standard_Boolean BinMDataStd_IntegerDriver::Paste
BinObjMgt_RRelocationTable& theRT) const
{
Handle(TDataStd_Integer) anAtt = Handle(TDataStd_Integer)::DownCast(theTarget);
Standard_Integer aValue;
const Standard_Integer aValue = -1;
Standard_Boolean ok = theSource >> aValue;
if (ok)
anAtt->Set(aValue);

View File

@@ -54,7 +54,7 @@ Standard_Boolean BinMDataStd_RealDriver::Paste
BinObjMgt_RRelocationTable& theRelocTable) const
{
Handle(TDataStd_Real) anAtt= Handle(TDataStd_Real)::DownCast(theTarget);
Standard_Real aValue;
Standard_Real aValue = -1.0;
Standard_Boolean ok = theSource >> aValue;
if (ok)
anAtt->Set(aValue);

View File

@@ -54,7 +54,7 @@ Standard_Boolean BinMDataXtd_GeometryDriver::Paste
Handle(TDataXtd_Geometry) aT =
Handle(TDataXtd_Geometry)::DownCast (theTarget);
Standard_Integer aType;
const Standard_Integer aType = -1;
Standard_Boolean ok = theSource >> aType;
if (ok)
aT->SetType ((TDataXtd_GeometryEnum) aType);

View File

@@ -55,7 +55,7 @@ Standard_Boolean BinMDataXtd_PositionDriver::Paste
BinObjMgt_RRelocationTable& ) const
{
Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theTarget);
Standard_Real aValue;
Standard_Real aValue = 0.0;
Standard_Boolean ok = theSource >> aValue;
if (!ok) return ok;
gp_Pnt aPosition(0., 0., 0.);

View File

@@ -56,7 +56,7 @@ Standard_Boolean BinMDataXtd_PresentationDriver::Paste
Handle(TDataXtd_Presentation) anAttribute = Handle(TDataXtd_Presentation)::DownCast(theTarget);
// Display status
Standard_Integer aValue;
const Standard_Integer aValue = -1;
ok = theSource >> aValue;
if (!ok) return ok;
anAttribute->SetDisplayed (aValue != 0);
@@ -92,7 +92,7 @@ Standard_Boolean BinMDataXtd_PresentationDriver::Paste
anAttribute->UnsetMaterial();
// Transparency
Standard_Real aRValue;
Standard_Real aRValue = -1.0;
ok = theSource >> aRValue;
if ( !ok ) return ok;
if ( aRValue != -1. )

View File

@@ -62,7 +62,7 @@ Standard_Boolean BinMFunction_FunctionDriver::Paste
Standard_Boolean ok = theSource >> aGUID;
if (ok) {
anAtt->SetDriverGUID(aGUID);
Standard_Integer aValue;
const Standard_Integer aValue = -1;
ok = theSource >> aValue;
if(ok)
anAtt->SetFailure(aValue);

View File

@@ -117,8 +117,9 @@ static int TranslateFrom (const BinObjMgt_Persistent& theSource,
TopoDS_Shape& theResult,
BinTools_ShapeSet* theShapeSet)
{
Standard_Integer aShapeID, aLocID;
Standard_Character aCharOrient;
const Standard_Integer aShapeID = -1;
const Standard_Integer aLocID = -1;
const Standard_Character aCharOrient = '0';
Standard_Boolean Ok = theSource >> aShapeID; //TShapeID;
if(!Ok) return 1;
// Read TShape and Orientation
@@ -176,11 +177,11 @@ Standard_Boolean BinMNaming_NamedShapeDriver::Paste
theSource >> aNbShapes;
TDF_Label aLabel = theTarget->Label ();
TNaming_Builder aBuilder (aLabel);
Standard_Integer aVer;
const Standard_Integer aVer = -1;
Standard_Boolean ok = theSource >> aVer;
if(!ok) return Standard_False;
aTAtt->SetVersion(aVer); //Version
Standard_Character aCharEvol;
const Standard_Character aCharEvol = '0';
ok = theSource >> aCharEvol;
if(!ok) return Standard_False;
TNaming_Evolution anEvol = EvolutionToEnum (aCharEvol); //Evolution

View File

@@ -152,7 +152,7 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
TNaming_Name& aName = anAtt->ChangeName();
TCollection_ExtendedString aMsg;
//1. NameType
Standard_Character aValue;
const Standard_Character aValue = '0';
Standard_Boolean ok = theSource >> aValue;
Standard_Boolean aNewF = Standard_False;
if (ok) {
@@ -171,7 +171,7 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
//3. Args
Standard_Integer aNbArgs=0;
Standard_Integer anIndx;
const Standard_Integer anIndx = -1;
Handle(TNaming_NamedShape) aNS;
ok = theSource >> aNbArgs;
if (ok) {

View File

@@ -48,7 +48,9 @@ Standard_Boolean BinMXCAFDoc_CentroidDriver::Paste(const BinObjMgt_Persistent& t
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
{
Handle(XCAFDoc_Centroid) anAtt = Handle(XCAFDoc_Centroid)::DownCast(theTarget);
Standard_Real x, y, z;
Standard_Real x = 0.0;
Standard_Real y = 0.0;
Standard_Real z = 0.0;
Standard_Boolean isOk = theSource >> x >> y >> z;
if(isOk) {
gp_Pnt aPnt(x, y, z);

View File

@@ -48,8 +48,10 @@ Standard_Boolean BinMXCAFDoc_ColorDriver::Paste(const BinObjMgt_Persistent& theS
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
{
Handle(XCAFDoc_Color) anAtt = Handle(XCAFDoc_Color)::DownCast(theTarget);
Standard_Real R, G, B;
Standard_ShortReal alpha;
Standard_Real R = 0.0;
Standard_Real G = 0.0;
Standard_Real B = 0.0;
Standard_ShortReal alpha = 1.0;
Standard_Boolean isOk = theSource >> R >> G >> B;
if(isOk) {
Standard_Boolean isRGBA = theSource >> alpha;

View File

@@ -198,7 +198,7 @@ public:
Standard_Real LowerValue()
{
Standard_Integer a, aResultIndex = 0;
Standard_Real aValue;
Standard_Real aValue = 0.0;
for(a = myV.Length(); a > 0; a--)
{
if (aResultIndex == 0 || Abs(aValue) > Abs(myV.Value(a)))

View File

@@ -3915,7 +3915,7 @@ void ChFi3d_Builder::IntersectMoreCorner(const Standard_Integer Index)
}
TopoDS_Face FFv;
Standard_Real tol;
Standard_Integer prol;
Standard_Integer prol = 0;
BRep_Builder BRE;
Handle(Geom_Surface ) Sface;
Sface=BRep_Tool::Surface(Fv);

View File

@@ -1780,7 +1780,7 @@ void ChFi3d_ChBuilder::ExtentTwoCorner(const TopoDS_Vertex& V,
Standard_Integer Sens = 0;
ChFiDS_ListIteratorOfListOfStripe itel(LS);
Standard_Boolean FF = Standard_True;
Standard_Boolean isfirst[2];
Standard_Boolean isfirst[2] = { Standard_True, Standard_True };
Standard_Integer Iedge[2];
Iedge[0] = 1;
Iedge[1] = 1;

View File

@@ -543,7 +543,11 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
if ( C3d.IsNull()) {
Handle(Geom_BSplineSurface) S =
DrawTrSurf::GetBSplineSurface(a[2]);
if ( S.IsNull()) return 1;
if (S.IsNull())
{
delete[] name;
return 1;
}
if (n == 7) {
Standard_Real U1, U2, V1, V2;
U1 = Draw::Atof(a[3]);
@@ -631,6 +635,8 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
}
}
delete[] name;
return 0;
}

View File

@@ -420,7 +420,8 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
aSegIndices2->Conex2 = cnx2;
aNodIndices3.NdSg = find;
Standard_Integer iOld,iNew,iTr,skip,ip4,itpk[2];
Standard_Integer iOld,iNew,iTr,skip,ip4;
Standard_Integer itpk[2] = { -1, -1 };
Standard_Integer n1,n2,n3,nOld[3],nNew[3],New[4];
New[0] = cnx1;
New[2] = myNbTData + 1;

View File

@@ -999,7 +999,8 @@ static void TestWLineToRLine(const IntPatch_SequenceOfLine& slinref,
}
// resolve arcs for vertices not having a link to an arc
Standard_Real utst,vtst;
Standard_Real utst = 0.0;
Standard_Real vtst = 0.0;
TColStd_Array1OfReal paramsResolved(1,nbvtx);
TColStd_Array1OfTransient arcsResolved(1,nbvtx);
arcsResolved.Init(Handle(Adaptor2d_Curve2d)());

View File

@@ -2335,7 +2335,7 @@ Standard_Boolean ClassifyLin2d(const Handle(GeomAdaptor_Surface)& theS,
{
Standard_Real xmin, xmax, ymin, ymax, d1, d2, A, B, C;
Standard_Real par[2];
Standard_Real par[2] = { 0.0, 0.0 };
Standard_Integer nbi = 0;
xmin = theS->FirstUParameter();

View File

@@ -318,7 +318,7 @@ Bnd_Box MeshVS_DataSource::GetBoundingBox() const
const TColStd_PackedMapOfInteger& aNodes = GetAllNodes();
if( aNodes.Extent() )
{
Standard_Real aCoordsBuf[ 3 ];
const Standard_Real aCoordsBuf[3] = { 0.0, 0.0, 0.0 };
TColStd_Array1OfReal aCoords (*aCoordsBuf, 1, 3);
Standard_Integer nbNodes;
MeshVS_EntityType aType;

View File

@@ -108,7 +108,7 @@ void MeshVS_MeshPrsBuilder::BuildNodes ( const Handle(Prs3d_Presentation)& Prs,
Standard_Boolean HasSelectFlag = ( ( DisplayMode & MeshVS_DMF_SelectionPrs ) != 0 );
Standard_Boolean HasHilightFlag = ( ( DisplayMode & MeshVS_DMF_HilightPrs ) != 0 );
Standard_Real aCoordsBuf[ 3 ];
const Standard_Real aCoordsBuf[3] = { 0.0, 0.0, 0.0 };
TColStd_Array1OfReal aCoords( *aCoordsBuf, 1, 3 );
Standard_Integer NbNodes;
MeshVS_EntityType aType;

View File

@@ -294,7 +294,7 @@ static LONG CallHandler (DWORD theExceptionCode,
&& theExceptionCode != EXCEPTION_NONCONTINUABLE_EXCEPTION)
{
MessageBeep (MB_ICONHAND);
char aMsgBoxBuffer[2048];
char aMsgBoxBuffer[2048] = { '\0' };
strcat_s (aMsgBoxBuffer, sizeof(aMsgBoxBuffer), aBuffer);
if (aStackBuffer != NULL)
{

View File

@@ -160,7 +160,10 @@ Standard_Boolean Standard_Dump::InitRealValues (const TCollection_AsciiString& t
TCollection_AsciiString aValueText = aSubText.SubString (aStreamPos, aNextPos - 1);
if (!aValueText.IsRealValue())
{
va_end(vl);
return Standard_False;
}
Standard_Real aValue = aValueText.RealValue();
*(va_arg(vl, Standard_Real*)) = aValue;
@@ -227,10 +230,12 @@ TCollection_AsciiString Standard_Dump::GetPointerInfo (const void* thePointer, c
std::ostringstream aPtrStr;
aPtrStr << thePointer;
if (!isShortInfo)
return aPtrStr.str().c_str();
TCollection_AsciiString anInfoPtr (aPtrStr.str().c_str());
TCollection_AsciiString anInfoPtr(aPtrStr.str().c_str());
if (!isShortInfo)
return anInfoPtr;
for (int aSymbolId = 1; aSymbolId < anInfoPtr.Length(); aSymbolId++)
{
if (anInfoPtr.Value(aSymbolId) != '0')
@@ -240,7 +245,7 @@ TCollection_AsciiString Standard_Dump::GetPointerInfo (const void* thePointer, c
return anInfoPtr;
}
}
return aPtrStr.str().c_str();
return TCollection_AsciiString(aPtrStr.str().c_str());
}
// =======================================================================