]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix more C++ warnings/errors in MSVC
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 17 Sep 2009 05:31:05 +0000 (05:31 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 17 Sep 2009 05:31:05 +0000 (05:31 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9204 d7cf8633-e32d-0410-b094-e92efae38249

snd_win.c
sys_win.c
vid_wgl.c

index fff1e3aaf3c8a7326d9ef37eec78d51405892ce3..1228bd7f1c069b6450682931a7ccf139d8324c1a 100644 (file)
--- 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");
index ee6ef061c219b4204a388f0cd41c62f32c44a2d0..d571dd2a4ba9173659d2f818ec8728140c561326 100644 (file)
--- 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);
                        }
index ed890e702baee9a57f2971632de73ea6bb0a1daf..2b1e9da23b9de875574777319d2d3e66e14b22c2 100644 (file)
--- 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;