#include "wx/memory.h"
-#if wxUSE_THREADS && defined(__WXDEBUG__) && !defined(__WXMAC__)
+#if wxUSE_THREADS && defined(__WXDEBUG__)
#define USE_THREADSAFE_MEMORY_ALLOCATION 1
#else
#define USE_THREADSAFE_MEMORY_ALLOCATION 0
*/
void wxMemStruct::ErrorMsg (const char * mesg)
{
- wxLogMessage(wxT("wxWindows memory checking error: %s"), mesg);
+ wxLogMessage(wxT("wxWidgets memory checking error: %s"), mesg);
PrintNode ();
}
*/
void wxMemStruct::ErrorMsg ()
{
- wxLogMessage(wxT("wxWindows over/underwrite memory error:"));
+ wxLogMessage(wxT("wxWidgets over/underwrite memory error:"));
PrintNode ();
}
int count;
va_list argptr;
va_start(argptr, szFormat);
- buf[sizeof(buf)-1] = _T('\0');
+ buf[sizeof(buf)/sizeof(wxChar)-1] = _T('\0');
// keep 3 bytes for a \r\n\0
- count = wxVsnprintf(buf, sizeof(buf)-3, szFormat, argptr);
+ count = wxVsnprintf(buf, sizeof(buf)/sizeof(wxChar)-3, szFormat, argptr);
if ( count < 0 )
- count = sizeof(buf)-3;
+ count = sizeof(buf)/sizeof(wxChar)-3;
buf[count]=_T('\r');
buf[count+1]=_T('\n');
buf[count+2]=_T('\0');
class MemoryCriticalSection : public wxCriticalSection
{
public:
- MemoryCriticalSection() {
- memSectionOk = true;
- }
+ MemoryCriticalSection() {
+ memSectionOk = true;
+ }
};
class MemoryCriticalSectionLocker
{
public:
inline MemoryCriticalSectionLocker(wxCriticalSection& critsect)
- : m_critsect(critsect), m_locked(memSectionOk) { if(m_locked) m_critsect.Enter(); }
+ : m_critsect(critsect), m_locked(memSectionOk) { if(m_locked) m_critsect.Enter(); }
inline ~MemoryCriticalSectionLocker() { if(m_locked) m_critsect.Leave(); }
private:
MemoryCriticalSectionLocker& operator=(const MemoryCriticalSectionLocker&);
wxCriticalSection& m_critsect;
- bool m_locked;
+ bool m_locked;
};
MemoryCriticalSection &GetMemLocker()