core: Adding workaround for missing <byteswap.h> on FreeBSD
This commit also fixes a couple of compilation issues with gcc 4.2.1
Change-Id: Iacc5a742b666849694b6ee947482e78340f74336
diff --git a/core/city-hash.cpp b/core/city-hash.cpp
index e0bebb4..7b9790a 100644
--- a/core/city-hash.cpp
+++ b/core/city-hash.cpp
@@ -69,6 +69,17 @@
#define bswap_64(x) bswap64(x)
#endif
+
+#elif defined(__FreeBSD__)
+
+// Based on https://code.google.com/p/freebsd/source/browse/sys/ofed/include/byteswap.h?spec=svn38a8350a629d959c8c5509221cd07ffb891b5a77&r=38a8350a629d959c8c5509221cd07ffb891b5a77
+
+#include <sys/types.h>
+#include <sys/endian.h>
+#define bswap_16(x) bswap16(x)
+#define bswap_32(x) bswap32(x)
+#define bswap_64(x) bswap64(x)
+
#else
#include <byteswap.h>
diff --git a/daemon/face/local-face.hpp b/daemon/face/local-face.hpp
index f992231..dbcb9bd 100644
--- a/daemon/face/local-face.hpp
+++ b/daemon/face/local-face.hpp
@@ -115,14 +115,16 @@
inline bool
LocalFace::isLocalControlHeaderEnabled(LocalControlFeature feature) const
{
- BOOST_ASSERT(0 < feature && feature < m_localControlHeaderFeatures.size());
+ BOOST_ASSERT(0 < feature &&
+ static_cast<size_t>(feature) < m_localControlHeaderFeatures.size());
return m_localControlHeaderFeatures[feature];
}
inline void
LocalFace::setLocalControlHeaderFeature(LocalControlFeature feature, bool enabled/* = true*/)
{
- BOOST_ASSERT(0 < feature && feature < m_localControlHeaderFeatures.size());
+ BOOST_ASSERT(0 < feature &&
+ static_cast<size_t>(feature) < m_localControlHeaderFeatures.size());
m_localControlHeaderFeatures[feature] = enabled;
diff --git a/tools/ndn-autoconfig-server.cpp b/tools/ndn-autoconfig-server.cpp
index ac5c3bf..f09a39a 100644
--- a/tools/ndn-autoconfig-server.cpp
+++ b/tools/ndn-autoconfig-server.cpp
@@ -51,7 +51,7 @@
onInterest(const Name& name, const Interest& interest)
{
ndn::Data data(ndn::Name(interest.getName()).appendVersion());
- data.setFreshnessPeriod(time::hours(1)); // 1 hour
+ data.setFreshnessPeriod(ndn::time::hours(1)); // 1 hour
// create and encode uri block
Block uriBlock = dataBlock(tlv::nfd::Uri,