diff --git a/qbsp/bspfile.h b/qbsp/bspfile.h index 0b2a7b1a..0b7a64df 100644 --- a/qbsp/bspfile.h +++ b/qbsp/bspfile.h @@ -23,6 +23,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /* FIXME - put this typedef elsewhere */ typedef uint8_t byte; @@ -243,4 +247,8 @@ void WriteBSPFile(void); void PrintBSPFileSizes(void); void BSPX_AddLump(const char *xname, const void *xdata, size_t xsize); +#ifdef __cplusplus +} +#endif + #endif /* __BSPFILE_H__ */ diff --git a/qbsp/file.h b/qbsp/file.h index f7182aff..69ea4a19 100644 --- a/qbsp/file.h +++ b/qbsp/file.h @@ -24,6 +24,14 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + size_t LoadFile(const char *filename, void *bufptr, bool nofail); +#ifdef __cplusplus +} +#endif + #endif diff --git a/qbsp/parser.h b/qbsp/parser.h index 4dd16dce..31177d0a 100644 --- a/qbsp/parser.h +++ b/qbsp/parser.h @@ -24,6 +24,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #define MAXTOKEN 1024 typedef enum parseflags { @@ -43,4 +47,8 @@ typedef struct parser { bool ParseToken(parser_t *p, parseflags_t flags); void ParserInit(parser_t *p, const char *data); +#ifdef __cplusplus +} +#endif + #endif /* PARSER_H */ diff --git a/qbsp/qbsp.c b/qbsp/qbsp.c index f8900f75..48657589 100644 --- a/qbsp/qbsp.c +++ b/qbsp/qbsp.c @@ -312,7 +312,7 @@ void BSPX_Brushes_AddModel(struct bspxbrushes_s *ctx, int modelnum, brush_t *bru if (ctx->lumpmaxsize < ctx->lumpsize + sizeof(permodel) + permodel.numbrushes*sizeof(perbrush) + permodel.numfaces*sizeof(perface)) { ctx->lumpmaxsize = (ctx->lumpsize + sizeof(permodel) + permodel.numbrushes*sizeof(perbrush) + permodel.numfaces*sizeof(perface))*2; - ctx->lumpinfo = realloc(ctx->lumpinfo, ctx->lumpmaxsize); + ctx->lumpinfo = (byte *) realloc(ctx->lumpinfo, ctx->lumpmaxsize); } permodel.ver = LittleLong(1); @@ -547,7 +547,7 @@ ProcessFile(void) if (wadstring[0]) Message(msgWarning, warnNoValidWads); /* Try the default wad name */ - defaultwad = AllocMem(OTHER, strlen(options.szMapName) + 5, false); + defaultwad = (char *) AllocMem(OTHER, strlen(options.szMapName) + 5, false); strcpy(defaultwad, options.szMapName); StripExtension(defaultwad); DefaultExtension(defaultwad, ".wad"); @@ -829,7 +829,7 @@ InitQBSP(int argc, char **argv) if (argv[i][0] != '-') length += 2; /* quotes */ } - szBuf = AllocMem(OTHER, length, true); + szBuf = (char *) AllocMem(OTHER, length, true); for (i = 1; i < argc; i++) { /* Quote filenames for the parsing function */ if (argv[i][0] != '-') diff --git a/qbsp/qbsp.h b/qbsp/qbsp.h index 3c728753..f2fa57a2 100644 --- a/qbsp/qbsp.h +++ b/qbsp/qbsp.h @@ -38,13 +38,16 @@ #include "file.h" #include "warnerr.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifndef offsetof #define offsetof(type, member) __builtin_offsetof(type, member) #endif #ifdef _MSC_VER #define __func__ __FUNCTION__ -#define inline __inline #endif #ifndef __GNUC__ @@ -626,4 +629,8 @@ void Message(int MsgType, ...); void Error(const char *error, ...) __attribute__((format(printf,1,2),noreturn)); +#ifdef __cplusplus +} +#endif + #endif diff --git a/qbsp/wad.h b/qbsp/wad.h index c0b5de96..cf784f97 100644 --- a/qbsp/wad.h +++ b/qbsp/wad.h @@ -24,6 +24,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { char identification[4]; // should be WAD2 int numlumps; @@ -67,4 +71,8 @@ void WADList_Free(wad_t *wadlist); const texture_t *WADList_GetTexture(const char *name); // for getting a texture width/height +#ifdef __cplusplus +} +#endif + #endif /* WAD_H */ diff --git a/qbsp/warnerr.h b/qbsp/warnerr.h index 0ecaf4c9..09b537d6 100644 --- a/qbsp/warnerr.h +++ b/qbsp/warnerr.h @@ -20,6 +20,10 @@ */ // warnerr.h +#ifdef __cplusplus +extern "C" { +#endif + enum { warnNoWadKey, // 0 warnNoValidWads, @@ -49,3 +53,7 @@ enum { warnMixedFaceContents, cWarnings }; + +#ifdef __cplusplus +} +#endif