From 2a3f31f52100ca657169e8a31f09fd88706548aa Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Tue, 6 Mar 2012 20:19:47 +0000 Subject: [PATCH] Using g++ for compilation. Fixed C++ build. --- Makefile | 9 +++++---- mongoose.c | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8fd5b436..ffdd70e1 100644 --- a/Makefile +++ b/Makefile @@ -22,10 +22,11 @@ all: ### UNIX build: linux, bsd, mac, rtems ########################################################################## -CFLAGS= -W -Wall -std=c99 -pedantic -O2 $(COPT) -MAC_SHARED= -flat_namespace -bundle -undefined suppress -LINFLAGS= -ldl -pthread $(CFLAGS) -LIB= _$(PROG).so +CFLAGS = -W -Wall -std=c99 -pedantic -O2 $(COPT) +MAC_SHARED = -flat_namespace -bundle -undefined suppress +LINFLAGS = -ldl -pthread $(CFLAGS) +LIB = _$(PROG).so +CC = g++ # Make sure that the compiler flags come last in the compilation string. # If not so, this can break some on some Linux distros which use diff --git a/mongoose.c b/mongoose.c index 444f7117..7ad13f3d 100644 --- a/mongoose.c +++ b/mongoose.c @@ -24,6 +24,7 @@ #define _XOPEN_SOURCE 600 // For flockfile() on Linux #define _LARGEFILE_SOURCE // Enable 64-bit file offsets #define __STDC_FORMAT_MACROS // wants this for C++ +#define __STDC_LIMIT_MACROS // C++ wants that for INT64_MAX #endif #if defined(__SYMBIAN32__) @@ -779,7 +780,7 @@ static int match_prefix(const char *pattern, int pattern_len, const char *str) { const char *or_str; int i, j, len, res; - if ((or_str = memchr(pattern, '|', pattern_len)) != NULL) { + if ((or_str = (const char *) memchr(pattern, '|', pattern_len)) != NULL) { res = match_prefix(pattern, or_str - pattern, str); return res > 0 ? res : match_prefix(or_str + 1, (pattern + pattern_len) - (or_str + 1), str);