Fix a couple of clang warnings. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4697 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2014-10-29 17:05:15 +00:00
parent eed56532a8
commit 384aec522a
8 changed files with 30 additions and 20 deletions

View file

@ -89,8 +89,8 @@ extern char inputdevices;
#define NUMKEYS 256 #define NUMKEYS 256
#define KEYSTATUSSIZ 256 #define KEYSTATUSSIZ 256
#define KEYFIFOSIZ 64 #define KEYFIFOSIZ 64
extern char keystatus[KEYSTATUSSIZ], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend; extern char keystatus[KEYSTATUSSIZ], keyfifo[KEYFIFOSIZ], keyasciififo[KEYFIFOSIZ];
extern char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend; extern uint8_t keyasciififoplc, keyasciififoend, keyfifoplc, keyfifoend;
extern char scantoasc[128], remap[KEYSTATUSSIZ], key_names[NUMKEYS][24]; extern char scantoasc[128], remap[KEYSTATUSSIZ], key_names[NUMKEYS][24];
extern int32_t remapinit; extern int32_t remapinit;

View file

@ -44,10 +44,12 @@
# define __has_extension __has_feature // Compatibility with pre-3.0 compilers. # define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
#endif #endif
#ifndef UNREFERENCED_PARAMETER #ifdef UNREFERENCED_PARAMETER
#define UNREFERENCED_PARAMETER(x) x=x #undef UNREFERENCED_PARAMETER
#endif #endif
#define UNREFERENCED_PARAMETER(x) x = x
#if defined __GNUC__ || defined __clang__ #if defined __GNUC__ || defined __clang__
# define ATTRIBUTE(attrlist) __attribute__(attrlist) # define ATTRIBUTE(attrlist) __attribute__(attrlist)
#else #else
@ -582,7 +584,15 @@ static inline uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7ff
# define Bcalloc calloc # define Bcalloc calloc
# define Brealloc realloc # define Brealloc realloc
# define Bfree free # define Bfree free
#ifdef __cplusplus
# define Bstrdup _strdup
# define Bchdir _chdir
# define Bgetcwd _getcwd
#else
# define Bstrdup strdup # define Bstrdup strdup
# define Bchdir chdir
# define Bgetcwd getcwd
#endif
# define Bmemalign memalign # define Bmemalign memalign
# define Bopen open # define Bopen open
# define Bclose close # define Bclose close
@ -680,7 +690,6 @@ static inline uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7ff
# define Bvsnprintf vsnprintf # define Bvsnprintf vsnprintf
# endif # endif
# define Bvfprintf vfprintf # define Bvfprintf vfprintf
# define Bgetcwd getcwd
# define Bgetenv getenv # define Bgetenv getenv
# define Btime() time(NULL) # define Btime() time(NULL)
# define Butime utime # define Butime utime

View file

@ -10,8 +10,8 @@
// input // input
char inputdevices=0; char inputdevices=0;
char keystatus[KEYSTATUSSIZ], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend; char keystatus[KEYSTATUSSIZ], keyfifo[KEYFIFOSIZ], keyasciififo[KEYFIFOSIZ];
char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend; uint8_t keyfifoplc, keyfifoend, keyasciififoplc, keyasciififoend;
char remap[KEYSTATUSSIZ]; char remap[KEYSTATUSSIZ];
int32_t remapinit=0; int32_t remapinit=0;
char key_names[NUMKEYS][24]; char key_names[NUMKEYS][24];

View file

@ -10695,7 +10695,7 @@ void test_map(int32_t mode)
if ((program_origcwd[0] == '\0') || !getcwd(current_cwd, BMAX_PATH)) if ((program_origcwd[0] == '\0') || !getcwd(current_cwd, BMAX_PATH))
current_cwd[0] = '\0'; current_cwd[0] = '\0';
else // Before we check if file exists, for the case there's no absolute path. else // Before we check if file exists, for the case there's no absolute path.
chdir(program_origcwd); Bchdir(program_origcwd);
fp = fopen(game_executable, "rb"); // File exists? fp = fopen(game_executable, "rb"); // File exists?
if (fp != NULL) if (fp != NULL)
@ -10719,7 +10719,7 @@ void test_map(int32_t mode)
} }
if (current_cwd[0] != '\0') // Temporarily changing back, if (current_cwd[0] != '\0') // Temporarily changing back,
chdir(current_cwd); // after checking if file exists. Bchdir(current_cwd); // after checking if file exists.
if (testplay_addparam) if (testplay_addparam)
slen = Bstrlen(testplay_addparam); slen = Bstrlen(testplay_addparam);
@ -10765,10 +10765,10 @@ void test_map(int32_t mode)
#else #else
if (current_cwd[0] != '\0') if (current_cwd[0] != '\0')
{ {
chdir(program_origcwd); Bchdir(program_origcwd);
if (system(fullparam)) if (system(fullparam))
message("Error launching the game!"); message("Error launching the game!");
chdir(current_cwd); Bchdir(current_cwd);
} }
else system(fullparam); else system(fullparam);
#endif #endif

View file

@ -97,7 +97,7 @@ void *Bmalloc(bsize_t size)
void Bfree(void *ptr) void Bfree(void *ptr)
{ {
free(ptr); Bfree(ptr);
} }
int32_t Bopen(const char *pathname, int32_t flags, uint32_t mode) int32_t Bopen(const char *pathname, int32_t flags, uint32_t mode)

View file

@ -157,11 +157,12 @@
/************************************** /**************************************
Memory routines Memory routines
**************************************/ **************************************/
#include "compat.h"
#include <stdlib.h> /* malloc, calloc, free */ #include <stdlib.h> /* malloc, calloc, free */
#define ALLOCATOR(n,s) calloc(n,s) #define ALLOCATOR(n,s) Xcalloc(n,s)
#define FREEMEM free #define FREEMEM Bfree
#include <string.h> /* memset, memcpy */ #include <string.h> /* memset, memcpy */
#define MEM_INIT memset #define MEM_INIT Bmemset
/************************************** /**************************************

View file

@ -352,7 +352,7 @@ void G_ExtInit(void)
else asperr = -1; else asperr = -1;
} }
if (asperr == 0) if (asperr == 0)
chdir(cwd); Bchdir(cwd);
Bfree(homedir); Bfree(homedir);
} }
} }

View file

@ -11021,15 +11021,15 @@ static void G_Startup(void)
if (g_modDir[0] != '/' && (cwd = getcwd(NULL, 0))) if (g_modDir[0] != '/' && (cwd = getcwd(NULL, 0)))
{ {
chdir(g_modDir); Bchdir(g_modDir);
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
{ {
chdir(cwd); Bchdir(cwd);
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
G_GameExit("Failed loading art."); G_GameExit("Failed loading art.");
} }
chdir(cwd); Bchdir(cwd);
free(cwd); Bfree(cwd);
} }
else if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) else if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
G_GameExit("Failed loading art."); G_GameExit("Failed loading art.");