]> git.mxchange.org Git - simgear.git/commitdiff
FreeBSD fixes from Ganael LAPLANCHE
authorJames Turner <zakalawe@mac.com>
Mon, 30 May 2016 11:52:48 +0000 (12:52 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 13 Aug 2016 08:21:16 +0000 (10:21 +0200)
simgear/io/DNSClient.hxx
simgear/misc/sha1.c
simgear/misc/strutils.cxx

index b23e6dc5a48a7411c76db88f27bbcf267eda5f50..7cabd41ca084def0840c499bed77e224443aa77f 100644 (file)
@@ -27,6 +27,8 @@
 #include <memory> // for std::auto_ptr
 #include <string>
 #include <vector>
+#include <ctime> // for time_t
+
 #include <simgear/structure/SGReferenced.hxx>
 #include <simgear/structure/SGSharedPtr.hxx>
 
index 3fce90478090b2569ec51f79332366fe6d86d267..d4221f172d7ded4c2714743d46df77d3fbbe7faa 100644 (file)
@@ -6,25 +6,24 @@
 //#include <stdint.h>
 //#include <string.h>
 
+#if defined(__FreeBSD__) || defined(__APPLE__)
+# include <machine/endian.h>
+#elif !defined(_WIN32)
+# include <endian.h>
+#endif
 
 #ifdef __BIG_ENDIAN__
 # define SHA_BIG_ENDIAN
-#elif defined __LITTLE_ENDIAN__
-/* override */
 #elif defined __BYTE_ORDER
 # if __BYTE_ORDER__ ==  __ORDER_BIG_ENDIAN__
 # define SHA_BIG_ENDIAN
 # endif
-#elif defined _WIN32
-/* assume little-endian, there is no endian.h on MSVC */
-#else // ! defined __LITTLE_ENDIAN__
-# include <endian.h> // machine/endian.h
-# if __BYTE_ORDER__ ==  __ORDER_BIG_ENDIAN__
-#  define SHA_BIG_ENDIAN
+#elif defined BYTE_ORDER
+# if BYTE_ORDER == BIG_ENDIAN
+# define SHA_BIG_ENDIAN
 # endif
 #endif
 
-
 /* code */
 #define SHA1_K0  0x5a827999
 #define SHA1_K20 0x6ed9eba1
index fd3b148e3fc3ee7fb06897cec97debe8575cfecc..867005a9eca2fd314e6b9c33d1408ad6455090ed 100644 (file)
@@ -615,7 +615,7 @@ std::string error_string(int errnum)
   retcode = strerror_s(buf, sizeof(buf), errnum);
 #elif defined(_GNU_SOURCE)
   return std::string(strerror_r(errnum, buf, sizeof(buf)));
-#elif (_POSIX_C_SOURCE >= 200112L) || defined(SG_MAC)
+#elif (_POSIX_C_SOURCE >= 200112L) || defined(SG_MAC) || defined(__FreeBSD__)
   int retcode;
   // POSIX.1-2001 and POSIX.1-2008
   retcode = strerror_r(errnum, buf, sizeof(buf));