BSD related fixes. Thanks to coldz.

This commit is contained in:
lotodore
2009-02-16 20:14:12 +00:00
parent 24c0ceb7b6
commit f1c5ff3ba2
3 changed files with 13 additions and 5 deletions
+6 -2
View File
@@ -24,6 +24,10 @@
#error This file is not for Windows. #error This file is not for Windows.
#endif #endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
#define HAVE_ICONV_CONST
#endif
#include <string> #include <string>
#include <cstring> #include <cstring>
@@ -37,7 +41,7 @@ ConvHelper::NativeToUtf8(const std::string &inStr)
{ {
string retStr(inStr); string retStr(inStr);
size_t insize = inStr.length(); size_t insize = inStr.length();
#if defined(__APPLE__) || defined(__FreeBSD__) #ifdef HAVE_ICONV_CONST
const char *inbuf = inStr.data(); const char *inbuf = inStr.data();
#else #else
char *inbuf = const_cast<char *>(inStr.data()); char *inbuf = const_cast<char *>(inStr.data());
@@ -72,7 +76,7 @@ ConvHelper::Utf8ToNative(const std::string &inStr)
{ {
string retStr(inStr); string retStr(inStr);
size_t insize = inStr.length(); size_t insize = inStr.length();
#if defined(__APPLE__) || defined(__FreeBSD__) #ifdef HAVE_ICONV_CONST
const char *inbuf = inStr.data(); const char *inbuf = inStr.data();
#else #else
char *inbuf = const_cast<char *>(inStr.data()); char *inbuf = const_cast<char *>(inStr.data());
+6 -2
View File
@@ -40,8 +40,12 @@
#undef X509_NAME // Again for Windows - conflict with WinCrypt.h. #undef X509_NAME // Again for Windows - conflict with WinCrypt.h.
#endif #endif
#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) // For BSD-Systems, we assume that OpenSSL is part of the operating system.
// For BSD-Systems, we assume that OpenSSL is part of the operating system. #if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
#define HAVE_OPENSSL
#endif
#ifdef HAVE_OPENSSL
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/md5.h> #include <openssl/md5.h>
#include <openssl/rand.h> #include <openssl/rand.h>
+1 -1
View File
@@ -2,7 +2,7 @@
/* include/config.h.in. Generated from configure.in by autoheader. */ /* include/config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the `gethostbyname_r' function. */ /* Define to 1 if you have the `gethostbyname_r' function. */
#if !defined(__APPLE__) && !defined(__OpenBSD__) #if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
#define HAVE_GETHOSTBYNAME_R 1 #define HAVE_GETHOSTBYNAME_R 1
#endif #endif