From d011f09f3262bbc6cad5bbb09d37b5c26bc2cbf6 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sun, 24 Feb 2013 08:52:09 +0100 Subject: [PATCH] Windows build fixes. --- lib/base/application.cpp | 19 ------------------- lib/base/application.h | 3 --- lib/base/base.vcxproj | 6 +++--- lib/base/base.vcxproj.filters | 24 ++++++++++++++++++------ lib/base/process-unix.cpp | 3 ++- lib/base/process-windows.cpp | 3 ++- lib/base/streamlogger.cpp | 9 +++++++++ 7 files changed, 34 insertions(+), 33 deletions(-) diff --git a/lib/base/application.cpp b/lib/base/application.cpp index 99453a992..75d234acd 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -107,17 +107,6 @@ void Application::SetArgV(char **argv) m_ArgV = argv; } -#ifdef _DEBUG -void Application::ProfileTimerHandler(void) -{ - stringstream msgbuf; - msgbuf << "Active objects: " << Object::GetAliveObjectsCount(); - Logger::Write(LogInformation, "base", msgbuf.str()); - - Object::PrintMemoryProfile(); -} -#endif /* _DEBUG */ - void Application::ShutdownTimerHandler(void) { if (m_ShuttingDown) { @@ -144,14 +133,6 @@ void Application::RunEventLoop(void) const shutdownTimer->SetInterval(0.5); shutdownTimer->Start(); -#ifdef _DEBUG - /* Set up a timer that periodically prints some information about the object system. */ - Timer::Ptr profileTimer = boost::make_shared(); - profileTimer->OnTimerExpired.connect(boost::bind(&Application::ProfileTimerHandler)); - flushTxTimer->SetInterval(15); - flushTxTimer->Start(); -#endif /* _DEBUG */ - Timer::Initialize(); GetEQ().Join(); diff --git a/lib/base/application.h b/lib/base/application.h index dfb27e766..a8a7c1c79 100644 --- a/lib/base/application.h +++ b/lib/base/application.h @@ -113,9 +113,6 @@ private: static void TimeWatchThreadProc(void); static void NewTxTimerHandler(void); -#ifdef _DEBUG - static void ProfileTimerHandler(void) -#endif /* _DEBUG */ static void ShutdownTimerHandler(void); }; diff --git a/lib/base/base.vcxproj b/lib/base/base.vcxproj index c115d7465..2b5afb228 100644 --- a/lib/base/base.vcxproj +++ b/lib/base/base.vcxproj @@ -26,7 +26,7 @@ - + @@ -68,7 +68,7 @@ - + @@ -253,4 +253,4 @@ - + \ No newline at end of file diff --git a/lib/base/base.vcxproj.filters b/lib/base/base.vcxproj.filters index 304b17697..097c74493 100644 --- a/lib/base/base.vcxproj.filters +++ b/lib/base/base.vcxproj.filters @@ -10,9 +10,6 @@ Quelldateien - - Quelldateien - Quelldateien @@ -94,6 +91,18 @@ Quelldateien + + Quelldateien + + + Quelldateien + + + Quelldateien + + + Quelldateien + @@ -108,9 +117,6 @@ Headerdateien - - Headerdateien - Headerdateien @@ -198,6 +204,12 @@ Headerdateien + + Headerdateien + + + Headerdateien + diff --git a/lib/base/process-unix.cpp b/lib/base/process-unix.cpp index d7fdae546..b08b05214 100644 --- a/lib/base/process-unix.cpp +++ b/lib/base/process-unix.cpp @@ -17,8 +17,9 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#ifndef _WIN32 #include "i2-base.h" + +#ifndef _WIN32 #include using namespace icinga; diff --git a/lib/base/process-windows.cpp b/lib/base/process-windows.cpp index 3dace62fe..98cf0fc62 100644 --- a/lib/base/process-windows.cpp +++ b/lib/base/process-windows.cpp @@ -17,9 +17,9 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#ifdef _WIN32 #include "i2-base.h" +#ifdef _WIN32 using namespace icinga; void Process::Initialize(void) @@ -45,6 +45,7 @@ void Process::InitTask(void) bool Process::RunTask(void) { // TODO: implement + return false; } #endif /* _WIN32 */ diff --git a/lib/base/streamlogger.cpp b/lib/base/streamlogger.cpp index e45c3809f..74afa94d7 100644 --- a/lib/base/streamlogger.cpp +++ b/lib/base/streamlogger.cpp @@ -81,8 +81,17 @@ void StreamLogger::ProcessLogEntry(ostream& stream, bool tty, const LogEntry& en time_t ts = entry.Timestamp; tm tmnow; +#ifdef _WIN32 + tm *temp = localtime(&ts); + + if (temp == NULL) + BOOST_THROW_EXCEPTION(PosixException("localtime() failed", errno)); + + tmnow = *temp; +#else /* _WIN32 */ if (localtime_r(&ts, &tmnow) == NULL) BOOST_THROW_EXCEPTION(PosixException("localtime_r() failed.", errno)); +#endif /* _WIN32 */ strftime(timestamp, sizeof(timestamp), "%Y/%m/%d %H:%M:%S %z", &tmnow);