From: Vadim Zeitlin Date: Sat, 27 Apr 2002 10:35:04 +0000 (+0000) Subject: fixes for operator new declaration/definition (patch 549349) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/cf760e4c30a0324f441989dbf8362c63472336ec?hp=b2edef6f2f587d957eabbc17364382293707340f fixes for operator new declaration/definition (patch 549349) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15279 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/object.h b/include/wx/object.h index 54df87ed09..5b06ab786f 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -411,7 +411,7 @@ public: // Turn on the correct set of new and delete operators #ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT - void *operator new ( size_t size, wxChar *fileName = NULL, int lineNum = 0 ); + void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); #endif #ifdef _WX_WANT_DELETE_VOID @@ -423,11 +423,11 @@ public: #endif #ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT - void operator delete ( void *buf, wxChar*, int ); + void operator delete ( void *buf, const wxChar*, int ); #endif #ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT - void *operator new[] ( size_t size, wxChar *fileName = NULL, int lineNum = 0 ); + void *operator new[] ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); #endif #ifdef _WX_WANT_ARRAY_DELETE_VOID @@ -435,7 +435,7 @@ public: #endif #ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT - void operator delete[] (void* buf, wxChar*, int ); + void operator delete[] (void* buf, const wxChar*, int ); #endif diff --git a/src/common/object.cpp b/src/common/object.cpp index a9b7d22d61..c091b0c681 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -77,11 +77,16 @@ void wxObject::Dump(wxSTD ostream& str) #endif +#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING && defined( new ) + #undef new +#endif + + #ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT -void *wxObject::operator new ( size_t size, wxChar *fileName, int lineNum ) +void *wxObject::operator new ( size_t size, const wxChar *fileName, int lineNum ) { - return wxDebugAlloc(size, fileName, lineNum, TRUE); + return wxDebugAlloc(size, (wxChar*) fileName, lineNum, TRUE); } #endif @@ -100,16 +105,16 @@ void wxObject::operator delete ( void *buf, const char *_fname, size_t _line ) #endif #ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT -void wxObject::operator delete ( void *buf, wxChar *WXUNUSED(fileName), int WXUNUSED(lineNum) ) +void wxObject::operator delete ( void *buf, const wxChar *WXUNUSED(fileName), int WXUNUSED(lineNum) ) { wxDebugFree(buf); } #endif #ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT -void *wxObject::operator new[] ( size_t size, wxChar* WXUNUSED(fileName), int WXUNUSED(lineNum) ) +void *wxObject::operator new[] ( size_t size, const wxChar* fileName, int lineNum ) { - return wxDebugAlloc(size, fileName, lineNum, TRUE, TRUE); + return wxDebugAlloc(size, (wxChar*) fileName, lineNum, TRUE, TRUE); } #endif @@ -121,7 +126,7 @@ void wxObject::operator delete[] ( void *buf ) #endif #ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT -void wxObject::operator delete[] (void * buf, wxChar* WXUNUSED(fileName), int WXUNUSED(lineNum) ) +void wxObject::operator delete[] (void * buf, const wxChar* WXUNUSED(fileName), int WXUNUSED(lineNum) ) { wxDebugFree(buf, TRUE); }