From 773f53f1ec50f359433455cd8e446f466464f9df Mon Sep 17 00:00:00 2001 From: omy Date: Thu, 1 Aug 2013 12:20:35 +0400 Subject: [PATCH] 0024085: Eliminate compiler warning C4706 in MSVC++ with warning level 4 Got rid from most cases which led to Warning c4706 Tiny code style corrections --- src/BRepClass3d/BRepClass3d_Intersector3d.cxx | 29 +++----- src/BRepTest/BRepTest_CheckCommands.cxx | 13 +--- .../BRepTopAdaptor_FClass2d.cxx | 20 +++--- src/Draw/Draw_Window.cxx | 7 +- src/Draw/MainWindow.cxx | 33 ++++----- src/Extrema/Extrema_GExtCC.gxx | 3 +- src/Geom2dGcc/Geom2dGcc_Lin2dTanObl.cxx | 9 ++- src/GeomPlate/GeomPlate_BuildPlateSurface.cxx | 5 +- src/IntTools/IntTools_FClass2d.cxx | 72 ++++++++----------- src/OpenGl/OpenGl_telem_view.cxx | 4 +- src/QABugs/QABugs_19.cxx | 2 +- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 4 +- src/Visual3d/Visual3d_View.cxx | 4 +- 13 files changed, 83 insertions(+), 122 deletions(-) diff --git a/src/BRepClass3d/BRepClass3d_Intersector3d.cxx b/src/BRepClass3d/BRepClass3d_Intersector3d.cxx index 58d8cca277..8a1d9b4a6c 100755 --- a/src/BRepClass3d/BRepClass3d_Intersector3d.cxx +++ b/src/BRepClass3d/BRepClass3d_Intersector3d.cxx @@ -18,10 +18,6 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - -// Modified by skv - Fri Mar 4 12:07:34 2005 OCC7966 - #include #include @@ -29,7 +25,6 @@ #include #include - #include #include #include @@ -61,18 +56,15 @@ void BRepClass3d_Intersector3d::Perform(const gp_Lin& L, surface.Initialize(Face,Standard_True); - Standard_Boolean IsUPer, IsVPer; - Standard_Real uperiod=0, vperiod=0; - if ((IsUPer = surface.IsUPeriodic())) - uperiod = surface.UPeriod(); - if ((IsVPer = surface.IsVPeriodic())) - vperiod = surface.VPeriod(); - - Standard_Real U1, U2, V1, V2; - U1 = surface.FirstUParameter(); - U2 = surface.LastUParameter(); - V1 = surface.FirstVParameter(); - V2 = surface.LastVParameter(); + const Standard_Boolean IsUPer = surface.IsUPeriodic(); + const Standard_Boolean IsVPer = surface.IsVPeriodic(); + const Standard_Real uperiod = IsUPer ? surface.UPeriod() : 0.0; + const Standard_Real vperiod = IsVPer ? surface.VPeriod() : 0.0; + + Standard_Real U1 = surface.FirstUParameter(); + Standard_Real U2 = surface.LastUParameter(); + Standard_Real V1 = surface.FirstVParameter(); + Standard_Real V2 = surface.LastVParameter(); //-- Handle(GeomAdaptor_HCurve) HLL = new GeomAdaptor_HCurve(LL); @@ -140,6 +132,3 @@ void BRepClass3d_Intersector3d::Perform(const gp_Lin& L, } //-- Loop on Intersection points. } //-- HICS.IsDone() } - - - diff --git a/src/BRepTest/BRepTest_CheckCommands.cxx b/src/BRepTest/BRepTest_CheckCommands.cxx index 6755056987..1d35f7962e 100755 --- a/src/BRepTest/BRepTest_CheckCommands.cxx +++ b/src/BRepTest/BRepTest_CheckCommands.cxx @@ -18,8 +18,6 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. -// modified by mps (dec 96) ajout des commandes pour l'analyse de continuite - #include #ifdef HAVE_CONFIG_H # include @@ -77,11 +75,7 @@ #include #include -//#ifdef WNT #include -#ifdef WNT -//#define strcasecmp strcmp Already defined -#endif #ifdef HAVE_STRINGS_H # include #endif @@ -1444,10 +1438,9 @@ static Standard_Integer clintedge(Draw_Interpretor& di, TopTools_DataMapOfShapeListOfShape mymap; TopOpeBRepTool_PurgeInternalEdges mypurgealgo(S); - Standard_Integer nbedges; - - if ((nbedges = mypurgealgo.NbEdges())) { - + Standard_Integer nbedges = mypurgealgo.NbEdges(); + if (nbedges > 0) + { //cout<ChangeSurface().Initialize( Face, Standard_False ); - Standard_Boolean IsUPer, IsVPer; - Standard_Real uperiod=0, vperiod=0; - if ((IsUPer = surf->IsUPeriodic())) - uperiod = surf->UPeriod(); - if ((IsVPer = surf->IsVPeriodic())) - vperiod = surf->VPeriod(); + const Standard_Boolean IsUPer = surf->IsUPeriodic(); + const Standard_Boolean IsVPer = surf->IsVPeriodic(); + const Standard_Real uperiod = IsUPer ? surf->UPeriod() : 0.0; + const Standard_Real vperiod = IsVPer ? surf->VPeriod() : 0.0; TopAbs_State Status = TopAbs_UNKNOWN; Standard_Boolean urecadre = Standard_False, vrecadre = Standard_False; @@ -561,12 +559,10 @@ TopAbs_State BRepTopAdaptor_FClass2d::TestOnRestriction(const gp_Pnt2d& _Puv, Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface(); surf->ChangeSurface().Initialize( Face, Standard_False ); - Standard_Boolean IsUPer, IsVPer; - Standard_Real uperiod=0, vperiod=0; - if ((IsUPer = surf->IsUPeriodic())) - uperiod = surf->UPeriod(); - if ((IsVPer = surf->IsVPeriodic())) - vperiod = surf->VPeriod(); + const Standard_Boolean IsUPer = surf->IsUPeriodic(); + const Standard_Boolean IsVPer = surf->IsVPeriodic(); + const Standard_Real uperiod = IsUPer ? surf->UPeriod() : 0.0; + const Standard_Real vperiod = IsVPer ? surf->VPeriod() : 0.0; TopAbs_State Status = TopAbs_UNKNOWN; Standard_Boolean urecadre = Standard_False, vrecadre = Standard_False; diff --git a/src/Draw/Draw_Window.cxx b/src/Draw/Draw_Window.cxx index 487779682c..f6af461905 100755 --- a/src/Draw/Draw_Window.cxx +++ b/src/Draw/Draw_Window.cxx @@ -2024,11 +2024,8 @@ Standard_Boolean Init_Appli(HINSTANCE hInst, ** Enter the application message-polling loop. This is the anchor for ** the application. */ - if(Draw_IsConsoleSubsystem) - - hWndFrame = NULL; - - else if (hWndFrame = CreateAppWindow(hInst)) + hWndFrame = !Draw_IsConsoleSubsystem ? CreateAppWindow (hInst) : NULL; + if (hWndFrame != NULL) { ShowWindow(hWndFrame,nShow); UpdateWindow(hWndFrame); diff --git a/src/Draw/MainWindow.cxx b/src/Draw/MainWindow.cxx index b5e1a9972d..a63b3b440e 100755 --- a/src/Draw/MainWindow.cxx +++ b/src/Draw/MainWindow.cxx @@ -18,12 +18,8 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. - - - #ifdef WNT - #include #include #include @@ -80,11 +76,12 @@ LRESULT APIENTRY WndProc(HWND hWndFrame, UINT wMsg, WPARAM wParam, LPARAM lParam \*--------------------------------------------------------------------------*/ BOOL CreateProc(HWND hWndFrame) { - HWND hWnd; - - // Save hWnd in the main window in extra memory in 0 - if (hWnd = CreateMDIClientWindow(hWndFrame)) + HWND hWnd = CreateMDIClientWindow (hWndFrame); + if (hWnd != NULL) + { + // Save hWnd in the main window in extra memory in 0 SetWindowLong(hWndFrame, CLIENTWND, (LONG)hWnd); + } return(TRUE); } @@ -96,30 +93,30 @@ BOOL CreateProc(HWND hWndFrame) \*--------------------------------------------------------------------------*/ BOOL CommandProc(HWND hWndFrame, WPARAM wParam, LPARAM /*lParam*/) { - HWND hWndClient; // Handle on window MDI - HWND hWndActive; - - hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND); + // Handle on window MDI + HWND hWndClient = (HWND)GetWindowLong (hWndFrame, CLIENTWND); switch (LOWORD(wParam)) { case IDM_WINDOW_NEXT : - if(hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND)) - hWndActive = (HWND)SendMessage(hWndClient, WM_MDIGETACTIVE, 0, 0l); - SendMessage(hWndClient, WM_MDINEXT, (WPARAM)hWndActive, 0l); + if(hWndClient) + { + HWND hWndActive = (HWND)SendMessage(hWndClient, WM_MDIGETACTIVE, 0, 0l); + SendMessage(hWndClient, WM_MDINEXT, (WPARAM)hWndActive, 0l); + } break; case IDM_WINDOW_CASCADE : - if(hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND)) + if(hWndClient) SendMessage(hWndClient, WM_MDICASCADE, 0, 0l); break; case IDM_WINDOW_TILEHOR : - if(hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND)) + if(hWndClient) SendMessage(hWndClient, WM_MDITILE, MDITILE_HORIZONTAL, 0l); break; case IDM_WINDOW_TILEVERT : - if(hWndClient = (HWND)GetWindowLong(hWndFrame, CLIENTWND)) + if(hWndClient) SendMessage(hWndClient, WM_MDITILE, MDITILE_VERTICAL, 0l); break; diff --git a/src/Extrema/Extrema_GExtCC.gxx b/src/Extrema/Extrema_GExtCC.gxx index fbd971940d..9eaf263ec9 100755 --- a/src/Extrema/Extrema_GExtCC.gxx +++ b/src/Extrema/Extrema_GExtCC.gxx @@ -206,7 +206,8 @@ void Extrema_GExtCC::Perform() //analytical case - one curve is always a line Standard_Integer anInd1 = 0, anInd2 = 1; GeomAbs_CurveType aType2 = type2; - if (inverse = (type1 > type2)) { + inverse = (type1 > type2); + if (inverse) { //algorithm uses inverse order of arguments anInd1 = 1; anInd2 = 0; diff --git a/src/Geom2dGcc/Geom2dGcc_Lin2dTanObl.cxx b/src/Geom2dGcc/Geom2dGcc_Lin2dTanObl.cxx index a114ef6095..f4bfaa19fb 100755 --- a/src/Geom2dGcc/Geom2dGcc_Lin2dTanObl.cxx +++ b/src/Geom2dGcc/Geom2dGcc_Lin2dTanObl.cxx @@ -59,7 +59,8 @@ Geom2dGcc_Lin2dTanObl:: gp_Circ2d c1(CCC1->Circ2d()); GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier()); GccAna_Lin2dTanObl Lin(Qc1,TheLine,Angle); - if((WellDone = Lin.IsDone())) { + WellDone = Lin.IsDone(); + if(WellDone) { NbrSol = Lin.NbSolutions(); for (Standard_Integer i = 1 ; i <= NbrSol ; i++) { linsol(i) = Lin.ThisSolution(i); @@ -123,7 +124,8 @@ Geom2dGcc_Lin2dTanObl:: gp_Circ2d c1(CCC1->Circ2d()); GccEnt_QualifiedCirc Qc1=GccEnt_QualifiedCirc(c1,Qualified1.Qualifier()); GccAna_Lin2dTanObl Lin(Qc1,TheLine,Angle); - if((WellDone = Lin.IsDone())) { + WellDone = Lin.IsDone(); + if(WellDone) { NbrSol = Lin.NbSolutions(); for (Standard_Integer i = 1 ; i <= NbrSol ; i++) { linsol(i) = Lin.ThisSolution(i); @@ -136,7 +138,8 @@ Geom2dGcc_Lin2dTanObl:: else { Geom2dGcc_MyQCurve Qc1(C1,Qualified1.Qualifier()); Geom2dGcc_MyL2dTanObl Lin(Qc1,TheLine,TolAng,Param1,Angle); - if((WellDone = Lin.IsDone())) { + WellDone = Lin.IsDone(); + if(WellDone) { linsol(1) = Lin.ThisSolution(); Lin.Tangency1(par1sol(1),pararg1(1),pnttg1sol(1)); Lin.Intersection2(par2sol(1),pararg2(1),pntint2sol(1)); diff --git a/src/GeomPlate/GeomPlate_BuildPlateSurface.cxx b/src/GeomPlate/GeomPlate_BuildPlateSurface.cxx index 6cfbbca04a..a59c3a8199 100755 --- a/src/GeomPlate/GeomPlate_BuildPlateSurface.cxx +++ b/src/GeomPlate/GeomPlate_BuildPlateSurface.cxx @@ -1354,9 +1354,8 @@ void GeomPlate_BuildPlateSurface::ComputeSurfInit() myInitOrder->SetValue( i, i ); } - Standard_Boolean CourbeJoint=Standard_False; - - if (NTLinCont != 0 && (CourbeJoint = CourbeJointive( myTol3d )) && IsOrderG1()) + Standard_Boolean CourbeJoint = (NTLinCont != 0) && CourbeJointive (myTol3d); + if (CourbeJoint && IsOrderG1()) { nopt = 3; // Tableau contenant le nuage de point pour le calcul du plan diff --git a/src/IntTools/IntTools_FClass2d.cxx b/src/IntTools/IntTools_FClass2d.cxx index e9bffd6d0c..f8319712e0 100755 --- a/src/IntTools/IntTools_FClass2d.cxx +++ b/src/IntTools/IntTools_FClass2d.cxx @@ -528,40 +528,30 @@ IntTools_FClass2d::IntTools_FClass2d() TopAbs_State IntTools_FClass2d::Perform(const gp_Pnt2d& _Puv, const Standard_Boolean RecadreOnPeriodic) const { - Standard_Integer dedans, nbtabclass; - - nbtabclass = TabClass.Length(); - - if(nbtabclass==0) { - return(TopAbs_IN); + Standard_Integer nbtabclass = TabClass.Length(); + if (nbtabclass == 0) + { + return TopAbs_IN; } - - //-- U1 is the First Param and U2 is in this case U1+Period - Standard_Real u, v, uu, vv, uperiod, vperiod; - Standard_Boolean IsUPer, IsVPer, urecadre, vrecadre; - TopAbs_State Status= TopAbs_UNKNOWN; - u=_Puv.X(); - v=_Puv.Y(); - uu = u, vv = v; + //-- U1 is the First Param and U2 is in this case U1+Period + Standard_Real u = _Puv.X(); + Standard_Real v = _Puv.Y(); + Standard_Real uu = u; + Standard_Real vv = v; + TopAbs_State Status = TopAbs_UNKNOWN; Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface(); surf->ChangeSurface().Initialize( Face, Standard_False ); - uperiod=0., vperiod=0.; - IsUPer = surf->IsUPeriodic(); - IsVPer = surf->IsVPeriodic(); - - if (IsUPer){ - uperiod = surf->UPeriod(); - } + const Standard_Boolean IsUPer = surf->IsUPeriodic(); + const Standard_Boolean IsVPer = surf->IsVPeriodic(); + const Standard_Real uperiod = IsUPer ? surf->UPeriod() : 0.0; + const Standard_Real vperiod = IsVPer ? surf->VPeriod() : 0.0; - if (IsVPer){ - vperiod = surf->VPeriod(); - } - - urecadre = Standard_False; - vrecadre = Standard_False; + Standard_Boolean urecadre = Standard_False; + Standard_Boolean vrecadre = Standard_False; + Standard_Integer dedans = 1; if (RecadreOnPeriodic) { @@ -683,31 +673,27 @@ IntTools_FClass2d::IntTools_FClass2d() const Standard_Real Tol, const Standard_Boolean RecadreOnPeriodic) const { - - Standard_Integer dedans, nbtabclass; - - nbtabclass = TabClass.Length(); - - if(nbtabclass==0) { - return(TopAbs_IN); + Standard_Integer nbtabclass = TabClass.Length(); + if (nbtabclass == 0) + { + return TopAbs_IN; } - + //-- U1 is the First Param and U2 in this case is U1+Period Standard_Real u=_Puv.X(); Standard_Real v=_Puv.Y(); Standard_Real uu = u, vv = v; - + Handle(BRepAdaptor_HSurface) surf = new BRepAdaptor_HSurface(); surf->ChangeSurface().Initialize( Face, Standard_False ); - Standard_Boolean IsUPer, IsVPer; - Standard_Real uperiod=0, vperiod=0; - if ((IsUPer = surf->IsUPeriodic())) - uperiod = surf->UPeriod(); - if ((IsVPer = surf->IsVPeriodic())) - vperiod = surf->VPeriod(); + const Standard_Boolean IsUPer = surf->IsUPeriodic(); + const Standard_Boolean IsVPer = surf->IsVPeriodic(); + const Standard_Real uperiod = IsUPer ? surf->UPeriod() : 0.0; + const Standard_Real vperiod = IsVPer ? surf->VPeriod() : 0.0; TopAbs_State Status = TopAbs_UNKNOWN; Standard_Boolean urecadre = Standard_False, vrecadre = Standard_False; - + Standard_Integer dedans = 1; + if (RecadreOnPeriodic) { if (IsUPer) diff --git a/src/OpenGl/OpenGl_telem_view.cxx b/src/OpenGl/OpenGl_telem_view.cxx index b161e674c4..3a061344ba 100644 --- a/src/OpenGl/OpenGl_telem_view.cxx +++ b/src/OpenGl/OpenGl_telem_view.cxx @@ -30,13 +30,13 @@ File OpenGl_telem_view : static void EvalViewMappingMatrix( tel_view_mapping mapping /* View Mapping */, - Tint *error_ind /* Out: Error Indicator */, + Tint* error_ind /* Out: Error Indicator */, Tmatrix3 mat /* Out: Mapping Matrix * */, Tint flag, Tfloat cx, Tfloat cy, Tint /*clip_flag*/, - Tlimit3 */*clip_limit*/ + Tlimit3* /*clip_limit*/ ) { Tfloat gx, gy, xsf, ysf, zsf; diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index 2dfd118277..51a56147b9 100755 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -224,7 +224,7 @@ static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc* #include #include -static Standard_Integer OCC23595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char **/*argv*/) +static Standard_Integer OCC23595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/) { const Handle(TDocStd_Application)& anApp = XCAFApp_Application::GetApplication(); Handle(TDocStd_Document) aDoc; diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index c75af624f0..f7e3c18cf0 100755 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -558,8 +558,8 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft #endif TCollection_AsciiString anOverlappedViewId(""); - Standard_Boolean isOverlapped = Standard_False; - while (isOverlapped = IsWindowOverlapped (aPxLeft, aPxTop, aPxLeft + aPxWidth, aPxTop + aPxHeight, anOverlappedViewId)) + + while (IsWindowOverlapped (aPxLeft, aPxTop, aPxLeft + aPxWidth, aPxTop + aPxHeight, anOverlappedViewId)) { ViewerTest_myViews.Find1(anOverlappedViewId)->Window()->Position (aLeft, aTop, aRight, aBottom); diff --git a/src/Visual3d/Visual3d_View.cxx b/src/Visual3d/Visual3d_View.cxx index 5c3529f5f9..3a75172b1b 100755 --- a/src/Visual3d/Visual3d_View.cxx +++ b/src/Visual3d/Visual3d_View.cxx @@ -3588,8 +3588,8 @@ void Visual3d_View :: SetComputedMode ( const Standard_Boolean aMode ) Visual3d_TypeOfAnswer Answer; Standard_Integer StructId; Standard_Integer i = MyDisplayedStructure.Extent (); - - if ( !( ComputedModeIsActive = aMode ) ) { + ComputedModeIsActive = aMode; + if (!ComputedModeIsActive) { while ( S1Iterator.More () ) { -- 2.20.1