FreeBSD fixes from Ganael LAPLANCHE

This commit is contained in:
James Turner 2016-05-30 12:52:48 +01:00
parent d1a808c630
commit 5ca9a06273
3 changed files with 11 additions and 10 deletions

View 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>

View 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__
#elif defined BYTE_ORDER
# if BYTE_ORDER == BIG_ENDIAN
# define SHA_BIG_ENDIAN
# endif
#endif
/* code */
#define SHA1_K0 0x5a827999
#define SHA1_K20 0x6ed9eba1

View 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));