Converted the instance of osgNew and osgDelete back to new and delete as part
of depecating the include/osg/MemoryManager
This commit is contained in:
@@ -55,7 +55,7 @@ DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName)
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
HANDLE handle = LoadLibrary( fullLibraryName.c_str() );
|
||||
if (handle) return osgNew DynamicLibrary(libraryName,handle);
|
||||
if (handle) return new DynamicLibrary(libraryName,handle);
|
||||
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
|
||||
#elif defined(__DARWIN_OSX__)
|
||||
NSObjectFileImage image;
|
||||
@@ -64,19 +64,19 @@ DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName)
|
||||
// os_handle = NSLinkModule(image, fullLibraryName.c_str(), TRUE);
|
||||
HANDLE handle = NSLinkModule(image, fullLibraryName.c_str(), TRUE);
|
||||
NSDestroyObjectFileImage(image);
|
||||
if (handle) return osgNew DynamicLibrary(libraryName,handle);
|
||||
if (handle) return new DynamicLibrary(libraryName,handle);
|
||||
}
|
||||
// if (os_handle) return osgNew DynamicLibrary(libraryName,os_handle);
|
||||
// if (os_handle) return new DynamicLibrary(libraryName,os_handle);
|
||||
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
|
||||
#elif defined(__hpux__)
|
||||
// BIND_FIRST is neccessary for some reason
|
||||
HANDLE handle = shl_load ( fullLibraryName.c_str(), BIND_DEFERRED|BIND_FIRST|BIND_VERBOSE, 0);
|
||||
if (handle) return osgNew DynamicLibrary(libraryName,handle);
|
||||
if (handle) return new DynamicLibrary(libraryName,handle);
|
||||
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
|
||||
notify(WARN) << "DynamicLibrary::error "<<strerror(errno)<<std::endl;
|
||||
#else // other unix
|
||||
HANDLE handle = dlopen( fullLibraryName.c_str(), RTLD_LAZY );
|
||||
if (handle) return osgNew DynamicLibrary(libraryName,handle);
|
||||
if (handle) return new DynamicLibrary(libraryName,handle);
|
||||
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
|
||||
notify(WARN) << "DynamicLibrary::error "<<dlerror()<<std::endl;
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,7 @@ Field& Field::operator = (const Field& ic)
|
||||
void Field::_free()
|
||||
{
|
||||
// free all data
|
||||
if (_fieldCache) osgDelete [] _fieldCache;
|
||||
if (_fieldCache) delete [] _fieldCache;
|
||||
|
||||
_init();
|
||||
|
||||
@@ -64,7 +64,7 @@ void Field::_copy(const Field& ic)
|
||||
{
|
||||
_fieldCacheCapacity = ic._fieldCacheCapacity;
|
||||
_fieldCacheSize = ic._fieldCacheSize;
|
||||
_fieldCache = osgNew char [_fieldCacheCapacity];
|
||||
_fieldCache = new char [_fieldCacheCapacity];
|
||||
strncpy(_fieldCache,ic._fieldCache,_fieldCacheCapacity);
|
||||
}
|
||||
else
|
||||
@@ -146,7 +146,7 @@ void Field::addChar(char c)
|
||||
if (_fieldCache==NULL)
|
||||
{
|
||||
if (_fieldCacheCapacity<MIN_CACHE_SIZE) _fieldCacheCapacity=MIN_CACHE_SIZE;
|
||||
_fieldCache = osgNew char[_fieldCacheCapacity];
|
||||
_fieldCache = new char[_fieldCacheCapacity];
|
||||
memset(_fieldCache,0,_fieldCacheCapacity);
|
||||
_fieldCacheSize = 0;
|
||||
}
|
||||
@@ -155,10 +155,10 @@ void Field::addChar(char c)
|
||||
if (_fieldCacheCapacity<MIN_CACHE_SIZE) _fieldCacheCapacity=MIN_CACHE_SIZE;
|
||||
while (_fieldCacheSize>=_fieldCacheCapacity-1) _fieldCacheCapacity *= 2;
|
||||
char* tmp_str = _fieldCache;
|
||||
_fieldCache = osgNew char[_fieldCacheCapacity];
|
||||
_fieldCache = new char[_fieldCacheCapacity];
|
||||
memset(_fieldCache,0,_fieldCacheCapacity);
|
||||
strncpy(_fieldCache,tmp_str,_fieldCacheSize);
|
||||
osgDelete [] tmp_str;
|
||||
delete [] tmp_str;
|
||||
|
||||
}
|
||||
_fieldCache[_fieldCacheSize++] = c;
|
||||
|
||||
@@ -34,16 +34,16 @@ void FieldReaderIterator::_free()
|
||||
// free all data
|
||||
if (_previousField)
|
||||
{
|
||||
osgDelete _previousField;
|
||||
delete _previousField;
|
||||
}
|
||||
if (_fieldQueue)
|
||||
{
|
||||
for(int i=0;i<_fieldQueueCapacity;++i)
|
||||
{
|
||||
if (_fieldQueue[i]) osgDelete _fieldQueue[i];
|
||||
if (_fieldQueue[i]) delete _fieldQueue[i];
|
||||
_fieldQueue[i] = NULL;
|
||||
}
|
||||
osgDelete [] _fieldQueue;
|
||||
delete [] _fieldQueue;
|
||||
}
|
||||
_init();
|
||||
|
||||
@@ -66,17 +66,17 @@ void FieldReaderIterator::_copy(const FieldReaderIterator& ic)
|
||||
|
||||
if (ic._previousField)
|
||||
{
|
||||
_previousField = osgNew Field(*ic._previousField);
|
||||
_previousField = new Field(*ic._previousField);
|
||||
}
|
||||
|
||||
if (ic._fieldQueue && ic._fieldQueueCapacity>0)
|
||||
{
|
||||
_fieldQueue = osgNew Field* [ic._fieldQueueCapacity];
|
||||
_fieldQueue = new Field* [ic._fieldQueueCapacity];
|
||||
for(int i=0;i<ic._fieldQueueCapacity;++i)
|
||||
{
|
||||
if (ic._fieldQueue[i])
|
||||
{
|
||||
_fieldQueue[i] = osgNew Field(*ic._fieldQueue[i]);
|
||||
_fieldQueue[i] = new Field(*ic._fieldQueue[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -128,7 +128,7 @@ void FieldReaderIterator::insert(int pos,Field* field)
|
||||
int newCapacity = _fieldQueueCapacity*2;
|
||||
if (newCapacity<MINIMUM_FIELD_READER_QUEUE_SIZE) newCapacity = MINIMUM_FIELD_READER_QUEUE_SIZE;
|
||||
while(_fieldQueueSize>=newCapacity) newCapacity*=2;
|
||||
Field** newFieldStack = osgNew Field* [newCapacity];
|
||||
Field** newFieldStack = new Field* [newCapacity];
|
||||
for(i=0;i<_fieldQueueCapacity;++i)
|
||||
{
|
||||
newFieldStack[i] = _fieldQueue[i];
|
||||
@@ -139,7 +139,7 @@ void FieldReaderIterator::insert(int pos,Field* field)
|
||||
}
|
||||
|
||||
// free the old memory.
|
||||
osgDelete [] _fieldQueue;
|
||||
delete [] _fieldQueue;
|
||||
|
||||
_fieldQueue = newFieldStack;
|
||||
_fieldQueueCapacity = newCapacity;
|
||||
@@ -158,7 +158,7 @@ void FieldReaderIterator::insert(int pos,const char* str)
|
||||
{
|
||||
if (str)
|
||||
{
|
||||
Field* field = osgNew Field;
|
||||
Field* field = new Field;
|
||||
while(*str!=0)
|
||||
{
|
||||
field->addChar(*str);
|
||||
@@ -194,7 +194,7 @@ Field& FieldReaderIterator::field (int pos)
|
||||
int newCapacity = _fieldQueueCapacity*2;
|
||||
if (newCapacity<MINIMUM_FIELD_READER_QUEUE_SIZE) newCapacity = MINIMUM_FIELD_READER_QUEUE_SIZE;
|
||||
while(_fieldQueueSize>=newCapacity) newCapacity*=2;
|
||||
Field** newFieldStack = osgNew Field* [newCapacity];
|
||||
Field** newFieldStack = new Field* [newCapacity];
|
||||
int i;
|
||||
for(i=0;i<_fieldQueueCapacity;++i)
|
||||
{
|
||||
@@ -205,14 +205,14 @@ Field& FieldReaderIterator::field (int pos)
|
||||
newFieldStack[i] = NULL;
|
||||
}
|
||||
// free the old memory.
|
||||
osgDelete [] _fieldQueue;
|
||||
delete [] _fieldQueue;
|
||||
|
||||
_fieldQueue = newFieldStack;
|
||||
_fieldQueueCapacity = newCapacity;
|
||||
}
|
||||
while(!_reader.eof() && pos>=_fieldQueueSize)
|
||||
{
|
||||
if (_fieldQueue[_fieldQueueSize]==NULL) _fieldQueue[_fieldQueueSize] = osgNew Field;
|
||||
if (_fieldQueue[_fieldQueueSize]==NULL) _fieldQueue[_fieldQueueSize] = new Field;
|
||||
if (_reader.readField(*_fieldQueue[_fieldQueueSize]))
|
||||
{
|
||||
++_fieldQueueSize;
|
||||
@@ -250,7 +250,7 @@ FieldReaderIterator& FieldReaderIterator::operator += (int no)
|
||||
}
|
||||
else if (no>0)
|
||||
{
|
||||
Field** tmpFields = osgNew Field* [no];
|
||||
Field** tmpFields = new Field* [no];
|
||||
int i;
|
||||
for(i=0;i<no;++i)
|
||||
{
|
||||
@@ -265,7 +265,7 @@ FieldReaderIterator& FieldReaderIterator::operator += (int no)
|
||||
{
|
||||
_fieldQueue[_fieldQueueSize+i] = tmpFields[i];
|
||||
}
|
||||
osgDelete [] tmpFields;
|
||||
delete [] tmpFields;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ Node* osgDB::readNodeFiles(std::vector<std::string>& commandLine)
|
||||
}
|
||||
else // size >1
|
||||
{
|
||||
osg::Group* group = osgNew osg::Group;
|
||||
osg::Group* group = new osg::Group;
|
||||
for(NodeList::iterator itr=nodeList.begin();
|
||||
itr!=nodeList.end();
|
||||
++itr)
|
||||
|
||||
@@ -34,7 +34,7 @@ class RegistryPtr
|
||||
RegistryPtr() : _ptr(0L) {}
|
||||
RegistryPtr(Registry* t): _ptr(t) {}
|
||||
RegistryPtr(const RegistryPtr& rp):_ptr(rp._ptr) { }
|
||||
~RegistryPtr() { if (_ptr) osgDelete _ptr; _ptr=0L; }
|
||||
~RegistryPtr() { if (_ptr) delete _ptr; _ptr=0L; }
|
||||
|
||||
inline Registry* get() { return _ptr; }
|
||||
|
||||
@@ -43,7 +43,7 @@ class RegistryPtr
|
||||
|
||||
Registry* Registry::instance()
|
||||
{
|
||||
static RegistryPtr s_nodeFactory = osgNew Registry;
|
||||
static RegistryPtr s_nodeFactory = new Registry;
|
||||
return s_nodeFactory.get();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user