Handle classes now use 0 as invalid value for pointer instead of custom (and platform-dependent) value like 0xfefd0000.
Compiler macros UndefinedHandleAddress and _OCC64 are eliminated.
SET(COMPILER ${CMAKE_GENERATOR})
endif()
-if (${COMPILER_BITNESS} STREQUAL 64)
- add_definitions(-D_OCC64)
-endif()
-
add_definitions(-DCSFDB)
if(WIN32)
add_definitions(/DWNT -wd4996)
TCollection_AsciiString& anErrorString)
: myEOF (Standard_False),
myFileDes (aFileDes),
-#ifdef WNT
- myIStream (cin), // one quirk of MSVC6.0: can't initialise by 0
-#else
- myIStream (* (istream *) UndefinedHandleAddress),
-#endif
+ myIStream (cin), // just a placeholder, myIStream will never be used anyway
myError (anErrorString),
myDocument (aDocument),
myElement (NULL),
#include <OSD_SIGSYS.hxx>
#include <OSD_Exception_CTRL_BREAK.hxx>
#include <Standard_NumericError.hxx>
-#include <Standard_NullObject.hxx>
#include <Standard_DivideByZero.hxx>
#include <Standard_Overflow.hxx>
sigaddset(&set, SIGSEGV);
sigprocmask (SIG_UNBLOCK, &set, NULL) ;
void *address = ip->si_addr ;
- if ( (((long) address )& ~0xffff) == (long) UndefinedHandleAddress ) {
- Standard_NullObject::NewInstance("Attempt to access to null object")->Jump();
- }
- else {
+ {
char Msg[100];
sprintf(Msg,"SIGSEGV 'segmentation violation' detected. Address %lx",
(long ) address ) ;
Space = ((struct sigcontext *)theContext)->sc_sl.sl_ss.ss_cr20 ;
Offset = ((struct sigcontext *)theContext)->sc_sl.sl_ss.ss_cr21 ;
// cout << "Wrong address = " << hex(Offset) << endl ;
- if ((Offset & ~0xffff) == (long)UndefinedHandleAddress) {
- Standard_NullObject::Jump("Attempt to access to null object") ;
- }
- else {
+ {
sprintf(Msg,"SIGSEGV 'segmentation violation' detected. Address %lx",Offset) ;
OSD_SIGSEGV::Jump(Msg);
// scp->sc_pcoq_head = scp->sc_pcoq_tail ; Permettrait de continuer a
#pragma warning (disable:4312)
#endif
-#ifndef PUndefinedAddress
-#ifdef _OCC64
-#define PUndefinedAddress ((Standard_Persistent *)0xfefdfefdfefd0000)
-#else
-#define PUndefinedAddress ((Standard_Persistent *)0xfefd0000)
-#endif
-#endif
-
class Standard_Persistent;
class Handle_Standard_Type;
class Handle_Standard_Persistent;
void BeginScope() const
{
- if (entity != PUndefinedAddress) entity->count++;
+ if (entity != 0) entity->count++;
}
void EndScope()
{
- if (entity != PUndefinedAddress)
+ if (entity != 0)
{
entity->count--;
if (entity->count == 0) {
entity->Delete();
- entity = PUndefinedAddress ;
+ entity = 0 ;
}
}
}
Handle(Standard_Persistent)()
{
- entity = PUndefinedAddress ;
+ entity = 0 ;
}
Handle(Standard_Persistent)(const Handle(Standard_Persistent)& aTid)
Handle(Standard_Persistent)(const Standard_Persistent *anItem)
{
if (!anItem)
- entity = PUndefinedAddress ;
+ entity = 0 ;
else {
entity = (Standard_Persistent *)anItem;
BeginScope();
Standard_EXPORT void ShallowDump(Standard_OStream&) const;
- int operator==(const Handle(Standard_Persistent)& right) const
+ bool operator==(const Handle(Standard_Persistent)& right) const
{
return entity == right.entity;
}
- int operator==(const Standard_Persistent *right) const
+ bool operator==(const Standard_Persistent *right) const
{
return entity == right;
}
- friend int operator==(const Standard_Persistent *left, const Handle(Standard_Persistent)& right)
+ friend bool operator==(const Standard_Persistent *left, const Handle(Standard_Persistent)& right)
{
return left == right.entity;
}
- int operator!=(const Handle(Standard_Persistent)& right) const
+ bool operator!=(const Handle(Standard_Persistent)& right) const
{
return entity != right.entity;
}
- int operator!=(const Standard_Persistent *right) const
+ bool operator!=(const Standard_Persistent *right) const
{
return entity != right;
}
- friend int operator!=(const Standard_Persistent *left, const Handle(Standard_Persistent)& right)
+ friend bool operator!=(const Standard_Persistent *left, const Handle(Standard_Persistent)& right)
{
return left != right.entity;
}
void Nullify()
{
EndScope();
- entity = PUndefinedAddress ;
+ entity = 0 ;
}
Standard_Boolean IsNull() const
{
- return entity == PUndefinedAddress ;
+ return entity == 0 ;
}
Standard_Persistent* Access() const
{
EndScope();
if (!anItem)
- entity = PUndefinedAddress ;
+ entity = 0 ;
else {
entity = (Standard_Persistent *)anItem;
BeginScope();
void Handle(Standard_Transient)::Assign (const Standard_Transient *anItem)
{
- Standard_Transient *anIt = ( anItem ? (Standard_Transient*)anItem : UndefinedHandleAddress );
+ Standard_Transient *anIt = (Standard_Transient*)anItem;
if ( anIt == entity ) return;
EndScope();
entity = anIt;
void Handle(Standard_Transient)::BeginScope()
{
- if (entity != UndefinedHandleAddress)
+ if (entity != 0)
{
Standard_Atomic_Increment (&entity->count);
}
void Handle(Standard_Transient)::EndScope()
{
- if (entity == UndefinedHandleAddress)
+ if (entity == 0)
return;
if (Standard_Atomic_Decrement (&entity->count) == 0)
entity->Delete();
- entity = UndefinedHandleAddress;
+ entity = 0;
}
#pragma warning (disable:4312)
#endif
-#ifndef UndefinedHandleAddress
-#ifdef _OCC64
-#define UndefinedHandleAddress ((Standard_Transient *)0xfefdfefdfefd0000)
-#else
-#define UndefinedHandleAddress ((Standard_Transient *)0xfefd0000)
-#endif
-#endif
-
class Handle_Standard_Transient;
Standard_EXPORT Standard_Integer HashCode(const Handle(Standard_Transient)& ,const Standard_Integer);
class Handle(Standard_Transient)
{
public:
+
// Public methods
//! Empty constructor
Handle(Standard_Transient) ()
- : entity(UndefinedHandleAddress)
+ : entity(0)
{
}
//! Constructor from pointer to new object
Handle(Standard_Transient) (const Standard_Transient *anItem)
- : entity ( anItem ? (Standard_Transient*)anItem : UndefinedHandleAddress )
+ : entity ( (Standard_Transient*)anItem )
{
BeginScope();
}
}
//! Destructor
- Standard_EXPORT ~Handle(Standard_Transient)()
+ ~Handle(Standard_Transient)()
{
EndScope();
}
//! Check for being null
Standard_Boolean IsNull() const
{
- return entity == UndefinedHandleAddress;
+ return entity == 0;
}
//! Returns pointer to referred object
}
//! Check for equality
- friend int operator==(const Standard_Transient *left, const Handle(Standard_Transient)& right)
+ friend bool operator==(const Standard_Transient *left, const Handle(Standard_Transient)& right)
{
return left == right.entity;
}
//! Check for inequality
- int operator!=(const Handle(Standard_Transient)& right) const
+ bool operator!=(const Handle(Standard_Transient)& right) const
{
return entity != right.entity;
}
//! Check for inequality
- int operator!=(const Standard_Transient *right) const
+ bool operator!=(const Standard_Transient *right) const
{
return entity != right;
}
//! Check for inequality
- friend int operator!=(const Standard_Transient *left, const Handle(Standard_Transient)& right)
+ friend bool operator!=(const Standard_Transient *left, const Handle(Standard_Transient)& right)
{
return left != right.entity;
}
#define ROUNDDOWN_CELL(size) ROUNDDOWN8(size)
#define INDEX_CELL(rsize) ((rsize) >> 3)
-// Minimal granularity: 4 bytes (32-bit systems only)
-#ifndef _OCC64
-//#define ROUNDUP_CELL(size) ROUNDUP4(size)
-//#define INDEX_CELL(rsize) ((rsize) >> 2)
-#endif
-
-// Adaptive granularity, less for little blocks and greater for bigger ones:
-/*
-#if _OCC64
-#define ROUNDUP_CELL(size) ((size) <= 0x40 ? ROUNDUP8(size) : ROUNDUP16(size))
-#define INDEX_CELL(rsize) ((rsize) <= 0x40 ? ((rsize) >> 3) : (4 + ((rsize) >> 4)))
-#else
-#define ROUNDUP_CELL(size) ((size) <= 0x40 ? ROUNDUP4(size) : ROUNDUP8(size))
-#define INDEX_CELL(rsize) ((rsize) <= 0x40 ? ((rsize) >> 2) : (8 + ((rsize) >> 3)))
-#endif
-*/
-
-
/* In the allocated block, first bytes are used for storing of memory manager's data.
(size of block). The minimal size of these data is sizeof(int).
The memory allocated in system usually alligned by 16 bytes.Tthe aligment of the
//# endif // WNT
# endif // __Standard_API
-// Define _OCC64 variable (unless already defined) if platform is known to be 64-bit
-#ifndef _OCC64
-#if defined (__alpha) || defined(DECOSF1) || defined(_WIN64) || defined(__amd64) || defined(__x86_64)
-#define _OCC64 1
-#endif
-#endif
-
#endif