From: havoc Date: Thu, 17 Sep 2009 05:31:05 +0000 (+0000) Subject: fix more C++ warnings/errors in MSVC X-Git-Tag: xonotic-v0.1.0preview~1428 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=87e474443b39bf3c118ad442b40ff448bf38420c;p=xonotic%2Fdarkplaces.git fix more C++ warnings/errors in MSVC git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9204 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/snd_win.c b/snd_win.c index fff1e3aa..1228bd7f 100644 --- a/snd_win.c +++ b/snd_win.c @@ -237,7 +237,7 @@ static sndinitstat SndSys_InitDirectSound (const snd_format_t* requested) return SIS_FAILURE; } - pDirectSoundCreate = (void *)GetProcAddress(hInstDS,"DirectSoundCreate"); + pDirectSoundCreate = (HRESULT (__stdcall *)(GUID *, LPDIRECTSOUND *,IUnknown *))GetProcAddress(hInstDS,"DirectSoundCreate"); if (!pDirectSoundCreate) { @@ -473,7 +473,7 @@ static qboolean SndSys_InitMmsystem (const snd_format_t* requested) SndSys_Shutdown (); return false; } - lpData = GlobalLock(hData); + lpData = (HPSTR)GlobalLock(hData); if (!lpData) { Con_Print("Sound: Failed to lock.\n"); diff --git a/sys_win.c b/sys_win.c index ee6ef061..d571dd2a 100644 --- a/sys_win.c +++ b/sys_win.c @@ -302,11 +302,11 @@ char *Sys_GetClipboardData (void) if ((hClipboardData = GetClipboardData (CF_TEXT)) != 0) { - if ((cliptext = GlobalLock (hClipboardData)) != 0) + if ((cliptext = (char *)GlobalLock (hClipboardData)) != 0) { size_t allocsize; allocsize = GlobalSize (hClipboardData) + 1; - data = Z_Malloc (allocsize); + data = (char *)Z_Malloc (allocsize); strlcpy (data, cliptext, allocsize); GlobalUnlock (hClipboardData); } diff --git a/vid_wgl.c b/vid_wgl.c index ed890e70..2b1e9da2 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -395,8 +395,8 @@ void AppActivate(BOOL fActive, BOOL minimize) { static qboolean sound_active = false; // initially blocked by Sys_InitConsole() - vid_activewindow = fActive; - vid_hidden = minimize; + vid_activewindow = fActive != FALSE; + vid_hidden = minimize != FALSE; // enable/disable sound on focus gain/loss if ((!vid_hidden && vid_activewindow) || !snd_mutewhenidle.integer) @@ -1235,8 +1235,8 @@ int VID_InitMode (int fullscreen, int *width, int *height, int bpp, int refreshr if (gl_videosyncavailable) { - vid_usevsync = vid_vsync.integer; - vid_usingvsync = vid_vsync.integer; + vid_usevsync = vid_vsync.integer != 0; + vid_usingvsync = vid_vsync.integer != 0; qwglSwapIntervalEXT (vid_usevsync); } @@ -1308,7 +1308,7 @@ void VID_SetMouse(qboolean fullscreengrab, qboolean relative, qboolean hidecurso newmouseparms[0] = 0; // threshold to double movement (only if accel level is >= 1) newmouseparms[1] = 0; // threshold to quadruple movement (only if accel level is >= 2) newmouseparms[2] = 0; // maximum level of acceleration (0 = off) - restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0); + restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0) != FALSE; } else restore_spi = false; @@ -1384,7 +1384,7 @@ static qboolean IN_InitDInput (void) if (!pDirectInputCreate) { - pDirectInputCreate = (void *)GetProcAddress(hInstDI,"DirectInputCreateA"); + pDirectInputCreate = (HRESULT (__stdcall *)(HINSTANCE,DWORD,LPDIRECTINPUT *,LPUNKNOWN))GetProcAddress(hInstDI,"DirectInputCreateA"); if (!pDirectInputCreate) { @@ -1402,7 +1402,11 @@ static qboolean IN_InitDInput (void) } // obtain an interface to the system mouse device. +#ifdef __cplusplus + hr = IDirectInput_CreateDevice(g_pdi, GUID_SysMouse, &g_pMouse, NULL); +#else hr = IDirectInput_CreateDevice(g_pdi, &GUID_SysMouse, &g_pMouse, NULL); +#endif if (FAILED(hr)) { @@ -1658,7 +1662,7 @@ static void IN_StartupJoystick (void) // save the joystick's number of buttons and POV status joy_numbuttons = jc.wNumButtons; - joy_haspov = jc.wCaps & JOYCAPS_HASPOV; + joy_haspov = (jc.wCaps & JOYCAPS_HASPOV) != 0; // old button and POV states default to no buttons pressed joy_oldbuttonstate = joy_oldpovstate = 0;