- 0, NULL);
-
- // copy it to our buffer and free memory
- wxStrncpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf) - 1);
- s_szBuf[WXSIZEOF(s_szBuf) - 1] = wxT('\0');
- LocalFree(lpMsgBuf);
-
- // returned string is capitalized and ended with '\r\n' - bad
- s_szBuf[0] = (wxChar)wxTolower(s_szBuf[0]);
- size_t len = wxStrlen(s_szBuf);
- if ( len > 0 ) {
- // truncate string
- if ( s_szBuf[len - 2] == wxT('\r') )
- s_szBuf[len - 2] = wxT('\0');
- }
-
- return s_szBuf;
-#else //Win16
- // TODO
- return NULL;
-#endif // Win16/32
-#else // Unix
-#if wxUSE_UNICODE
- static wxChar s_szBuf[LOG_BUFFER_SIZE / 2];
- wxConvCurrent->MB2WC(s_szBuf, strerror(nErrCode), WXSIZEOF(s_szBuf) -1);
- return s_szBuf;
-#else
- return strerror(nErrCode);
-#endif
-#endif // Win/Unix
-}
-
-// ----------------------------------------------------------------------------
-// debug helper
-// ----------------------------------------------------------------------------
-
-#ifdef __WXDEBUG__
-
-// break into the debugger
-void Trap()
-{
-#ifdef __WXMSW__
- DebugBreak();
-#elif defined(__WXMAC__)
-#if __powerc
- Debugger();
-#else
- SysBreak();
-#endif
-#elif defined(__UNIX__)
- raise(SIGTRAP);
-#else
- // TODO
-#endif // Win/Unix
-}
-
-// this function is called when an assert fails
-void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg)
-{
- // this variable can be set to true to suppress "assert failure" messages
- static bool s_bNoAsserts = FALSE;
- static bool s_bInAssert = FALSE; // FIXME MT-unsafe
-
- if ( s_bInAssert ) {
- // He-e-e-e-elp!! we're trapped in endless loop
- Trap();
-
- s_bInAssert = FALSE;
-
- return;
- }
-
- s_bInAssert = TRUE;
-
- wxChar szBuf[LOG_BUFFER_SIZE];
-
- // make life easier for people using VC++ IDE: clicking on the message
- // will take us immediately to the place of the failed assert
-#ifdef __VISUALC__
- wxSprintf(szBuf, wxT("%s(%d): assert failed"), szFile, nLine);
-#else // !VC++
- // make the error message more clear for all the others
- wxSprintf(szBuf, wxT("Assert failed in file %s at line %d"), szFile, nLine);
-#endif // VC/!VC
-
- if ( szMsg != NULL ) {
- wxStrcat(szBuf, wxT(": "));
- wxStrcat(szBuf, szMsg);
- }
- else {
- wxStrcat(szBuf, wxT("."));