From 9bfa28a7c2e7c1d661f13cbe1cdaceae88c5537d Mon Sep 17 00:00:00 2001 From: kgv Date: Thu, 13 Aug 2015 13:10:49 +0300 Subject: [PATCH] 0026547: Configuration - fix compilation errors on VS2015 Interface_STAT.cxx - rename local variable 'stat' to 'myStat' to avoid name collision. OSD_FileNode.cxx - pass correct argument to va_start(). STEPConstruct_AP203Context::DefaultDateAndTime() - use _get_timezone() instead of global variable timezone on msvc. Graphic3d_ArrayOfPrimitives::VertexColor() - fix reinterpret_cast() argument. Small correction: OCC26481-linesarc.brep is equal to bug26296_linesarc.brep --- src/Graphic3d/Graphic3d_ArrayOfPrimitives.lxx | 2 +- src/Interface/Interface_STAT.cxx | 58 +++++++++---------- src/OSD/OSD_FileNode.cxx | 2 +- .../STEPConstruct_AP203Context.cxx | 5 ++ 4 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/Graphic3d/Graphic3d_ArrayOfPrimitives.lxx b/src/Graphic3d/Graphic3d_ArrayOfPrimitives.lxx index bf7f77e3d6..79e140c2ef 100644 --- a/src/Graphic3d/Graphic3d_ArrayOfPrimitives.lxx +++ b/src/Graphic3d/Graphic3d_ArrayOfPrimitives.lxx @@ -288,7 +288,7 @@ inline void Graphic3d_ArrayOfPrimitives::VertexColor (const Standard_Integer the } Standard_Integer aColorInt = 0; VertexColor (theIndex, aColorInt); - const Graphic3d_Vec4ub& aColor = *reinterpret_cast(aColorInt); + const Graphic3d_Vec4ub& aColor = *reinterpret_cast(&aColorInt); theR = Standard_Real(aColor.r()) / 255.0; theG = Standard_Real(aColor.g()) / 255.0; theB = Standard_Real(aColor.b()) / 255.0; diff --git a/src/Interface/Interface_STAT.cxx b/src/Interface/Interface_STAT.cxx index 107cdbaaf2..24ad2109bb 100644 --- a/src/Interface/Interface_STAT.cxx +++ b/src/Interface/Interface_STAT.cxx @@ -150,15 +150,15 @@ static struct zestat { nbitc, // nb items cycle en cours numst, // n0 etape en cours / cycle numitem; // nb items deja passes / etape courante -} stat; +} TheStat; void Interface_STAT::Start (const Standard_Integer items, const Standard_Integer cycles) const { statact = *this; - statact.Description (stat.nbph,stat.otal,stat.itle); - stat.oldph = stat.phw = 0.; stat.numph = 0; + statact.Description (TheStat.nbph, TheStat.otal, TheStat.itle); + TheStat.oldph = TheStat.phw = 0.; TheStat.numph = 0; NextPhase (items,cycles); } @@ -173,68 +173,68 @@ static struct zestat { (const Standard_Integer items, const Standard_Integer cycles) { // On cumule la phase precedente au total, on efface les donnees "locales" - stat.numcyc = stat.numst = stat.olditp = 0; stat.oldst = stat.stw = 0.; - if (stat.numph >= stat.nbph) { End(); return; } + TheStat.numcyc = TheStat.numst = TheStat.olditp = 0; TheStat.oldst = TheStat.stw = 0.; + if (TheStat.numph >= TheStat.nbph) { End(); return; } - stat.numph ++; stat.oldph += stat.phw; // cumule sur cette phase - stat.nbitp = items; stat.nbcyc = cycles; - statact.Phase(stat.numph, stat.n0,stat.n1,stat.phw,stat.name); - stat.otph = (stat.n1 > 1 ? statact.Step (stat.n0) : 1.); + TheStat.numph ++; TheStat.oldph += TheStat.phw; // cumule sur cette phase + TheStat.nbitp = items; TheStat.nbcyc = cycles; + statact.Phase(TheStat.numph, TheStat.n0, TheStat.n1, TheStat.phw, TheStat.name); + TheStat.otph = (TheStat.n1 > 1 ? statact.Step (TheStat.n0) : 1.); // si un seul cycle, on le demarre; sinon, attendre NextCycle - stat.nbitc = 0; + TheStat.nbitc = 0; if (cycles == 1) NextCycle (items); } void Interface_STAT::SetPhase (const Standard_Integer items, const Standard_Integer cycles) - { stat.nbitp = items; stat.nbcyc = cycles; } + { TheStat.nbitp = items; TheStat.nbcyc = cycles; } void Interface_STAT::NextCycle (const Standard_Integer items) { // cumul de ce cycle sur les cycles deja passes, raz etapes - stat.numcyc ++; stat.olditp += stat.nbitc; + TheStat.numcyc ++; TheStat.olditp += TheStat.nbitc; // if (stat.olditem > stat.nbitp) return; - stat.numst = 1; - stat.oldst = 0.; - stat.stw = (stat.n1 > 1 ? statact.Step(stat.n0 + 1) : stat.otph); - stat.nbitc = items; stat.numitem = 0; + TheStat.numst = 1; + TheStat.oldst = 0.; + TheStat.stw = (TheStat.n1 > 1 ? statact.Step(TheStat.n0 + 1) : TheStat.otph); + TheStat.nbitc = items; TheStat.numitem = 0; } void Interface_STAT::NextStep () { - if (stat.numst >= stat.n1) return; - stat.numst ++; stat.oldst += stat.stw; - stat.numitem = 0; - stat.stw = statact.Step (stat.n0 + stat.numst); + if (TheStat.numst >= TheStat.n1) return; + TheStat.numst ++; TheStat.oldst += TheStat.stw; + TheStat.numitem = 0; + TheStat.stw = statact.Step (TheStat.n0 + TheStat.numst); } void Interface_STAT::NextItem (const Standard_Integer nbitems) - { stat.numitem += nbitems; } + { TheStat.numitem += nbitems; } void Interface_STAT::End () -{ stat.oldph = stat.otal; stat.phw = stat.stw = 0.; stat.itle = stat.name = voidname; } +{ TheStat.oldph = TheStat.otal; TheStat.phw = TheStat.stw = 0.; TheStat.itle = TheStat.name = voidname; } // ########### QUERY ############ Standard_CString Interface_STAT::Where (const Standard_Boolean phase) - { return (phase ? stat.name : stat.itle); } + { return (phase ? TheStat.name : TheStat.itle); } Standard_Integer Interface_STAT::Percent (const Standard_Boolean phase) { - if (stat.numitem > stat.nbitc) stat.numitem = stat.nbitc; + if (TheStat.numitem > TheStat.nbitc) TheStat.numitem = TheStat.nbitc; // on compte les items deja passes Standard_Real enphase = - stat.olditp * stat.otph + // cycles complets passes - stat.nbitc * stat.oldst + // cycle courant, etapes completes passees - stat.numitem * stat.stw; // etape courante + TheStat.olditp * TheStat.otph + // cycles complets passes + TheStat.nbitc * TheStat.oldst + // cycle courant, etapes completes passees + TheStat.numitem * TheStat.stw; // etape courante // proportion pour cette phase - Standard_Real prophase = enphase / (stat.nbitp * stat.otph); + Standard_Real prophase = enphase / (TheStat.nbitp * TheStat.otph); Standard_Integer res = Standard_Integer (prophase*100.); if (phase) return res; // voila pour cette phase // comptage dans les phases - Standard_Real encours = (stat.oldph + stat.phw * prophase) / stat.otal; + Standard_Real encours = (TheStat.oldph + TheStat.phw * prophase) / TheStat.otal; res = Standard_Integer (encours * 100.); return res; } diff --git a/src/OSD/OSD_FileNode.cxx b/src/OSD/OSD_FileNode.cxx index 37d6a9e836..e30439846c 100644 --- a/src/OSD/OSD_FileNode.cxx +++ b/src/OSD/OSD_FileNode.cxx @@ -931,7 +931,7 @@ void _osd_wnt_set_error ( OSD_Error& err, OSD_WhoAmI who, ... ) { Standard_Character buffer[ 2048 ]; va_list arg_ptr; - va_start ( arg_ptr, err ); + va_start ( arg_ptr, who); errCode = GetLastError (); diff --git a/src/STEPConstruct/STEPConstruct_AP203Context.cxx b/src/STEPConstruct/STEPConstruct_AP203Context.cxx index 3129fbc648..ce615a09bd 100644 --- a/src/STEPConstruct/STEPConstruct_AP203Context.cxx +++ b/src/STEPConstruct/STEPConstruct_AP203Context.cxx @@ -123,7 +123,12 @@ Handle(StepBasic_DateAndTime) STEPConstruct_AP203Context::DefaultDateAndTime () Handle(StepBasic_CoordinatedUniversalTimeOffset) zone = new StepBasic_CoordinatedUniversalTimeOffset; + #if defined(_MSC_VER) && _MSC_VER >= 1600 + long shift = 0; + _get_timezone (&shift); + #else Standard_Integer shift = Standard_Integer(timezone); + #endif Standard_Integer shifth = abs ( shift ) / 3600; Standard_Integer shiftm = ( abs ( shift ) - shifth * 3600 ) / 60; StepBasic_AheadOrBehind sense = ( shift >0 ? StepBasic_aobBehind :