1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

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
This commit is contained in:
abv 2013-10-14 17:38:02 +04:00 committed by bugmaster
parent 3054a9f4df
commit 37e640d5bd
6 changed files with 22 additions and 69 deletions

View File

@ -96,9 +96,9 @@ void BOPAlgo_Builder::FillImagesFaces()
void BOPAlgo_Builder::BuildSplitFaces() void BOPAlgo_Builder::BuildSplitFaces()
{ {
Standard_Boolean bHasFaceInfo, bIsClosed, bIsDegenerated, bToReverse; 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_Boolean bRunParallel;
Standard_Size aNbBF, k; Standard_Size aNbBF;
TopoDS_Face aFF, aFSD; TopoDS_Face aFF, aFSD;
TopoDS_Edge aSp, aEE; TopoDS_Edge aSp, aEE;
TopAbs_Orientation anOriF, anOriE; TopAbs_Orientation anOriF, anOriE;
@ -267,7 +267,7 @@ void BOPAlgo_Builder::BuildSplitFaces()
BOPAlgo_BuilderFaceCnt::Perform(bRunParallel, aVBF); BOPAlgo_BuilderFaceCnt::Perform(bRunParallel, aVBF);
//=================================================== //===================================================
// //
for (k=0; k<aNbBF; ++k) { for (k=0; k<(Standard_Integer)aNbBF; ++k) {
aLFIm.Clear(); aLFIm.Clear();
// //
BOPAlgo_BuilderFace& aBF=aVBF(k); BOPAlgo_BuilderFace& aBF=aVBF(k);

View File

@ -63,7 +63,7 @@ class BOPAlgo_BuilderFaceFunctor {
iBeg=aBR.begin(); iBeg=aBR.begin();
iEnd=aBR.end(); iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) { for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_BuilderFace& aBF=aVBF(i); BOPAlgo_BuilderFace& aBF=aVBF((Standard_Integer)i);
// //
aBF.Perform(); aBF.Perform();
} }

View File

@ -222,13 +222,13 @@ void iges_newparam (int typarg, int longval, char *parval)
/* Complement du parametre courant (cf Hollerith sur +ieurs lignes) */ /* Complement du parametre courant (cf Hollerith sur +ieurs lignes) */
void iges_addparam (int longval, char* parval) void iges_addparam (int longval, char* parval)
{ {
char *newval, *oldval; int i; char *newval, *oldval;
size_t long0; int i, long0;
if (longval <= 0) return; if (longval <= 0) return;
oldval = curparam->parval; oldval = curparam->parval;
long0 = strlen(oldval); long0 = (int)strlen(oldval);
/* newval = (char*) malloc(long0+longval+1); */ /* 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 < long0; i ++) newval[i] = oldval[i];
for (i = 0; i < longval; i ++) newval[i+long0] = parval[i]; for (i = 0; i < longval; i ++) newval[i+long0] = parval[i];
newval[long0+longval] = '\0'; newval[long0+longval] = '\0';

View File

@ -2380,26 +2380,13 @@ static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, co
return 0; return 0;
} }
static char sarr[2000];
static int si=1;
#ifdef WNT #ifdef WNT
static int StackOverflow(int i = -1) static int StackOverflow (int i = -1)
{ {
char arr[2000]; char arr[2000];
if (si == 1) { memset (arr, 0, sizeof(arr));
si = 0; if (i < 0)
memcpy(arr,sarr,2000); StackOverflow(i-1);
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;
return i; return i;
} }
@ -2410,7 +2397,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
{ {
if (argc != 1) if (argc != 1)
{ {
di << "Usage : " << argv[0] << "\n"; cout << "Usage : " << argv[0] << "\n";
return 1; return 1;
} }
Standard_Boolean Succes; Standard_Boolean Succes;
@ -2421,6 +2408,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
{//==== Test Divide ByZero (Integer) ======================================== {//==== Test Divide ByZero (Integer) ========================================
try{ try{
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
cout << "(Integer) Divide By Zero..." << endl;
di << "(Integer) Divide By Zero..."; di << "(Integer) Divide By Zero...";
//cout.flush(); //cout.flush();
di << "\n"; di << "\n";
@ -2456,6 +2444,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
{//==== Test Divide ByZero (Real) =========================================== {//==== Test Divide ByZero (Real) ===========================================
try{ try{
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
cout << "(Real) Divide By Zero..." << endl;
di << "(Real) Divide By Zero..."; di << "(Real) Divide By Zero...";
//cout.flush(); //cout.flush();
di << "\n"; di << "\n";
@ -2484,6 +2473,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
{//==== Test Overflow (Integer) ============================================= {//==== Test Overflow (Integer) =============================================
try{ try{
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
cout << "(Integer) Overflow..." << endl;
di << "(Integer) Overflow..."; di << "(Integer) Overflow...";
//cout.flush(); //cout.flush();
di << "\n"; di << "\n";
@ -2508,6 +2498,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
{//==== Test Overflow (Real) ================================================ {//==== Test Overflow (Real) ================================================
try{ try{
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
cout << "(Real) Overflow..." << endl;
di << "(Real) Overflow..."; di << "(Real) Overflow...";
//cout.flush(); //cout.flush();
di << "\n"; di << "\n";
@ -2539,6 +2530,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
{//==== Test Underflow (Real) =============================================== {//==== Test Underflow (Real) ===============================================
try{ try{
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
cout << "(Real) Underflow" << endl; // to have message in log even if process crashed
di << "(Real) Underflow"; di << "(Real) Underflow";
//cout.flush(); //cout.flush();
di << "\n"; di << "\n";
@ -2569,6 +2561,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
{//==== Test Invalid Operation (Real) =============================================== {//==== Test Invalid Operation (Real) ===============================================
try{ try{
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
cout << "(Real) Invalid Operation..." << endl;
di << "(Real) Invalid Operation..."; di << "(Real) Invalid Operation...";
//cout.flush(); //cout.flush();
di << "\n"; di << "\n";
@ -2592,6 +2585,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
{//==== Test Access Violation =============================================== {//==== Test Access Violation ===============================================
try { try {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
cout << "Segmentation Fault..." << endl;
di << "Segmentation Fault..."; di << "Segmentation Fault...";
//cout.flush(); //cout.flush();
di << "\n"; di << "\n";
@ -2620,6 +2614,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
{//==== Test Stack Overflow =============================================== {//==== Test Stack Overflow ===============================================
try { try {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
cout << "Stack Overflow..." << endl;
di << "Stack Overflow..."; di << "Stack Overflow...";
//cout.flush(); //cout.flush();
di << "\n"; di << "\n";

View File

@ -311,47 +311,6 @@ static Standard_Integer testread (Draw_Interpretor& di, Standard_Integer argc, c
return 0; 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="<<num<<" :\n";
cout<<"Mode (0 End, 1 root n0 1, 2 one root/n0, 3 one entity/n0, 4 Selection) : "<<flush;
cin>>modepri;
if (modepri == 0) { di<<"End Reading STEP"<<"\n"; return 0; }
if (!sr.TransferRoot (num)) di<<"Transfer root n0 "<<num<<" : no result"<<"\n";
else {
TopoDS_Shape sh = sr.OneShape();
DBRep::Set (argv[2],sh);
}
cin>>modepri;
return 0;
}
// ######## COMMANDE steptrans : teste les transformations ######### // ######## COMMANDE steptrans : teste les transformations #########
//======================================================================= //=======================================================================
//function : steptrans //function : steptrans
@ -607,6 +566,5 @@ void XSDRAWSTEP::InitCommands (Draw_Interpretor& theCommands)
theCommands.Add("steptrans", "steptrans shape stepax1 stepax2", __FILE__, steptrans, g); theCommands.Add("steptrans", "steptrans shape stepax1 stepax2", __FILE__, steptrans, g);
theCommands.Add("countexpected","TEST", __FILE__, countexpected, g); theCommands.Add("countexpected","TEST", __FILE__, countexpected, g);
theCommands.Add("dumpassembly", "TEST", __FILE__, dumpassembly, 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); theCommands.Add("stepfileunits" , "stepfileunits name_file", __FILE__, stepfileunits, g);
} }

View File

@ -6,7 +6,7 @@ puts ""
# Incorrect faces of the filleted cube after import from iges file # 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] puts [whatis s1]
explode s1 F explode s1 F