]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix almost all g++ -pedantic warnings
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 19 Aug 2010 14:38:49 +0000 (14:38 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 19 Aug 2010 14:38:49 +0000 (14:38 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10402 d7cf8633-e32d-0410-b094-e92efae38249

46 files changed:
bih.h
cap_ogg.c
cl_parse.c
cl_screen.c
cl_video.c
client.h
cmd.c
common.c
common.h
csprogs.c
cvar.c
cvar.h
dpvsimpledecode.c
dpvsimpledecode.h
draw.h
filematch.c
gl_backend.c
gl_textures.c
glquake.h
host_cmd.c
image_png.c
lhnet.c
lhnet.h
libcurl.c
menu.c
menu.h
model_brush.c
model_shared.h
mvm_cmds.c
progsvm.h
prvm_cmds.c
prvm_edict.c
prvm_exec.c
r_modules.c
r_modules.h
r_shadow.c
r_textures.h
render.h
snd_ogg.c
snd_wav.c
sv_main.c
svvm_cmds.c
sys_linux.c
sys_shared.c
vid.h
vid_wgl.c

diff --git a/bih.h b/bih.h
index 90ec71db7744c887f328ed51730586475443eeeb..810cf9ca9e87ad7e53be86ec7c5c333d6c4a7187 100644 (file)
--- a/bih.h
+++ b/bih.h
@@ -9,7 +9,7 @@
 typedef enum biherror_e
 {
        BIHERROR_OK, // no error, be happy
-       BIHERROR_OUT_OF_NODES, // could not produce complete hierarchy, maxnodes too low (should be roughly half of numleafs)
+       BIHERROR_OUT_OF_NODES // could not produce complete hierarchy, maxnodes too low (should be roughly half of numleafs)
 }
 biherror_t;
 
@@ -17,7 +17,7 @@ typedef enum bih_nodetype_e
 {
        BIH_SPLITX = 0,
        BIH_SPLITY = 1,
-       BIH_SPLITZ = 2,
+       BIH_SPLITZ = 2
 }
 bih_nodetype_t;
 
@@ -25,7 +25,7 @@ typedef enum bih_leaftype_e
 {
        BIH_BRUSH = 3,
        BIH_COLLISIONTRIANGLE = 4,
-       BIH_RENDERTRIANGLE = 5,
+       BIH_RENDERTRIANGLE = 5
 }
 bih_leaftype_t;
 
index 424eac411774344d2f27fbd731c10c8783aa6dd4..013a0b566cc16ee9d1904db2885be261cb8bb27a 100644 (file)
--- a/cap_ogg.c
+++ b/cap_ogg.c
@@ -345,7 +345,7 @@ typedef enum {
   OC_PF_420,    /**< Chroma subsampling by 2 in each direction (4:2:0) */
   OC_PF_RSVD,   /**< Reserved value */
   OC_PF_422,    /**< Horizonatal chroma subsampling by 2 (4:2:2) */
-  OC_PF_444,    /**< No chroma subsampling at all (4:4:4) */
+  OC_PF_444     /**< No chroma subsampling at all (4:4:4) */
 } theora_pixelformat;
 /**
  * Theora bitstream info.
index 5931a7da716212c46f01af204a010a0c91aeba44..b8bfb65eaa0bf2589de2ddff7da462d175975537 100644 (file)
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "libcurl.h"
 #include "utf8lib.h"
 
-char *svc_strings[128] =
+const char *svc_strings[128] =
 {
        "svc_bad",
        "svc_nop",
@@ -100,7 +100,7 @@ char *svc_strings[128] =
        "svc_pointparticles1", //       62              // [short] effectnum [vector] start, same as svc_pointparticles except velocity is zero and count is 1
 };
 
-char *qw_svc_strings[128] =
+const char *qw_svc_strings[128] =
 {
        "qw_svc_bad",                                   // 0
        "qw_svc_nop",                                   // 1
@@ -3288,7 +3288,7 @@ void CL_ParseServerMessage(void)
        int                     i;
        protocolversion_t protocol;
        unsigned char           cmdlog[32];
-       char            *cmdlogname[32], *temp;
+       const char              *cmdlogname[32], *temp;
        int                     cmdindex, cmdcount = 0;
        qboolean        qwplayerupdatereceived;
        qboolean        strip_pqc;
index 9319ca858196aae70394e5a6e15a55704c4f097c..9b0a0c144548602f5366a8eb80aa3ea4ea99c9c4 100644 (file)
@@ -696,7 +696,7 @@ int speedstringcount, r_timereport_active;
 double r_timereport_temp = 0, r_timereport_current = 0, r_timereport_start = 0;
 int r_speeds_longestitem = 0;
 
-void R_TimeReport(char *desc)
+void R_TimeReport(const char *desc)
 {
        char tempbuf[256];
        int length;
@@ -1314,7 +1314,7 @@ Grab six views for environment mapping tests
 struct envmapinfo_s
 {
        float angles[3];
-       char *name;
+       const char *name;
        qboolean flipx, flipy, flipdiagonaly;
 }
 envmapinfo[12] =
index afba2119b5a968068258cc641b3c919f72ef2248..12960d786c09fe690218225fffd4f7ba56c05ee0 100644 (file)
@@ -34,7 +34,7 @@ static clvideo_t *FindUnusedVid( void )
 
 static qboolean OpenStream( clvideo_t * video )
 {
-       char *errorstring;
+       const char *errorstring;
        video->stream = dpvsimpledecode_open( video->filename, &errorstring);
        if (!video->stream )
        {
index 47ec148e33bc7bbb26261b79cb670f4c7bcb5ec8..d97801643a1876e0907d3e05c73fb1dd57b9edae 100644 (file)
--- a/client.h
+++ b/client.h
@@ -537,7 +537,7 @@ qw_downloadtype_t;
 typedef enum capturevideoformat_e
 {
        CAPTUREVIDEOFORMAT_AVI_I420,
-       CAPTUREVIDEOFORMAT_OGG_VORBIS_THEORA,
+       CAPTUREVIDEOFORMAT_OGG_VORBIS_THEORA
 }
 capturevideoformat_t;
 
diff --git a/cmd.c b/cmd.c
index 18cb6a13fc366e63cf2ba34bc2e0bbfc17cb2cad..995473c6e6936a60695b13e8b1ac06d5fd28e1e9 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -857,6 +857,7 @@ static const char *Cmd_GetCvarValue(const char *var, size_t varlen, cmdalias_t *
        static char varval[MAX_INPUTLINE];
        const char *varstr;
        char *varfunc;
+static char asis[] = "asis"; // just to suppress const char warnings
 
        if(varlen >= MAX_INPUTLINE)
                varlen = MAX_INPUTLINE - 1;
@@ -887,7 +888,7 @@ static const char *Cmd_GetCvarValue(const char *var, size_t varlen, cmdalias_t *
                varstr = Cmd_GetDirectCvarValue(varname, alias, &is_multiple);
                if(is_multiple)
                        if(!varfunc)
-                               varfunc = "asis";
+                               varfunc = asis;
        }
 
        if(!varstr)
index 9bcaeb8c407b92b148d6bccfbcb059eb13825b68..f3dd8e502dd8226dd2a72798d4f6415cf9fade5f 100644 (file)
--- a/common.c
+++ b/common.c
@@ -606,7 +606,7 @@ void SZ_Write (sizebuf_t *buf, const unsigned char *data, int length)
 // attention, it has been eradicated from here, its only (former) use in
 // all of darkplaces.
 
-static char *hexchar = "0123456789ABCDEF";
+static const char *hexchar = "0123456789ABCDEF";
 void Com_HexDumpToConsole(const unsigned char *data, int size)
 {
        int i, j, n;
@@ -1996,8 +1996,6 @@ void InfoString_GetValue(const char *buffer, const char *key, char *value, size_
        size_t keylength;
        if (!key)
                key = "";
-       if (!value)
-               value = "";
        keylength = strlen(key);
        if (valuelength < 1 || !value)
        {
index 228a133e572874b95059abc0cf268a83259c4167..220e5caaa64b019506c9dd8a044ba9edfe1b78ba 100644 (file)
--- a/common.h
+++ b/common.h
@@ -134,7 +134,7 @@ typedef enum protocolversion_e
        PROTOCOL_QUAKEWORLD, ///< quakeworld protocol
        PROTOCOL_NEHAHRABJP, ///< same as QUAKEDP but with 16bit modelindex
        PROTOCOL_NEHAHRABJP2, ///< same as NEHAHRABJP but with 16bit soundindex
-       PROTOCOL_NEHAHRABJP3, ///< same as NEHAHRABJP2 but with some changes
+       PROTOCOL_NEHAHRABJP3 ///< same as NEHAHRABJP2 but with some changes
 }
 protocolversion_t;
 
index 3e82840f0ca68fea5388c4bb632dee5079fd3faa..92a8872057427c86248739ea591706d6b33a34dd 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -30,7 +30,7 @@ void CL_VM_PreventInformationLeaks(void)
 }
 
 //[515]: these are required funcs
-static char *cl_required_func[] =
+static const char *cl_required_func[] =
 {
        "CSQC_Init",
        "CSQC_InputEvent",
diff --git a/cvar.c b/cvar.c
index c6f69360825f07765f71b485561f40370f17ae09..4696034acd21f58773313dc500add16f2f38f03e 100644 (file)
--- a/cvar.c
+++ b/cvar.c
@@ -21,11 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "quakedef.h"
 
-char *cvar_dummy_description = "custom cvar";
+const char *cvar_dummy_description = "custom cvar";
 
 cvar_t *cvar_vars = NULL;
 cvar_t *cvar_hashtable[CVAR_HASHSIZE];
-char *cvar_null_string = "";
+const char *cvar_null_string = "";
 
 /*
 ============
@@ -324,11 +324,11 @@ void Cvar_SetQuick_Internal (cvar_t *var, const char *value)
        valuelen = strlen(value);
        if (!var->string || strlen(var->string) != valuelen)
        {
-               Z_Free (var->string);   // free the old value string
+               Z_Free ((char *)var->string);   // free the old value string
 
                var->string = (char *)Z_Malloc (valuelen + 1);
        }
-       memcpy (var->string, value, valuelen + 1);
+       memcpy ((char *)var->string, value, valuelen + 1);
        var->value = atof (var->string);
        var->integer = (int) var->value;
        if ((var->flags & CVAR_NOTIFY) && changed && sv.active)
@@ -504,7 +504,7 @@ void Cvar_RegisterVariable (cvar_t *variable)
 
                        // get rid of old allocated cvar
                        // (but not cvar->string and cvar->defstring, because we kept those)
-                       Z_Free(cvar->name);
+                       Z_Free((char *)cvar->name);
                        Z_Free(cvar);
                }
                else
@@ -520,12 +520,12 @@ void Cvar_RegisterVariable (cvar_t *variable)
        }
 
 // copy the value off, because future sets will Z_Free it
-       oldstr = variable->string;
+       oldstr = (char *)variable->string;
        alloclen = strlen(variable->string) + 1;
        variable->string = (char *)Z_Malloc (alloclen);
-       memcpy (variable->string, oldstr, alloclen);
+       memcpy ((char *)variable->string, oldstr, alloclen);
        variable->defstring = (char *)Z_Malloc (alloclen);
-       memcpy (variable->defstring, oldstr, alloclen);
+       memcpy ((char *)variable->defstring, oldstr, alloclen);
        variable->value = atof (variable->string);
        variable->integer = (int) variable->value;
 
@@ -571,13 +571,13 @@ cvar_t *Cvar_Get (const char *name, const char *value, int flags, const char *ne
                if(newdescription && (cvar->flags & CVAR_ALLOCATED))
                {
                        if(cvar->description != cvar_dummy_description)
-                               Z_Free(cvar->description);
+                               Z_Free((char *)cvar->description);
 
                        if(*newdescription)
                        {
                                alloclen = strlen(newdescription) + 1;
                                cvar->description = (char *)Z_Malloc(alloclen);
-                               memcpy(cvar->description, newdescription, alloclen);
+                               memcpy((char *)cvar->description, newdescription, alloclen);
                        }
                        else
                                cvar->description = cvar_dummy_description;
@@ -606,12 +606,12 @@ cvar_t *Cvar_Get (const char *name, const char *value, int flags, const char *ne
        cvar->flags = flags | CVAR_ALLOCATED;
        alloclen = strlen(name) + 1;
        cvar->name = (char *)Z_Malloc(alloclen);
-       memcpy(cvar->name, name, alloclen);
+       memcpy((char *)cvar->name, name, alloclen);
        alloclen = strlen(value) + 1;
        cvar->string = (char *)Z_Malloc(alloclen);
-       memcpy(cvar->string, value, alloclen);
+       memcpy((char *)cvar->string, value, alloclen);
        cvar->defstring = (char *)Z_Malloc(alloclen);
-       memcpy(cvar->defstring, value, alloclen);
+       memcpy((char *)cvar->defstring, value, alloclen);
        cvar->value = atof (cvar->string);
        cvar->integer = (int) cvar->value;
 
@@ -619,7 +619,7 @@ cvar_t *Cvar_Get (const char *name, const char *value, int flags, const char *ne
        {
                alloclen = strlen(newdescription) + 1;
                cvar->description = (char *)Z_Malloc(alloclen);
-               memcpy(cvar->description, newdescription, alloclen);
+               memcpy((char *)cvar->description, newdescription, alloclen);
        }
        else
                cvar->description = cvar_dummy_description; // actually checked by VM_cvar_type
@@ -702,10 +702,10 @@ void Cvar_LockDefaults_f (void)
 
                        //Con_Printf("locking cvar %s (%s -> %s)\n", var->name, var->string, var->defstring);
                        var->flags |= CVAR_DEFAULTSET;
-                       Z_Free(var->defstring);
+                       Z_Free((char *)var->defstring);
                        alloclen = strlen(var->string) + 1;
                        var->defstring = (char *)Z_Malloc(alloclen);
-                       memcpy(var->defstring, var->string, alloclen);
+                       memcpy((char *)var->defstring, var->string, alloclen);
                }
        }
 }
@@ -912,11 +912,11 @@ void Cvar_Del_f (void)
                        *link = cvar->nextonhashchain;
 
                if(cvar->description != cvar_dummy_description)
-                       Z_Free(cvar->description);
+                       Z_Free((char *)cvar->description);
 
-               Z_Free(cvar->name);
-               Z_Free(cvar->string);
-               Z_Free(cvar->defstring);
+               Z_Free((char *)cvar->name);
+               Z_Free((char *)cvar->string);
+               Z_Free((char *)cvar->defstring);
                Z_Free(cvar);
        }
 }
diff --git a/cvar.h b/cvar.h
index 3c94aae266b91b13e25b481e0162931256aee192..1509f756f5ce405a7ff65a344541744c69bf02b0 100644 (file)
--- a/cvar.h
+++ b/cvar.h
@@ -114,15 +114,15 @@ typedef struct cvar_s
 {
        int flags;
 
-       char *name;
+       const char *name;
 
-       char *string;
-       char *description;
+       const char *string;
+       const char *description;
        int integer;
        float value;
        float vector[3];
 
-       char *defstring;
+       const char *defstring;
 
        unsigned int globaldefindex_progid[3];
        int globaldefindex[3];
@@ -213,7 +213,7 @@ void Cvar_Del_f (void);
 /// or merely sets its value if it already exists.
 cvar_t *Cvar_Get (const char *name, const char *value, int flags, const char *newdescription);
 
-extern char *cvar_dummy_description; // ALWAYS the same pointer
+extern const char *cvar_dummy_description; // ALWAYS the same pointer
 extern cvar_t *cvar_vars; // used to list all cvars
 
 void Cvar_UpdateAllAutoCvars(void); // updates ALL autocvars of the active prog to the cvar values (savegame loading)
index 3f6567bd3bd29d2991dc93857820e287628b61ae..8ad43beab3736e9292b3106a26cdda7c4d88076d 100644 (file)
@@ -333,7 +333,7 @@ static int dpvsimpledecode_setpixelformat(dpvsimpledecodestream_t *s, unsigned i
 // opening and closing streams
 
 // opens a stream
-void *dpvsimpledecode_open(char *filename, char **errorstring)
+void *dpvsimpledecode_open(char *filename, const char **errorstring)
 {
        dpvsimpledecodestream_t *s;
        char t[8], *wavename;
@@ -437,7 +437,7 @@ void dpvsimpledecode_close(void *stream)
 // number to DPVSIMPLEDECODEERROR_NONE
 // if the supplied string pointer variable is not NULL, it will be set to the
 // error message
-int dpvsimpledecode_error(void *stream, char **errorstring)
+int dpvsimpledecode_error(void *stream, const char **errorstring)
 {
        dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream;
        int e;
index 2d1f99c9cdee8b103cf35159e678d010aff41c76..075f3652b45cbe923d5b4eb3a2d8bec18322457b 100644 (file)
@@ -16,7 +16,7 @@
 // opening and closing streams
 
 // opens a stream
-void *dpvsimpledecode_open(char *filename, char **errorstring);
+void *dpvsimpledecode_open(char *filename, const char **errorstring);
 // closes a stream
 void dpvsimpledecode_close(void *stream);
 
@@ -26,7 +26,7 @@ void dpvsimpledecode_close(void *stream);
 // number to DPVDECODEERROR_NONE
 // if the supplied string pointer variable is not NULL, it will be set to the
 // error message
-int dpvsimpledecode_error(void *stream, char **errorstring);
+int dpvsimpledecode_error(void *stream, const char **errorstring);
 
 // returns the width of the image data
 unsigned int dpvsimpledecode_getwidth(void *stream);
diff --git a/draw.h b/draw.h
index ace96f8cb06425a7d28cdb8e53fad18fc01f9ad3..cd220ce03a1ebef6a38d8edb522906dcfdecfeb3 100644 (file)
--- a/draw.h
+++ b/draw.h
@@ -51,7 +51,7 @@ typedef enum cachepicflags_e
        CACHEPICFLAG_NOTPERSISTENT = 1,
        CACHEPICFLAG_QUIET = 2,
        CACHEPICFLAG_NOCOMPRESSION = 4,
-       CACHEPICFLAG_NOCLAMP = 8,
+       CACHEPICFLAG_NOCLAMP = 8
 }
 cachepicflags_t;
 
index 9ff8a767514a39667afb4f3c867a15b014ad7d8e..4bacbc15a1704029ff223c09b98a8c369bff8bf1 100644 (file)
@@ -1,4 +1,10 @@
 
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <dirent.h>
+#endif
+
 #include "quakedef.h"
 
 // LordHavoc: some portable directory listing code I wrote for lmp2pcx, now used in darkplaces to load id1/*.pak and such...
@@ -141,7 +147,6 @@ static void adddirentry(stringlist_t *list, const char *path, const char *name)
        }
 }
 #ifdef WIN32
-#include <windows.h>
 void listdirectory(stringlist_t *list, const char *basepath, const char *path)
 {
        int i;
@@ -167,7 +172,6 @@ void listdirectory(stringlist_t *list, const char *basepath, const char *path)
                                *c += 'a' - 'A';
 }
 #else
-#include <dirent.h>
 void listdirectory(stringlist_t *list, const char *basepath, const char *path)
 {
        char fullpath[MAX_OSPATH];
index cbcab90dc4c1b2e977784969db11a068541b87a1..f91b54a3512096c970309409601b052da3ab471f 100644 (file)
@@ -45,7 +45,7 @@ int gl_maxdrawrangeelementsindices;
 #ifdef DEBUGGL
 int errornumber = 0;
 
-void GL_PrintError(int errornumber, char *filename, int linenumber)
+void GL_PrintError(int errornumber, const char *filename, int linenumber)
 {
        switch(errornumber)
        {
index 1884633d51cb3dafd30356b03541cd72ba4c63e1..70a3d933fcf246097f37f264fa1aede93b5954cf 100644 (file)
@@ -341,7 +341,7 @@ void R_FreeTexturePool(rtexturepool_t **rtexturepool)
 
 typedef struct glmode_s
 {
-       char *name;
+       const char *name;
        int minification, magnification;
 }
 glmode_t;
@@ -359,7 +359,7 @@ static glmode_t modes[6] =
 #ifdef SUPPORTD3D
 typedef struct d3dmode_s
 {
-       char *name;
+       const char *name;
        int m1, m2;
 }
 d3dmode_t;
@@ -2161,7 +2161,7 @@ void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, in
                Host_Error("R_UpdateTexture: no texture supplied");
        if (!glt->texnum && !glt->d3dtexture)
        {
-               Con_Printf("R_UpdateTexture: texture %p \"%s\" in pool %p has not been uploaded yet", glt, glt->identifier, glt->pool);
+               Con_Printf("R_UpdateTexture: texture %p \"%s\" in pool %p has not been uploaded yet", (void *)glt, glt->identifier, (void *)glt->pool);
                return;
        }
        // update part of the texture
index cd59c5ae9f4de2036d11fea84cebb32a9c2e65cf..c1311f49e9f05b5f2e2ae9ea37b85fbc8256f35d 100644 (file)
--- a/glquake.h
+++ b/glquake.h
@@ -964,7 +964,7 @@ extern void (GLAPIENTRY *qglGetQueryObjectuivARB)(GLuint qid, GLenum pname, GLui
 #ifdef DEBUGGL
 #define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);errornumber = qglGetError();if (errornumber) GL_PrintError(errornumber, __FILE__, __LINE__);}}
 extern int errornumber;
-void GL_PrintError(int errornumber, char *filename, int linenumber);
+void GL_PrintError(int errornumber, const char *filename, int linenumber);
 #else
 #define CHECKGLERROR
 #endif
index 32d8bb35ec7f9736b8bcbc24d6057e41551dba4b..3f9c56e864054bef906260d100e44593fd985d63 100644 (file)
@@ -1937,7 +1937,7 @@ Kicks a user off of the server
 */
 void Host_Kick_f (void)
 {
-       char *who;
+       const char *who;
        const char *message = NULL;
        client_t *save;
        int i;
index 0b9543e8742890d76955e5cf814f9e24d0f35e12..ce6ba6db31f28de4255ef9273f0e37e0ca9bc390 100644 (file)
@@ -285,7 +285,9 @@ unsigned char *PNG_LoadImage_BGRA (const unsigned char *raw, int filesize, int *
        // NOTE: this relies on jmp_buf being the first thing in the png structure
        // created by libpng! (this is correct for libpng 1.2.x)
 #ifdef __cplusplus
-#if defined(MACOSX) || defined(WIN32)
+#ifdef WIN64
+       if (setjmp((_JBTYPE *)png))
+#elif defined(MACOSX) || defined(WIN32)
        if (setjmp((int *)png))
 #else
        if (setjmp((__jmp_buf_tag *)png))
@@ -478,7 +480,9 @@ qboolean PNG_SaveImage_preflipped (const char *filename, int width, int height,
        // NOTE: this relies on jmp_buf being the first thing in the png structure
        // created by libpng! (this is correct for libpng 1.2.x)
 #ifdef __cplusplus
-#if defined(MACOSX) || defined(WIN32)
+#ifdef WIN64
+       if (setjmp((_JBTYPE *)png))
+#elif defined(MACOSX) || defined(WIN32)
        if (setjmp((int *)png))
 #else
        if (setjmp((__jmp_buf_tag *)png))
diff --git a/lhnet.c b/lhnet.c
index e2e513ee7bfdbc1d73b145a13f7ae7bb11ef889e..aa6cbc94153b5f6c9f65f8960ed835515a61ce63 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -839,7 +839,11 @@ void LHNET_SleepUntilPacket_Microseconds(int microseconds)
                {
                        if (lastfd < s->inetsocket)
                                lastfd = s->inetsocket;
+#ifdef WIN32
+                       FD_SET((int)s->inetsocket, &fdreadset);
+#else
                        FD_SET((unsigned int)s->inetsocket, &fdreadset);
+#endif
                }
        }
        tv.tv_sec = microseconds / 1000000;
diff --git a/lhnet.h b/lhnet.h
index 701045e3aa384372275c79de522ef89a0fc85ac3..d46dbe99a859cfb6db3a2ad8ed095febcd79073c 100644 (file)
--- a/lhnet.h
+++ b/lhnet.h
@@ -9,7 +9,7 @@ typedef enum lhnetaddresstype_e
        LHNETADDRESSTYPE_NONE,
        LHNETADDRESSTYPE_LOOP,
        LHNETADDRESSTYPE_INET4,
-       LHNETADDRESSTYPE_INET6,
+       LHNETADDRESSTYPE_INET6
 }
 lhnetaddresstype_t;
 
index 0efac5e87591b8e026603700024dcccec3ea280a..30a48aff07d97f399a014dfe1fa5dd5c931856f2 100644 (file)
--- a/libcurl.c
+++ b/libcurl.c
@@ -55,7 +55,7 @@ typedef enum
        CINIT(LOW_SPEED_LIMIT, LONG , 19),
        CINIT(LOW_SPEED_TIME, LONG, 20),
        CINIT(PROTOCOLS, LONG, 181),
-       CINIT(REDIR_PROTOCOLS, LONG, 182),
+       CINIT(REDIR_PROTOCOLS, LONG, 182)
 }
 CURLoption;
 #define CURLPROTO_HTTP   (1<<0)
@@ -108,7 +108,7 @@ typedef enum
        CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,
        CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,
        CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,
-       CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,
+       CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27
 }
 CURLINFO;
 
diff --git a/menu.c b/menu.c
index c9e8d1fa4801a28e58be71c3ffeada3166ac2ce0..864dcbbb9ebafa02352c6b480feb6d1890668980 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -107,7 +107,7 @@ static void M_ModList_Key (int key, int ascii);
 
 static qboolean        m_entersound;           ///< play after drawing a frame, so caching won't disrupt the sound
 
-void M_Update_Return_Reason(char *s)
+void M_Update_Return_Reason(const char *s)
 {
        strlcpy(m_return_reason, s, sizeof(m_return_reason));
        if (s)
@@ -121,8 +121,8 @@ void M_Update_Return_Reason(char *s)
 #define NumberOfNehahraDemos 34
 typedef struct nehahrademonames_s
 {
-       char *name;
-       char *desc;
+       const char *name;
+       const char *desc;
 } nehahrademonames_t;
 
 static nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] =
@@ -167,8 +167,8 @@ static float menu_x, menu_y, menu_width, menu_height;
 
 static void M_Background(int width, int height)
 {
-       menu_width = bound(1, width, vid_conwidth.integer);
-       menu_height = bound(1, height, vid_conheight.integer);
+       menu_width = bound(1.0f, (float)width, vid_conwidth.value);
+       menu_height = bound(1.0f, (float)height, vid_conheight.value);
        menu_x = (vid_conwidth.integer - menu_width) * 0.5;
        menu_y = (vid_conheight.integer - menu_height) * 0.5;
        //DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0);
@@ -1266,7 +1266,7 @@ static unsigned int *menuplyr_translated;
 typedef struct ratetable_s
 {
        int rate;
-       char *name;
+       const char *name;
 }
 ratetable_t;
 
@@ -2315,7 +2315,7 @@ static void M_Options_ColorControl_Key (int k, int ascii)
 //=============================================================================
 /* KEYS MENU */
 
-static char *quakebindnames[][2] =
+static const char *quakebindnames[][2] =
 {
 {"+attack",            "attack"},
 {"impulse 10",                 "next weapon"},
@@ -2338,7 +2338,7 @@ static char *quakebindnames[][2] =
 {"+movedown",          "swim down"}
 };
 
-static char *transfusionbindnames[][2] =
+static const char *transfusionbindnames[][2] =
 {
 {"",                           "Movement"},            // Movement commands
 {"+forward",           "walk forward"},
@@ -2396,7 +2396,7 @@ static char *transfusionbindnames[][2] =
 {"impulse 79",         "taunt 9"}
 };
 
-static char *goodvsbad2bindnames[][2] =
+static const char *goodvsbad2bindnames[][2] =
 {
 {"impulse 69",         "Power 1"},
 {"impulse 70",         "Power 2"},
@@ -2420,7 +2420,7 @@ static char *goodvsbad2bindnames[][2] =
 };
 
 static int numcommands;
-static char *(*bindnames)[2];
+static const char *(*bindnames)[2];
 
 /*
 typedef struct binditem_s
@@ -2525,10 +2525,10 @@ void M_Menu_Keys_f (void)
 
 #define NUMKEYS 5
 
-static void M_UnbindCommand (char *command)
+static void M_UnbindCommand (const char *command)
 {
        int             j;
-       char    *b;
+       const char      *b;
 
        for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++)
        {
@@ -3107,12 +3107,12 @@ static void M_Credits_Key (int key, int ascii)
 //=============================================================================
 /* QUIT MENU */
 
-static char *m_quit_message[9];
+static const char *m_quit_message[9];
 static int             m_quit_prevstate;
 static qboolean        wasInMenus;
 
 
-static int M_QuitMessage(char *line1, char *line2, char *line3, char *line4, char *line5, char *line6, char *line7, char *line8)
+static int M_QuitMessage(const char *line1, const char *line2, const char *line3, const char *line4, const char *line5, const char *line6, const char *line7, const char *line8)
 {
        m_quit_message[0] = line1;
        m_quit_message[1] = line2;
@@ -3292,8 +3292,8 @@ static void M_LanConfig_Draw (void)
 {
        cachepic_t      *p;
        int             basex;
-       char    *startJoin;
-       char    *protocol;
+       const char      *startJoin;
+       const char      *protocol;
 
        M_Background(320, 200);
 
@@ -3456,20 +3456,20 @@ static void M_LanConfig_Key (int key, int ascii)
 
 typedef struct level_s
 {
-       char    *name;
-       char    *description;
+       const char      *name;
+       const char      *description;
 } level_t;
 
 typedef struct episode_s
 {
-       char    *description;
+       const char      *description;
        int             firstLevel;
        int             levels;
 } episode_t;
 
 typedef struct gamelevels_s
 {
-       char *gamename;
+       const char *gamename;
        level_t *levels;
        episode_t *episodes;
        int numepisodes;
@@ -3976,7 +3976,7 @@ void M_GameOptions_Draw (void)
                M_Print(0, 72, "        Teamplay");
                if (gamemode == GAME_ROGUE)
                {
-                       char *msg;
+                       const char *msg;
 
                        switch((int)teamplay.integer)
                        {
@@ -3992,7 +3992,7 @@ void M_GameOptions_Draw (void)
                }
                else
                {
-                       char *msg;
+                       const char *msg;
 
                        switch (teamplay.integer)
                        {
@@ -5029,7 +5029,7 @@ void M_Restart(void)
 //============================================================================
 // Menu prog handling
 
-static char *m_required_func[] = {
+static const char *m_required_func[] = {
 "m_init",
 "m_keydown",
 "m_draw",
diff --git a/menu.h b/menu.h
index cef87e2edb630827da03be08f4201807e1626dd9..7fdf78bad073826dbf7b0092a799e1356088a3d9 100644 (file)
--- a/menu.h
+++ b/menu.h
@@ -53,7 +53,7 @@ enum m_state_e {
 
 extern enum m_state_e m_state;
 extern char m_return_reason[32];
-void M_Update_Return_Reason(char *s);
+void M_Update_Return_Reason(const char *s);
 
 /*
 // hard-coded menus
index 70acef81d982f2d0546d977246c0ba7f6e8bb228..9ec8cb192aa5f98e67d4fde50afe35b5ef79da3a 100644 (file)
@@ -7181,6 +7181,7 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend)
        // parse the OBJ text now
        for(;;)
        {
+               static char emptyarg[1] = "";
                if (!*text)
                        break;
                linenumber++;
@@ -7189,7 +7190,7 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend)
                        line[linelen] = text[linelen];
                line[linelen] = 0;
                for (argc = 0;argc < 4;argc++)
-                       argv[argc] = "";
+                       argv[argc] = emptyarg;
                argc = 0;
                s = line;
                while (*s == ' ' || *s == '\t')
index 4254ae0759542585b9367d24444de3c908276586..15808eab9a224d7c6eca6b56906a635f7ddfb82a 100644 (file)
@@ -488,7 +488,7 @@ typedef enum texturelayertype_e
        TEXTURELAYERTYPE_INVALID,
        TEXTURELAYERTYPE_LITTEXTURE,
        TEXTURELAYERTYPE_TEXTURE,
-       TEXTURELAYERTYPE_FOG,
+       TEXTURELAYERTYPE_FOG
 }
 texturelayertype_t;
 
index b7bbc8b0f5350df77913f5ff88f2f70582420564..e9cc68a986177b5ffc1609f6a51acc9ee4f1596d 100644 (file)
@@ -9,7 +9,7 @@
 //============================================================================
 // Menu
 
-char *vm_m_extensions =
+const char *vm_m_extensions =
 "BX_WAL_SUPPORT "
 "DP_CINEMATIC_DPV "
 "DP_CSQC_BINDMAPS "
index 6c048ba4af03f4f554b1fede58831a45b385cd02..323ae71b4832bc3fc68658c45a6c10f981ab6f38 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -486,12 +486,12 @@ typedef struct prvm_prog_s
        qboolean                        allowworldwrites;
 
        // name of the prog, e.g. "Server", "Client" or "Menu" (used for text output)
-       char                            *name; // [INIT]
+       const char                      *name; // [INIT]
 
        // flag - used to store general flags like PRVM_GE_SELF, etc.
        int                             flag;
 
-       char                            *extensionstring; // [INIT]
+       const char                      *extensionstring; // [INIT]
 
        qboolean                        loadintoworld; // [INIT]
 
@@ -556,8 +556,8 @@ extern const int vm_sv_numbuiltins;
 extern const int vm_cl_numbuiltins;
 extern const int vm_m_numbuiltins;
 
-extern char * vm_sv_extensions; // client also uses this
-extern char * vm_m_extensions;
+extern const char * vm_sv_extensions; // client also uses this
+extern const char * vm_m_extensions;
 
 void VM_SV_Cmd_Init(void);
 void VM_SV_Cmd_Reset(void);
@@ -631,7 +631,7 @@ void PRVM_ED_ParseGlobals (const char *data);
 
 void PRVM_ED_LoadFromFile (const char *data);
 
-unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, char *filename, int fileline);
+unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, const char *filename, int fileline);
 #define        PRVM_EDICT(n) (((unsigned)(n) < (unsigned int)prog->max_edicts) ? (unsigned int)(n) : PRVM_EDICT_NUM_ERROR((unsigned int)(n), __FILE__, __LINE__))
 #define        PRVM_EDICT_NUM(n) (prog->edicts + PRVM_EDICT(n))
 
@@ -714,7 +714,7 @@ Load a program with LoadProgs
 */
 void PRVM_InitProg(int prognr);
 // LoadProgs expects to be called right after InitProg
-void PRVM_LoadProgs (const char *filename, int numrequiredfunc, char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, char **required_global);
+void PRVM_LoadProgs (const char *filename, int numrequiredfunc, const char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, char **required_global);
 void PRVM_ResetProg(void);
 
 qboolean PRVM_ProgLoaded(int prognr);
index 20f06119cdf96879b73baafeced6edaf75ad924c..391f9e27cf91e7e802a718b2bb545ff4af2d9ae4 100644 (file)
@@ -269,7 +269,7 @@ checkextension(extensionname)
 static qboolean checkextension(const char *name)
 {
        int len;
-       char *e, *start;
+       const char *e, *start;
        len = (int)strlen(name);
 
        for (e = prog->extensionstring;*e;e++)
index ad6273919939eeaebebdccb632ef2fb5604ae2f0..092ef0667ef84cb0f191376c417114cfd8642c7d 100644 (file)
@@ -2072,7 +2072,7 @@ void PRVM_LoadLNO( const char *progname ) {
 PRVM_LoadProgs
 ===============
 */
-void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, char **required_global)
+void PRVM_LoadProgs (const char * filename, int numrequiredfunc, const char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, char **required_global)
 {
        int i;
        dstatement_t *st;
@@ -2806,7 +2806,7 @@ void _PRVM_FreeAll(const char *filename, int fileline)
 }
 
 // LordHavoc: turned PRVM_EDICT_NUM into a #define for speed reasons
-unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, char *filename, int fileline)
+unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, const char *filename, int fileline)
 {
        PRVM_ERROR ("PRVM_EDICT_NUM: %s: bad number %i (called at %s:%i)", PRVM_NAME, n, filename, fileline);
        return 0;
index ea85df9e9cb33c5088730874fa1b4fbbcf13c78b..ca1c191cb04c6835578a2ce421aec3fe60d1e385 100644 (file)
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "quakedef.h"
 #include "progsvm.h"
 
-char *prvm_opnames[] =
+const char *prvm_opnames[] =
 {
 "^5DONE",
 
index 541ef0439ea11ef6b811d0017c1c754b7a40c1d6..818637e8467d67100f0e75e6291d403403a40c8e 100644 (file)
@@ -6,7 +6,7 @@
 typedef struct rendermodule_s
 {
        int active; // set by start, cleared by shutdown
-       char *name;
+       const char *name;
        void(*start)(void);
        void(*shutdown)(void);
        void(*newmap)(void);
@@ -22,7 +22,7 @@ void R_Modules_Init(void)
        Cmd_AddCommand("r_restart", R_Modules_Restart, "restarts renderer");
 }
 
-void R_RegisterModule(char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void))
+void R_RegisterModule(const char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void))
 {
        int i;
        for (i = 0;i < MAXRENDERMODULES;i++)
index 9316515c36796c934db814159defea43f948206f..ad838d17046de527a6ed15197c6b56ced1c1298f 100644 (file)
@@ -3,7 +3,7 @@
 #define R_MODULES_H
 
 void R_Modules_Init(void);
-void R_RegisterModule(char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void));
+void R_RegisterModule(const char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void));
 void R_Modules_Start(void);
 void R_Modules_Shutdown(void);
 void R_Modules_NewMap(void);
index 4392b2ed94df92d384d1d51fc2e90a7908dc15cc..899c14544fff79a150db4d3fe26c6f985fb42be9 100644 (file)
@@ -165,7 +165,7 @@ typedef enum r_shadow_rendermode_e
        R_SHADOW_RENDERMODE_VISIBLELIGHTING,
        R_SHADOW_RENDERMODE_SHADOWMAP2D,
        R_SHADOW_RENDERMODE_SHADOWMAPRECTANGLE,
-       R_SHADOW_RENDERMODE_SHADOWMAPCUBESIDE,
+       R_SHADOW_RENDERMODE_SHADOWMAPCUBESIDE
 }
 r_shadow_rendermode_t;
 
index c433a04b1e9906539ebbfff2e06eac8b1e81fa69..fa6d645df128f2386caca4224ab7e628eacf3d3b 100644 (file)
@@ -54,7 +54,7 @@ typedef enum textype_e
        // 4x4 block compressed 15bit color plus 8bit alpha (8 bits per pixel)
        TEXTYPE_DXT5,
        // this represents the same format as the framebuffer, for fast copies
-       TEXTYPE_COLORBUFFER,
+       TEXTYPE_COLORBUFFER
 }
 textype_t;
 
index 7f85446b448c885f9dc57cf52b92daf8be1c3dec..b5dea8db55022347372c356f2d82975a14da15db 100644 (file)
--- a/render.h
+++ b/render.h
@@ -220,7 +220,7 @@ extern unsigned int r_queries[MAX_OCCLUSION_QUERIES];
 extern unsigned int r_numqueries;
 extern unsigned int r_maxqueries;
 
-void R_TimeReport(char *name);
+void R_TimeReport(const char *name);
 
 // r_stain
 void R_Stain(const vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2);
@@ -462,7 +462,7 @@ typedef enum rsurfacepass_e
        RSURFPASS_BASE,
        RSURFPASS_BACKGROUND,
        RSURFPASS_RTLIGHT,
-       RSURFPASS_DEFERREDGEOMETRY,
+       RSURFPASS_DEFERREDGEOMETRY
 }
 rsurfacepass_t;
 
index c3143ac9ba6bf381ff7d77cca0c03aaca73c8f17..ded0473cf38d329dc6618e314e87408de14724ff 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -222,7 +222,7 @@ typedef struct
 static int (*qov_clear) (OggVorbis_File *vf);
 static vorbis_info* (*qov_info) (OggVorbis_File *vf,int link);
 static vorbis_comment* (*qov_comment) (OggVorbis_File *vf,int link);
-static char * (*qvorbis_comment_query) (vorbis_comment *vc, char *tag, int count);
+static char * (*qvorbis_comment_query) (vorbis_comment *vc, const char *tag, int count);
 static int (*qov_open_callbacks) (void *datasource, OggVorbis_File *vf,
                                                                  char *initial, long ibytes,
                                                                  ov_callbacks callbacks);
index 438db2ba8a0a95a189b5ac66f23b883c0496b453..7eb118d7a1c2b64563c037dba1f8282d59f1d13a 100644 (file)
--- a/snd_wav.c
+++ b/snd_wav.c
@@ -65,7 +65,7 @@ static int GetLittleLong(void)
        return val;
 }
 
-static void FindNextChunk(char *name)
+static void FindNextChunk(const char *name)
 {
        while (1)
        {
@@ -91,7 +91,7 @@ static void FindNextChunk(char *name)
        }
 }
 
-static void FindChunk(char *name)
+static void FindChunk(const char *name)
 {
        last_chunk = iff_data;
        FindNextChunk (name);
index d0345bf4b11adc53f15e76d8f251deb4933d6553..336676ff1c567fa93ff465a933938495bf97d388 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -978,14 +978,19 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection)
 {
        client_t                *client;
        int                             i;
-       float                   spawn_parms[NUM_SPAWN_PARMS];
 
        client = svs.clients + clientnum;
 
 // set up the client_t
        if (sv.loadgame)
-               memcpy (spawn_parms, client->spawn_parms, sizeof(spawn_parms));
-       memset (client, 0, sizeof(*client));
+       {
+               float backupparms[NUM_SPAWN_PARMS];
+               memcpy(backupparms, client->spawn_parms, sizeof(backupparms));
+               memset(client, 0, sizeof(*client));
+               memcpy(client->spawn_parms, backupparms, sizeof(backupparms));
+       }
+       else
+               memset(client, 0, sizeof(*client));
        client->active = true;
        client->netconnection = netconnection;
 
@@ -1007,9 +1012,7 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection)
                client->rate = 1000000000;
        client->connecttime = realtime;
 
-       if (sv.loadgame)
-               memcpy (client->spawn_parms, spawn_parms, sizeof(spawn_parms));
-       else
+       if (!sv.loadgame)
        {
                // call the progs to get default spawn parms for the new client
                // set self to world to intentionally cause errors with broken SetNewParms code in some mods
index 35cb8beed1a93bd463875344772d14e7ad04847d..459c73f4e745ffc797d6fbe142d7694158075fce 100644 (file)
@@ -8,7 +8,7 @@
 
 
 
-char *vm_sv_extensions =
+const char *vm_sv_extensions =
 "BX_WAL_SUPPORT "
 "DP_BUTTONCHAT "
 "DP_BUTTONUSE "
index 167121a83bd9381f4fc1541de1268b826b3e3bfe..bddb5d7d153a565201bc239178d936d65ef7e14d 100644 (file)
@@ -1,4 +1,3 @@
-#include "quakedef.h"
 
 #ifdef WIN32
 #include <windows.h>
@@ -13,6 +12,7 @@
 
 #include <signal.h>
 
+#include "quakedef.h"
 
 // =======================================================================
 // General routines
index 903bee1e6868edbe8363ea1791f2f5fdefccfcd8..dd00b48b01cafcaced429677d894d6ba41c22fc2 100644 (file)
@@ -4,7 +4,9 @@
 
 #ifdef WIN32
 # ifdef _WIN64
-#  define _WIN32_WINNT 0x0502
+#  ifndef _WIN32_WINNT
+#   define _WIN32_WINNT 0x0502
+#  endif
    // for SetDllDirectory
 # endif
 # include <windows.h>
diff --git a/vid.h b/vid.h
index 900628071844dd7e757952dc50028d6bef40d3e5..7eecb29592303009e0dfa5ad00521ee284c5cd4f 100644 (file)
--- a/vid.h
+++ b/vid.h
@@ -36,7 +36,7 @@ typedef enum renderpath_e
        RENDERPATH_CGGL,
        RENDERPATH_D3D9,
        RENDERPATH_D3D10,
-       RENDERPATH_D3D11,
+       RENDERPATH_D3D11
 }
 renderpath_t;
 
index 53153e02d5ee267c094db0dccaf842f32f11ec6e..fb98973c15116f187f61aeabb0559bf853157181 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -1208,7 +1208,7 @@ qboolean VID_InitModeGL(viddef_mode_t *mode)
                mainwindow = CreateWindowEx (ExWindowStyle, "DarkPlacesWindowClass", gamename, WindowStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, global_hInstance, NULL);
                if (!mainwindow)
                {
-                       Con_Printf("CreateWindowEx(%d, %s, %s, %d, %d, %d, %d, %d, %p, %p, %p, %p) failed\n", (int)ExWindowStyle, "DarkPlacesWindowClass", gamename, (int)WindowStyle, (int)(rect.left), (int)(rect.top), (int)(rect.right - rect.left), (int)(rect.bottom - rect.top), NULL, NULL, global_hInstance, NULL);
+                       Con_Printf("CreateWindowEx(%d, %s, %s, %d, %d, %d, %d, %d, %p, %p, %p, %p) failed\n", (int)ExWindowStyle, "DarkPlacesWindowClass", gamename, (int)WindowStyle, (int)(rect.left), (int)(rect.top), (int)(rect.right - rect.left), (int)(rect.bottom - rect.top), (void *)NULL, (void *)NULL, (void *)global_hInstance, (void *)NULL);
                        VID_Shutdown();
                        return false;
                }
@@ -1221,14 +1221,14 @@ qboolean VID_InitModeGL(viddef_mode_t *mode)
                if (!pixelformat)
                {
                        VID_Shutdown();
-                       Con_Printf("ChoosePixelFormat(%p, %p) failed\n", baseDC, &pfd);
+                       Con_Printf("ChoosePixelFormat(%p, %p) failed\n", (void *)baseDC, (void *)&pfd);
                        return false;
                }
 
                if (SetPixelFormat(baseDC, pixelformat, &pfd) == false)
                {
                        VID_Shutdown();
-                       Con_Printf("SetPixelFormat(%p, %d, %p) failed\n", baseDC, pixelformat, &pfd);
+                       Con_Printf("SetPixelFormat(%p, %d, %p) failed\n", (void *)baseDC, pixelformat, (void *)&pfd);
                        return false;
                }
 
@@ -1249,7 +1249,7 @@ qboolean VID_InitModeGL(viddef_mode_t *mode)
                if (!qwglMakeCurrent(baseDC, baseRC))
                {
                        VID_Shutdown();
-                       Con_Printf("wglMakeCurrent(%p, %p) failed\n", baseDC, baseRC);
+                       Con_Printf("wglMakeCurrent(%p, %p) failed\n", (void *)baseDC, (void *)baseRC);
                        return false;
                }
 
@@ -1430,7 +1430,7 @@ qboolean VID_InitModeDX(viddef_mode_t *mode, int version)
        mainwindow = CreateWindowEx (ExWindowStyle, "DarkPlacesWindowClass", gamename, WindowStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, global_hInstance, NULL);
        if (!mainwindow)
        {
-               Con_Printf("CreateWindowEx(%d, %s, %s, %d, %d, %d, %d, %d, %p, %p, %p, %p) failed\n", (int)ExWindowStyle, "DarkPlacesWindowClass", gamename, (int)WindowStyle, (int)(rect.left), (int)(rect.top), (int)(rect.right - rect.left), (int)(rect.bottom - rect.top), NULL, NULL, global_hInstance, NULL);
+               Con_Printf("CreateWindowEx(%d, %s, %s, %d, %d, %d, %d, %d, %p, %p, %p, %p) failed\n", (int)ExWindowStyle, "DarkPlacesWindowClass", gamename, (int)WindowStyle, (int)(rect.left), (int)(rect.top), (int)(rect.right - rect.left), (int)(rect.bottom - rect.top), (void *)NULL, (void *)NULL, global_hInstance, (void *)NULL);
                VID_Shutdown();
                return false;
        }
@@ -1513,10 +1513,10 @@ qboolean VID_InitModeDX(viddef_mode_t *mode, int version)
 
        Con_Printf("D3D9 adapter info:\n");
        Con_Printf("Description: %s\n", d3d9adapteridentifier.Description);
-       Con_Printf("DeviceId: %x\n", d3d9adapteridentifier.DeviceId);
-       Con_Printf("DeviceName: %x\n", d3d9adapteridentifier.DeviceName);
+       Con_Printf("DeviceId: %x\n", (unsigned int)d3d9adapteridentifier.DeviceId);
+       Con_Printf("DeviceName: %p\n", d3d9adapteridentifier.DeviceName);
        Con_Printf("Driver: %s\n", d3d9adapteridentifier.Driver);
-       Con_Printf("DriverVersion: %x\n", d3d9adapteridentifier.DriverVersion);
+       Con_Printf("DriverVersion: %08x%08x\n", (unsigned int)d3d9adapteridentifier.DriverVersion.u.HighPart, (unsigned int)d3d9adapteridentifier.DriverVersion.u.LowPart);
        Con_DPrintf("GL_EXTENSIONS: %s\n", gl_extensions);
        Con_DPrintf("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions);
 
@@ -1904,57 +1904,31 @@ static void IN_MouseMove (void)
 
                        /* Look at the element to see what happened */
 
-                       switch (od.dwOfs)
+                       if ((int)od.dwOfs == DIMOFS_X)
+                               in_mouse_x += (LONG) od.dwData;
+                       if ((int)od.dwOfs == DIMOFS_Y)
+                               in_mouse_y += (LONG) od.dwData;
+                       if ((int)od.dwOfs == DIMOFS_Z)
                        {
-                               case DIMOFS_X:
-                                       in_mouse_x += (LONG) od.dwData;
-                                       break;
-
-                               case DIMOFS_Y:
-                                       in_mouse_y += (LONG) od.dwData;
-                                       break;
-
-                               case DIMOFS_Z:
-                                       if((LONG) od.dwData < 0)
-                                       {
-                                               Key_Event (K_MWHEELDOWN, 0, true);
-                                               Key_Event (K_MWHEELDOWN, 0, false);
-                                       }
-                                       else if((LONG) od.dwData > 0)
-                                       {
-                                               Key_Event (K_MWHEELUP, 0, true);
-                                               Key_Event (K_MWHEELUP, 0, false);
-                                       }
-                                       break;
-
-                               case DIMOFS_BUTTON0:
-                                       if (od.dwData & 0x80)
-                                               mstate_di |= 1;
-                                       else
-                                               mstate_di &= ~1;
-                                       break;
-
-                               case DIMOFS_BUTTON1:
-                                       if (od.dwData & 0x80)
-                                               mstate_di |= (1<<1);
-                                       else
-                                               mstate_di &= ~(1<<1);
-                                       break;
-
-                               case DIMOFS_BUTTON2:
-                                       if (od.dwData & 0x80)
-                                               mstate_di |= (1<<2);
-                                       else
-                                               mstate_di &= ~(1<<2);
-                                       break;
-
-                               case DIMOFS_BUTTON3:
-                                       if (od.dwData & 0x80)
-                                               mstate_di |= (1<<3);
-                                       else
-                                               mstate_di &= ~(1<<3);
-                                       break;
+                               if((LONG)od.dwData < 0)
+                               {
+                                       Key_Event(K_MWHEELDOWN, 0, true);
+                                       Key_Event(K_MWHEELDOWN, 0, false);
+                               }
+                               else if((LONG)od.dwData > 0)
+                               {
+                                       Key_Event(K_MWHEELUP, 0, true);
+                                       Key_Event(K_MWHEELUP, 0, false);
+                               }
                        }
+                       if ((int)od.dwOfs == DIMOFS_BUTTON0)
+                               mstate_di = (mstate_di & ~1) | ((od.dwData & 0x80) >> 7);
+                       if ((int)od.dwOfs == DIMOFS_BUTTON1)
+                               mstate_di = (mstate_di & ~2) | ((od.dwData & 0x80) >> 6);
+                       if ((int)od.dwOfs == DIMOFS_BUTTON2)
+                               mstate_di = (mstate_di & ~4) | ((od.dwData & 0x80) >> 5);
+                       if ((int)od.dwOfs == DIMOFS_BUTTON3)
+                               mstate_di = (mstate_di & ~8) | ((od.dwData & 0x80) >> 4);
                }
 
                // perform button actions