]> granicus.if.org Git - icinga2/commitdiff
Fixed compilation errors with automake/gcc
authorGunnar Beutner <gunnar.beutner@netways.de>
Sun, 1 Apr 2012 07:48:52 +0000 (09:48 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Sun, 1 Apr 2012 08:18:29 +0000 (10:18 +0200)
16 files changed:
Makefile.am
base/confighive.cpp
base/confighive.h
base/configobject.cpp
base/configobject.h
base/i2-base.h
base/mutex.cpp
base/thread.h
base/unix.h
configfilecomponent/Makefile.am
configfilecomponent/configfilecomponent.cpp
configrpccomponent/Makefile.am
configrpccomponent/configrpccomponent.cpp
configure.ac
icinga/Makefile.am
icinga/icingaapplication.cpp

index b9c1b3f55aecd12d3ce0524c97602c0101cdbc48..dd469cf6563474daa5840af56c7198065363298d 100644 (file)
@@ -1,11 +1,12 @@
 ## Process this file with automake to produce Makefile.in
 ## Created by Anjuta
 
-SUBDIRS = base \
+SUBDIRS = ltdl \
+       base \
+       jsonrpc \
        configfilecomponent \
        configrpccomponent \
        icinga \
-       jsonrpc \
        miniapp 
 
 icinga2docdir = ${prefix}/doc/icinga2
index 7c454a1f171145fde5f99b3e4bd89d566f48ded9..1aaf740ff9941df4a49d742aba89265979fffe01 100644 (file)
@@ -19,7 +19,7 @@ void ConfigHive::AddObject(ConfigObject::RefType object)
 
        ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
        ea->Source = shared_from_this();
-       ea->ConfigObject = object;
+       ea->Object = object;
        OnObjectCreated(ea);
 }
 
@@ -35,7 +35,7 @@ void ConfigHive::RemoveObject(ConfigObject::RefType object)
 
        ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
        ea->Source = shared_from_this();
-       ea->ConfigObject = object;
+       ea->Object = object;
        OnObjectRemoved(ea);
 }
 
index 5286077e9241ebc483c2202d17eccdd04ec1cc6d..bd0c3523ec0d4c25c423a91025cb28569bc800de 100644 (file)
@@ -13,7 +13,7 @@ struct ConfigHiveEventArgs : public EventArgs
        typedef shared_ptr<ConfigHiveEventArgs> RefType;
        typedef weak_ptr<ConfigHiveEventArgs> WeakRefType;
 
-       ConfigObject::RefType ConfigObject;
+       ConfigObject::RefType Object;
        string Property;
        string OldValue;
 };
index 94834f0e1dca6871b9ecf7f6dde535c93b251f44..838d19a9efbe42028ffead7d098bae910ad605d9 100644 (file)
@@ -42,33 +42,33 @@ void ConfigObject::SetProperty(const string& name, const string& value)
        if (hive.get() != NULL) {
                ConfigHiveEventArgs::RefType ea = new_object<ConfigHiveEventArgs>();
                ea->Source = hive;
-               ea->ConfigObject = static_pointer_cast<ConfigObject>(shared_from_this());
+               ea->Object = static_pointer_cast<ConfigObject>(shared_from_this());
                ea->Property = name;
                ea->OldValue = oldValue;
                hive->OnPropertyChanged(ea);
        }
 }
 
-string ConfigObject::GetProperty(const string& name, const string& default) const
+string ConfigObject::GetProperty(const string& name, const string& defaultValue) const
 {
        map<string, string>::const_iterator vi = Properties.find(name);
        if (vi == Properties.end())
-               return default;
+               return defaultValue;
        return vi->second;
 }
 
-int ConfigObject::GetPropertyInteger(const string& name, int default) const
+int ConfigObject::GetPropertyInteger(const string& name, int defaultValue) const
 {
        string value = GetProperty(name);
        if (value == string())
-               return default;
+               return defaultValue;
        return strtol(value.c_str(), NULL, 10);
 }
 
-double ConfigObject::GetPropertyDouble(const string& name, double default) const
+double ConfigObject::GetPropertyDouble(const string& name, double defaultValue) const
 {
        string value = GetProperty(name);
        if (value == string())
-               return default;
+               return defaultValue;
        return strtod(value.c_str(), NULL);
 }
index 939af74d0dc415a4c17f4d96294016328aacfe41..78bfc8c31296cf91c15ebdd62a2911e16b10f707 100644 (file)
@@ -39,9 +39,9 @@ public:
        void SetPropertyInteger(const string& name, int value);
        void SetPropertyDouble(const string& name, double value);
 
-       string GetProperty(const string& name, const string& default = string()) const;
-       int GetPropertyInteger(const string& name, int default = 0) const;
-       double GetPropertyDouble(const string& name, double default = 0.0f) const;
+       string GetProperty(const string& name, const string& defaultValue = string()) const;
+       int GetPropertyInteger(const string& name, int defaultValue = 0) const;
+       double GetPropertyDouble(const string& name, double defaultValue = 0.0f) const;
 };
 
 }
index d2667160426c84c08c0a13ef858666dbc37f07ba..e655fcdf54df9e2927bce519ab0218f11841c1dd 100644 (file)
@@ -1,10 +1,12 @@
 #ifndef I2_BASE_H
 #define I2_BASE_H
 
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
+#include <cstdlib>
+#include <cstdarg>
+#include <cstdio>
+#include <cstring>
+#include <cassert>
+#include <cerrno>
 
 #include <memory>
 #include <string>
index ce706cdaa9d1e4183d3b283645e50d46f3b5d825..5a3b596014dc568e64dc154b986e16d6d31aa778 100644 (file)
@@ -7,7 +7,7 @@ mutex::mutex(void)
 #ifdef _WIN32
        InitializeCriticalSection(&m_Mutex);
 #else /* _WIN32 */
-       pthread_mutex_init(&m_Mutex);
+       pthread_mutex_init(&m_Mutex, NULL);
 #endif /* _WIN32 */
 }
 
@@ -16,7 +16,7 @@ mutex::~mutex(void)
 #ifdef _WIN32
        DeleteCriticalSection(&m_Mutex);
 #else /* _WIN32 */
-       pthread_mutex_init(&m_Mutex);
+       pthread_mutex_destroy(&m_Mutex);
 #endif /* _WIN32 */
 }
 
@@ -25,7 +25,7 @@ bool mutex::tryenter(void)
 #ifdef _WIN32
        return (TryEnterCriticalSection(&m_Mutex) == TRUE);
 #else /* _WIN32 */
-       return pthread_mutex_tryenter(&m_Mutex);
+       return pthread_mutex_trylock(&m_Mutex);
 #endif /* _WIN32 */
 }
 
@@ -34,7 +34,7 @@ void mutex::enter(void)
 #ifdef _WIN32
        EnterCriticalSection(&m_Mutex);
 #else /* _WIN32 */
-       pthread_mutex_enter(&m_Mutex);
+       pthread_mutex_lock(&m_Mutex);
 #endif /* _WIN32 */
 }
 
@@ -43,7 +43,7 @@ void mutex::exit(void)
 #ifdef _WIN32
        LeaveCriticalSection(&m_Mutex);
 #else /* _WIN32 */
-       pthread_mutex_exit(&m_Mutex);
+       pthread_mutex_unlock(&m_Mutex);
 #endif /* _WIN32 */
 }
 
index 39d7c9721bea3239cde770dd1e980c91d3353bfe..8306942da18498054270f9fa476fcb63f52dd91a 100644 (file)
@@ -4,8 +4,6 @@
 namespace icinga
 {
 
-using std::function;
-
 class thread
 {
 private:
index f9d9e88b08ef8e1dc7126867c0512f8099527daa..cde7fdb1ab02afb33177cc6ac24044f90df367fd 100644 (file)
@@ -4,10 +4,13 @@
 #include <execinfo.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <pthread.h>
 
 typedef int SOCKET;
 
index 332c0b1159989fff673374fa0e97ec6c4203525a..9b0e8bedfa1b3fe63c1118fa6c98f2239a778da1 100644 (file)
@@ -1,9 +1,11 @@
 ## Process this file with automake to produce Makefile.in
 
+pkglib_LTLIBRARIES =  \
+       libconfigfilecomponent.la
 
 libconfigfilecomponent_la_SOURCES =  \
        configfilecomponent.cpp \
        configfilecomponent.h \
        i2-configfilecomponent.h
 
-libconfigfilecomponent_la_CXXFLAGS = -I${top_srcdir}/base 
+libconfigfilecomponent_la_CXXFLAGS = -I${top_srcdir}/base -I${top_srcdir}/jsonrpc
index dbdea10f5567d8578a2c80ef739b97e246130aff..4c10c0d259ef5ee79bb7edafdea3bb72407cf990 100644 (file)
@@ -16,7 +16,7 @@ void ConfigFileComponent::Start(void)
        ifstream fp;
        FIFO::RefType fifo = new_object<FIFO>();
 
-       fp.open(GetConfig()->GetProperty("filename"), ifstream::in);
+       fp.open(GetConfig()->GetProperty("filename").c_str(), ifstream::in);
        if (fp.fail())
                throw exception(/*"Could not open config file"*/);
        
index 35340f2ac8ab2a98507c641d617e2c8fd6374498..35ffe934d94ee3d89018efcfd9c703013eb309f3 100644 (file)
@@ -1,9 +1,11 @@
 ## Process this file with automake to produce Makefile.in
 
+pkglib_LTLIBRARIES =  \
+       libconfigrpccomponent.la
 
 libconfigrpccomponent_la_SOURCES =  \
        configrpccomponent.cpp \
        configrpccomponent.h \
        i2-configrpccomponent.h
 
-libconfigrpccomponent_la_CXXFLAGS = -I${top_srcdir}/base 
+libconfigrpccomponent_la_CXXFLAGS = -I${top_srcdir}/base -I${top_srcdir}/jsonrpc -I${top_srcdir}/icinga
index ce741692fc9fc2630a71b9245bb54b4f3c602b28..efb651af1a1a4304e6d52329389f095e5e64ecbb 100644 (file)
@@ -81,7 +81,7 @@ int ConfigRpcComponent::FetchObjectsHandler(NewMessageEventArgs::RefType ea)
 int ConfigRpcComponent::LocalObjectCreatedHandler(ConfigHiveEventArgs::RefType ea)
 {
        ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
-       connectionManager->SendMessage(MakeObjectMessage(ea->ConfigObject, "config::ObjectCreated", true));
+       connectionManager->SendMessage(MakeObjectMessage(ea->Object, "config::ObjectCreated", true));
 
        return 0;
 }
@@ -89,17 +89,17 @@ int ConfigRpcComponent::LocalObjectCreatedHandler(ConfigHiveEventArgs::RefType e
 int ConfigRpcComponent::LocalObjectRemovedHandler(ConfigHiveEventArgs::RefType ea)
 {
        ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
-       connectionManager->SendMessage(MakeObjectMessage(ea->ConfigObject, "config::ObjectRemoved", false));
+       connectionManager->SendMessage(MakeObjectMessage(ea->Object, "config::ObjectRemoved", false));
 
        return 0;
 }
 
 int ConfigRpcComponent::LocalPropertyChangedHandler(ConfigHiveEventArgs::RefType ea)
 {
-       JsonRpcMessage::RefType msg = MakeObjectMessage(ea->ConfigObject, "config::ObjectRemoved", false);
+       JsonRpcMessage::RefType msg = MakeObjectMessage(ea->Object, "config::ObjectRemoved", false);
        cJSON *params = msg->GetParams();
        cJSON_AddStringToObject(params, "property", ea->Property.c_str());
-       string value = ea->ConfigObject->GetProperty(ea->Property);
+       string value = ea->Object->GetProperty(ea->Property);
        cJSON_AddStringToObject(params, "value", value.c_str());
 
        ConnectionManager::RefType connectionManager = GetIcingaApplication()->GetConnectionManager();
index fd8c81a1eb89fe63e477a2638752e3fa8e0e5148..af7ade1b3d3d02195e2a6d1e3c6692965313fb1d 100644 (file)
@@ -17,7 +17,8 @@ AC_PROG_CXX
 
 
 LT_INIT
-
+LT_CONFIG_LTDL_DIR([ltdl])
+LTDL_INIT
 
 
 
@@ -26,6 +27,9 @@ LT_INIT
 AC_OUTPUT([
 Makefile
 base/Makefile
+configfilecomponent/Makefile
+configrpccomponent/Makefile
+icinga/Makefile
 jsonrpc/Makefile
 miniapp/Makefile
 
index e4c1157201723635bbe9e08b53ba74f36cd29186..ead535022c7f7f174547eeef8b317c4b0e813cad 100644 (file)
@@ -4,12 +4,12 @@
 bin_PROGRAMS =  \
        icinga
 
-miniapp_SOURCES =  \
+icinga_SOURCES =  \
        icingaapplication.cpp \
        icingaapplication.h
 
-miniapp_CXXFLAGS = -I${top_srcdir}/base \
+icinga_CXXFLAGS = -I${top_srcdir}/base \
        -I${top_srcdir}/jsonrpc 
 
-miniapp_LDFLAGS = $(top_builddir)/base/libbase.a \
+icinga_LDFLAGS = $(top_builddir)/base/libbase.a \
        $(top_builddir)/jsonrpc/libjsonrpc.a 
index b7a6c6677849bf083f5d8035a630ee118016d8b3..79e383e8b5c0180b96183af98d36028676df178d 100644 (file)
@@ -35,8 +35,8 @@ ConnectionManager::RefType IcingaApplication::GetConnectionManager(void)
 
 int IcingaApplication::ConfigObjectCreatedHandler(ConfigHiveEventArgs::RefType ea)
 {
-       if (ea->ConfigObject->GetType() == "component") {
-               LoadComponent(ea->ConfigObject->GetName());
+       if (ea->Object->GetType() == "component") {
+               LoadComponent(ea->Object->GetName());
        }
 
        return 0;
@@ -44,8 +44,8 @@ int IcingaApplication::ConfigObjectCreatedHandler(ConfigHiveEventArgs::RefType e
 
 int IcingaApplication::ConfigObjectRemovedHandler(ConfigHiveEventArgs::RefType ea)
 {
-       if (ea->ConfigObject->GetType() == "component") {
-               UnloadComponent(ea->ConfigObject->GetName());
+       if (ea->Object->GetType() == "component") {
+               UnloadComponent(ea->Object->GetName());
        }
 
        return 0;