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

0024234: occt master is not compiled by VC++ 2005 (vc8 32/64 bit TKBO)

Fixed building by VS 2005 and VS 2013 (Express):
- macro _WIN32_WINNT defined in BOPCol_TBB.hxx for building with TBB on VS 2005
- compiler warnings specific for VS 2005 (vc8) fixed (explicit casts added in assignment expressions involving small integer types)
- definition of functions atanh, acosh, asinh is avoided for vc12 and later (they are provided by CRT in vc12)
- math constants (M_PI and similar) are defined by including math.h rather than by custom code
- misuse of stream operator << fixed in a few places
This commit is contained in:
abv 2013-10-31 00:44:20 +04:00 committed by bugmaster
parent 2b3ac0cf2d
commit 008aef40eb
14 changed files with 43 additions and 50 deletions

View File

@ -21,6 +21,13 @@
#ifdef HAVE_TBB #ifdef HAVE_TBB
// On Windows, function TryEnterCriticalSection has appeared in Windows NT
// and is surrounded by #ifdef in MS VC++ 7.1 headers.
// Thus to use it we need to define appropriate macro saying that we wil
// run on Windows NT 4.0 at least
#if ((defined(_WIN32) || defined(__WIN32__)) && !defined(_WIN32_WINNT))
#define _WIN32_WINNT 0x0501
#endif
#include <tbb/tbb.h> #include <tbb/tbb.h>
using namespace tbb; using namespace tbb;
@ -28,7 +35,6 @@ using namespace tbb;
#define flexible_range blocked_range #define flexible_range blocked_range
#define flexible_for parallel_for #define flexible_for parallel_for
#else // not HAVE_TBB #else // not HAVE_TBB
#define flexible_range serial_range #define flexible_range serial_range

View File

@ -39,9 +39,6 @@
// for null derivatives // for null derivatives
static Standard_Real BSplSLib_zero[3] = {0.0, 0.0, 0.0}; static Standard_Real BSplSLib_zero[3] = {0.0, 0.0, 0.0};
#ifdef WNT
#define M_SQRT2 1.4142135623730950488016887
#endif
//======================================================================= //=======================================================================
//struct : BSplCLib_DataContainer //struct : BSplCLib_DataContainer

View File

@ -258,8 +258,7 @@ void DDF_IOStream::ReadExtendedLine(TCollection_ExtendedString& buffer)
myIStream->get(c); myIStream->get(c);
check++; check++;
// if (!(check % 2)) Storage_StreamExtCharParityError::Raise(); // if (!(check % 2)) Storage_StreamExtCharParityError::Raise();
i = 0; j = 0; i = (Standard_ExtCharacter)c;
i += (Standard_ExtCharacter)c;
if (c == '\0') fin = Standard_True; if (c == '\0') fin = Standard_True;
i = (i << 8); i = (i << 8);
@ -267,7 +266,7 @@ void DDF_IOStream::ReadExtendedLine(TCollection_ExtendedString& buffer)
check++; check++;
// if ((check % 2) != 0) Storage_StreamExtCharParityError::Raise(); // if ((check % 2) != 0) Storage_StreamExtCharParityError::Raise();
// cout << check << endl; // cout << check << endl;
j += (Standard_ExtCharacter)c; j = (Standard_ExtCharacter)c;
if (c != '\n') fin = Standard_False; if (c != '\n') fin = Standard_False;
i |= (0x00FF & j); i |= (0x00FF & j);
buffer += (Standard_ExtCharacter)i; buffer += (Standard_ExtCharacter)i;

View File

@ -237,8 +237,8 @@ void FSD_File::ReadExtendedLine(TCollection_ExtendedString& buffer)
if (c == tg[count]) count++; if (c == tg[count]) count++;
else count = 0; else count = 0;
if (count < SIZEOFNORMALEXTENDEDSECTION) { if (count < SIZEOFNORMALEXTENDEDSECTION) {
i = 0; j = 0; j = 0;
i += (Standard_ExtCharacter)c; i = (Standard_ExtCharacter)c;
if (c == '\0') fin = Standard_True; if (c == '\0') fin = Standard_True;
i = (i << 8); i = (i << 8);
@ -246,7 +246,7 @@ void FSD_File::ReadExtendedLine(TCollection_ExtendedString& buffer)
if (c == tg[count]) count++; if (c == tg[count]) count++;
else count = 0; else count = 0;
if (count < SIZEOFNORMALEXTENDEDSECTION) { if (count < SIZEOFNORMALEXTENDEDSECTION) {
j += (Standard_ExtCharacter)c; j = (Standard_ExtCharacter)c;
if (c != '\n') { if (c != '\n') {
fin = Standard_False; fin = Standard_False;
i |= (0x00FF & j); i |= (0x00FF & j);

View File

@ -111,7 +111,9 @@ Handle(TColStd_HArray1OfByte) Graphic3d_MarkerImage::GetBitMapArray (const Stand
aBitOn = anAlphaValue > theAlphaValue; aBitOn = anAlphaValue > theAlphaValue;
} }
aBitMap->ChangeValue (aNumOfBytesInRow * aRow + aColumn / 8) += aBitOn ? (0x80 >> (aColumn % 8)) : 0; Standard_Integer anIndex = aNumOfBytesInRow * aRow + aColumn / 8;
aBitMap->SetValue (anIndex, (Standard_Byte)(aBitMap->Value (anIndex) +
(aBitOn ? (0x80 >> (aColumn % 8)) : 0)));
} }
} }

View File

@ -461,7 +461,7 @@ static void writefnes (Standard_OStream& S, const Standard_CString ligne)
char val; char val;
for (Standard_Integer i = 0; i < 80; i ++) { for (Standard_Integer i = 0; i < 80; i ++) {
if (ligne[i] == '\0') return; if (ligne[i] == '\0') return;
val = ligne[i] ^ (150 + (i & 3)); val = (char)(ligne[i] ^ (150 + (i & 3)));
S << val; S << val;
} }
} }
@ -487,7 +487,11 @@ Standard_Boolean IGESData_IGESWriter::Print (Standard_OStream& S) const
Standard_Integer i; // svv Jan11 2000 : porting on DEC Standard_Integer i; // svv Jan11 2000 : porting on DEC
for (i = 0; i < MaxcarsG; i ++) blancs[i] = ' '; for (i = 0; i < MaxcarsG; i ++) blancs[i] = ' ';
blancs[MaxcarsG] = '\0'; blancs[MaxcarsG] = '\0';
if (fnes) for (i = 0; i < MaxcarsG; i ++) blancs[i] = blancs[i] ^ (150 + (i & 3)); if (fnes)
{
for (i = 0; i < MaxcarsG; i ++)
blancs[i] = (char)(blancs[i] ^ (150 + (i & 3)));
}
if (thesect != 4) Interface_InterfaceError::Raise if (thesect != 4) Interface_InterfaceError::Raise
("IGESWriter not ready for Print"); ("IGESWriter not ready for Print");

View File

@ -70,7 +70,8 @@ int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes)
} }
} }
if ((ligne[0] & 128)&&modefnes) { if ((ligne[0] & 128)&&modefnes) {
for (i = 0; i < 80; i ++) ligne[i] = ligne[i] ^ (150 + (i & 3)); for (i = 0; i < 80; i ++)
ligne[i] = (char)(ligne[i] ^ (150 + (i & 3)));
} }
} }
if (feof(lefic)) return 0; if (feof(lefic)) return 0;

View File

@ -699,7 +699,7 @@ Standard_Integer ShapeFix_ComposeShell::ComputeCode (const Handle(ShapeExtend_Wi
code = IOR_LEFT; code = IOR_LEFT;
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL2 ); myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL2 );
#ifdef DEB #ifdef DEB
cout << "Warning: ShapeFix_ComposeShell::ComputeCode: lost intersection point" << cout; cout << "Warning: ShapeFix_ComposeShell::ComputeCode: lost intersection point" << endl;
#endif #endif
} }
return code; return code;

View File

@ -357,7 +357,7 @@ Standard_UUID Standard_GUID::ToUUID() const
result.Data1 = my32b ; result.Data1 = my32b ;
result.Data2 = my16b1 ; result.Data2 = my16b1 ;
result.Data3 = my16b2 ; result.Data3 = my16b2 ;
result.Data4[0] = my16b3 >> 8 ; result.Data4[0] = (unsigned char)(my16b3 >> 8);
result.Data4[1] = (char) my16b3; result.Data4[1] = (char) my16b3;
result.Data4[2] = my8b1 ; result.Data4[2] = my8b1 ;
result.Data4[3] = my8b2 ; result.Data4[3] = my8b2 ;

View File

@ -16,17 +16,10 @@
// purpose or non-infringement. Please see the License for the specific terms // purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License. // and conditions governing the rights and limitations under the License.
// -------------------------------------------------------------------------
// Definition des fonctions mathematiques hyperboliques: acosh, asinh, atanh
// pour Windows/NT uniquement.
// -------------------------------------------------------------------------
#ifdef WNT
#include <math.h>
#include <Standard_math.hxx> #include <Standard_math.hxx>
#ifndef _Standard_MacroHeaderFile // MSVC versions prior to 12 did not provided acosh, asinh, atanh functions in standard library
# include <Standard_Macro.hxx> #if defined(_MSC_VER) && (_MSC_VER < 1800)
#endif // _Standard_MacroHeaderFile
Standard_EXPORT double __cdecl acosh( double X) Standard_EXPORT double __cdecl acosh( double X)
{ {
@ -53,4 +46,5 @@ Standard_EXPORT double __cdecl atanh( double X)
res = log((1 + X) / (1 - X)) / 2; res = log((1 + X) / (1 - X)) / 2;
return res; return res;
}; };
#endif #endif

View File

@ -20,31 +20,17 @@
#include <Standard_Macro.hxx> #include <Standard_Macro.hxx>
#endif #endif
#ifdef WNT #ifdef _MSC_VER
# ifndef __MATH_WNT_H #define _USE_MATH_DEFINES
# define __MATH_WNT_H #include <math.h>
// MSVC versions prior to 12 did not provided acosh, asinh, atanh functions in standard library
#if _MSC_VER < 1800
__Standard_API double __cdecl acosh ( double ); __Standard_API double __cdecl acosh ( double );
__Standard_API double __cdecl asinh ( double ); __Standard_API double __cdecl asinh ( double );
__Standard_API double __cdecl atanh ( double ); __Standard_API double __cdecl atanh ( double );
# ifdef M_SQRT1_2
# undef M_SQRT1_2
#endif #endif
# define M_SQRT1_2 0.707106781186547524401
# ifdef M_PI_2 #endif /* _MSC_VER */
# undef M_PI_2
# endif
# define M_PI_2 1.57079632679489661923
# ifdef M_PI
# undef M_PI
# endif
# define M_PI 3.14159265358979323846
# endif /* __MATH_WNT_H */
#endif /* WNT */

View File

@ -147,7 +147,7 @@ Standard_OStream& TDataStd_Integer::Dump (Standard_OStream& anOS) const
anOS << myValue; anOS << myValue;
// //
anOS <<"\nAttribute fields: "; anOS <<"\nAttribute fields: ";
anOS << TDF_Attribute::Dump(anOS); TDF_Attribute::Dump(anOS);
return anOS; return anOS;
} }

View File

@ -452,7 +452,11 @@ Standard_Boolean TestTransition(const TopOpeBRepDS_Transition& T,const TopoDS_Fa
if(!transok) { if(!transok) {
cout<<"States found by classifier :"<<endl; cout<<"States found by classifier :"<<endl;
cout<<"Before :"<<TopAbs::Print(stb, cout)<<"After :"<<TopAbs::Print(sta, cout)<<endl; cout << "Before :";
TopAbs::Print(stb, cout);
cout << "After :";
TopAbs::Print(sta, cout);
cout << endl;
} }
return transok; return transok;

View File

@ -92,7 +92,7 @@ void SprintfExtStr(char * out, const TCollection_ExtendedString& theString) {
while (len) { while (len) {
for(int j = 0,k=3; j<4; j++,k--) { for(int j = 0,k=3; j<4; j++,k--) {
unsigned short v = *(p+i) & mask[j];//x000 unsigned short v = *(p+i) & mask[j];//x000
v = v >> (4*k); v = (unsigned short)(v >> (4*k));
if(v < 10) if(v < 10)
v |= 0x30; v |= 0x30;
else else