[icinga-checkins] icinga.org: icinga2/master: Windows build fixes.

git at icinga.org git at icinga.org
Sun Feb 24 08:52:14 CET 2013


Module: icinga2
Branch: master
Commit: d011f09f3262bbc6cad5bbb09d37b5c26bc2cbf6
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=d011f09f3262bbc6cad5bbb09d37b5c26bc2cbf6

Author: Gunnar Beutner <gunnar at beutner.name>
Date:   Sun Feb 24 08:52:09 2013 +0100

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 99453a9..75d234a 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<Timer>();
-	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 dfb27e7..a8a7c1c 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 c115d74..2b5afb2 100644
--- a/lib/base/base.vcxproj
+++ b/lib/base/base.vcxproj
@@ -26,7 +26,7 @@
     <ClCompile Include="dynamicobject.cpp" />
     <ClCompile Include="dictionary.cpp" />
     <ClCompile Include="dynamictype.cpp" />
-    <ClCompile Include="event.cpp" />
+    <ClCompile Include="eventqueue.cpp" />
     <ClCompile Include="exception.cpp" />
     <ClCompile Include="fifo.cpp" />
     <ClCompile Include="i2-base.cpp">
@@ -68,7 +68,7 @@
     <ClInclude Include="dynamicobject.h" />
     <ClInclude Include="dictionary.h" />
     <ClInclude Include="dynamictype.h" />
-    <ClInclude Include="event.h" />
+    <ClInclude Include="eventqueue.h" />
     <ClInclude Include="fifo.h" />
     <ClInclude Include="stdiostream.h" />
     <ClInclude Include="stream.h" />
@@ -253,4 +253,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/lib/base/base.vcxproj.filters b/lib/base/base.vcxproj.filters
index 304b176..097c744 100644
--- a/lib/base/base.vcxproj.filters
+++ b/lib/base/base.vcxproj.filters
@@ -10,9 +10,6 @@
     <ClCompile Include="dictionary.cpp">
       <Filter>Quelldateien</Filter>
     </ClCompile>
-    <ClCompile Include="event.cpp">
-      <Filter>Quelldateien</Filter>
-    </ClCompile>
     <ClCompile Include="exception.cpp">
       <Filter>Quelldateien</Filter>
     </ClCompile>
@@ -94,6 +91,18 @@
     <ClCompile Include="convert.cpp">
       <Filter>Quelldateien</Filter>
     </ClCompile>
+    <ClCompile Include="objectlock.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="process-unix.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="process-windows.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="eventqueue.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="application.h">
@@ -108,9 +117,6 @@
     <ClInclude Include="dictionary.h">
       <Filter>Headerdateien</Filter>
     </ClInclude>
-    <ClInclude Include="event.h">
-      <Filter>Headerdateien</Filter>
-    </ClInclude>
     <ClInclude Include="exception.h">
       <Filter>Headerdateien</Filter>
     </ClInclude>
@@ -198,6 +204,12 @@
     <ClInclude Include="convert.h">
       <Filter>Headerdateien</Filter>
     </ClInclude>
+    <ClInclude Include="objectlock.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="eventqueue.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <Filter Include="Quelldateien">
diff --git a/lib/base/process-unix.cpp b/lib/base/process-unix.cpp
index d7fdae5..b08b052 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 <execvpe.h>
 
 using namespace icinga;
diff --git a/lib/base/process-windows.cpp b/lib/base/process-windows.cpp
index 3dace62..98cf0fc 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 e45c380..74afa94 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);
 





More information about the icinga-checkins mailing list