From 37e640d5bd2e4e42449c104176eccf2d54e5dd06 Mon Sep 17 00:00:00 2001 From: abv Date: Mon, 14 Oct 2013 17:38:02 +0400 Subject: [PATCH] 0024257: Minor corrections for building / testing on VC++ 11 Several corrections coming from building and testing on MSVC++ 11: - compiler warnings corrected in structiges.c (32-bit mode) and BOPAlgo (64-bit mode) - DRAW command for testing exceptions (OCC6143) refactored for getting some output even if process fails (problem with stack overflow handling) - DRAW command readstep removed as it leads to hang-up in Debug mode due to waiting for user input; the only test that used it changed to use testreadstep command --- src/BOPAlgo/BOPAlgo_Builder_2.cxx | 6 ++-- src/BOPAlgo/BOPAlgo_Builder_2Cnt.hxx | 2 +- src/IGESFile/structiges.c | 8 +++--- src/QABugs/QABugs_11.cxx | 31 +++++++++----------- src/XSDRAWSTEP/XSDRAWSTEP.cxx | 42 ---------------------------- tests/bugs/iges/bug22715_1 | 2 +- 6 files changed, 22 insertions(+), 69 deletions(-) diff --git a/src/BOPAlgo/BOPAlgo_Builder_2.cxx b/src/BOPAlgo/BOPAlgo_Builder_2.cxx index e096dee412..026990b060 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_2.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_2.cxx @@ -96,9 +96,9 @@ void BOPAlgo_Builder::FillImagesFaces() void BOPAlgo_Builder::BuildSplitFaces() { Standard_Boolean bHasFaceInfo, bIsClosed, bIsDegenerated, bToReverse; - Standard_Integer i, j, aNbS, aNbPBIn, aNbPBOn, aNbPBSc, aNbAV, nSp; + Standard_Integer i, j, k, aNbS, aNbPBIn, aNbPBOn, aNbPBSc, aNbAV, nSp; Standard_Boolean bRunParallel; - Standard_Size aNbBF, k; + Standard_Size aNbBF; TopoDS_Face aFF, aFSD; TopoDS_Edge aSp, aEE; TopAbs_Orientation anOriF, anOriE; @@ -267,7 +267,7 @@ void BOPAlgo_Builder::BuildSplitFaces() BOPAlgo_BuilderFaceCnt::Perform(bRunParallel, aVBF); //=================================================== // - for (k=0; kparval; - long0 = strlen(oldval); + long0 = (int)strlen(oldval); /* newval = (char*) malloc(long0+longval+1); */ - newval = iges_newchar("",(int)long0+longval+1); + newval = iges_newchar("",long0+longval+1); for (i = 0; i < long0; i ++) newval[i] = oldval[i]; for (i = 0; i < longval; i ++) newval[i+long0] = parval[i]; newval[long0+longval] = '\0'; diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index 06694ba2b7..a3ddc90980 100755 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -2380,26 +2380,13 @@ static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, co return 0; } -static char sarr[2000]; -static int si=1; - #ifdef WNT -static int StackOverflow(int i = -1) +static int StackOverflow (int i = -1) { char arr[2000]; - if (si == 1) { - si = 0; - memcpy(arr,sarr,2000); - arr[1999]=0; - int n = (int)strlen(arr), s=0; - while (n--) - s += StackOverflow(i-1); - return i + s + StackOverflow(i-1); - } - else if (i != 0) { - return i + StackOverflow(i-1); - } - si = 1; + memset (arr, 0, sizeof(arr)); + if (i < 0) + StackOverflow(i-1); return i; } @@ -2410,7 +2397,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co { if (argc != 1) { - di << "Usage : " << argv[0] << "\n"; + cout << "Usage : " << argv[0] << "\n"; return 1; } Standard_Boolean Succes; @@ -2421,6 +2408,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co {//==== Test Divide ByZero (Integer) ======================================== try{ OCC_CATCH_SIGNALS + cout << "(Integer) Divide By Zero..." << endl; di << "(Integer) Divide By Zero..."; //cout.flush(); di << "\n"; @@ -2456,6 +2444,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co {//==== Test Divide ByZero (Real) =========================================== try{ OCC_CATCH_SIGNALS + cout << "(Real) Divide By Zero..." << endl; di << "(Real) Divide By Zero..."; //cout.flush(); di << "\n"; @@ -2484,6 +2473,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co {//==== Test Overflow (Integer) ============================================= try{ OCC_CATCH_SIGNALS + cout << "(Integer) Overflow..." << endl; di << "(Integer) Overflow..."; //cout.flush(); di << "\n"; @@ -2508,6 +2498,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co {//==== Test Overflow (Real) ================================================ try{ OCC_CATCH_SIGNALS + cout << "(Real) Overflow..." << endl; di << "(Real) Overflow..."; //cout.flush(); di << "\n"; @@ -2539,6 +2530,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co {//==== Test Underflow (Real) =============================================== try{ OCC_CATCH_SIGNALS + cout << "(Real) Underflow" << endl; // to have message in log even if process crashed di << "(Real) Underflow"; //cout.flush(); di << "\n"; @@ -2569,6 +2561,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co {//==== Test Invalid Operation (Real) =============================================== try{ OCC_CATCH_SIGNALS + cout << "(Real) Invalid Operation..." << endl; di << "(Real) Invalid Operation..."; //cout.flush(); di << "\n"; @@ -2592,6 +2585,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co {//==== Test Access Violation =============================================== try { OCC_CATCH_SIGNALS + cout << "Segmentation Fault..." << endl; di << "Segmentation Fault..."; //cout.flush(); di << "\n"; @@ -2620,6 +2614,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co {//==== Test Stack Overflow =============================================== try { OCC_CATCH_SIGNALS + cout << "Stack Overflow..." << endl; di << "Stack Overflow..."; //cout.flush(); di << "\n"; diff --git a/src/XSDRAWSTEP/XSDRAWSTEP.cxx b/src/XSDRAWSTEP/XSDRAWSTEP.cxx index 4668a8f937..5ee31d9fa8 100755 --- a/src/XSDRAWSTEP/XSDRAWSTEP.cxx +++ b/src/XSDRAWSTEP/XSDRAWSTEP.cxx @@ -311,47 +311,6 @@ static Standard_Integer testread (Draw_Interpretor& di, Standard_Integer argc, c return 0; } -//======================================================================= -//function : readstep -//purpose : -//======================================================================= - -static Standard_Integer readstep (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** argv) -{ -// On admet le controller AP214 ou une variante - - - STEPControl_Reader sr; - - IFSelect_ReturnStatus readstat = IFSelect_RetVoid; - - readstat = sr.ReadFile (argv[1]); - - if (readstat != IFSelect_RetDone) { - - di<<"No model loaded"<<"\n"; - return 1; - } - - - Standard_Integer num = sr.NbRootsForTransfer(); - Standard_Integer modepri; - di<<"NbRootsForTransfer="<>modepri; - if (modepri == 0) { di<<"End Reading STEP"<<"\n"; return 0; } - - - if (!sr.TransferRoot (num)) di<<"Transfer root n0 "<>modepri; - return 0; -} - // ######## COMMANDE steptrans : teste les transformations ######### //======================================================================= //function : steptrans @@ -607,6 +566,5 @@ void XSDRAWSTEP::InitCommands (Draw_Interpretor& theCommands) theCommands.Add("steptrans", "steptrans shape stepax1 stepax2", __FILE__, steptrans, g); theCommands.Add("countexpected","TEST", __FILE__, countexpected, g); theCommands.Add("dumpassembly", "TEST", __FILE__, dumpassembly, g); - theCommands.Add("readstep", "readstep [file]", __FILE__, readstep, g); theCommands.Add("stepfileunits" , "stepfileunits name_file", __FILE__, stepfileunits, g); } diff --git a/tests/bugs/iges/bug22715_1 b/tests/bugs/iges/bug22715_1 index 74dc4d1b2f..446608ef3b 100755 --- a/tests/bugs/iges/bug22715_1 +++ b/tests/bugs/iges/bug22715_1 @@ -6,7 +6,7 @@ puts "" # Incorrect faces of the filleted cube after import from iges file ####################################################################### -readstep [locate_data_file bug22715_cube.stp] s1 * +testreadstep [locate_data_file bug22715_cube.stp] s1 puts [whatis s1] explode s1 F