diff --git a/src/QABugs/QABugs_13.cxx b/src/QABugs/QABugs_13.cxx index 39758d7ece..9ea0efdb92 100644 --- a/src/QABugs/QABugs_13.cxx +++ b/src/QABugs/QABugs_13.cxx @@ -926,9 +926,9 @@ static Standard_Integer OCC817 (Draw_Interpretor& di, Standard_Integer argc, con di<<"Info: Bounds\n ("< 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST) - const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY); -#else - Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY); -#endif - Standard_Character *file1 = new Standard_Character [strlen(DD)+strlen(argv[1])+2]; - sprintf(file1,"%s/%s",DD,argv[1]); + TCollection_AsciiString aFilePath(argv[1]); filebuf fic; istream in(&fic); - if (!fic.open(file1,ios::in)) { - di << "Cannot open file for reading : " << file1 << "\n"; - delete file1; + if (!fic.open(aFilePath.ToCString(),ios::in)) { + di << "Cannot open file for reading : " << aFilePath << "\n"; return(-1); } @@ -177,8 +166,7 @@ static int BUC60609(Draw_Interpretor& di, Standard_Integer argc, const char ** a S.Read(in); S.Read(theShape,in); }else{ - di << "Wrong entity type in " << file1 << "\n"; - delete file1; + di << "Wrong entity type in " << aFilePath << "\n"; return(-1); } } @@ -393,7 +381,7 @@ static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** a istream in(&fic); if (!fic.open(filename,ios::in)) { di << "Cannot open file for reading : " << filename << "\n"; - delete filename; + delete [] filename; return -1; } @@ -441,7 +429,7 @@ static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** a Sec.Build(); if(!Sec.IsDone()){ di << "Error performing intersection: not done." << "\n"; - delete filename; + delete [] filename; return -1; } res = Sec.Shape(); @@ -451,7 +439,7 @@ static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** a Sec.Build(); if(!Sec.IsDone()){ di << "Error performing intersection: not done." << "\n"; - delete filename; + delete [] filename; return -1; } res = Sec.Shape(); @@ -460,7 +448,7 @@ static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** a }catch(Standard_Failure){ Handle(Standard_Failure) error = Standard_Failure::Caught(); di << "Error performing intersection: not done." << "\n"; - delete filename; + delete [] filename; return -1; } @@ -477,7 +465,7 @@ static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** a di << "Done" << "\n"; - delete filename; + delete [] filename; return 0; } @@ -563,8 +551,8 @@ static int BUC60547(Draw_Interpretor& di, Standard_Integer argc, const char ** a BRepTools::Write(Com,FileName); - delete Ch; - delete FileName; + delete [] Ch; + delete [] FileName; return 0; } @@ -596,7 +584,7 @@ static Standard_Integer BUC60632(Draw_Interpretor& di, Standard_Integer /*n*/, c TCollection_ExtendedString Ext1("Dim1"); Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1,atof(a[2]),Ext1); - myAIScontext->SetDisplayMode(Dim1, atof(a[1])); + myAIScontext->SetDisplayMode(Dim1, atoi(a[1])); myAIScontext->Display(Dim1); return 0; } diff --git a/src/QABugs/QABugs_7.cxx b/src/QABugs/QABugs_7.cxx index c76ffd51b8..5321f3a793 100644 --- a/src/QABugs/QABugs_7.cxx +++ b/src/QABugs/QABugs_7.cxx @@ -277,7 +277,7 @@ static Standard_Integer OCC862 (Draw_Interpretor& di, Standard_Integer argc, con for (i = 0; i < Glob_NbKnots; i++) aMults.SetValue(i+1,Glob_Mults[i]); // Create B-Spline curve - const Standard_Real aDegree = 14; + const Standard_Integer aDegree = 14; Handle(Geom_BSplineCurve) C1 = new Geom_BSplineCurve(aPoles,aKnots,aMults,aDegree); // Create trimmed line diff --git a/src/QADNaming/QADNaming_IteratorsCommands.cxx b/src/QADNaming/QADNaming_IteratorsCommands.cxx index cc6104438c..77e1aa373e 100755 --- a/src/QADNaming/QADNaming_IteratorsCommands.cxx +++ b/src/QADNaming/QADNaming_IteratorsCommands.cxx @@ -117,15 +117,20 @@ static Standard_Integer GetOldShapes (Draw_Interpretor& di, return 0; } -static int GetAllNew(const TopoDS_Shape& theShape, const TDF_Label& theAccess, const char* theName, Standard_Integer theIndex) { +static int GetAllNew(const TopoDS_Shape& theShape, const TDF_Label& theAccess, + const TCollection_AsciiString& theName, Standard_Integer theIndex) +{ TNaming_NewShapeIterator anIter(theShape,theAccess); - char aName[200]; - for(;anIter.More();anIter.Next()) { - if (!anIter.Shape().IsNull()) { + TCollection_AsciiString aName; + for(;anIter.More();anIter.Next()) + { + if (!anIter.Shape().IsNull()) + { theIndex++; - if (theName != NULL) { - sprintf(aName,"%s_%d",theName,theIndex); - DBRep::Set(aName,anIter.Shape()); + if (!theName.IsEmpty()) + { + aName = theName + "_" + theIndex; + DBRep::Set(aName.ToCString(),anIter.Shape()); } theIndex = GetAllNew(anIter.Shape(),theAccess,theName,theIndex); } @@ -138,7 +143,7 @@ static Standard_Integer GetAllNewShapes (Draw_Interpretor& di, const char** arg) { Standard_Integer aResult = 0; if (nb==3 || nb==4) { - const char* aName = (nb==4) ? arg[3] : NULL; + TCollection_AsciiString aName ((nb==4) ? arg[3] : ""); if (arg[2][0]=='0') { // label TDF_Label aLabel; @@ -152,13 +157,13 @@ static Standard_Integer GetAllNewShapes (Draw_Interpretor& di, TNaming_Iterator anIter(aNS); for(a=1;anIter.More();anIter.Next(),a++) { if (!anIter.NewShape().IsNull()) { - char* aSubName; - if (aName!=NULL) { - aSubName = new char[200]; - sprintf(aSubName,"%s_%d",aName,a); - } else aSubName = NULL; - aResult+=GetAllNew(anIter.NewShape(),aLabel,aSubName,0); - if (aSubName != NULL) delete [] aSubName; + TCollection_AsciiString aSubName; + if (!aName.IsEmpty()) + { + aSubName += aName + "_"; + aSubName += a; + } + aResult+=GetAllNew(anIter.NewShape(),aLabel,aSubName,0); } } } else { // shape @@ -178,17 +183,22 @@ static Standard_Integer GetAllNewShapes (Draw_Interpretor& di, return 0; } -static int GetAllOld(const TopoDS_Shape& theShape, const TDF_Label& theAccess, const char* theName, Standard_Integer theIndex) { - char aName[200]; +static int GetAllOld(const TopoDS_Shape& theShape, const TDF_Label& theAccess, + const TCollection_AsciiString& theName, Standard_Integer theIndex) +{ + TCollection_AsciiString aName; Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(theShape,theAccess); if (aNS.IsNull()) return theIndex; TNaming_Iterator anIter(aNS); - for(;anIter.More();anIter.Next()) { - if (!anIter.OldShape().IsNull() && !anIter.NewShape().IsNull()) if (anIter.NewShape().IsSame(theShape)) { + for(;anIter.More();anIter.Next()) + { + if (!anIter.OldShape().IsNull() && !anIter.NewShape().IsNull()) if (anIter.NewShape().IsSame(theShape)) + { theIndex++; - if (theName!=NULL) { - sprintf(aName,"%s_%d",theName,theIndex); - DBRep::Set(aName,anIter.OldShape()); + if (!theName.IsEmpty()) + { + aName = theName + "_" + theIndex; + DBRep::Set(aName.ToCString(),anIter.OldShape()); } theIndex = GetAllOld(anIter.OldShape(),theAccess,theName,theIndex); } @@ -201,7 +211,7 @@ static Standard_Integer GetAllOldShapes (Draw_Interpretor& di, const char** arg) { Standard_Integer aResult = 0; if (nb==3 || nb==4) { - const char* aName = (nb==4) ? arg[3] : NULL; + TCollection_AsciiString aName((nb==4) ? arg[3] : ""); if (arg[2][0]=='0') { // label TDF_Label aLabel; @@ -215,12 +225,13 @@ static Standard_Integer GetAllOldShapes (Draw_Interpretor& di, TNaming_Iterator anIter(aNS); for(a=1;anIter.More();anIter.Next(),a++) { if (!anIter.NewShape().IsNull()) { - char* aSubName; - if (aName!=NULL) { - aSubName = new char[200]; - sprintf(aSubName,"%s_%d",aName,a); - } else aSubName = NULL; - aResult+=GetAllOld(anIter.NewShape(),aLabel,aSubName,0); + TCollection_AsciiString aSubName; + if (!aName.IsEmpty()) + { + aSubName += aName + "_"; + aSubName += a; + } + aResult+=GetAllOld(anIter.NewShape(),aLabel,aSubName,0); } } } else { // shape diff --git a/src/QADraw/QADraw.cxx b/src/QADraw/QADraw.cxx index cd0c279b30..a9279bcf31 100755 --- a/src/QADraw/QADraw.cxx +++ b/src/QADraw/QADraw.cxx @@ -481,12 +481,12 @@ static Standard_Integer QAAISGetPixelColor (Draw_Interpretor& di, Standard_Integ Standard_Integer QAAISXWindowSize_X = 0; Standard_Integer QAAISXWindowSize_Y = 0; QAAISWindow->Size(QAAISXWindowSize_X, QAAISXWindowSize_Y); - Standard_ShortReal QAAISCoordinateX = atof (argv [1]); - Standard_ShortReal QAAISCoordinateY = atof (argv [2]); + Standard_Integer QAAISCoordinateX = atoi (argv [1]); + Standard_Integer QAAISCoordinateY = atoi (argv [2]); - Standard_ShortReal QAAISColorRED_V = 0; - Standard_ShortReal QAAISColorGRN_V = 0; - Standard_ShortReal QAAISColorBLU_V = 0; + Standard_Real QAAISColorRED_V = 0; + Standard_Real QAAISColorGRN_V = 0; + Standard_Real QAAISColorBLU_V = 0; if ( argc == 6 ) { QAAISColorRED_V = atof (argv [3]); @@ -512,9 +512,9 @@ static Standard_Integer QAAISGetPixelColor (Draw_Interpretor& di, Standard_Integ Standard_Integer i; for(i=1; i<=aSeq->Length();i+=3) { // mkv 29.04.03 - Standard_ShortReal QAAISColorRED_R = (((Standard_ShortReal) ((Standard_Integer) (aSeq->Value(i+0) * 1000000))) / 1000000.); - Standard_ShortReal QAAISColorGRN_R = (((Standard_ShortReal) ((Standard_Integer) (aSeq->Value(i+1) * 1000000))) / 1000000.); - Standard_ShortReal QAAISColorBLU_R = (((Standard_ShortReal) ((Standard_Integer) (aSeq->Value(i+2) * 1000000))) / 1000000.); + Standard_Real QAAISColorRED_R = (Floor(aSeq->Value(i+0) * 1000000.)) / 1000000.; + Standard_Real QAAISColorGRN_R = (Floor(aSeq->Value(i+1) * 1000000.)) / 1000000.; + Standard_Real QAAISColorBLU_R = (Floor(aSeq->Value(i+2) * 1000000.)) / 1000000.; // mkv 29.04.03 if ( argc == 3 ) { diff --git a/src/QANewDBRepNaming/QANewDBRepNaming.cxx b/src/QANewDBRepNaming/QANewDBRepNaming.cxx index 24c4e3fa05..64c16f41ec 100755 --- a/src/QANewDBRepNaming/QANewDBRepNaming.cxx +++ b/src/QANewDBRepNaming/QANewDBRepNaming.cxx @@ -230,8 +230,7 @@ static Standard_Integer QANewDBRepNaming_CheckNaming(Draw_Interpretor& di,Standa TDF_LabelMap scope; TDF_ChildIterator itr(L.Root(), Standard_True); i = 1; - char aNotSolved[1000]; - aNotSolved[0]=0; + TCollection_AsciiString aNotSolved; for (itr.Initialize(L, Standard_False); itr.More(); itr.Next(), i++) { Handle(TNaming_NamedShape) aNS; if (!itr.Value().FindAttribute(TNaming_NamedShape::GetID(), aNS)) { @@ -244,7 +243,8 @@ static Standard_Integer QANewDBRepNaming_CheckNaming(Draw_Interpretor& di,Standa TNaming_Selector SLSolving(itr.Value()); if (!SLSolving.Solve(scope)) { isFailured = Standard_True; - sprintf(aNotSolved,"%s %d",aNotSolved,i); + aNotSolved += " "; + aNotSolved += i; continue; } const Handle(TNaming_NamedShape)& aResultOfSolving = SLSolving.NamedShape(); @@ -252,8 +252,8 @@ static Standard_Integer QANewDBRepNaming_CheckNaming(Draw_Interpretor& di,Standa // cout<<"Failure of Solving: it didn't produced a shape!"< 0. && aMat(i,n)> 0.) { - if(aMat[i-1] == 1 && aMat[(i-1)*nbs+n-1] == 1) { - p=1.; - break; - } - // p+=aMat(1,i)*aMat(i,n); - } - //p = aRow*aCol; - if(p > 0.0) { - // aMat(1, n) = 1.0; - // aMat(n, 1) = 1.0; - aMat[n-1] = 1; - aMat[(n-1)*nbs+1-1] = 1; - aNotChanged = Standard_False; - } - aRes = Standard_False; + for (n = 1; n <= nbs; n++) + { + if (aMat(1, n) == 0) + { + p = 0; + for (i = 1; i <= nbs; i++) + { + if (aMat(1, i) == 1 && aMat(i, n) == 1) + { + p = 1; + break; + } + } + if (p > 0) + { + aMat(1, n) = 1; + aMat(n, 1) = 1; + aNotChanged = Standard_False; + } + aRes = Standard_False; } } if(aNotChanged) break; if(aRes) break; } - delete [] aMat; - // cout << "QANewModTopOpe::IsConnected END: aRes="<