diff --git a/common/network/PosixInterfacePicker.cpp b/common/network/PosixInterfacePicker.cpp index 406aefdbfa..a85d996dc3 100644 --- a/common/network/PosixInterfacePicker.cpp +++ b/common/network/PosixInterfacePicker.cpp @@ -38,7 +38,7 @@ #endif // HAVE_SYS_SOCKET_H #include #ifdef HAVE_NETINET_IN_H -#include // Required by FreeBSD + #include // Required by FreeBSD #endif // HAVE_NETINET_IN_H #include #include @@ -226,7 +226,7 @@ vector PosixInterfacePicker::GetInterfaces( interface.index = ifrcopy.ifr_index; #else interface.index = ifrcopy.ifr_ifindex; -#endif // SIOCGIFINDEX +#endif // __FreeBSD__ } } #elif defined(HAVE_IF_NAMETOINDEX) @@ -235,7 +235,7 @@ vector PosixInterfacePicker::GetInterfaces( if (index != 0) { interface.index = index; } -#endif // defined(HAVE_IF_NAMETOINDEX) +#endif // SIOCGIFINDEX /* ok, if that all failed we should prob try and use sysctl to work out the * broadcast and hardware addresses diff --git a/common/web/JsonTest.cpp b/common/web/JsonTest.cpp index c1fd2152ce..75ecf32c06 100644 --- a/common/web/JsonTest.cpp +++ b/common/web/JsonTest.cpp @@ -556,7 +556,12 @@ void JsonTest::testLookups() { JsonString string1("foo"); OLA_ASSERT_EQ(reinterpret_cast(&string1), string1.LookupElement(empty_pointer)); + +#ifdef __FreeBSD__ + OLA_ASSERT_EQ(reinterpret_cast(0), +#else OLA_ASSERT_EQ(reinterpret_cast(NULL), +#endif // __FreeBSD__ string1.LookupElement(invalid_pointer)); // Now try an object @@ -571,7 +576,12 @@ void JsonTest::testLookups() { object.LookupElement(empty_pointer)); OLA_ASSERT_EQ(reinterpret_cast(name_value), object.LookupElement(name_pointer)); + +#ifdef __FreeBSD__ + OLA_ASSERT_EQ(reinterpret_cast(0), +#else OLA_ASSERT_EQ(reinterpret_cast(NULL), +#endif // __FreeBSD__ object.LookupElement(invalid_pointer)); // Now try an array @@ -591,17 +601,33 @@ void JsonTest::testLookups() { OLA_ASSERT_EQ(reinterpret_cast(array), array->LookupElement(empty_pointer)); + +#ifdef __FreeBSD__ + OLA_ASSERT_EQ(reinterpret_cast(0), +#else OLA_ASSERT_EQ(reinterpret_cast(NULL), +#endif // __FreeBSD__ array->LookupElement(invalid_pointer)); + OLA_ASSERT_EQ(reinterpret_cast(string2), array->LookupElement(first)); OLA_ASSERT_EQ(reinterpret_cast(string3), array->LookupElement(middle)); OLA_ASSERT_EQ(reinterpret_cast(string4), array->LookupElement(last)); + +#ifdef __FreeBSD__ + OLA_ASSERT_EQ(reinterpret_cast(0), +#else OLA_ASSERT_EQ(reinterpret_cast(NULL), +#endif // __FreeBSD__ array->LookupElement(one_past_last)); + +#ifdef __FreeBSD__ + OLA_ASSERT_EQ(reinterpret_cast(0), +#else OLA_ASSERT_EQ(reinterpret_cast(NULL), +#endif // __FreeBSD__ array->LookupElement(invalid)); // now a nested case diff --git a/config/resolv.m4 b/config/resolv.m4 index 8b7974f6e1..c7a67c3b78 100644 --- a/config/resolv.m4 +++ b/config/resolv.m4 @@ -27,7 +27,7 @@ AC_CHECK_HEADERS([resolv.h]) am_save_LDFLAGS="$LDFLAGS" RESOLV_LIBS="" -acx_resolv_libs="-lresolv -resolv" +acx_resolv_libs="-lresolv -resolv -lc" for lib in $acx_resolv_libs; do acx_resolv_ok=no LDFLAGS="$am_save_LDFLAGS $lib" diff --git a/ola/AutoStart.cpp b/ola/AutoStart.cpp index 12e15def46..89fa51f115 100644 --- a/ola/AutoStart.cpp +++ b/ola/AutoStart.cpp @@ -110,7 +110,11 @@ TCPSocket *ConnectToServer(unsigned short port) { // Try to start the server, we pass --daemon (fork into background) and // --syslog (log to syslog). execlp("olad", "olad", "--daemon", "--syslog", +#ifdef __FreeBSD__ + reinterpret_cast(0)); +#else reinterpret_cast(NULL)); +#endif // __FreeBSD__ OLA_WARN << "Failed to exec: " << strerror(errno); _exit(1); } diff --git a/olad/plugin_api/UniverseTest.cpp b/olad/plugin_api/UniverseTest.cpp index 563fd24176..faedd01bb4 100644 --- a/olad/plugin_api/UniverseTest.cpp +++ b/olad/plugin_api/UniverseTest.cpp @@ -632,7 +632,11 @@ void UniverseTest::testRDMSend() { &UniverseTest::ConfirmRDM, __LINE__, ola::rdm::RDM_UNKNOWN_UID, +#ifdef __FreeBSD__ + reinterpret_cast(0))); +#else reinterpret_cast(NULL))); +#endif // __FreeBSD__ // ok, now try something that returns a response from the port request = new ola::rdm::RDMGetRequest( @@ -654,7 +658,11 @@ void UniverseTest::testRDMSend() { &UniverseTest::ConfirmRDM, __LINE__, ola::rdm::RDM_TIMEOUT, +#ifdef __FreeBSD__ + reinterpret_cast(0))); +#else reinterpret_cast(NULL))); +#endif // __FreeBSD__ // now try a broadcast fan out UID vendorcast_uid = UID::VendorcastAddress(0x7a70); @@ -683,7 +691,11 @@ void UniverseTest::testRDMSend() { &UniverseTest::ConfirmRDM, __LINE__, ola::rdm::RDM_WAS_BROADCAST, +#ifdef __FreeBSD__ + reinterpret_cast(0))); +#else reinterpret_cast(NULL))); +#endif // __FreeBSD__ // now confirm that if one of the ports fails to send, we see this response request = new ola::rdm::RDMGetRequest( @@ -707,7 +719,11 @@ void UniverseTest::testRDMSend() { &UniverseTest::ConfirmRDM, __LINE__, ola::rdm::RDM_FAILED_TO_SEND, +#ifdef __FreeBSD__ + reinterpret_cast(0))); +#else reinterpret_cast(NULL))); +#endif // __FreeBSD__ // DUB responses are slightly different request = NewDiscoveryUniqueBranchRequest(source_uid, uid1, uid2, 0); @@ -727,7 +743,11 @@ void UniverseTest::testRDMSend() { &UniverseTest::ConfirmRDM, __LINE__, ola::rdm::RDM_DUB_RESPONSE, +#ifdef __FreeBSD__ + reinterpret_cast(0))); +#else reinterpret_cast(NULL))); +#endif // __FreeBSD__ // now check that we still get a RDM_DUB_RESPONSE even if one port returns an // RDM_TIMEOUT @@ -744,7 +764,11 @@ void UniverseTest::testRDMSend() { &UniverseTest::ConfirmRDM, __LINE__, ola::rdm::RDM_DUB_RESPONSE, +#ifdef __FreeBSD__ + reinterpret_cast(0))); +#else reinterpret_cast(NULL))); +#endif // __FreeBSD__ // and the same again but the second port returns // RDM_PLUGIN_DISCOVERY_NOT_SUPPORTED @@ -761,7 +785,11 @@ void UniverseTest::testRDMSend() { &UniverseTest::ConfirmRDM, __LINE__, ola::rdm::RDM_DUB_RESPONSE, +#ifdef __FreeBSD__ + reinterpret_cast(0))); +#else reinterpret_cast(NULL))); +#endif // __FreeBSD__ // now the first port returns a RDM_TIMEOUT request = NewDiscoveryUniqueBranchRequest(source_uid, uid1, uid2, 0); @@ -777,7 +805,11 @@ void UniverseTest::testRDMSend() { &UniverseTest::ConfirmRDM, __LINE__, ola::rdm::RDM_TIMEOUT, +#ifdef __FreeBSD__ + reinterpret_cast(0))); +#else reinterpret_cast(NULL))); +#endif // __FreeBSD__ // finally if neither ports support the DUB, we should return that request = NewDiscoveryUniqueBranchRequest(source_uid, uid1, uid2, 0); @@ -793,7 +825,11 @@ void UniverseTest::testRDMSend() { &UniverseTest::ConfirmRDM, __LINE__, ola::rdm::RDM_PLUGIN_DISCOVERY_NOT_SUPPORTED, +#ifdef __FreeBSD__ + reinterpret_cast(0))); +#else reinterpret_cast(NULL))); +#endif // __FreeBSD__ universe->RemovePort(&port1); universe->RemovePort(&port2);