Date: Monday, December 18, 2006 @ 19:57:14
Author: marc
Path: /cvsroot/carob/carob
Modified: include/SystemDependantDefs.hpp (1.8 -> 1.9) src/JavaSocket.cpp
(1.61 -> 1.62)
#ifdef __FreeBSD__ #include <sys/param.h> to get __BYTE_ORDER
Fix required for CAROB-117 and probably others to come
---------------------------------+
include/SystemDependantDefs.hpp | 9 +++++++++
src/JavaSocket.cpp | 11 +++++------
2 files changed, 14 insertions(+), 6 deletions(-)
Index: carob/include/SystemDependantDefs.hpp
diff -u carob/include/SystemDependantDefs.hpp:1.8
carob/include/SystemDependantDefs.hpp:1.9
--- carob/include/SystemDependantDefs.hpp:1.8 Mon Dec 18 16:44:33 2006
+++ carob/include/SystemDependantDefs.hpp Mon Dec 18 19:57:14 2006
@@ -23,6 +23,15 @@
// http://predef.sourceforge.net/ is interesting but quite outdated
+///////////////////////////////////////////////////////
+// Endianness
+#ifdef __MINGW32__
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#ifdef __FreeBSD__ // should probably add many more here
+#include <sys/param.h>
+#endif
////////////////////////////////////////////////////////////////////////////////
// Sockets options
Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.61 carob/src/JavaSocket.cpp:1.62
--- carob/src/JavaSocket.cpp:1.61 Mon Dec 18 17:02:51 2006
+++ carob/src/JavaSocket.cpp Mon Dec 18 19:57:14 2006
@@ -26,7 +26,6 @@
#ifdef __MINGW32__
#include <ws2tcpip.h>
- #define __BYTE_ORDER BYTE_ORDER
#else
#include <sys/types.h> // socket(), send(), etc.
#include <sys/socket.h> // "
@@ -476,14 +475,14 @@
const uint64_t JavaSocket::ntohll(const uint64_t &n) const
{
-#ifndef __BYTE_ORDER // typically found through <sys/param.h>
- // or <netinet/*.h>
-#error "__BYTE_ORDER undefined: unknown endianness, can't implement 64bits
swaps"
-#endif
#if __BYTE_ORDER == __BIG_ENDIAN
return n;
-#else
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
return (((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32);
+#else
+// Typically found through <sys/param.h> or <netinet/*.h>
+// See ../include/SystemDependantDefs.hpp
+#error "__BYTE_ORDER undefined: unknown endianness, can't implement 64bits
swaps"
#endif
}
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits