]> granicus.if.org Git - icinga2/commitdiff
Build fix for FreeBSD/OS X.
authorGunnar Beutner <gunnar@beutner.name>
Mon, 31 Mar 2014 00:08:15 +0000 (02:08 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Sun, 30 Mar 2014 22:08:43 +0000 (00:08 +0200)
icinga-app/icinga.cpp
lib/base/convert.h
lib/base/exception.cpp
lib/base/value-operators.cpp

index abb43672b0db5cdeaf53ff2e441b21900b602817..4c10e3a8cb61affb49d0931c3afc16e9d0154840 100644 (file)
@@ -67,7 +67,7 @@ static bool LoadConfigFiles(const String& appType, ValidationType validate)
        ConfigCompilerContext::GetInstance()->Reset();
 
        if (g_AppParams.count("config") > 0) {
-               BOOST_FOREACH(const String& configPath, g_AppParams["config"].as<std::vector<String> >()) {
+               BOOST_FOREACH(const String& configPath, g_AppParams["config"].as<std::vector<std::string> >()) {
                        ConfigCompiler::CompileFile(configPath);
                }
        }
@@ -216,19 +216,19 @@ int main(int argc, char **argv)
        desc.add_options()
                ("help", "show this help message")
                ("version,V", "show version information")
-               ("library,l", po::value<std::vector<String> >(), "load a library")
-               ("include,I", po::value<std::vector<String> >(), "add include search directory")
-               ("define,D", po::value<std::vector<String> >(), "define a constant")
-               ("config,c", po::value<std::vector<String> >(), "parse a configuration file")
+               ("library,l", po::value<std::vector<std::string> >(), "load a library")
+               ("include,I", po::value<std::vector<std::string> >(), "add include search directory")
+               ("define,D", po::value<std::vector<std::string> >(), "define a constant")
+               ("config,c", po::value<std::vector<std::string> >(), "parse a configuration file")
                ("no-config,z", "start without a configuration file")
                ("validate,C", "exit after validating the configuration")
                ("no-validate,Z", "skip validating the configuration")
                ("debug,x", "enable debugging")
                ("daemonize,d", "detach from the controlling terminal")
-               ("errorlog,e", po::value<String>(), "log fatal errors to the specified log file (only works in combination with --daemonize)")
+               ("errorlog,e", po::value<std::string>(), "log fatal errors to the specified log file (only works in combination with --daemonize)")
 #ifndef _WIN32
-               ("user,u", po::value<String>(), "user to run Icinga as")
-               ("group,g", po::value<String>(), "group to run Icinga as")
+               ("user,u", po::value<std::string>(), "user to run Icinga as")
+               ("group,g", po::value<std::string>(), "group to run Icinga as")
 #endif
        ;
 
@@ -245,7 +245,7 @@ int main(int argc, char **argv)
 
 #ifndef _WIN32
        if (g_AppParams.count("group")) {
-               String group = g_AppParams["group"].as<String>();
+               String group = g_AppParams["group"].as<std::string>();
 
                errno = 0;
                struct group *gr = getgrnam(group.CStr());
@@ -268,7 +268,7 @@ int main(int argc, char **argv)
        }
 
        if (g_AppParams.count("user")) {
-               String user = g_AppParams["user"].as<String>();
+               String user = g_AppParams["user"].as<std::string>();
 
                errno = 0;
                struct passwd *pw = getpwnam(user.CStr());
@@ -326,7 +326,7 @@ int main(int argc, char **argv)
        }
 
        if (g_AppParams.count("define")) {
-               BOOST_FOREACH(const String& define, g_AppParams["define"].as<std::vector<String> >()) {
+               BOOST_FOREACH(const String& define, g_AppParams["define"].as<std::vector<std::string> >()) {
                        String key, value;
                        size_t pos = define.FindFirstOf('=');
                        if (pos != String::NPos) {
@@ -353,7 +353,7 @@ int main(int argc, char **argv)
        String appType = LoadAppType(Application::GetApplicationType());
 
        if (g_AppParams.count("library")) {
-               BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as<std::vector<String> >()) {
+               BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as<std::vector<std::string> >()) {
                        (void) Utility::LoadExtensionLibrary(libraryName);
                }
        }
@@ -361,7 +361,7 @@ int main(int argc, char **argv)
        ConfigCompiler::AddIncludeSearchDir(Application::GetPkgDataDir());
 
        if (g_AppParams.count("include")) {
-               BOOST_FOREACH(const String& includePath, g_AppParams["include"].as<std::vector<String> >()) {
+               BOOST_FOREACH(const String& includePath, g_AppParams["include"].as<std::vector<std::string> >()) {
                        ConfigCompiler::AddIncludeSearchDir(includePath);
                }
        }
@@ -376,7 +376,7 @@ int main(int argc, char **argv)
                String errorLog;
 
                if (g_AppParams.count("errorlog"))
-                       errorLog = g_AppParams["errorlog"].as<String>();
+                       errorLog = g_AppParams["errorlog"].as<std::string>();
 
                Daemonize(errorLog);
                Logger::DisableConsoleLog();
index 6e55ebf12aea1e2d0cce5087fe18de9ded1325f0..a66e9b7ce2566ee55fbe1b40486c161ed2b4116f 100644 (file)
@@ -64,7 +64,7 @@ public:
        template<typename T>
        static String ToString(const T& val)
        {
-               return boost::lexical_cast<String>(val);
+               return boost::lexical_cast<std::string>(val);
        }
 
        static String ToString(const String& val);
index fd142d7349529f95a98a6f8345350ddcce481a73..58ff7aaed01d0d7bf69a52822215ce1855adf163 100644 (file)
@@ -34,7 +34,7 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *))
        if (real_cxa_throw == 0)
                real_cxa_throw = (cxa_throw_fn)dlsym(RTLD_NEXT, "__cxa_throw");
 
-#ifndef __APPLE__
+#ifdef __GLIBC__
        void *thrown_ptr = obj;
        const std::type_info *tinfo = static_cast<std::type_info *>(pvtinfo);
        const std::type_info *boost_exc = &typeid(boost::exception);
@@ -45,14 +45,14 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *))
                thrown_ptr = *(void **)thrown_ptr;
 
        if (!user_exc->__do_catch(tinfo, &thrown_ptr, 1)) {
-#endif /* __APPLE__ */
+#endif /* __GLIBCXX__ */
                StackTrace stack;
                SetLastExceptionStack(stack);
 
                ContextTrace context;
                SetLastExceptionContext(context);
 
-#ifndef __APPLE__
+#ifdef __GLIBCXX__
                /* Check if thrown_ptr inherits from boost::exception. */
                if (boost_exc->__do_catch(tinfo, &thrown_ptr, 1)) {
                        boost::exception *ex = (boost::exception *)thrown_ptr;
@@ -64,7 +64,7 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *))
                                *ex << ContextTraceErrorInfo(context);
                }
        }
-#endif /* __APPLE__ */
+#endif /* __GLIBCXX__ */
 
        real_cxa_throw(obj, pvtinfo, dest);
 }
index afd4d8a16f055e2a42b53e901a40ed900371116d..eb507fbac795d0015dfa17b4502ff2ab021a68e3 100644 (file)
@@ -51,9 +51,9 @@ Value::operator String(void) const
                        fractional = modf(boost::get<double>(m_Value), &integral);
 
                        if (fractional != 0)
-                               return boost::lexical_cast<String>(m_Value);
+                               return boost::lexical_cast<std::string>(m_Value);
                        else
-                               return boost::lexical_cast<String>((long)integral);
+                               return boost::lexical_cast<std::string>((long)integral);
                case ValueString:
                        return boost::get<String>(m_Value);
                case ValueObject: