From b17119f2c6fc83dcec73550da550021957c14649 Mon Sep 17 00:00:00 2001 From: Kovensky Date: Sun, 18 Nov 2012 21:36:07 -0300 Subject: [PATCH] Fixes for compatibility with FreeBSD backtrace.cpp assumes that anything non-windows is linux. stb_vorbis.c includes malloc.h which has been deprecated since the 90s on all implementations other than MSVC. The stat64 hack in file_util.cpp is only needed on linux. http_client.h also assumes non-windows is linux. --- base/backtrace.cpp | 2 +- ext/stb_vorbis/stb_vorbis.c | 2 +- file/file_util.cpp | 4 ++++ net/http_client.h | 12 ++++++++---- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/base/backtrace.cpp b/base/backtrace.cpp index 1af17b4307..92e3e2739f 100644 --- a/base/backtrace.cpp +++ b/base/backtrace.cpp @@ -1,6 +1,6 @@ #include "base/backtrace.h" -#ifndef _MSC_VER +#ifdef __linux__ // LINUX ONLY diff --git a/ext/stb_vorbis/stb_vorbis.c b/ext/stb_vorbis/stb_vorbis.c index 019438ccbd..85aac31688 100644 --- a/ext/stb_vorbis/stb_vorbis.c +++ b/ext/stb_vorbis/stb_vorbis.c @@ -205,7 +205,7 @@ #include #include #include -#if !(defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)) +#ifdef _MSC_VER #include #endif #else diff --git a/file/file_util.cpp b/file/file_util.cpp index 7b856cbc16..5a8a557357 100644 --- a/file/file_util.cpp +++ b/file/file_util.cpp @@ -17,6 +17,10 @@ #include "base/basictypes.h" #include "file/file_util.h" +#ifdef __FreeBSD__ +#define stat64 stat +#endif + bool writeStringToFile(bool text_file, const std::string &str, const char *filename) { FILE *f = fopen(filename, text_file ? "w" : "wb"); diff --git a/net/http_client.h b/net/http_client.h index 320b8fba0f..a9592cbde9 100644 --- a/net/http_client.h +++ b/net/http_client.h @@ -4,11 +4,15 @@ #include "base/basictypes.h" #include "base/buffer.h" -#ifndef _WIN32 -#include -#include -#else +#ifdef _WIN32 #include +#else +#ifdef __FreeBSD__ +#include +#else +#include +#endif +#include #endif namespace net {