1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-09 18:50:54 +03:00

0026171: Coding rules - eliminate -Wshorten-64-to-32 CLang warnings

This commit is contained in:
rkv 2021-11-11 00:06:46 +03:00 committed by inv
parent 2b40ee81d1
commit 57c5e9e895
28 changed files with 189 additions and 246 deletions

@ -115,6 +115,9 @@ if (MSVC)
endif() endif()
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshorten-64-to-32")
endif()
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
if (APPLE) if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}") set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")

@ -39,6 +39,10 @@ win32 {
DEFINES += _SCL_SECURE_NO_WARNINGS DEFINES += _SCL_SECURE_NO_WARNINGS
} else { } else {
CONFIG += c++11 CONFIG += c++11
clang {
QMAKE_CFLAGS_WARN_ON += -Wshorten-64-to-32
QMAKE_CXXFLAGS_WARN_ON += -Wshorten-64-to-32
}
QMAKE_CFLAGS += -fexceptions QMAKE_CFLAGS += -fexceptions
QMAKE_CXXFLAGS += -fexceptions QMAKE_CXXFLAGS += -fexceptions
QMAKE_CXXFLAGS += -fvisibility=default QMAKE_CXXFLAGS += -fvisibility=default

@ -97,12 +97,12 @@
#define DIMAXIS 20 #define DIMAXIS 20
#if DEBUG #if DEBUG
static long unsigned APPELREJECTION=0L; static unsigned int APPELREJECTION=0L;
static long unsigned REJECTNIV0=0L; static unsigned int REJECTNIV0=0L;
static long unsigned REJECTNIV1=0L; static unsigned int REJECTNIV1=0L;
static long unsigned NBCOMPARE=0L; static unsigned int NBCOMPARE=0L;
static long unsigned NBBOITES=0L; static unsigned int NBBOITES=0L;
static long unsigned NBBOITESATESTER=0L; static unsigned int NBBOITESATESTER=0L;
#endif #endif
//======================================================================= //=======================================================================
static Standard_Integer ComputeSize(const Standard_Integer n) { static Standard_Integer ComputeSize(const Standard_Integer n) {
@ -113,7 +113,7 @@ static Standard_Integer ComputeSize(const Standard_Integer n) {
return(8); return(8);
} }
//======================================================================= //=======================================================================
static long unsigned _P2[32] = { 1,2,4,8, 16,32,64,128, 256,512,1024,2048, static unsigned int _P2[32] = { 1,2,4,8, 16,32,64,128, 256,512,1024,2048,
4096,8192,16384,32768, 4096,8192,16384,32768,
65536,131072,262144,524288, 65536,131072,262144,524288,
1048576,2097152,4194304,8388608, 1048576,2097152,4194304,8388608,
@ -130,12 +130,12 @@ public:
Standard_Integer _BASE; Standard_Integer _BASE;
Standard_Integer _BASEM1; Standard_Integer _BASEM1;
long unsigned ind; unsigned int ind;
long unsigned Isize; unsigned int Isize;
Standard_Integer ssize; Standard_Integer ssize;
Standard_Real Xmin,Xmax,Ymin,Ymax,Zmin,Zmax; Standard_Real Xmin,Xmax,Ymin,Ymax,Zmin,Zmax;
long unsigned *p; unsigned int* p;
Standard_Integer **axisX; Standard_Integer **axisX;
Standard_Integer **axisY; Standard_Integer **axisY;
Standard_Integer **axisZ; Standard_Integer **axisZ;
@ -152,9 +152,9 @@ public:
void AppendAxisY(const Standard_Integer i,const Standard_Integer v); void AppendAxisY(const Standard_Integer i,const Standard_Integer v);
void AppendAxisZ(const Standard_Integer i,const Standard_Integer v); void AppendAxisZ(const Standard_Integer i,const Standard_Integer v);
void Add(long unsigned t) { int o=t&31; int k=t>>5; p[k]|=_P2[o]; } void Add (unsigned int t) { int o=t&31; int k=t>>5; p[k]|=_P2[o]; }
int Val(long unsigned t) { int o=t&31; int k=t>>5; return(p[k]&_P2[o]); } int Val (unsigned int t) { int o=t&31; int k=t>>5; return(p[k]&_P2[o]); }
void Raz(long unsigned t) { int o=t&31; int k=t>>5; p[k]&= ~(_P2[o]); } void Raz (unsigned int t) { int o=t&31; int k=t>>5; p[k]&= ~(_P2[o]); }
Standard_Integer NbAxisX(const Standard_Integer i) { return(axisX[0][i]); } Standard_Integer NbAxisX(const Standard_Integer i) { return(axisX[0][i]); }
Standard_Integer NbAxisY(const Standard_Integer i) { return(axisY[0][i]); } Standard_Integer NbAxisY(const Standard_Integer i) { return(axisY[0][i]); }
@ -220,10 +220,10 @@ BSB_T3Bits::BSB_T3Bits(int size)
default : { _DECAL=3; _DECAL2= 6; _BASE= 8; _BASEM1= 7; break; } default : { _DECAL=3; _DECAL2= 6; _BASE= 8; _BASEM1= 7; break; }
} }
Standard_Integer i ; Standard_Integer i ;
long unsigned nb = (size*size*size)>>5; unsigned int nb = (size*size*size)>>5;
Isize = nb; Isize = nb;
ssize = size; ssize = size;
p = new long unsigned [nb]; p = new unsigned int[nb];
do { p[--nb]=0; } while(nb); do { p[--nb]=0; } while(nb);
axisX = (Standard_Integer **) malloc((size+1)*sizeof(Standard_Integer *)); axisX = (Standard_Integer **) malloc((size+1)*sizeof(Standard_Integer *));
@ -457,7 +457,7 @@ void Bnd_BoundSortBox::SortBoxes()
for (lacaseX=firstcaseX; lacaseX<=lastcaseX; lacaseX++) { for (lacaseX=firstcaseX; lacaseX<=lastcaseX; lacaseX++) {
for (lacaseY=firstcaseY; lacaseY<=lastcaseY; lacaseY++) { for (lacaseY=firstcaseY; lacaseY<=lastcaseY; lacaseY++) {
for (lacaseZ=firstcaseZ; lacaseZ<=lastcaseZ; lacaseZ++) { for (lacaseZ=firstcaseZ; lacaseZ<=lastcaseZ; lacaseZ++) {
long unsigned t=Map->GrilleInteger(lacaseX-1,lacaseY-1,lacaseZ-1); unsigned int t = Map->GrilleInteger(lacaseX-1,lacaseY-1,lacaseZ-1);
Map->Add(t); Map->Add(t);
} }
} }
@ -578,7 +578,7 @@ void Bnd_BoundSortBox::Add(const Bnd_Box& theBox,
for (theGapX=firstGapX; theGapX<=lastGapX; theGapX++) { for (theGapX=firstGapX; theGapX<=lastGapX; theGapX++) {
for (theGapY=firstGapY; theGapY<=lastGapY; theGapY++) { for (theGapY=firstGapY; theGapY<=lastGapY; theGapY++) {
for (theGapZ=firstGapZ; theGapZ<=lastGapZ; theGapZ++) { for (theGapZ=firstGapZ; theGapZ<=lastGapZ; theGapZ++) {
long unsigned t=Map->GrilleInteger(theGapX-1,theGapY-1,theGapZ-1); unsigned int t = Map->GrilleInteger(theGapX-1,theGapY-1,theGapZ-1);
Map->Add(t); Map->Add(t);
} }
} }
@ -668,7 +668,7 @@ const TColStd_ListOfInteger& Bnd_BoundSortBox::Compare (const Bnd_Box& theBox)
for(Standard_Integer i=i0; touch==Standard_False && i<=i1;i++) { for(Standard_Integer i=i0; touch==Standard_False && i<=i1;i++) {
for(Standard_Integer j=j0; touch==Standard_False && j<=j1;j++) { for(Standard_Integer j=j0; touch==Standard_False && j<=j1;j++) {
for(Standard_Integer k=k0; touch==Standard_False && k<=k1;k++) { for(Standard_Integer k=k0; touch==Standard_False && k<=k1;k++) {
long unsigned t=Map->GrilleInteger(i,j,k); unsigned int t = Map->GrilleInteger(i,j,k);
if(Map->Val(t)) { if(Map->Val(t)) {
touch = Standard_True; touch = Standard_True;
} }

@ -690,7 +690,7 @@ TCollection_AsciiString Draw_Interpretor::GetLog ()
char buffer[BUFSIZE + 1]; char buffer[BUFSIZE + 1];
for (;;) for (;;)
{ {
int nbRead = read (myFDLog, buffer, BUFSIZE); int nbRead = (int )read (myFDLog, buffer, BUFSIZE);
if (nbRead <= 0) if (nbRead <= 0)
{ {
break; break;

@ -1084,7 +1084,7 @@ void Draw_Viewer::Select (Standard_Integer& theId,
theId = MAXVIEW; theId = MAXVIEW;
while (theId >= MAXVIEW) while (theId >= MAXVIEW)
{ {
Standard_Integer aWindowNumber = 0; long aWindowNumber = 0;
Draw_Window::GetNextEvent (theToWait, aWindowNumber, theX, theY, theButton); Draw_Window::GetNextEvent (theToWait, aWindowNumber, theX, theY, theButton);
if (theY < 0) if (theY < 0)
{ {

@ -853,7 +853,7 @@ void Draw_Window::DrawString (Standard_Integer theX, Standard_Integer theY,
} }
ReleaseDC (myWindow, hDC); ReleaseDC (myWindow, hDC);
#elif defined(HAVE_XLIB) #elif defined(HAVE_XLIB)
XDrawString (Draw_WindowDisplay, GetDrawable(), myBase->gc, theX, theY, (char* )theText, strlen(theText)); XDrawString (Draw_WindowDisplay, GetDrawable(), myBase->gc, theX, theY, (char* )theText, (int )strlen(theText));
#else #else
(void )theX; (void )theX;
(void )theY; (void )theY;

@ -249,10 +249,10 @@ public:
void Wait (Standard_Boolean theToWait = Standard_True); void Wait (Standard_Boolean theToWait = Standard_True);
#elif defined(__APPLE__) #elif defined(__APPLE__)
Standard_Boolean IsEqualWindows (const Standard_Integer& theWindowNumber); Standard_Boolean IsEqualWindows (const long theWindowNumber);
static void GetNextEvent (Standard_Boolean theWait, static void GetNextEvent (Standard_Boolean theWait,
Standard_Integer& theWindowNumber, long& theWindowNumber,
Standard_Integer& theX, Standard_Integer& theX,
Standard_Integer& theY, Standard_Integer& theY,
Standard_Integer& theButton); Standard_Integer& theButton);

@ -552,13 +552,13 @@ Standard_Boolean Draw_Window::Save (Standard_CString theFileName) const
return isSuccess; return isSuccess;
} }
Standard_Boolean Draw_Window::IsEqualWindows (const Standard_Integer& theWindowNumber) Standard_Boolean Draw_Window::IsEqualWindows (const long theWindowNumber)
{ {
return ([myWindow windowNumber] == theWindowNumber); return ([myWindow windowNumber] == theWindowNumber);
} }
void Draw_Window::GetNextEvent (Standard_Boolean theWait, void Draw_Window::GetNextEvent (Standard_Boolean theWait,
Standard_Integer& theWindowNumber, long& theWindowNumber,
Standard_Integer& theX, Standard_Integer& theX,
Standard_Integer& theY, Standard_Integer& theY,
Standard_Integer& theButton) Standard_Integer& theButton)

@ -507,7 +507,7 @@ Storage_Error FSD_BinaryFile::BeginWriteInfoSection()
myStream)) myStream))
throw Storage_StreamWriteError(); throw Storage_StreamWriteError();
myHeader.binfo = ftell(myStream); myHeader.binfo = (Standard_Integer )ftell(myStream);
WriteHeader(); WriteHeader();
return Storage_VSOk; return Storage_VSOk;
@ -590,8 +590,7 @@ Standard_Integer FSD_BinaryFile::WriteInfo (Standard_OStream&
Storage_Error FSD_BinaryFile::EndWriteInfoSection() Storage_Error FSD_BinaryFile::EndWriteInfoSection()
{ {
myHeader.einfo = ftell(myStream); myHeader.einfo = (Standard_Integer )ftell(myStream);
return Storage_VSOk; return Storage_VSOk;
} }
@ -602,7 +601,6 @@ Storage_Error FSD_BinaryFile::EndWriteInfoSection()
Storage_Error FSD_BinaryFile::EndWriteInfoSection(Standard_OStream& theOStream) Storage_Error FSD_BinaryFile::EndWriteInfoSection(Standard_OStream& theOStream)
{ {
myHeader.einfo = (Standard_Integer)theOStream.tellp(); myHeader.einfo = (Standard_Integer)theOStream.tellp();
return Storage_VSOk; return Storage_VSOk;
} }
@ -795,7 +793,7 @@ Storage_Error FSD_BinaryFile::EndReadInfoSection()
Storage_Error FSD_BinaryFile::BeginWriteCommentSection() Storage_Error FSD_BinaryFile::BeginWriteCommentSection()
{ {
myHeader.bcomment = ftell(myStream); myHeader.bcomment = (Standard_Integer )ftell(myStream);
return Storage_VSOk; return Storage_VSOk;
} }
@ -852,8 +850,7 @@ Standard_Integer FSD_BinaryFile::WriteComment (Standard_OStream&
Storage_Error FSD_BinaryFile::EndWriteCommentSection() Storage_Error FSD_BinaryFile::EndWriteCommentSection()
{ {
myHeader.ecomment = ftell(myStream); myHeader.ecomment = (Standard_Integer )ftell(myStream);
return Storage_VSOk; return Storage_VSOk;
} }
@ -931,8 +928,7 @@ Storage_Error FSD_BinaryFile::EndReadCommentSection()
Storage_Error FSD_BinaryFile::BeginWriteTypeSection() Storage_Error FSD_BinaryFile::BeginWriteTypeSection()
{ {
myHeader.btype = ftell(myStream); myHeader.btype = (Standard_Integer )ftell(myStream);
return Storage_VSOk; return Storage_VSOk;
} }
@ -965,8 +961,7 @@ void FSD_BinaryFile::WriteTypeInformations(const Standard_Integer typeNum,
Storage_Error FSD_BinaryFile::EndWriteTypeSection() Storage_Error FSD_BinaryFile::EndWriteTypeSection()
{ {
myHeader.etype = ftell(myStream); myHeader.etype = (Standard_Integer )ftell(myStream);
return Storage_VSOk; return Storage_VSOk;
} }
@ -1046,8 +1041,7 @@ Storage_Error FSD_BinaryFile::EndReadTypeSection()
Storage_Error FSD_BinaryFile::BeginWriteRootSection() Storage_Error FSD_BinaryFile::BeginWriteRootSection()
{ {
myHeader.broot = ftell(myStream); myHeader.broot = (Standard_Integer )ftell(myStream);
return Storage_VSOk; return Storage_VSOk;
} }
@ -1080,8 +1074,7 @@ void FSD_BinaryFile::WriteRoot(const TCollection_AsciiString& rootName, const St
Storage_Error FSD_BinaryFile::EndWriteRootSection() Storage_Error FSD_BinaryFile::EndWriteRootSection()
{ {
myHeader.eroot = ftell(myStream); myHeader.eroot = (Standard_Integer )ftell(myStream);
return Storage_VSOk; return Storage_VSOk;
} }
@ -1163,8 +1156,7 @@ Storage_Error FSD_BinaryFile::EndReadRootSection()
Storage_Error FSD_BinaryFile::BeginWriteRefSection() Storage_Error FSD_BinaryFile::BeginWriteRefSection()
{ {
myHeader.bref = ftell(myStream); myHeader.bref = (Standard_Integer )ftell(myStream);
return Storage_VSOk; return Storage_VSOk;
} }
@ -1196,8 +1188,7 @@ void FSD_BinaryFile::WriteReferenceType(const Standard_Integer reference,const S
Storage_Error FSD_BinaryFile::EndWriteRefSection() Storage_Error FSD_BinaryFile::EndWriteRefSection()
{ {
myHeader.eref = ftell(myStream); myHeader.eref = (Standard_Integer )ftell(myStream);
return Storage_VSOk; return Storage_VSOk;
} }
@ -1278,8 +1269,7 @@ Storage_Error FSD_BinaryFile::EndReadRefSection()
Storage_Error FSD_BinaryFile::BeginWriteDataSection() Storage_Error FSD_BinaryFile::BeginWriteDataSection()
{ {
myHeader.bdata = ftell(myStream); myHeader.bdata = (Standard_Integer )ftell(myStream);
return Storage_VSOk; return Storage_VSOk;
} }
@ -1338,7 +1328,7 @@ void FSD_BinaryFile::EndWritePersistentObjectData()
Storage_Error FSD_BinaryFile::EndWriteDataSection() Storage_Error FSD_BinaryFile::EndWriteDataSection()
{ {
myHeader.edata = ftell(myStream); myHeader.edata = (Standard_Integer )ftell(myStream);
fseek(myStream,myHeader.binfo,SEEK_SET); fseek(myStream,myHeader.binfo,SEEK_SET);
WriteHeader(); WriteHeader();

@ -653,7 +653,7 @@ float Font_FTFont::AdvanceY (Standard_Utf32Char theUCharNext) const
Standard_Integer Font_FTFont::GlyphsNumber (bool theToIncludeFallback) const Standard_Integer Font_FTFont::GlyphsNumber (bool theToIncludeFallback) const
{ {
#ifdef HAVE_FREETYPE #ifdef HAVE_FREETYPE
Standard_Integer aNbGlyphs = myFTFace->num_glyphs; Standard_Integer aNbGlyphs = (Standard_Integer )myFTFace->num_glyphs;
if (theToIncludeFallback) if (theToIncludeFallback)
{ {
for (Standard_Integer aFontIter = 0; aFontIter < Font_UnicodeSubset_NB; ++aFontIter) for (Standard_Integer aFontIter = 0; aFontIter < Font_UnicodeSubset_NB; ++aFontIter)

@ -64,7 +64,6 @@ IntPatch_PrmPrmIntersection.hxx
IntPatch_PrmPrmIntersection.lxx IntPatch_PrmPrmIntersection.lxx
IntPatch_PrmPrmIntersection_T3Bits.cxx IntPatch_PrmPrmIntersection_T3Bits.cxx
IntPatch_PrmPrmIntersection_T3Bits.hxx IntPatch_PrmPrmIntersection_T3Bits.hxx
IntPatch_PrmPrmIntersection_T3Bits.lxx
IntPatch_RLine.cxx IntPatch_RLine.cxx
IntPatch_RLine.hxx IntPatch_RLine.hxx
IntPatch_RLine.lxx IntPatch_RLine.lxx

@ -3308,7 +3308,7 @@ void IntPatch_PrmPrmIntersection::PointDepart(Handle(IntSurf_LineOn2S)& LineOn2S
for(si=-1; si<= 1 && nb<LIM; si++) { for(si=-1; si<= 1 && nb<LIM; si++) {
for(sj=-1; sj<= 1 && nb<LIM; sj++) { for(sj=-1; sj<= 1 && nb<LIM; sj++) {
for(sk=-1; sk<= 1 && nb<LIM; sk++) { for(sk=-1; sk<= 1 && nb<LIM; sk++) {
long unsigned lu=GrilleInteger(i+si,j+sj,k+sk); Standard_Integer lu = GrilleInteger(i+si,j+sj,k+sk);
if(M1.Val(lu) && M2.Val(lu)) { if(M1.Val(lu) && M2.Val(lu)) {
nb++; nb++;
} }
@ -3320,7 +3320,7 @@ void IntPatch_PrmPrmIntersection::PointDepart(Handle(IntSurf_LineOn2S)& LineOn2S
for(sj=-1; sj<= 1; sj++) { for(sj=-1; sj<= 1; sj++) {
for(sk=-1; sk<= 1; sk++) { for(sk=-1; sk<= 1; sk++) {
if(si || sj || sk) { if(si || sj || sk) {
long unsigned lu=GrilleInteger(i+si,j+sj,k+sk); Standard_Integer lu = GrilleInteger(i+si,j+sj,k+sk);
M1.Raz(lu); M1.Raz(lu);
} }
} }

@ -14,7 +14,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <IntPatch_PrmPrmIntersection_T3Bits.hxx> #include <IntPatch_PrmPrmIntersection_T3Bits.hxx>
IntPatch_PrmPrmIntersection_T3Bits::IntPatch_PrmPrmIntersection_T3Bits(const Standard_Integer size) IntPatch_PrmPrmIntersection_T3Bits::IntPatch_PrmPrmIntersection_T3Bits(const Standard_Integer size)
@ -23,12 +22,12 @@ IntPatch_PrmPrmIntersection_T3Bits::IntPatch_PrmPrmIntersection_T3Bits(const Sta
Standard_Integer nb = (size*size*size)>>5; Standard_Integer nb = (size*size*size)>>5;
Isize = nb; Isize = nb;
p = new Standard_Integer [nb]; p = new Standard_Integer [nb];
do { ((Standard_Integer *) p)[--nb]=0; } while(nb); do { p[--nb] = 0; } while(nb);
} }
void IntPatch_PrmPrmIntersection_T3Bits::Destroy() IntPatch_PrmPrmIntersection_T3Bits::~IntPatch_PrmPrmIntersection_T3Bits()
{ {
if(p) { delete[] ((Standard_Integer*)p); p=NULL; } if (p) { delete[] p; p = NULL; }
} }
void IntPatch_PrmPrmIntersection_T3Bits::ResetAnd() void IntPatch_PrmPrmIntersection_T3Bits::ResetAnd()
@ -42,10 +41,10 @@ Standard_Integer IntPatch_PrmPrmIntersection_T3Bits::And(IntPatch_PrmPrmIntersec
int k=indice>>5; int k=indice>>5;
while(k<Isize) while(k<Isize)
{ {
Standard_Integer r=((Standard_Integer *) p)[k] & ((Standard_Integer *) Oth.p)[k]; Standard_Integer r = p[k] & Oth.p[k];
if(r) if(r)
{ {
unsigned long int c=0; unsigned int c = 0;
do do
{ {
if(r&1) if(r&1)

@ -24,57 +24,40 @@
#include <Standard_Address.hxx> #include <Standard_Address.hxx>
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
class IntPatch_PrmPrmIntersection_T3Bits class IntPatch_PrmPrmIntersection_T3Bits
{ {
public: public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT IntPatch_PrmPrmIntersection_T3Bits(const Standard_Integer size); Standard_EXPORT IntPatch_PrmPrmIntersection_T3Bits(const Standard_Integer size);
Standard_EXPORT void Destroy(); Standard_EXPORT ~IntPatch_PrmPrmIntersection_T3Bits();
~IntPatch_PrmPrmIntersection_T3Bits()
{
Destroy();
}
void Add (const Standard_Integer t); void Add (const Standard_Integer t)
{
p[t>>5] |= (1<<(((unsigned int)t)&31));
}
Standard_Integer Val (const Standard_Integer t) const; Standard_Integer Val (const Standard_Integer t) const
{
return (p[t>>5] & (1<<(((unsigned int)t)&31)));
}
void Raz (const Standard_Integer t); void Raz (const Standard_Integer t)
{
p[t>>5] &= ~(1<<(((unsigned int)t)&31));
}
Standard_EXPORT void ResetAnd(); Standard_EXPORT void ResetAnd();
Standard_EXPORT Standard_Integer And (IntPatch_PrmPrmIntersection_T3Bits& Oth, Standard_Integer& indiceprecedent); Standard_EXPORT Standard_Integer And (IntPatch_PrmPrmIntersection_T3Bits& Oth, Standard_Integer& indiceprecedent);
protected:
private: private:
Standard_Integer* p;
Standard_Address p;
Standard_Integer Isize; Standard_Integer Isize;
}; };
#include <IntPatch_PrmPrmIntersection_T3Bits.lxx>
#endif // _IntPatch_PrmPrmIntersection_T3Bits_HeaderFile #endif // _IntPatch_PrmPrmIntersection_T3Bits_HeaderFile

@ -1,30 +0,0 @@
// Created on: 1999-12-16
// Created by: Atelier CAS2000
// Copyright (c) 1999-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
inline void IntPatch_PrmPrmIntersection_T3Bits::Add(const Standard_Integer t)
{
((Standard_Integer *) p)[t>>5] |= (1<<(((unsigned int)t)&31));
}
inline Standard_Integer IntPatch_PrmPrmIntersection_T3Bits::Val(const Standard_Integer t) const
{
return (((Standard_Integer *) p)[t>>5] & (1<<(((unsigned int)t)&31)));
}
inline void IntPatch_PrmPrmIntersection_T3Bits::Raz(const Standard_Integer t)
{
((Standard_Integer *) p)[t>>5] &= ~(1<<(((unsigned int)t)&31));
}

@ -253,6 +253,9 @@ protected:
ListNode *Next; ListNode *Next;
}; };
//! Cell index type.
typedef Standard_Integer Cell_IndexType;
/** /**
* Auxiliary structure representing a cell in the space. * Auxiliary structure representing a cell in the space.
* Cells are stored in the map, each cell contains list of objects * Cells are stored in the map, each cell contains list of objects
@ -270,14 +273,14 @@ protected:
{ {
for (int i = 0; i < theCellSize.Size(); i++) for (int i = 0; i < theCellSize.Size(); i++)
{ {
Standard_Real val = (Standard_Real)(Inspector::Coord(i, thePnt) / theCellSize(theCellSize.Lower() + i)); Standard_Real aVal = (Standard_Real)(Inspector::Coord(i, thePnt) / theCellSize(theCellSize.Lower() + i));
//If the value of index is greater than //If the value of index is greater than
//INT_MAX it is decreased correspondingly for the value of INT_MAX. If the value //INT_MAX it is decreased correspondingly for the value of INT_MAX. If the value
//of index is less than INT_MIN it is increased correspondingly for the absolute //of index is less than INT_MIN it is increased correspondingly for the absolute
//value of INT_MIN. //value of INT_MIN.
index[i] = long((val > INT_MAX - 1) ? fmod(val, (Standard_Real) INT_MAX) index[i] = Cell_IndexType((aVal > INT_MAX - 1) ? fmod(aVal, (Standard_Real) INT_MAX)
: (val < INT_MIN + 1) ? fmod(val, (Standard_Real) INT_MIN) : (aVal < INT_MIN + 1) ? fmod(aVal, (Standard_Real) INT_MIN)
: val); : aVal);
} }
} }
@ -324,19 +327,19 @@ protected:
{ {
// number of bits per each dimension in the hash code // number of bits per each dimension in the hash code
const std::size_t aDim = index.Size(); const std::size_t aDim = index.Size();
const std::size_t aShiftBits = (BITS (long) - 1) / aDim; const std::size_t aShiftBits = (BITS (Cell_IndexType) - 1) / aDim;
unsigned int aCode = 0; std::size_t aCode = 0;
for (std::size_t i = 0; i < aDim; ++i) for (std::size_t i = 0; i < aDim; ++i)
{ {
aCode = (aCode << aShiftBits) ^ index[i]; aCode = (aCode << aShiftBits) ^ std::size_t(index[i]);
} }
return ::HashCode(aCode, theUpperBound); return ::HashCode(aCode, theUpperBound);
} }
public: public:
NCollection_LocalArray<long, 10> index; NCollection_LocalArray<Cell_IndexType, 10> index;
ListNode *Objects; ListNode *Objects;
}; };
@ -383,16 +386,21 @@ protected:
const Cell& theCellMin, const Cell& theCellMax, const Cell& theCellMin, const Cell& theCellMax,
const Target& theTarget) const Target& theTarget)
{ {
int start = theCellMin.index[idim]; const Cell_IndexType aStart = theCellMin.index[idim];
int end = theCellMax.index[idim]; const Cell_IndexType anEnd = theCellMax.index[idim];
for (int i=start; i <= end; i++) { for (Cell_IndexType i = aStart; i <= anEnd; ++i)
{
theCell.index[idim] = i; theCell.index[idim] = i;
if ( idim ) // recurse if ( idim ) // recurse
{
iterateAdd (idim-1, theCell, theCellMin, theCellMax, theTarget); iterateAdd (idim-1, theCell, theCellMin, theCellMax, theTarget);
}
else // add to this cell else // add to this cell
{
add (theCell, theTarget); add (theCell, theTarget);
} }
} }
}
//! Remove the target object from the specified cell //! Remove the target object from the specified cell
void remove (const Cell& theCell, const Target& theTarget) void remove (const Cell& theCell, const Target& theTarget)
@ -426,16 +434,21 @@ protected:
const Cell& theCellMin, const Cell& theCellMax, const Cell& theCellMin, const Cell& theCellMax,
const Target& theTarget) const Target& theTarget)
{ {
int start = theCellMin.index[idim]; const Cell_IndexType aStart = theCellMin.index[idim];
int end = theCellMax.index[idim]; const Cell_IndexType anEnd = theCellMax.index[idim];
for (int i=start; i <= end; i++) { for (Cell_IndexType i = aStart; i <= anEnd; ++i)
{
theCell.index[idim] = i; theCell.index[idim] = i;
if ( idim ) // recurse if ( idim ) // recurse
{
iterateRemove (idim-1, theCell, theCellMin, theCellMax, theTarget); iterateRemove (idim-1, theCell, theCellMin, theCellMax, theTarget);
}
else // remove from this cell else // remove from this cell
{
remove (theCell, theTarget); remove (theCell, theTarget);
} }
} }
}
//! Inspect the target objects in the specified cell. //! Inspect the target objects in the specified cell.
void inspect (const Cell& theCell, Inspector& theInspector) void inspect (const Cell& theCell, Inspector& theInspector)
@ -469,16 +482,21 @@ protected:
const Cell& theCellMin, const Cell& theCellMax, const Cell& theCellMin, const Cell& theCellMax,
Inspector& theInspector) Inspector& theInspector)
{ {
int start = theCellMin.index[idim]; const Cell_IndexType aStart = theCellMin.index[idim];
int end = theCellMax.index[idim]; const Cell_IndexType anEnd = theCellMax.index[idim];
for (int i=start; i <= end; i++) { for (Cell_IndexType i = aStart; i <= anEnd; ++i)
{
theCell.index[idim] = i; theCell.index[idim] = i;
if ( idim ) // recurse if ( idim ) // recurse
{
iterateInspect (idim-1, theCell, theCellMin, theCellMax, theInspector); iterateInspect (idim-1, theCell, theCellMin, theCellMax, theInspector);
}
else // inspect this cell else // inspect this cell
{
inspect (theCell, theInspector); inspect (theCell, theInspector);
} }
} }
}
protected: protected:
Standard_Integer myDim; Standard_Integer myDim;

@ -145,21 +145,27 @@ Standard_Integer NCollection_UBTreeFiller<TheObjType,TheBndType>::Fill ()
Standard_Integer i, nbAdd = mySeqPtr.Length(); Standard_Integer i, nbAdd = mySeqPtr.Length();
// Fisher-Yates randomization // Fisher-Yates randomization
if (myIsFullRandom) if (myIsFullRandom)
for (i = nbAdd; i > 0; i--) { {
unsigned int ind = myRandGen(); for (i = nbAdd; i > 0; i--)
{
unsigned int ind = (unsigned int )myRandGen();
ind = ind % i; ind = ind % i;
const ObjBnd& aObjBnd = mySeqPtr(ind); const ObjBnd& aObjBnd = mySeqPtr(ind);
myTree.Add (aObjBnd.myObj, aObjBnd.myBnd); myTree.Add (aObjBnd.myObj, aObjBnd.myBnd);
mySeqPtr(ind) = mySeqPtr(i-1); mySeqPtr(ind) = mySeqPtr(i-1);
} }
}
else else
for (i = nbAdd; i > 0; i--) { {
unsigned int ind = myRandGen(); for (i = nbAdd; i > 0; i--)
{
unsigned int ind = (unsigned int )myRandGen();
ind = i - (ind % i) - 1; ind = i - (ind % i) - 1;
const ObjBnd& aObjBnd = mySeqPtr(ind); const ObjBnd& aObjBnd = mySeqPtr(ind);
myTree.Add (aObjBnd.myObj, aObjBnd.myBnd); myTree.Add (aObjBnd.myObj, aObjBnd.myBnd);
mySeqPtr(ind) = mySeqPtr(i-1); mySeqPtr(ind) = mySeqPtr(i-1);
} }
}
mySeqPtr.Clear(); mySeqPtr.Clear();
return nbAdd; return nbAdd;
} }

@ -217,19 +217,19 @@ private:
private: //! @name unicode magic numbers private: //! @name unicode magic numbers
static const unsigned char UTF8_BYTES_MINUS_ONE[256]; static const unsigned char UTF8_BYTES_MINUS_ONE[256];
static const unsigned long offsetsFromUTF8[6]; static const Standard_Utf32Char offsetsFromUTF8[6];
static const unsigned char UTF8_FIRST_BYTE_MARK[7]; static const unsigned char UTF8_FIRST_BYTE_MARK[7];
static const unsigned long UTF8_BYTE_MASK; static const Standard_Utf32Char UTF8_BYTE_MASK;
static const unsigned long UTF8_BYTE_MARK; static const Standard_Utf32Char UTF8_BYTE_MARK;
static const unsigned long UTF16_SURROGATE_HIGH_START; static const Standard_Utf32Char UTF16_SURROGATE_HIGH_START;
static const unsigned long UTF16_SURROGATE_HIGH_END; static const Standard_Utf32Char UTF16_SURROGATE_HIGH_END;
static const unsigned long UTF16_SURROGATE_LOW_START; static const Standard_Utf32Char UTF16_SURROGATE_LOW_START;
static const unsigned long UTF16_SURROGATE_LOW_END; static const Standard_Utf32Char UTF16_SURROGATE_LOW_END;
static const unsigned long UTF16_SURROGATE_HIGH_SHIFT; static const Standard_Utf32Char UTF16_SURROGATE_HIGH_SHIFT;
static const unsigned long UTF16_SURROGATE_LOW_BASE; static const Standard_Utf32Char UTF16_SURROGATE_LOW_BASE;
static const unsigned long UTF16_SURROGATE_LOW_MASK; static const Standard_Utf32Char UTF16_SURROGATE_LOW_MASK;
static const unsigned long UTF32_MAX_BMP; static const Standard_Utf32Char UTF32_MAX_BMP;
static const unsigned long UTF32_MAX_LEGAL; static const Standard_Utf32Char UTF32_MAX_LEGAL;
private: //! @name private fields private: //! @name private fields

@ -54,7 +54,7 @@ const unsigned char NCollection_UtfIterator<Type>::UTF8_BYTES_MINUS_ONE[256] =
//! This table contains as many values as there might be trailing bytes //! This table contains as many values as there might be trailing bytes
//! in a UTF-8 sequence. //! in a UTF-8 sequence.
template<typename Type> template<typename Type>
const unsigned long NCollection_UtfIterator<Type>::offsetsFromUTF8[6] = const Standard_Utf32Char NCollection_UtfIterator<Type>::offsetsFromUTF8[6] =
{ {
0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL 0x03C82080UL, 0xFA082080UL, 0x82082080UL
@ -95,17 +95,17 @@ inline void NCollection_UtfIterator<Type>::readUTF8()
} }
// magic numbers // magic numbers
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF8_BYTE_MASK = 0xBF; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF8_BYTE_MASK = 0xBF;
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF8_BYTE_MARK = 0x80; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF8_BYTE_MARK = 0x80;
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF16_SURROGATE_HIGH_START = 0xD800; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_HIGH_START = 0xD800;
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF16_SURROGATE_HIGH_END = 0xDBFF; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_HIGH_END = 0xDBFF;
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_START = 0xDC00; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_START = 0xDC00;
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_END = 0xDFFF; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_END = 0xDFFF;
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF16_SURROGATE_HIGH_SHIFT = 10; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_HIGH_SHIFT = 10;
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_BASE = 0x0010000UL; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_BASE = 0x0010000UL;
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_MASK = 0x3FFUL; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_MASK = 0x3FFUL;
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF32_MAX_BMP = 0x0000FFFFUL; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF32_MAX_BMP = 0x0000FFFFUL;
template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF32_MAX_LEGAL = 0x0010FFFFUL; template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF32_MAX_LEGAL = 0x0010FFFFUL;
// ======================================================================= // =======================================================================
// function : readUTF16 // function : readUTF16

@ -187,11 +187,11 @@ Standard_Integer OSD_Disk::DiskSize()
ULONGLONG aSize = aNbTotalBytes.QuadPart / 512; ULONGLONG aSize = aNbTotalBytes.QuadPart / 512;
return (Standard_Integer )aSize; // may be an overflow return (Standard_Integer )aSize; // may be an overflow
#else #else
struct statvfs buffer; struct statvfs aBuffer;
if (statvfs (myDiskName.ToCString(), &buffer) == 0) if (statvfs (myDiskName.ToCString(), &aBuffer) == 0)
{ {
int BSize512 = buffer.f_frsize / 512; unsigned long aBSize512 = aBuffer.f_frsize / 512;
return buffer.f_blocks * BSize512; return Standard_Integer(aBuffer.f_blocks * aBSize512);
} }
myError.SetValue (errno, Iam, "OSD_Disk: statvfs failed."); myError.SetValue (errno, Iam, "OSD_Disk: statvfs failed.");
return 0; return 0;
@ -219,11 +219,11 @@ Standard_Integer OSD_Disk::DiskFree()
ULONGLONG aSize = aNbFreeAvailableBytes.QuadPart / 512; ULONGLONG aSize = aNbFreeAvailableBytes.QuadPart / 512;
return (Standard_Integer )aSize; // may be an overflow return (Standard_Integer )aSize; // may be an overflow
#else #else
struct statvfs buffer; struct statvfs aBuffer;
if (statvfs (myDiskName.ToCString(), &buffer) == 0) if (statvfs (myDiskName.ToCString(), &aBuffer) == 0)
{ {
int BSize512 = buffer.f_frsize / 512; unsigned long aBSize512 = aBuffer.f_frsize / 512;
return buffer.f_bavail * BSize512; return Standard_Integer(aBuffer.f_bavail * aBSize512);
} }
myError.SetValue (errno, Iam, "OSD_Disk: statvfs failed."); myError.SetValue (errno, Iam, "OSD_Disk: statvfs failed.");
return 0; return 0;

@ -782,7 +782,7 @@ void OSD_File::Read (TCollection_AsciiString& theBuffer,
#ifdef _WIN32 #ifdef _WIN32
Read (&aBuffer.ChangeFirst(), theNbBytes, aNbBytesRead); Read (&aBuffer.ChangeFirst(), theNbBytes, aNbBytesRead);
#else #else
aNbBytesRead = read (myFileChannel, &aBuffer.ChangeFirst(), theNbBytes); aNbBytesRead = (Standard_Integer )read (myFileChannel, &aBuffer.ChangeFirst(), theNbBytes);
if (aNbBytesRead == -1) if (aNbBytesRead == -1)
{ {
aNbBytesRead = 0; aNbBytesRead = 0;
@ -1078,7 +1078,7 @@ void OSD_File::Read (const Standard_Address theBuffer,
theNbReadBytes = (Standard_Integer )aNbReadBytes; theNbReadBytes = (Standard_Integer )aNbReadBytes;
#else #else
theNbReadBytes = 0; theNbReadBytes = 0;
int aNbReadBytes = read (myFileChannel, (char* )theBuffer, theNbBytes); int aNbReadBytes = (Standard_Integer )read (myFileChannel, (char* )theBuffer, theNbBytes);
if (aNbReadBytes == -1) if (aNbReadBytes == -1)
{ {
myError.SetValue (errno, Iam, "Read"); myError.SetValue (errno, Iam, "Read");
@ -1131,7 +1131,7 @@ void OSD_File::Write (const Standard_Address theBuffer,
_osd_wnt_set_error (myError, OSD_WFile); _osd_wnt_set_error (myError, OSD_WFile);
} }
#else #else
const int aNbWritten = write (myFileChannel, (const char* )theBuffer, theNbBytes); const int aNbWritten = (Standard_Integer )write (myFileChannel, (const char* )theBuffer, theNbBytes);
if (aNbWritten == -1) if (aNbWritten == -1)
{ {
myError.SetValue (errno, Iam, "Write"); myError.SetValue (errno, Iam, "Write");

@ -183,11 +183,15 @@ int static copy_file( const char* src, const char* trg )
const int BUFSIZE=4096; const int BUFSIZE=4096;
char buf[BUFSIZE]; char buf[BUFSIZE];
int n=0; int n=0;
while ( ( n = read ( fds, buf, BUFSIZE )) >0 ) while ((n = (int )read (fds, buf, BUFSIZE)) > 0)
{
if ( write ( fdo, buf, n ) != n )
{
// writing error
if (!errno)
{ {
if ( write ( fdo, buf, n ) != n ) { // writing error
if ( ! errno )
errno = ENOSPC; errno = ENOSPC;
}
break; break;
} }
} }

@ -1368,7 +1368,7 @@ static Standard_Integer OCC24137 (Draw_Interpretor& theDI, Standard_Integer theN
const TopoDS_Shape aShapeV = DBRep::Get (aVertName); const TopoDS_Shape aShapeV = DBRep::Get (aVertName);
const Standard_Real aUFrom = Atof (theArgv[anArgIter++]); const Standard_Real aUFrom = Atof (theArgv[anArgIter++]);
const Standard_Real aVFrom = Atof (theArgv[anArgIter++]); const Standard_Real aVFrom = Atof (theArgv[anArgIter++]);
const Standard_Integer aNbIts = (anArgIter < theNArg) ? atol (theArgv[anArgIter++]) : 100; const Standard_Integer aNbIts = (anArgIter < theNArg) ? Draw::Atoi (theArgv[anArgIter++]) : 100;
if (aShapeF.IsNull() || aShapeF.ShapeType() != TopAbs_FACE) if (aShapeF.IsNull() || aShapeF.ShapeType() != TopAbs_FACE)
{ {
std::cout << "Error: " << aFaceName << " shape is null / not a face" << std::endl; std::cout << "Error: " << aFaceName << " shape is null / not a face" << std::endl;

@ -3104,6 +3104,7 @@ static Standard_Integer OCC30391(Draw_Interpretor& theDI,
#include <TDF_ChildIterator.hxx> #include <TDF_ChildIterator.hxx>
#include <TDocStd_PathParser.hxx> #include <TDocStd_PathParser.hxx>
#include <OSD.hxx> #include <OSD.hxx>
#include <OSD_Parallel.hxx>
#include <OSD_Thread.hxx> #include <OSD_Thread.hxx>
#include <OSD_Environment.hxx> #include <OSD_Environment.hxx>
typedef NCollection_Sequence <TCollection_AsciiString> SequenceOfDocNames; typedef NCollection_Sequence <TCollection_AsciiString> SequenceOfDocNames;
@ -3193,31 +3194,6 @@ void* threadFunction(void* theArgs)
return args->res; return args->res;
} }
int getNumCores()
{
#ifdef WIN32
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
return sysinfo.dwNumberOfProcessors;
#elif MACOS
int nm[2];
size_t len = 4;
uint32_t count;
nm[0] = CTL_HW; nm[1] = HW_AVAILCPU;
sysctl(nm, 2, &count, &len, NULL, 0);
if (count < 1) {
nm[1] = HW_NCPU;
sysctl(nm, 2, &count, &len, NULL, 0);
if (count < 1) { count = 1; }
}
return count;
#else
return sysconf(_SC_NPROCESSORS_ONLN);
#endif
}
//======================================================================= //=======================================================================
//function : OCC29195 //function : OCC29195
//purpose : //purpose :
@ -3231,7 +3207,7 @@ static Standard_Integer OCC29195(Draw_Interpretor&, Standard_Integer theArgC, co
std::cout << "\ndocN - names (5 in each group) of OCAF documents names (3 input files, 2 output)\n" << std::endl; std::cout << "\ndocN - names (5 in each group) of OCAF documents names (3 input files, 2 output)\n" << std::endl;
return 1; return 1;
} }
int iThread(0), nbThreads(0), off(0); int iThread(0), off(0);
if (TCollection_AsciiString(theArgV[1]).IsIntegerValue()) if (TCollection_AsciiString(theArgV[1]).IsIntegerValue())
{ {
nbREP = TCollection_AsciiString(theArgV[1]).IntegerValue(); nbREP = TCollection_AsciiString(theArgV[1]).IntegerValue();
@ -3243,7 +3219,7 @@ static Standard_Integer OCC29195(Draw_Interpretor&, Standard_Integer theArgC, co
return 0; return 0;
} }
Standard_Integer aNbFiles = (theArgC - off - 1) / 5; Standard_Integer aNbFiles = (theArgC - off - 1) / 5;
nbThreads = getNumCores(); int nbThreads = OSD_Parallel::NbLogicalProcessors();
if (aNbFiles < nbThreads) if (aNbFiles < nbThreads)
{ {
nbThreads = aNbFiles; nbThreads = aNbFiles;

@ -329,7 +329,7 @@ void RWObj_Reader::pushIndices (const char* thePos)
for (Standard_Integer aNode = 0;; ++aNode) for (Standard_Integer aNode = 0;; ++aNode)
{ {
Graphic3d_Vec3i a3Indices (-1, -1, -1); Graphic3d_Vec3i a3Indices (-1, -1, -1);
a3Indices[0] = strtol (thePos, &aNext, 10) - 1; a3Indices[0] = int(strtol (thePos, &aNext, 10) - 1);
if (aNext == thePos) if (aNext == thePos)
{ {
break; break;
@ -340,14 +340,14 @@ void RWObj_Reader::pushIndices (const char* thePos)
if (*thePos == '/') if (*thePos == '/')
{ {
++thePos; ++thePos;
a3Indices[1] = strtol (thePos, &aNext, 10) - 1; a3Indices[1] = int(strtol (thePos, &aNext, 10) - 1);
thePos = aNext; thePos = aNext;
// parse Normal index // parse Normal index
if (*thePos == '/') if (*thePos == '/')
{ {
++thePos; ++thePos;
a3Indices[2] = strtol (thePos, &aNext, 10) - 1; a3Indices[2] = int(strtol (thePos, &aNext, 10) - 1);
thePos = aNext; thePos = aNext;
} }
} }

@ -1720,7 +1720,7 @@ multadd(Bigint *b, int m, int a MTd) /* multiply by m and add a */
Bfree(b MTa); Bfree(b MTa);
b = b1; b = b1;
} }
b->x[wds++] = carry; b->x[wds++] = (ULong )carry;
b->wds = wds; b->wds = wds;
} }
return b; return b;
@ -1889,7 +1889,7 @@ mult(Bigint *a, Bigint *b MTd)
*xc++ = z & FFFFFFFF; *xc++ = z & FFFFFFFF;
} }
while(x < xae); while(x < xae);
*xc = carry; *xc = (ULong )carry;
} }
} }
#else #else
@ -2704,7 +2704,7 @@ rshift(Bigint *b, int k)
while(x < xe) while(x < xe)
*x1++ = *x++; *x1++ = *x++;
} }
if ((b->wds = x1 - b->x) == 0) if ((b->wds = int(x1 - b->x)) == 0)
b->x[0] = 0; b->x[0] = 0;
} }
@ -2913,7 +2913,7 @@ gethex( const char **sp, U *rvp, int rounding, int sign MTd)
word1(rvp) = Big1; word1(rvp) = Big1;
return; return;
} }
n = s1 - s0 - 1; n = int(s1 - s0 - 1);
for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1) for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1)
k++; k++;
b = Balloc(k MTa); b = Balloc(k MTa);
@ -2942,7 +2942,7 @@ gethex( const char **sp, U *rvp, int rounding, int sign MTd)
n += 4; n += 4;
} }
*x++ = L; *x++ = L;
b->wds = n = x - b->x; b->wds = n = int(x - b->x);
n = ULbits*n - hi0bits(L); n = ULbits*n - hi0bits(L);
nbits = Nbits; nbits = Nbits;
lostbits = 0; lostbits = 0;
@ -3559,7 +3559,7 @@ Strtod(const char *s00, char **se)
z = 10*z + c - '0'; z = 10*z + c - '0';
#endif #endif
nd0 = nd; nd0 = nd;
bc.dp0 = bc.dp1 = s - s0; bc.dp0 = bc.dp1 = int(s - s0);
for(s1 = s; s1 > s0 && *--s1 == '0'; ) for(s1 = s; s1 > s0 && *--s1 == '0'; )
++nz1; ++nz1;
#ifdef USE_LOCALE #ifdef USE_LOCALE
@ -3583,13 +3583,13 @@ Strtod(const char *s00, char **se)
#endif #endif
if (c == '.') { if (c == '.') {
c = *++s; c = *++s;
bc.dp1 = s - s0; bc.dp1 = int(s - s0);
bc.dplen = bc.dp1 - bc.dp0; bc.dplen = bc.dp1 - bc.dp0;
if (!nd) { if (!nd) {
for(; c == '0'; c = *++s) for(; c == '0'; c = *++s)
nz++; nz++;
if (c > '0' && c <= '9') { if (c > '0' && c <= '9') {
bc.dp0 = s0 - s; bc.dp0 = int(s0 - s);
bc.dp1 = bc.dp0 + bc.dplen; bc.dp1 = bc.dp0 + bc.dplen;
s0 = s; s0 = s;
nf += nz; nf += nz;
@ -4126,14 +4126,14 @@ Strtod(const char *s00, char **se)
yz /= 10; yz /= 10;
e1 += 1; e1 += 1;
} }
y = yz / 100000000; y = ULong(yz / 100000000);
} }
else if (nd > 9) { else if (nd > 9) {
i = nd - 9; i = nd - 9;
y = (yz >> i) / pfive[i-1]; y = ULong((yz >> i) / pfive[i-1]);
} }
else else
y = yz; y = ULong(yz);
dval(&rv) = yz; dval(&rv) = yz;
#endif /*}*/ #endif /*}*/

@ -17,19 +17,12 @@
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
#ifdef _WIN32 struct Standard_UUID
#include <windows.h> {
#else uint32_t Data1;
typedef struct { uint16_t Data2;
unsigned long Data1 ; uint16_t Data3;
unsigned short Data2 ; uint8_t Data4[8];
unsigned short Data3 ; };
unsigned char Data4[8] ;
} GUID ;
#endif
typedef GUID Standard_UUID ;
#endif #endif

@ -67,13 +67,12 @@ Standard_Integer StepSelect_WorkLibrary::ReadFile
Handle(Interface_InterfaceModel)& model, Handle(Interface_InterfaceModel)& model,
const Handle(Interface_Protocol)& protocol) const const Handle(Interface_Protocol)& protocol) const
{ {
long status = 1;
DeclareAndCast(StepData_Protocol,stepro,protocol); DeclareAndCast(StepData_Protocol,stepro,protocol);
if (stepro.IsNull()) return 1; if (stepro.IsNull()) return 1;
Handle(StepData_StepModel) stepmodel = new StepData_StepModel; Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
model = stepmodel; model = stepmodel;
status = StepFile_Read(name, 0, stepmodel, stepro); Standard_Integer aStatus = StepFile_Read(name, 0, stepmodel, stepro);
return status; return aStatus;
} }
Standard_Integer StepSelect_WorkLibrary::ReadStream (const Standard_CString theName, Standard_Integer StepSelect_WorkLibrary::ReadStream (const Standard_CString theName,
@ -81,13 +80,12 @@ Standard_Integer StepSelect_WorkLibrary::ReadStream (const Standard_CString the
Handle(Interface_InterfaceModel)& model, Handle(Interface_InterfaceModel)& model,
const Handle(Interface_Protocol)& protocol) const const Handle(Interface_Protocol)& protocol) const
{ {
long status = 1;
DeclareAndCast(StepData_Protocol, stepro, protocol); DeclareAndCast(StepData_Protocol, stepro, protocol);
if (stepro.IsNull()) return 1; if (stepro.IsNull()) return 1;
Handle(StepData_StepModel) stepmodel = new StepData_StepModel; Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
model = stepmodel; model = stepmodel;
status = StepFile_Read(theName, &theIStream, stepmodel, stepro); Standard_Integer aStatus = StepFile_Read(theName, &theIStream, stepmodel, stepro);
return status; return aStatus;
} }