#if wxUSE_LOG
-// wxWindows
+// wxWidgets
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/arrstr.h"
va_list argptr;
va_start(argptr, szFormat);
wxVLogFatalError(szFormat, argptr);
- va_end(argptr);
+
+ // some compilers warn about unreachable code and it shouldn't matter
+ // for the others anyhow...
+ //va_end(argptr);
}
// same as info, but only if 'verbose' mode is on
void wxVLogVerbose(const wxChar *szFormat, va_list argptr)
{
if ( IsLoggingEnabled() ) {
- wxLog *pLog = wxLog::GetActiveTarget();
- if ( pLog != NULL && pLog->GetVerbose() ) {
+ if ( wxLog::GetActiveTarget() != NULL && wxLog::GetVerbose() ) {
wxCRIT_SECT_LOCKER(locker, gs_csLogBuf);
wxVsnprintf(s_szBuf, s_szBufSize, szFormat, argptr);
// wxLog class implementation
// ----------------------------------------------------------------------------
-wxLog::wxLog()
-{
-}
-
wxChar *wxLog::SetLogBuffer( wxChar *buf, size_t size)
{
wxChar *oldbuf = s_szBuf;
if ( ms_bAutoCreate && ms_pLogger == NULL ) {
// prevent infinite recursion if someone calls wxLogXXX() from
// wxApp::CreateLogTarget()
- static bool s_bInGetActiveTarget = FALSE;
+ static bool s_bInGetActiveTarget = false;
if ( !s_bInGetActiveTarget ) {
- s_bInGetActiveTarget = TRUE;
+ s_bInGetActiveTarget = true;
// ask the application to create a log target for us
if ( wxTheApp != NULL )
else
ms_pLogger = new wxLogStderr;
- s_bInGetActiveTarget = FALSE;
+ s_bInGetActiveTarget = false;
// do nothing if it fails - what can we do?
}
void wxLog::DontCreateOnDemand()
{
- ms_bAutoCreate = FALSE;
+ ms_bAutoCreate = false;
// this is usually called at the end of the program and we assume that it
// is *always* called at the end - so we free memory here to avoid false
wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
if ( traits && !traits->HasStderr() )
{
- wxMessageOutputDebug().Printf(_T("%s"), str.c_str());
+ wxMessageOutputDebug dbgout;
+ dbgout.Printf(_T("%s\n"), str.c_str());
}
}
}
wxLogChain::wxLogChain(wxLog *logger)
{
- m_bPassMessages = TRUE;
+ m_bPassMessages = true;
m_logNew = logger;
m_logOld = wxLog::SetActiveTarget(this);
// ----------------------------------------------------------------------------
wxLog *wxLog::ms_pLogger = (wxLog *)NULL;
-bool wxLog::ms_doLog = TRUE;
-bool wxLog::ms_bAutoCreate = TRUE;
-bool wxLog::ms_bVerbose = FALSE;
+bool wxLog::ms_doLog = true;
+bool wxLog::ms_bAutoCreate = true;
+bool wxLog::ms_bVerbose = false;
wxLogLevel wxLog::ms_logLevel = wxLOG_Max; // log everything by default
unsigned long wxSysErrorCode()
{
#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
-#ifdef __WIN32__
return ::GetLastError();
-#else //WIN16
- // TODO what to do on Windows 3.1?
- return 0;
-#endif //WIN16/32
#else //Unix
return errno;
#endif //Win/Unix
nErrCode = wxSysErrorCode();
#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
-#ifdef __WIN32__
static wxChar s_szBuf[LOG_BUFFER_SIZE / 2];
// get error message from system
0, NULL);
// copy it to our buffer and free memory
- if( lpMsgBuf != 0 ) {
+ // Crashes on SmartPhone
+#if !defined(__SMARTPHONE__) /* of WinCE */
+ if( lpMsgBuf != 0 ) {
wxStrncpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf) - 1);
s_szBuf[WXSIZEOF(s_szBuf) - 1] = wxT('\0');
s_szBuf[len - 2] = wxT('\0');
}
}
- else {
+ else
+#endif
+ {
s_szBuf[0] = wxT('\0');
}
return s_szBuf;
-#else //Win16
- // TODO
- return NULL;
-#endif // Win16/32
-#else // Unix
+#else // Unix-WXMICROWIN
#if wxUSE_UNICODE
static wxChar s_szBuf[LOG_BUFFER_SIZE / 2];
wxConvCurrent->MB2WC(s_szBuf, strerror(nErrCode), WXSIZEOF(s_szBuf) -1);
#else
return strerror((int)nErrCode);
#endif
-#endif // Win/Unix
+#endif // Win/Unix-WXMICROWIN
}
#endif // wxUSE_LOG