endif()
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")
+ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshorten-64-to-32")
+ endif()
if (BUILD_SHARED_LIBS)
if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
DEFINES += _SCL_SECURE_NO_WARNINGS
} else {
CONFIG += c++11
+ clang {
+ QMAKE_CFLAGS_WARN_ON += -Wshorten-64-to-32
+ QMAKE_CXXFLAGS_WARN_ON += -Wshorten-64-to-32
+ }
QMAKE_CFLAGS += -fexceptions
QMAKE_CXXFLAGS += -fexceptions
QMAKE_CXXFLAGS += -fvisibility=default
#define DIMAXIS 20
#if DEBUG
-static long unsigned APPELREJECTION=0L;
-static long unsigned REJECTNIV0=0L;
-static long unsigned REJECTNIV1=0L;
-static long unsigned NBCOMPARE=0L;
-static long unsigned NBBOITES=0L;
-static long unsigned NBBOITESATESTER=0L;
+static unsigned int APPELREJECTION=0L;
+static unsigned int REJECTNIV0=0L;
+static unsigned int REJECTNIV1=0L;
+static unsigned int NBCOMPARE=0L;
+static unsigned int NBBOITES=0L;
+static unsigned int NBBOITESATESTER=0L;
#endif
//=======================================================================
static Standard_Integer ComputeSize(const Standard_Integer n) {
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,
65536,131072,262144,524288,
1048576,2097152,4194304,8388608,
Standard_Integer _BASE;
Standard_Integer _BASEM1;
- long unsigned ind;
- long unsigned Isize;
+ unsigned int ind;
+ unsigned int Isize;
Standard_Integer ssize;
Standard_Real Xmin,Xmax,Ymin,Ymax,Zmin,Zmax;
- long unsigned *p;
+ unsigned int* p;
Standard_Integer **axisX;
Standard_Integer **axisY;
Standard_Integer **axisZ;
void AppendAxisY(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]; }
- int Val(long unsigned 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 Add (unsigned int t) { int o=t&31; int k=t>>5; p[k]|=_P2[o]; }
+ int Val (unsigned int t) { int o=t&31; int k=t>>5; return(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 NbAxisY(const Standard_Integer i) { return(axisY[0][i]); }
default : { _DECAL=3; _DECAL2= 6; _BASE= 8; _BASEM1= 7; break; }
}
Standard_Integer i ;
- long unsigned nb = (size*size*size)>>5;
+ unsigned int nb = (size*size*size)>>5;
Isize = nb;
ssize = size;
- p = new long unsigned [nb];
+ p = new unsigned int[nb];
do { p[--nb]=0; } while(nb);
axisX = (Standard_Integer **) malloc((size+1)*sizeof(Standard_Integer *));
for (lacaseX=firstcaseX; lacaseX<=lastcaseX; lacaseX++) {
for (lacaseY=firstcaseY; lacaseY<=lastcaseY; lacaseY++) {
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);
}
}
for (theGapX=firstGapX; theGapX<=lastGapX; theGapX++) {
for (theGapY=firstGapY; theGapY<=lastGapY; theGapY++) {
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);
}
}
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 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)) {
touch = Standard_True;
}
char buffer[BUFSIZE + 1];
for (;;)
{
- int nbRead = read (myFDLog, buffer, BUFSIZE);
+ int nbRead = (int )read (myFDLog, buffer, BUFSIZE);
if (nbRead <= 0)
{
break;
theId = MAXVIEW;
while (theId >= MAXVIEW)
{
- Standard_Integer aWindowNumber = 0;
+ long aWindowNumber = 0;
Draw_Window::GetNextEvent (theToWait, aWindowNumber, theX, theY, theButton);
if (theY < 0)
{
}
ReleaseDC (myWindow, hDC);
#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
(void )theX;
(void )theY;
void Wait (Standard_Boolean theToWait = Standard_True);
#elif defined(__APPLE__)
- Standard_Boolean IsEqualWindows (const Standard_Integer& theWindowNumber);
+ Standard_Boolean IsEqualWindows (const long theWindowNumber);
static void GetNextEvent (Standard_Boolean theWait,
- Standard_Integer& theWindowNumber,
+ long& theWindowNumber,
Standard_Integer& theX,
Standard_Integer& theY,
Standard_Integer& theButton);
return isSuccess;
}
-Standard_Boolean Draw_Window::IsEqualWindows (const Standard_Integer& theWindowNumber)
+Standard_Boolean Draw_Window::IsEqualWindows (const long theWindowNumber)
{
return ([myWindow windowNumber] == theWindowNumber);
}
void Draw_Window::GetNextEvent (Standard_Boolean theWait,
- Standard_Integer& theWindowNumber,
+ long& theWindowNumber,
Standard_Integer& theX,
Standard_Integer& theY,
Standard_Integer& theButton)
myStream))
throw Storage_StreamWriteError();
- myHeader.binfo = ftell(myStream);
+ myHeader.binfo = (Standard_Integer )ftell(myStream);
WriteHeader();
return Storage_VSOk;
Storage_Error FSD_BinaryFile::EndWriteInfoSection()
{
- myHeader.einfo = ftell(myStream);
-
+ myHeader.einfo = (Standard_Integer )ftell(myStream);
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::EndWriteInfoSection(Standard_OStream& theOStream)
{
myHeader.einfo = (Standard_Integer)theOStream.tellp();
-
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::BeginWriteCommentSection()
{
- myHeader.bcomment = ftell(myStream);
+ myHeader.bcomment = (Standard_Integer )ftell(myStream);
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::EndWriteCommentSection()
{
- myHeader.ecomment = ftell(myStream);
-
+ myHeader.ecomment = (Standard_Integer )ftell(myStream);
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::BeginWriteTypeSection()
{
- myHeader.btype = ftell(myStream);
-
+ myHeader.btype = (Standard_Integer )ftell(myStream);
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::EndWriteTypeSection()
{
- myHeader.etype = ftell(myStream);
-
+ myHeader.etype = (Standard_Integer )ftell(myStream);
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::BeginWriteRootSection()
{
- myHeader.broot = ftell(myStream);
-
+ myHeader.broot = (Standard_Integer )ftell(myStream);
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::EndWriteRootSection()
{
- myHeader.eroot = ftell(myStream);
-
+ myHeader.eroot = (Standard_Integer )ftell(myStream);
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::BeginWriteRefSection()
{
- myHeader.bref = ftell(myStream);
-
+ myHeader.bref = (Standard_Integer )ftell(myStream);
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::EndWriteRefSection()
{
- myHeader.eref = ftell(myStream);
-
+ myHeader.eref = (Standard_Integer )ftell(myStream);
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::BeginWriteDataSection()
{
- myHeader.bdata = ftell(myStream);
-
+ myHeader.bdata = (Standard_Integer )ftell(myStream);
return Storage_VSOk;
}
Storage_Error FSD_BinaryFile::EndWriteDataSection()
{
- myHeader.edata = ftell(myStream);
+ myHeader.edata = (Standard_Integer )ftell(myStream);
fseek(myStream,myHeader.binfo,SEEK_SET);
WriteHeader();
Standard_Integer Font_FTFont::GlyphsNumber (bool theToIncludeFallback) const
{
#ifdef HAVE_FREETYPE
- Standard_Integer aNbGlyphs = myFTFace->num_glyphs;
+ Standard_Integer aNbGlyphs = (Standard_Integer )myFTFace->num_glyphs;
if (theToIncludeFallback)
{
for (Standard_Integer aFontIter = 0; aFontIter < Font_UnicodeSubset_NB; ++aFontIter)
IntPatch_PrmPrmIntersection.lxx
IntPatch_PrmPrmIntersection_T3Bits.cxx
IntPatch_PrmPrmIntersection_T3Bits.hxx
-IntPatch_PrmPrmIntersection_T3Bits.lxx
IntPatch_RLine.cxx
IntPatch_RLine.hxx
IntPatch_RLine.lxx
for(si=-1; si<= 1 && nb<LIM; si++) {
for(sj=-1; sj<= 1 && nb<LIM; sj++) {
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)) {
nb++;
}
for(sj=-1; sj<= 1; sj++) {
for(sk=-1; sk<= 1; 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);
}
}
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#include <IntPatch_PrmPrmIntersection_T3Bits.hxx>
IntPatch_PrmPrmIntersection_T3Bits::IntPatch_PrmPrmIntersection_T3Bits(const Standard_Integer size)
Standard_Integer nb = (size*size*size)>>5;
Isize = 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()
int k=indice>>5;
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)
{
- unsigned long int c=0;
+ unsigned int c = 0;
do
{
if(r&1)
#include <Standard_Address.hxx>
#include <Standard_Integer.hxx>
-
-
class IntPatch_PrmPrmIntersection_T3Bits
{
public:
DEFINE_STANDARD_ALLOC
-
Standard_EXPORT IntPatch_PrmPrmIntersection_T3Bits(const Standard_Integer size);
-
- Standard_EXPORT void Destroy();
-~IntPatch_PrmPrmIntersection_T3Bits()
-{
- Destroy();
-}
-
- void Add (const Standard_Integer t);
-
- Standard_Integer Val (const Standard_Integer t) const;
-
- void Raz (const Standard_Integer t);
-
- Standard_EXPORT void ResetAnd();
-
- Standard_EXPORT Standard_Integer And (IntPatch_PrmPrmIntersection_T3Bits& Oth, Standard_Integer& indiceprecedent);
-
-
+ Standard_EXPORT ~IntPatch_PrmPrmIntersection_T3Bits();
-protected:
-
+ void Add (const Standard_Integer t)
+ {
+ p[t>>5] |= (1<<(((unsigned int)t)&31));
+ }
+ Standard_Integer Val (const Standard_Integer t) const
+ {
+ return (p[t>>5] & (1<<(((unsigned int)t)&31)));
+ }
+ void Raz (const Standard_Integer t)
+ {
+ p[t>>5] &= ~(1<<(((unsigned int)t)&31));
+ }
+ Standard_EXPORT void ResetAnd();
+
+ Standard_EXPORT Standard_Integer And (IntPatch_PrmPrmIntersection_T3Bits& Oth, Standard_Integer& indiceprecedent);
private:
-
-
- Standard_Address p;
+ Standard_Integer* p;
Standard_Integer Isize;
-
};
-
-#include <IntPatch_PrmPrmIntersection_T3Bits.lxx>
-
-
-
-
-
#endif // _IntPatch_PrmPrmIntersection_T3Bits_HeaderFile
+++ /dev/null
-// 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));
-}
ListNode *Next;
};
+ //! Cell index type.
+ typedef Standard_Integer Cell_IndexType;
+
/**
* Auxiliary structure representing a cell in the space.
* Cells are stored in the map, each cell contains list of objects
{
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
//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
//value of INT_MIN.
- index[i] = long((val > INT_MAX - 1) ? fmod(val, (Standard_Real) INT_MAX)
- : (val < INT_MIN + 1) ? fmod(val, (Standard_Real) INT_MIN)
- : val);
+ index[i] = Cell_IndexType((aVal > INT_MAX - 1) ? fmod(aVal, (Standard_Real) INT_MAX)
+ : (aVal < INT_MIN + 1) ? fmod(aVal, (Standard_Real) INT_MIN)
+ : aVal);
}
}
{
// number of bits per each dimension in the hash code
const std::size_t aDim = index.Size();
- const std::size_t aShiftBits = (BITS (long) - 1) / aDim;
- unsigned int aCode = 0;
+ const std::size_t aShiftBits = (BITS (Cell_IndexType) - 1) / aDim;
+ std::size_t aCode = 0;
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);
}
public:
- NCollection_LocalArray<long, 10> index;
+ NCollection_LocalArray<Cell_IndexType, 10> index;
ListNode *Objects;
};
const Cell& theCellMin, const Cell& theCellMax,
const Target& theTarget)
{
- int start = theCellMin.index[idim];
- int end = theCellMax.index[idim];
- for (int i=start; i <= end; i++) {
+ const Cell_IndexType aStart = theCellMin.index[idim];
+ const Cell_IndexType anEnd = theCellMax.index[idim];
+ for (Cell_IndexType i = aStart; i <= anEnd; ++i)
+ {
theCell.index[idim] = i;
if ( idim ) // recurse
+ {
iterateAdd (idim-1, theCell, theCellMin, theCellMax, theTarget);
+ }
else // add to this cell
+ {
add (theCell, theTarget);
+ }
}
}
const Cell& theCellMin, const Cell& theCellMax,
const Target& theTarget)
{
- int start = theCellMin.index[idim];
- int end = theCellMax.index[idim];
- for (int i=start; i <= end; i++) {
+ const Cell_IndexType aStart = theCellMin.index[idim];
+ const Cell_IndexType anEnd = theCellMax.index[idim];
+ for (Cell_IndexType i = aStart; i <= anEnd; ++i)
+ {
theCell.index[idim] = i;
if ( idim ) // recurse
+ {
iterateRemove (idim-1, theCell, theCellMin, theCellMax, theTarget);
+ }
else // remove from this cell
+ {
remove (theCell, theTarget);
+ }
}
}
const Cell& theCellMin, const Cell& theCellMax,
Inspector& theInspector)
{
- int start = theCellMin.index[idim];
- int end = theCellMax.index[idim];
- for (int i=start; i <= end; i++) {
+ const Cell_IndexType aStart = theCellMin.index[idim];
+ const Cell_IndexType anEnd = theCellMax.index[idim];
+ for (Cell_IndexType i = aStart; i <= anEnd; ++i)
+ {
theCell.index[idim] = i;
if ( idim ) // recurse
+ {
iterateInspect (idim-1, theCell, theCellMin, theCellMax, theInspector);
+ }
else // inspect this cell
+ {
inspect (theCell, theInspector);
+ }
}
}
Standard_Integer i, nbAdd = mySeqPtr.Length();
// Fisher-Yates randomization
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;
const ObjBnd& aObjBnd = mySeqPtr(ind);
myTree.Add (aObjBnd.myObj, aObjBnd.myBnd);
mySeqPtr(ind) = mySeqPtr(i-1);
}
+ }
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;
const ObjBnd& aObjBnd = mySeqPtr(ind);
myTree.Add (aObjBnd.myObj, aObjBnd.myBnd);
mySeqPtr(ind) = mySeqPtr(i-1);
}
+ }
mySeqPtr.Clear();
return nbAdd;
}
private: //! @name unicode magic numbers
- static const unsigned char UTF8_BYTES_MINUS_ONE[256];
- static const unsigned long offsetsFromUTF8[6];
- static const unsigned char UTF8_FIRST_BYTE_MARK[7];
- static const unsigned long UTF8_BYTE_MASK;
- static const unsigned long UTF8_BYTE_MARK;
- static const unsigned long UTF16_SURROGATE_HIGH_START;
- static const unsigned long UTF16_SURROGATE_HIGH_END;
- static const unsigned long UTF16_SURROGATE_LOW_START;
- static const unsigned long UTF16_SURROGATE_LOW_END;
- static const unsigned long UTF16_SURROGATE_HIGH_SHIFT;
- static const unsigned long UTF16_SURROGATE_LOW_BASE;
- static const unsigned long UTF16_SURROGATE_LOW_MASK;
- static const unsigned long UTF32_MAX_BMP;
- static const unsigned long UTF32_MAX_LEGAL;
+ static const unsigned char UTF8_BYTES_MINUS_ONE[256];
+ static const Standard_Utf32Char offsetsFromUTF8[6];
+ static const unsigned char UTF8_FIRST_BYTE_MARK[7];
+ static const Standard_Utf32Char UTF8_BYTE_MASK;
+ static const Standard_Utf32Char UTF8_BYTE_MARK;
+ static const Standard_Utf32Char UTF16_SURROGATE_HIGH_START;
+ static const Standard_Utf32Char UTF16_SURROGATE_HIGH_END;
+ static const Standard_Utf32Char UTF16_SURROGATE_LOW_START;
+ static const Standard_Utf32Char UTF16_SURROGATE_LOW_END;
+ static const Standard_Utf32Char UTF16_SURROGATE_HIGH_SHIFT;
+ static const Standard_Utf32Char UTF16_SURROGATE_LOW_BASE;
+ static const Standard_Utf32Char UTF16_SURROGATE_LOW_MASK;
+ static const Standard_Utf32Char UTF32_MAX_BMP;
+ static const Standard_Utf32Char UTF32_MAX_LEGAL;
private: //! @name private fields
//! This table contains as many values as there might be trailing bytes
//! in a UTF-8 sequence.
template<typename Type>
-const unsigned long NCollection_UtfIterator<Type>::offsetsFromUTF8[6] =
+const Standard_Utf32Char NCollection_UtfIterator<Type>::offsetsFromUTF8[6] =
{
0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL
}
// magic numbers
-template<typename Type> const unsigned long NCollection_UtfIterator<Type>::UTF8_BYTE_MASK = 0xBF;
-template<typename Type> const unsigned long 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 unsigned long 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 unsigned long 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 unsigned long 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 unsigned long 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>::UTF8_BYTE_MASK = 0xBF;
+template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF8_BYTE_MARK = 0x80;
+template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_HIGH_START = 0xD800;
+template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_HIGH_END = 0xDBFF;
+template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_START = 0xDC00;
+template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_END = 0xDFFF;
+template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_HIGH_SHIFT = 10;
+template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_BASE = 0x0010000UL;
+template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF16_SURROGATE_LOW_MASK = 0x3FFUL;
+template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF32_MAX_BMP = 0x0000FFFFUL;
+template<typename Type> const Standard_Utf32Char NCollection_UtfIterator<Type>::UTF32_MAX_LEGAL = 0x0010FFFFUL;
// =======================================================================
// function : readUTF16
ULONGLONG aSize = aNbTotalBytes.QuadPart / 512;
return (Standard_Integer )aSize; // may be an overflow
#else
- struct statvfs buffer;
- if (statvfs (myDiskName.ToCString(), &buffer) == 0)
+ struct statvfs aBuffer;
+ if (statvfs (myDiskName.ToCString(), &aBuffer) == 0)
{
- int BSize512 = buffer.f_frsize / 512;
- return buffer.f_blocks * BSize512;
+ unsigned long aBSize512 = aBuffer.f_frsize / 512;
+ return Standard_Integer(aBuffer.f_blocks * aBSize512);
}
myError.SetValue (errno, Iam, "OSD_Disk: statvfs failed.");
return 0;
ULONGLONG aSize = aNbFreeAvailableBytes.QuadPart / 512;
return (Standard_Integer )aSize; // may be an overflow
#else
- struct statvfs buffer;
- if (statvfs (myDiskName.ToCString(), &buffer) == 0)
+ struct statvfs aBuffer;
+ if (statvfs (myDiskName.ToCString(), &aBuffer) == 0)
{
- int BSize512 = buffer.f_frsize / 512;
- return buffer.f_bavail * BSize512;
+ unsigned long aBSize512 = aBuffer.f_frsize / 512;
+ return Standard_Integer(aBuffer.f_bavail * aBSize512);
}
myError.SetValue (errno, Iam, "OSD_Disk: statvfs failed.");
return 0;
#ifdef _WIN32
Read (&aBuffer.ChangeFirst(), theNbBytes, aNbBytesRead);
#else
- aNbBytesRead = read (myFileChannel, &aBuffer.ChangeFirst(), theNbBytes);
+ aNbBytesRead = (Standard_Integer )read (myFileChannel, &aBuffer.ChangeFirst(), theNbBytes);
if (aNbBytesRead == -1)
{
aNbBytesRead = 0;
theNbReadBytes = (Standard_Integer )aNbReadBytes;
#else
theNbReadBytes = 0;
- int aNbReadBytes = read (myFileChannel, (char* )theBuffer, theNbBytes);
+ int aNbReadBytes = (Standard_Integer )read (myFileChannel, (char* )theBuffer, theNbBytes);
if (aNbReadBytes == -1)
{
myError.SetValue (errno, Iam, "Read");
_osd_wnt_set_error (myError, OSD_WFile);
}
#else
- const int aNbWritten = write (myFileChannel, (const char* )theBuffer, theNbBytes);
+ const int aNbWritten = (Standard_Integer )write (myFileChannel, (const char* )theBuffer, theNbBytes);
if (aNbWritten == -1)
{
myError.SetValue (errno, Iam, "Write");
const int BUFSIZE=4096;
char buf[BUFSIZE];
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;
+ }
break;
}
}
const TopoDS_Shape aShapeV = DBRep::Get (aVertName);
const Standard_Real aUFrom = 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)
{
std::cout << "Error: " << aFaceName << " shape is null / not a face" << std::endl;
#include <TDF_ChildIterator.hxx>
#include <TDocStd_PathParser.hxx>
#include <OSD.hxx>
+#include <OSD_Parallel.hxx>
#include <OSD_Thread.hxx>
#include <OSD_Environment.hxx>
typedef NCollection_Sequence <TCollection_AsciiString> SequenceOfDocNames;
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
//purpose :
std::cout << "\ndocN - names (5 in each group) of OCAF documents names (3 input files, 2 output)\n" << std::endl;
return 1;
}
- int iThread(0), nbThreads(0), off(0);
+ int iThread(0), off(0);
if (TCollection_AsciiString(theArgV[1]).IsIntegerValue())
{
nbREP = TCollection_AsciiString(theArgV[1]).IntegerValue();
return 0;
}
Standard_Integer aNbFiles = (theArgC - off - 1) / 5;
- nbThreads = getNumCores();
+ int nbThreads = OSD_Parallel::NbLogicalProcessors();
if (aNbFiles < nbThreads)
{
nbThreads = aNbFiles;
for (Standard_Integer aNode = 0;; ++aNode)
{
Graphic3d_Vec3i a3Indices (-1, -1, -1);
- a3Indices[0] = strtol (thePos, &aNext, 10) - 1;
+ a3Indices[0] = int(strtol (thePos, &aNext, 10) - 1);
if (aNext == thePos)
{
break;
if (*thePos == '/')
{
++thePos;
- a3Indices[1] = strtol (thePos, &aNext, 10) - 1;
+ a3Indices[1] = int(strtol (thePos, &aNext, 10) - 1);
thePos = aNext;
// parse Normal index
if (*thePos == '/')
{
++thePos;
- a3Indices[2] = strtol (thePos, &aNext, 10) - 1;
+ a3Indices[2] = int(strtol (thePos, &aNext, 10) - 1);
thePos = aNext;
}
}
Bfree(b MTa);
b = b1;
}
- b->x[wds++] = carry;
+ b->x[wds++] = (ULong )carry;
b->wds = wds;
}
return b;
*xc++ = z & FFFFFFFF;
}
while(x < xae);
- *xc = carry;
+ *xc = (ULong )carry;
}
}
#else
while(x < xe)
*x1++ = *x++;
}
- if ((b->wds = x1 - b->x) == 0)
+ if ((b->wds = int(x1 - b->x)) == 0)
b->x[0] = 0;
}
word1(rvp) = Big1;
return;
}
- n = s1 - s0 - 1;
+ n = int(s1 - s0 - 1);
for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1)
k++;
b = Balloc(k MTa);
n += 4;
}
*x++ = L;
- b->wds = n = x - b->x;
+ b->wds = n = int(x - b->x);
n = ULbits*n - hi0bits(L);
nbits = Nbits;
lostbits = 0;
z = 10*z + c - '0';
#endif
nd0 = nd;
- bc.dp0 = bc.dp1 = s - s0;
+ bc.dp0 = bc.dp1 = int(s - s0);
for(s1 = s; s1 > s0 && *--s1 == '0'; )
++nz1;
#ifdef USE_LOCALE
#endif
if (c == '.') {
c = *++s;
- bc.dp1 = s - s0;
+ bc.dp1 = int(s - s0);
bc.dplen = bc.dp1 - bc.dp0;
if (!nd) {
for(; c == '0'; c = *++s)
nz++;
if (c > '0' && c <= '9') {
- bc.dp0 = s0 - s;
+ bc.dp0 = int(s0 - s);
bc.dp1 = bc.dp0 + bc.dplen;
s0 = s;
nf += nz;
yz /= 10;
e1 += 1;
}
- y = yz / 100000000;
+ y = ULong(yz / 100000000);
}
else if (nd > 9) {
i = nd - 9;
- y = (yz >> i) / pfive[i-1];
+ y = ULong((yz >> i) / pfive[i-1]);
}
else
- y = yz;
+ y = ULong(yz);
dval(&rv) = yz;
#endif /*}*/
#include <Standard_Type.hxx>
-#ifdef _WIN32
-#include <windows.h>
-#else
-typedef struct {
- unsigned long Data1 ;
- unsigned short Data2 ;
- unsigned short Data3 ;
- unsigned char Data4[8] ;
-} GUID ;
-#endif
-
-typedef GUID Standard_UUID ;
+struct Standard_UUID
+{
+ uint32_t Data1;
+ uint16_t Data2;
+ uint16_t Data3;
+ uint8_t Data4[8];
+};
#endif
-
-
Handle(Interface_InterfaceModel)& model,
const Handle(Interface_Protocol)& protocol) const
{
- long status = 1;
DeclareAndCast(StepData_Protocol,stepro,protocol);
if (stepro.IsNull()) return 1;
Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
model = stepmodel;
- status = StepFile_Read(name, 0, stepmodel, stepro);
- return status;
+ Standard_Integer aStatus = StepFile_Read(name, 0, stepmodel, stepro);
+ return aStatus;
}
Standard_Integer StepSelect_WorkLibrary::ReadStream (const Standard_CString theName,
Handle(Interface_InterfaceModel)& model,
const Handle(Interface_Protocol)& protocol) const
{
- long status = 1;
DeclareAndCast(StepData_Protocol, stepro, protocol);
if (stepro.IsNull()) return 1;
Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
model = stepmodel;
- status = StepFile_Read(theName, &theIStream, stepmodel, stepro);
- return status;
+ Standard_Integer aStatus = StepFile_Read(theName, &theIStream, stepmodel, stepro);
+ return aStatus;
}