X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5260b1c582632afeb8f25db7f10697c8d45461b4..6f34921d9369a31de14e4b07e4824e2d701710f0:/src/common/memory.cpp diff --git a/src/common/memory.cpp b/src/common/memory.cpp index fee8108d50..f219387d42 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -24,7 +24,7 @@ #include "wx/defs.h" #endif -#if (DEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT +#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT #ifdef __GNUG__ // #pragma implementation @@ -51,7 +51,7 @@ #include #include -#ifdef __WINDOWS__ +#ifdef __WXMSW__ #include #ifdef GetClassInfo @@ -387,7 +387,9 @@ int wxMemStruct::ValidateNode () ErrorMsg ("Object already deleted"); else { // Can't use the error routines as we have no recognisable object. - wxTrace("Can't verify memory struct - all bets are off!\n"); +#ifndef __WXGTK__ + wxTrace("Can't verify memory struct - all bets are off!\n"); +#endif } return 0; } @@ -623,11 +625,11 @@ void wxDebugContext::TraverseList (PmSFV func, wxMemStruct *from) */ bool wxDebugContext::PrintList (void) { -#if DEBUG +#if WXDEBUG if (!HasStream()) return FALSE; - TraverseList ((PmSFV)&wxMemStruct::PrintNode, (checkPoint ? checkPoint->m_next : NULL)); + TraverseList ((PmSFV)&wxMemStruct::PrintNode, (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL)); return TRUE; #else @@ -637,7 +639,7 @@ bool wxDebugContext::PrintList (void) bool wxDebugContext::Dump(void) { -#if DEBUG +#if WXDEBUG if (!HasStream()) return FALSE; @@ -649,10 +651,10 @@ bool wxDebugContext::Dump(void) { appNameStr = wxTheApp->GetAppName(); appName = (char*) (const char*) appNameStr; - wxTrace("Memory dump of %s at %s:\n", appName, wxNow()); + wxTrace("Memory dump of %s at %s:\n", appName, WXSTRINGCAST wxNow() ); } } - TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : NULL)); + TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL)); return TRUE; #else @@ -687,7 +689,7 @@ static wxDebugStatsStruct *InsertStatsStruct(wxDebugStatsStruct *head, wxDebugSt bool wxDebugContext::PrintStatistics(bool detailed) { -#if DEBUG +#if WXDEBUG if (!HasStream()) return FALSE; @@ -700,7 +702,7 @@ bool wxDebugContext::PrintStatistics(bool detailed) wxDebugStatsStruct *list = NULL; - wxMemStruct *from = (checkPoint ? checkPoint->m_next : NULL); + wxMemStruct *from = (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL ); if (!from) from = wxDebugContext::GetHead (); @@ -819,7 +821,7 @@ int wxDebugContext::Check(bool checkAll) { int nFailures = 0; - wxMemStruct *from = (checkPoint ? checkPoint->m_next : NULL); + wxMemStruct *from = (checkPoint ? checkPoint->m_next : (wxMemStruct*)NULL ); if (!from || checkAll) from = wxDebugContext::GetHead (); @@ -860,7 +862,7 @@ int wxDebugContext::CountObjectsLeft(void) // We'll only do malloc and free for the moment: leave the interesting // stuff for the wxObject versions. -#if DEBUG && USE_GLOBAL_MEMORY_OPERATORS +#if WXDEBUG && USE_GLOBAL_MEMORY_OPERATORS #ifdef new #undef new @@ -884,7 +886,7 @@ void * operator new (size_t size, char * fileName, int lineNum) #endif } -#if !( defined (_MSC_VER) && (_MSC_VER <= 800) ) +#if !( defined (_MSC_VER) && (_MSC_VER <= 1000) ) void * operator new[] (size_t size, char * fileName, int lineNum) { #ifdef NO_DEBUG_ALLOCATION @@ -904,7 +906,7 @@ void operator delete (void * buf) #endif } -#if !( defined (_MSC_VER) && (_MSC_VER <= 800) ) +#if !( defined (_MSC_VER) && (_MSC_VER <= 1000) ) void operator delete[] (void * buf) { #ifdef NO_DEBUG_ALLOCATION @@ -918,7 +920,7 @@ void operator delete[] (void * buf) #endif // TODO: store whether this is a vector or not. -void * wxDebugAlloc(size_t size, char * fileName, int lineNum, bool isObject, bool isVect) +void * wxDebugAlloc(size_t size, char * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) ) { // If not in debugging allocation mode, do the normal thing // so we don't leave any trace of ourselves in the node list. @@ -969,7 +971,7 @@ void * wxDebugAlloc(size_t size, char * fileName, int lineNum, bool isObject, bo } // TODO: check whether was allocated as a vector -void wxDebugFree(void * buf, bool isVect) +void wxDebugFree(void * buf, bool WXUNUSED(isVect) ) { if (!buf) return; @@ -1021,7 +1023,7 @@ void wxTrace(const char *fmt ...) va_start(ap, fmt); -#ifdef __WINDOWS__ +#ifdef __WXMSW__ wvsprintf(buffer,fmt,ap) ; #else vsprintf(buffer,fmt,ap) ; @@ -1035,7 +1037,7 @@ void wxTrace(const char *fmt ...) wxDebugContext::GetStream().flush(); } else -#ifdef __WINDOWS__ +#ifdef __WXMSW__ OutputDebugString((LPCSTR)buffer) ; #else fprintf(stderr, buffer); @@ -1053,7 +1055,7 @@ void wxTraceLevel(int level, const char *fmt ...) va_start(ap, fmt); -#ifdef __WINDOWS__ +#ifdef __WXMSW__ wvsprintf(buffer,fmt,ap) ; #else vsprintf(buffer,fmt,ap) ; @@ -1067,14 +1069,14 @@ void wxTraceLevel(int level, const char *fmt ...) wxDebugContext::GetStream().flush(); } else -#ifdef __WINDOWS__ +#ifdef __WXMSW__ OutputDebugString((LPCSTR)buffer) ; #else fprintf(stderr, buffer); #endif } -#else // USE_MEMORY_TRACING && DEBUG +#else // USE_MEMORY_TRACING && WXDEBUG void wxTrace(const char *WXUNUSED(fmt) ...) { }