From 0e078381b327a6e8c06f923353d5d1d05db3a2d6 Mon Sep 17 00:00:00 2001 From: Lance Date: Thu, 19 May 2011 13:34:07 +0000 Subject: [PATCH] Fixed incorrect pointer types, and some other warning types for GCC and MinGW git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3788 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cd_win.c | 34 ++--- engine/client/cl_parse.c | 2 +- engine/client/in_win.c | 260 ++++++++++++++++++------------------ engine/client/m_mp3.c | 76 +++++------ engine/client/m_multi.c | 22 +-- engine/client/m_options.c | 2 +- engine/client/menu.c | 6 +- engine/client/p_script.c | 2 +- engine/client/r_surf.c | 2 +- engine/client/snd_directx.c | 4 +- engine/client/snd_linux.c | 8 +- engine/client/snd_win.c | 96 ++++++------- engine/client/sys_linux.c | 4 +- engine/client/sys_win.c | 8 +- engine/common/cmd.c | 4 +- engine/common/common.c | 2 +- engine/common/fs_win32.c | 2 +- engine/common/net_wins.c | 4 +- engine/common/plugin.c | 12 +- engine/common/q1bsp.c | 14 +- engine/common/qvm.c | 2 +- engine/d3d/d3d_backend.c | 53 ++++---- engine/d3d/d3d_image.c | 2 +- engine/d3d/vid_d3d.c | 18 +-- engine/gl/gl_alias.c | 2 +- engine/gl/gl_hlmdl.c | 34 ++--- engine/gl/gl_shadow.c | 2 +- engine/gl/gl_vidnt.c | 43 +++--- engine/gl/gl_warp.c | 2 +- engine/http/ftpserver.c | 50 +++---- engine/http/httpserver.c | 16 +-- engine/server/sv_mvd.c | 12 +- engine/server/sv_sys_unix.c | 4 +- engine/server/sv_sys_win.c | 6 +- engine/server/svq3_game.c | 2 +- 35 files changed, 409 insertions(+), 403 deletions(-) diff --git a/engine/client/cd_win.c b/engine/client/cd_win.c index ea401fdaf..52e220064 100644 --- a/engine/client/cd_win.c +++ b/engine/client/cd_win.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the included (GNU.txt) GNU General Public License for more details. @@ -49,7 +49,7 @@ static void CDAudio_Eject(void) dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD_PTR)NULL); if (dwReturn) - Con_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn); + Con_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", (int)dwReturn); } @@ -59,7 +59,7 @@ static void CDAudio_CloseDoor(void) dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD_PTR)NULL); if (dwReturn) - Con_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn); + Con_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", (int)dwReturn); } @@ -123,7 +123,7 @@ void CDAudio_Play(int track, qboolean looping) { return; } - + if (!cdValid) { CDAudio_GetAudioDiskInfo(); @@ -156,7 +156,7 @@ void CDAudio_Play(int track, qboolean looping) dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms); if (dwReturn) { - Con_DPrintf("MCI_STATUS failed (%i)\n", dwReturn); + Con_DPrintf("MCI_STATUS failed (%i)\n", (int)dwReturn); return; } if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) @@ -171,14 +171,14 @@ void CDAudio_Play(int track, qboolean looping) dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms); if (dwReturn) { - Con_DPrintf("MCI_STATUS failed (%i)\n", dwReturn); + Con_DPrintf("MCI_STATUS failed (%i)\n", (int)dwReturn); return; } if (playing) { - if (playTrack == track) - return; + if (playTrack == track) + return; CDAudio_Stop(); } @@ -188,7 +188,7 @@ void CDAudio_Play(int track, qboolean looping) dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD_PTR)(LPVOID) &mciPlayParms); if (dwReturn) { - Con_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); + Con_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", (int)dwReturn); return; } @@ -209,13 +209,13 @@ void CDAudio_Stop(void) if (!enabled) return; - + if (!playing) return; dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (DWORD_PTR)NULL); if (dwReturn) - Con_DPrintf("MCI_STOP failed (%i)", dwReturn); + Con_DPrintf("MCI_STOP failed (%i)", (int)dwReturn); wasPlaying = false; playing = false; @@ -236,7 +236,7 @@ void CDAudio_Pause(void) mciGenericParms.dwCallback = (DWORD_PTR)mainwindow; dwReturn = mciSendCommand(wDeviceID, MCI_PAUSE, 0, (DWORD_PTR)(LPVOID) &mciGenericParms); if (dwReturn) - Con_DPrintf("MCI_PAUSE failed (%i)", dwReturn); + Con_DPrintf("MCI_PAUSE failed (%i)", (int)dwReturn); wasPlaying = playing; playing = false; @@ -250,7 +250,7 @@ void CDAudio_Resume(void) if (!enabled) return; - + if (!cdValid) return; @@ -259,14 +259,14 @@ void CDAudio_Resume(void) if (!bgmvolume.value) return; - + mciPlayParms.dwFrom = MCI_MAKE_TMSF(playTrack, 0, 0, 0); mciPlayParms.dwTo = MCI_MAKE_TMSF(playTrack + 1, 0, 0, 0); mciPlayParms.dwCallback = (DWORD_PTR)mainwindow; dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (DWORD_PTR)(LPVOID) &mciPlayParms); if (dwReturn) { - Con_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); + Con_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", (int)dwReturn); return; } playing = true; @@ -473,7 +473,7 @@ int CDAudio_Init(void) dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (DWORD_PTR) (LPVOID) &mciOpenParms); if (dwReturn) { - Con_Printf("CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn); + Con_Printf("CDAudio_Init: MCI_OPEN failed (%i)\n", (int)dwReturn); return -1; } wDeviceID = mciOpenParms.wDeviceID; @@ -483,7 +483,7 @@ int CDAudio_Init(void) dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR)(LPVOID) &mciSetParms); if (dwReturn) { - Con_Printf("MCI_SET_TIME_FORMAT failed (%i)\n", dwReturn); + Con_Printf("MCI_SET_TIME_FORMAT failed (%i)\n", (int)dwReturn); mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD_PTR)NULL); return -1; } diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 1536405a6..6200fabe4 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -758,7 +758,7 @@ static qboolean CL_CheckModelResources (char *name) // checking for skins in the model - FS_LoadFile(name, &file); + FS_LoadFile(name, (void **)&file); if (!file) { return false; // couldn't load it diff --git a/engine/client/in_win.c b/engine/client/in_win.c index e3497e328..7a3fb4946 100644 --- a/engine/client/in_win.c +++ b/engine/client/in_win.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -180,7 +180,7 @@ LPDIRECTINPUTDEVICE g_pMouse; static HINSTANCE hInstDI; // current DirectInput version in use, 0 means using no DirectInput -static int dinput; +static int dinput; typedef struct MYDATA { LONG lX; // X axis goes here @@ -192,8 +192,8 @@ typedef struct MYDATA { BYTE bButtonD; // Another button goes here #if (DIRECTINPUT_VERSION >= DINPUT_VERSION_DX7) BYTE bButtonE; // DX7 buttons - BYTE bButtonF; - BYTE bButtonG; + BYTE bButtonF; + BYTE bButtonG; BYTE bButtonH; #endif } MYDATA; @@ -602,7 +602,7 @@ int IN_InitDInput (void) if (!hInstDI) { hInstDI = LoadLibrary("dinput.dll"); - + if (hInstDI == NULL) { Con_SafePrintf ("Couldn't load dinput.dll\n"); @@ -764,8 +764,8 @@ void IN_RawInput_MouseDeRegister(void) RAWINPUTDEVICE Rid; // deregister raw input - Rid.usUsagePage = 0x01; - Rid.usUsage = 0x02; + Rid.usUsagePage = 0x01; + Rid.usUsage = 0x02; Rid.dwFlags = RIDEV_REMOVE; Rid.hwndTarget = NULL; @@ -777,8 +777,8 @@ void IN_RawInput_KeyboardDeRegister(void) RAWINPUTDEVICE Rid; // deregister raw input - Rid.usUsagePage = 0x01; - Rid.usUsage = 0x02; + Rid.usUsagePage = 0x01; + Rid.usUsage = 0x02; Rid.dwFlags = RIDEV_REMOVE; Rid.hwndTarget = NULL; @@ -807,11 +807,11 @@ void IN_RawInput_DeInit(void) int IN_RawInput_MouseRegister(void) { // This function registers to receive the WM_INPUT messages - RAWINPUTDEVICE Rid; // Register only for mouse messages from wm_input. + RAWINPUTDEVICE Rid; // Register only for mouse messages from wm_input. //register to get wm_input messages - Rid.usUsagePage = 0x01; - Rid.usUsage = 0x02; + Rid.usUsagePage = 0x01; + Rid.usUsage = 0x02; Rid.dwFlags = RIDEV_NOLEGACY; // adds HID mouse and also ignores legacy mouse messages Rid.hwndTarget = NULL; @@ -826,8 +826,8 @@ int IN_RawInput_KeyboardRegister(void) { RAWINPUTDEVICE Rid; - Rid.usUsagePage = 0x01; - Rid.usUsage = 0x06; + Rid.usUsagePage = 0x01; + Rid.usUsage = 0x06; Rid.dwFlags = RIDEV_NOLEGACY | RIDEV_APPKEYS | RIDEV_NOHOTKEYS; // fetch everything, disable hotkey behavior (should cvar?) Rid.hwndTarget = NULL; @@ -974,7 +974,7 @@ void IN_RawInput_Init(void) continue; switch (pRawInputDeviceList[i].dwType) - { + { case RIM_TYPEMOUSE: // set handle rawmice[rawmicecount].handles.rawinputhandle = pRawInputDeviceList[i].hDevice; @@ -1005,10 +1005,10 @@ void IN_RawInput_Init(void) break; } } - Con_SafePrintf("Raw input type %i: [%i] %s\n", pRawInputDeviceList[i].dwType, i, dname); + Con_SafePrintf("Raw input type %i: [%i] %s\n", (int)pRawInputDeviceList[i].dwType, i, dname); } - + // free the RAWINPUTDEVICELIST Z_Free(pRawInputDeviceList); @@ -1029,8 +1029,8 @@ IN_StartupMouse */ void IN_StartupMouse (void) { - if ( COM_CheckParm ("-nomouse") ) - return; + if ( COM_CheckParm ("-nomouse") ) + return; mouseinitialized = true; @@ -1062,10 +1062,10 @@ void IN_StartupMouse (void) if (mouseparmsvalid) { - if ( m_accel_noforce.value ) + if ( m_accel_noforce.value ) newmouseparms[2] = originalmouseparms[2]; - if ( m_threshold_noforce.value ) + if ( m_threshold_noforce.value ) { newmouseparms[0] = originalmouseparms[0]; newmouseparms[1] = originalmouseparms[1]; @@ -1139,7 +1139,7 @@ void IN_Init (void) Cvar_Register (&in_xflip, "Input stuff"); #endif - // joystick variables + // joystick variables Cvar_Register (&in_joystick, "Joystick variables"); Cvar_Register (&joy_name, "Joystick variables"); @@ -1229,8 +1229,8 @@ void IN_MouseEvent (int mstate) { Key_Event (0, K_MOUSE1 + i, 0, false); } - } - + } + sysmouse.oldbuttons = mstate; } } @@ -1398,7 +1398,7 @@ static void ProcessMouse(mouse_t *mouse, float *movements, int pnum) if (in_mlook.state[pnum] & 1) V_StopPitchDrift (pnum); - + if ( (in_mlook.state[pnum] & 1) && !(in_strafe.state[pnum] & 1)) { cl.viewangles[pnum][PITCH] += m_pitch.value * mouse_y; @@ -1517,59 +1517,59 @@ void IN_MouseMove (float *movements, int pnum) case DIMOFS_BUTTON0: if (od.dwData & 0x80) - sysmouse.buttons |= 1; - else - sysmouse.buttons &= ~1; + sysmouse.buttons |= 1; + else + sysmouse.buttons &= ~1; break; case DIMOFS_BUTTON1: if (od.dwData & 0x80) - sysmouse.buttons |= (1 << 1); - else - sysmouse.buttons &= ~(1 << 1); + sysmouse.buttons |= (1 << 1); + else + sysmouse.buttons &= ~(1 << 1); break; case DIMOFS_BUTTON2: if (od.dwData & 0x80) - sysmouse.buttons |= (1 << 2); - else - sysmouse.buttons &= ~(1 << 2); + sysmouse.buttons |= (1 << 2); + else + sysmouse.buttons &= ~(1 << 2); break; case DIMOFS_BUTTON3: if (od.dwData & 0x80) - sysmouse.buttons |= (1 << 3); - else - sysmouse.buttons &= ~(1 << 3); + sysmouse.buttons |= (1 << 3); + else + sysmouse.buttons &= ~(1 << 3); break; #if (DIRECTINPUT_VERSION >= DINPUT_VERSION_DX7) case DIMOFS_BUTTON4: if (od.dwData & 0x80) - sysmouse.buttons |= (1 << 4); - else - sysmouse.buttons &= ~(1 << 4); + sysmouse.buttons |= (1 << 4); + else + sysmouse.buttons &= ~(1 << 4); break; case DIMOFS_BUTTON5: if (od.dwData & 0x80) - sysmouse.buttons |= (1 << 5); - else - sysmouse.buttons &= ~(1 << 5); + sysmouse.buttons |= (1 << 5); + else + sysmouse.buttons &= ~(1 << 5); break; case DIMOFS_BUTTON6: if (od.dwData & 0x80) - sysmouse.buttons |= (1 << 6); - else - sysmouse.buttons &= ~(1 << 6); + sysmouse.buttons |= (1 << 6); + else + sysmouse.buttons &= ~(1 << 6); break; case DIMOFS_BUTTON7: if (od.dwData & 0x80) - sysmouse.buttons |= (1 << 7); - else - sysmouse.buttons &= ~(1 << 7); + sysmouse.buttons |= (1 << 7); + else + sysmouse.buttons &= ~(1 << 7); break; #endif } @@ -1687,31 +1687,31 @@ void IN_RawInput_MouseRead(void) } // buttons - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_1_DOWN) + if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_1_DOWN) Key_Event(pnum, K_MOUSE1, 0, true); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_1_UP) + if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_1_UP) Key_Event(pnum, K_MOUSE1, 0, false); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_2_DOWN) + if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_2_DOWN) Key_Event(pnum, K_MOUSE2, 0, true); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_2_UP) + if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_2_UP) Key_Event(pnum, K_MOUSE2, 0, false); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_3_DOWN) + if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_3_DOWN) Key_Event(pnum, K_MOUSE3, 0, true); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_3_UP) + if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_3_UP) Key_Event(pnum, K_MOUSE3, 0, false); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_4_DOWN) + if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_4_DOWN) Key_Event(pnum, K_MOUSE4, 0, true); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_4_UP) + if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_4_UP) Key_Event(pnum, K_MOUSE4, 0, false); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_5_DOWN) + if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_5_DOWN) Key_Event(pnum, K_MOUSE5, 0, true); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_5_UP) + if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_5_UP) Key_Event(pnum, K_MOUSE5, 0, false); // mouse wheel if (raw->data.mouse.usButtonFlags & RI_MOUSE_WHEEL) { // If the current message has a mouse_wheel message - if ((SHORT)raw->data.mouse.usButtonData > 0) + if ((SHORT)raw->data.mouse.usButtonData > 0) { Key_Event(pnum, K_MWHEELUP, 0, true); Key_Event(pnum, K_MWHEELUP, 0, false); @@ -1780,7 +1780,7 @@ void IN_RawInput_Read(HANDLE in_device_handle) int dwSize; // get raw input - if ((*_GRID)((HRAWINPUT)in_device_handle, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)) == -1) + if ((*_GRID)((HRAWINPUT)in_device_handle, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)) == -1) { Con_Printf("Raw input: unable to add to get size of raw input header.\n"); return; @@ -1791,7 +1791,7 @@ void IN_RawInput_Read(HANDLE in_device_handle) ribuffersize = dwSize; raw = (RAWINPUT *)BZ_Realloc(raw, dwSize); } - + if ((*_GRID)((HRAWINPUT)in_device_handle, RID_INPUT, raw, &dwSize, sizeof(RAWINPUTHEADER)) != dwSize ) { Con_Printf("Raw input: unable to add to get raw input header.\n"); return; @@ -1822,24 +1822,24 @@ void IN_ClearStates (void) } -/* -=============== -IN_StartupJoystick -=============== -*/ -void IN_StartupJoystick (void) -{ +/* +=============== +IN_StartupJoystick +=============== +*/ +void IN_StartupJoystick (void) +{ int numdevs; JOYCAPS jc; MMRESULT mmr; - + // assume no joystick - joy_avail = false; + joy_avail = false; // abort startup if user requests no joystick - if ( COM_CheckParm ("-nojoy") ) - return; - + if ( COM_CheckParm ("-nojoy") ) + return; + // verify joystick driver is present if ((numdevs = joyGetNumDevs ()) == 0) { @@ -1858,7 +1858,7 @@ void IN_StartupJoystick (void) if ((mmr = joyGetPosEx (joy_id, &ji)) == JOYERR_NOERROR) break; - } + } // abort startup if we didn't find a valid joystick if (mmr != JOYERR_NOERROR) @@ -1872,7 +1872,7 @@ void IN_StartupJoystick (void) memset (&jc, 0, sizeof(jc)); if ((mmr = joyGetDevCaps (joy_id, &jc, sizeof(jc))) != JOYERR_NOERROR) { - Con_Printf ("joystick not found -- invalid joystick capabilities (%x)\n", mmr); + Con_Printf ("joystick not found -- invalid joystick capabilities (%x)\n", mmr); return; } @@ -1886,10 +1886,10 @@ void IN_StartupJoystick (void) // mark the joystick as available and advanced initialization not completed // this is needed as cvars are not available during initialization - joy_avail = true; + joy_avail = true; joy_advancedinit = false; - Con_Printf ("joystick detected\n"); + Con_Printf ("joystick detected\n"); } @@ -2006,7 +2006,7 @@ void IN_Commands (void) return; } - + // loop through the joystick buttons // key a joystick event or auxillary event for higher number buttons for each state change buttonstate = ji.dwButtons; @@ -2061,11 +2061,11 @@ void IN_Commands (void) } -/* -=============== +/* +=============== IN_ReadJoystick -=============== -*/ +=============== +*/ qboolean IN_ReadJoystick (void) { @@ -2118,9 +2118,9 @@ void IN_JoyMove (float *movements, int pnum) // verify joystick is available and that the user wants to use it if (!joy_avail || !in_joystick.value) { - return; + return; } - + // collect the joystick data, if possible if (IN_ReadJoystick () != true) { @@ -2157,7 +2157,7 @@ void IN_JoyMove (float *movements, int pnum) } } - // convert range from -32768..32767 to -1..1 + // convert range from -32768..32767 to -1..1 fAxisValue /= 32768.0; switch (dwAxisMap[i]) @@ -2167,7 +2167,7 @@ void IN_JoyMove (float *movements, int pnum) { // user wants forward control to become look control if (fabs(fAxisValue) > joy_pitchthreshold.value) - { + { // if mouse invert is on, invert the joystick pitch value // only absolute control support here (joy_advanced is false) if (m_pitch.value < 0.0) @@ -2270,49 +2270,49 @@ void IN_JoyMove (float *movements, int pnum) CL_ClampPitch(pnum); } -static qbyte scantokey[128] = - { -// 0 1 2 3 4 5 6 7 -// 8 9 A B C D E F - 0 , 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '[', ']', 13 , K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', - '\'', '`', K_SHIFT, '\\', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '/', K_SHIFT, '*', - K_ALT, ' ', K_CAPSLOCK, K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCRLCK, K_HOME, - K_UPARROW, K_PGUP, '-', K_LEFTARROW,'5', K_RIGHTARROW,'+', K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, - K_F12, 0, 0, 0, 0, 0, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 // 7 - }; +static qbyte scantokey[128] = + { +// 0 1 2 3 4 5 6 7 +// 8 9 A B C D E F + 0 , 27, '1', '2', '3', '4', '5', '6', + '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '[', ']', 13 , K_CTRL, 'a', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', + '\'', '`', K_SHIFT, '\\', 'z', 'x', 'c', 'v', // 2 + 'b', 'n', 'm', ',', '.', '/', K_SHIFT, '*', + K_ALT, ' ', K_CAPSLOCK, K_F1, K_F2, K_F3, K_F4, K_F5, // 3 + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCRLCK, K_HOME, + K_UPARROW, K_PGUP, '-', K_LEFTARROW,'5', K_RIGHTARROW,'+', K_END, // 4 + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, + K_F12, 0, 0, 0, 0, 0, 0, 0, // 5 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, // 6 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 // 7 + }; /* -static qbyte shiftscantokey[128] = - { -// 0 1 2 3 4 5 6 7 -// 8 9 A B C D E F - 0 , 27, '!', '@', '#', '$', '%', '^', - '&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0 - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', '{', '}', 13 , K_CTRL,'A', 'S', // 1 - 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', - '"' , '~', K_SHIFT,'|', 'Z', 'X', 'C', 'V', // 2 - 'B', 'N', 'M', '<', '>', '?', K_SHIFT,'*', - K_ALT,' ', K_CAPSLOCK , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE , K_SCRLCK , K_HOME, - K_UPARROW,K_PGUP,'_',K_LEFTARROW,'%',K_RIGHTARROW,'+',K_END, //4 - K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, - K_F12, 0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 - }; +static qbyte shiftscantokey[128] = + { +// 0 1 2 3 4 5 6 7 +// 8 9 A B C D E F + 0 , 27, '!', '@', '#', '$', '%', '^', + '&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0 + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', + 'O', 'P', '{', '}', 13 , K_CTRL,'A', 'S', // 1 + 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', + '"' , '~', K_SHIFT,'|', 'Z', 'X', 'C', 'V', // 2 + 'B', 'N', 'M', '<', '>', '?', K_SHIFT,'*', + K_ALT,' ', K_CAPSLOCK , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE , K_SCRLCK , K_HOME, + K_UPARROW,K_PGUP,'_',K_LEFTARROW,'%',K_RIGHTARROW,'+',K_END, //4 + K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, + K_F12, 0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 + }; */ /* @@ -2423,6 +2423,6 @@ void IN_TranslateKeyEvent(WPARAM wParam, LPARAM lParam, qboolean down, int pnum) unicode = wchars[0]; } } - + Key_Event (pnum, qcode, unicode, down); } diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index 800dbc05b..293e621ef 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -79,7 +79,7 @@ qboolean WinAmp_StartTune(char *name) SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE); SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)0,IPC_STARTPLAY ); - + for (trys = 1000; trys; trys--) { pos = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTTIME); @@ -100,7 +100,7 @@ void WinAmp_Think(void) int len; if (!WinAmp_GetHandle()) - return; + return; pos = bgmvolume.value*255; if (pos > 255) pos = 255; @@ -117,7 +117,7 @@ void WinAmp_Think(void) } #endif void Media_Seek (float time) -{ +{ #ifdef WINAMP if (media_hijackwinamp.value) { @@ -233,7 +233,7 @@ qboolean Media_FakeTrack(int i, qboolean loop) return true; } } - + fakecdactive = false; return false; } @@ -363,14 +363,14 @@ void M_Media_Draw (void) if (media_repeat.value) MP_Hightlight (12, y, "Repeat on", op == selectedoption); else - MP_Hightlight (12, y, "Repeat off", op == selectedoption); + MP_Hightlight (12, y, "Repeat off", op == selectedoption); } else { if (media_repeat.value) MP_Hightlight (12, y, "(Repeat on)", op == selectedoption); else - MP_Hightlight (12, y, "(Repeat off)", op == selectedoption); + MP_Hightlight (12, y, "(Repeat off)", op == selectedoption); } y+=8; break; @@ -395,12 +395,12 @@ int Com_CompleatenameCallback(const char *name, int size, void *data) { if (*compleatenamename) compleatenamemultiple = true; - Q_strncpyz(compleatenamename, name, sizeof(compleatenamename)); + Q_strncpyz(compleatenamename, name, sizeof(compleatenamename)); return true; } void Com_CompleateOSFileName(char *name) -{ +{ char *ending; compleatenamemultiple = false; @@ -419,7 +419,7 @@ void Com_CompleateOSFileName(char *name) void M_Media_Key (int key) { - int dir; + int dir; if (key == K_ESCAPE) M_Menu_Main_f(); else if (key == K_RIGHTARROW || key == K_LEFTARROW) @@ -536,7 +536,7 @@ void M_Media_Key (int key) case MEDIA_ADDLIST: if (*media_iofilename) Media_LoadTrackNames(media_iofilename); - break; + break; case MEDIA_SHUFFLE: Cvar_Set(&media_shuffle, media_shuffle.value?"0":"1"); break; @@ -548,7 +548,7 @@ void M_Media_Key (int key) { media_playing = true; nexttrack = selectedoption; - Media_Next_f(); + Media_Next_f(); } break; } @@ -560,7 +560,7 @@ void M_Media_Key (int key) if (key == K_TAB) Com_CompleateOSFileName(media_iofilename); else if (key == K_BACKSPACE) - { + { dir = strlen(media_iofilename); if (dir) media_iofilename[dir-1] = '\0'; @@ -579,8 +579,8 @@ void M_Media_Key (int key) tr=tracks; while(tr) { - if (num == selectedoption) - break; + if (num == selectedoption) + break; prevtrack = tr; tr=tr->next; @@ -590,7 +590,7 @@ void M_Media_Key (int key) return; if (key == K_BACKSPACE) - { + { dir = strlen(tr->nicename); if (dir) tr->nicename[dir-1] = '\0'; @@ -611,7 +611,7 @@ void M_Media_Key (int key) //safeprints only. void Media_LoadTrackNames (char *listname) -{ +{ char *lineend; char *len; char *filename; @@ -662,7 +662,7 @@ void Media_LoadTrackNames (char *listname) snprintf(newtrack->filename, sizeof(newtrack->filename)-1, "/mnt/%c/%s", filename[0]-'A'+'a', filename+3); while((filename = strchr(newtrack->filename, '\\'))) *filename = '/'; - + } else #endif @@ -686,7 +686,7 @@ void Media_LoadTrackNames (char *listname) if (!lineend && !*data) break; - lineend[-1]='\0'; + lineend[-1]='\0'; data = lineend+1; newtrack = Z_Malloc(sizeof(mediatrack_t)); @@ -912,10 +912,10 @@ qboolean Media_WinAvi_DecodeFrame(cin_t *cin, qboolean nosound) lpbi = (LPBITMAPINFOHEADER)AVIStreamGetFrame(cin->avi.pgf, cin->currentframe); // Grab Data From The AVI Stream cin->currentframe++; if (!lpbi || lpbi->biBitCount != 24)//oops - { + { SCR_SetUpToDrawConsole(); R2D_ConsoleBackground(0, vid.height, true); - Draw_FunString(0, 0, "Video stream is corrupt\n"); + Draw_FunString(0, 0, "Video stream is corrupt\n"); } else { @@ -940,7 +940,7 @@ qboolean Media_WinAvi_DecodeFrame(cin_t *cin, qboolean nosound) AVIStreamRead(cin->avi.pavisound, cin->avi.soundpos, AVISTREAMREAD_CONVENIENT, pBuffer, lSize, NULL, &samples); - S_RawAudio(-1, pBuffer, cin->avi.pWaveFormat->nSamplesPerSec, samples, cin->avi.pWaveFormat->nChannels, 2); + S_RawAudio(-1, pBuffer, cin->avi.pWaveFormat->nSamplesPerSec, samples, cin->avi.pWaveFormat->nChannels, 2); } return true; } @@ -1070,7 +1070,7 @@ qboolean Media_Roq_DecodeFrame (cin_t *cin, qboolean nosound) return true; } else if (curtimenextframetime || roq_read_frame(cin->roq.roqfilm)==1) //0 if end, -1 if error, 1 if success - { + { //#define LIMIT(x) ((x)<0xFFFF)?(x)>>16:0xFF; #define LIMIT(x) ((((x) > 0xffffff) ? 0xff0000 : (((x) <= 0xffff) ? 0 : (x) & 0xff0000)) >> 16) unsigned char *pa=cin->roq.roqfilm->y[0]; @@ -1099,7 +1099,7 @@ qboolean Media_Roq_DecodeFrame (cin_t *cin, qboolean nosound) { //convert it properly. for(x = 0; x < num_columns; ++x) { - + int r, g, b, y1, y2, u, v, t; y1 = *(pa++); y2 = *(pa++); u = pb[x] - 128; @@ -1128,7 +1128,7 @@ qboolean Media_Roq_DecodeFrame (cin_t *cin, qboolean nosound) } if(y & 0x01) { pb += num_columns; pc += num_columns; } - } + } } cin->outunchanged = false; @@ -1231,11 +1231,11 @@ cin_t *Media_Static_TryLoad(char *name) qbyte *file; sprintf(fullname, "%s", name); - fsize = FS_LoadFile(fullname, &file); + fsize = FS_LoadFile(fullname, (void **)&file); if (!file) { sprintf(fullname, "pics/%s", name); - fsize = FS_LoadFile(fullname, &file); + fsize = FS_LoadFile(fullname, (void **)&file); if (!file) return NULL; } @@ -1977,7 +1977,7 @@ void Media_RecordFrame (void) return; } //ask gl for it - qglReadPixels (0, 0, vid.pixelwidth, vid.pixelheight, GL_RGB, GL_UNSIGNED_BYTE, framebuffer ); + qglReadPixels (0, 0, vid.pixelwidth, vid.pixelheight, GL_RGB, GL_UNSIGNED_BYTE, framebuffer ); // swap rgb to bgr c = vid.pixelwidth*vid.pixelheight*3; @@ -1989,7 +1989,7 @@ void Media_RecordFrame (void) } //write it hr = AVIStreamWrite(recordavi_video_stream, captureframe++, 1, framebuffer, vid.pixelwidth*vid.pixelheight * 3, ((captureframe%15) == 0)?AVIIF_KEYFRAME:0, NULL, NULL); - if (FAILED(hr)) Con_Printf("Recoring error\n"); + if (FAILED(hr)) Con_Printf("Recoring error\n"); } #endif /* WINAVI */ break; @@ -2151,7 +2151,7 @@ void Media_StopRecordFilm_f (void) if (recordavi_uncompressed_video_stream) AVIStreamRelease(recordavi_uncompressed_video_stream); if (recordavi_compressed_video_stream) AVIStreamRelease(recordavi_compressed_video_stream); if (recordavi_uncompressed_audio_stream) AVIStreamRelease(recordavi_uncompressed_audio_stream); - if (recordavi_file) AVIFileRelease(recordavi_file); + if (recordavi_file) AVIFileRelease(recordavi_file); recordavi_uncompressed_video_stream=NULL; recordavi_compressed_video_stream = NULL; @@ -2230,7 +2230,7 @@ void Media_RecordFilm_f (void) if (capturetype == CT_NONE) { - + } else if (capturetype == CT_SCREENSHOT) { @@ -2308,7 +2308,7 @@ void Media_RecordFilm_f (void) stream_header.fccHandler = recordavi_codec_fourcc; stream_header.dwScale = 100; stream_header.dwRate = (unsigned long)(0.5 + 100.0/recordavi_frametime); - SetRect(&stream_header.rcFrame, 0, 0, vid.pixelwidth, vid.pixelheight); + SetRect(&stream_header.rcFrame, 0, 0, vid.pixelwidth, vid.pixelheight); hr = AVIFileCreateStream(recordavi_file, &recordavi_uncompressed_video_stream, &stream_header); if (FAILED(hr)) @@ -2322,7 +2322,7 @@ void Media_RecordFilm_f (void) { AVICOMPRESSOPTIONS opts; AVICOMPRESSOPTIONS* aopts[1] = { &opts }; - memset(&opts, 0, sizeof(opts)); + memset(&opts, 0, sizeof(opts)); opts.fccType = stream_header.fccType; opts.fccHandler = recordavi_codec_fourcc; // Make the stream according to compression @@ -2334,7 +2334,7 @@ void Media_RecordFilm_f (void) return; } } - + hr = AVIStreamSetFormat(recordavi_video_stream, 0, &bitmap_info_header, sizeof(BITMAPINFOHEADER)); if (FAILED(hr)) @@ -2352,15 +2352,15 @@ void Media_RecordFilm_f (void) if (capturesound.value) { memset(&recordavi_wave_format, 0, sizeof(WAVEFORMATEX)); - recordavi_wave_format.wFormatTag = WAVE_FORMAT_PCM; + recordavi_wave_format.wFormatTag = WAVE_FORMAT_PCM; recordavi_wave_format.nChannels = capturesoundchannels.value; recordavi_wave_format.nSamplesPerSec = snd_speed; recordavi_wave_format.wBitsPerSample = capturesoundbits.value; - recordavi_wave_format.nBlockAlign = recordavi_wave_format.wBitsPerSample/8 * recordavi_wave_format.nChannels; - recordavi_wave_format.nAvgBytesPerSec = recordavi_wave_format.nSamplesPerSec * recordavi_wave_format.nBlockAlign; - recordavi_wave_format.cbSize = 0; + recordavi_wave_format.nBlockAlign = recordavi_wave_format.wBitsPerSample/8 * recordavi_wave_format.nChannels; + recordavi_wave_format.nAvgBytesPerSec = recordavi_wave_format.nSamplesPerSec * recordavi_wave_format.nBlockAlign; + recordavi_wave_format.cbSize = 0; + - memset(&stream_header, 0, sizeof(stream_header)); stream_header.fccType = streamtypeAUDIO; stream_header.dwScale = recordavi_wave_format.nBlockAlign; diff --git a/engine/client/m_multi.c b/engine/client/m_multi.c index b42d70c45..54fc89013 100644 --- a/engine/client/m_multi.c +++ b/engine/client/m_multi.c @@ -16,14 +16,14 @@ void M_Menu_MultiPlayer_f (void) mpic_t *p; int mgt; - p = NULL; + p = NULL; key_dest = key_menu; m_state = m_complex; mgt = M_GameType(); menu = M_CreateMenu(0); - + if (mgt == MGT_QUAKE2) { MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_multiplayer"); @@ -81,7 +81,7 @@ void M_Menu_MultiPlayer_f (void) } } - b = MC_AddConsoleCommand(menu, 72, 32, "", "menu_slist\n"); + b = MC_AddConsoleCommand(menu, 72, 32, "", "menu_slist\n"); menu->selecteditem = (menuoption_t*)b; b->common.height = 20; b->common.width = p?p->width:320; @@ -317,7 +317,7 @@ void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu) R2D_ScalePic (x-12, y-8, 72, 72, p); M_BuildTranslationTable(info->topcolour, info->lowercolour, translationTable); - R2D_TransPicTranslate (x, y, info->tiwidth, info->tiheight, info->translationimage, translationTable); + R2D_TransPicTranslate (x, y, info->tiwidth, info->tiheight, info->translationimage, translationTable); } void M_Menu_Setup_f (void) @@ -354,7 +354,7 @@ void M_Menu_Setup_f (void) menu = M_CreateMenu(sizeof(setupmenu_t)); info = menu->data; -// menu->key = MC_Main_Key; +// menu->key = MC_Main_Key; MC_AddPicture(menu, 0, 4, 38, 166, "pics/m_main_plaque"); p = R2D_SafeCachePic("pics/m_main_logo"); @@ -364,7 +364,7 @@ void M_Menu_Setup_f (void) menu->selecteditem = (menuoption_t*) (info->nameedit = MC_AddEdit(menu, 64, 40, "Your name", name.string)); - (info->modeledit = MC_AddCvarCombo(menu, 64, 72, "model", &skin, modeloptions, modeloptions)); + (info->modeledit = MC_AddCvarCombo(menu, 64, 72, "model", &skin, (const char **)modeloptions, (const char **)modeloptions)); info->modeledit->selectedoption = !strncmp(skin.string, "female", 6); cu = MC_AddCustom(menu, 172-16, 88+16, NULL); cu->draw = MSetupQ2_TransDraw; @@ -401,9 +401,9 @@ void M_Menu_Setup_f (void) key_dest = key_menu; m_state = m_complex; - menu = M_CreateMenu(sizeof(setupmenu_t)); + menu = M_CreateMenu(sizeof(setupmenu_t)); info = menu->data; - + MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp"); MC_AddCenterPicture(menu, 4, 24, "gfx/p_multi.lmp"); @@ -416,7 +416,7 @@ void M_Menu_Setup_f (void) if (mgt == MGT_HEXEN2) { cvar_t *pc = Cvar_Get("cl_playerclass", "1", CVAR_USERINFO|CVAR_ARCHIVE, "Hexen2"); - (info->classedit = MC_AddCombo(menu, 64, 72, "Your class", classnames, pc->ival-1)); + (info->classedit = MC_AddCombo(menu, 64, 72, "Your class", (const char **)classnames, pc->ival-1)); } else (info->skinedit = MC_AddEdit(menu, 64, 72, "Your skin", skin.string)); @@ -483,7 +483,7 @@ typedef struct { menucombo_t *teamplay; menucombo_t *skill; menucombo_t *timelimit; - menucombo_t *fraglimit; + menucombo_t *fraglimit; menuedit_t *mapnameedit; menucheck_t *rundedicated; @@ -601,7 +601,7 @@ void M_Menu_GameOptions_f (void) key_dest = key_menu; m_state = m_complex; - menu = M_CreateMenu(sizeof(newmultimenu_t)); + menu = M_CreateMenu(sizeof(newmultimenu_t)); info = menu->data; mgt = M_GameType(); diff --git a/engine/client/m_options.c b/engine/client/m_options.c index 796192fff..c27d32e93 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -372,7 +372,7 @@ void M_Menu_Particles_f (void) MC_AddWhiteText(menu, 16, y, " ", false); y+=8; y+=8; - MC_AddCvarCombo(menu, 16, y, " particle system", &r_particlesystem, psystemopts, psystemvals);y+=8; + MC_AddCvarCombo(menu, 16, y, " particle system", &r_particlesystem, (const char **)psystemopts, (const char **)psystemvals);y+=8; //fixme: hide the rest of the options if r_particlesystem==classic MC_AddConsoleCommand(menu, 16, y, " Choose particle set", "menu_particlesets");y+=8; // MC_AddSlider(menu, 16, y, " exp spark count", &r_particles_in_explosion, 16, 1024);y+=8; diff --git a/engine/client/menu.c b/engine/client/menu.c index 3f4c3ee03..b3c54b311 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -68,9 +68,9 @@ void M_BuildTranslationTable(int top, int bottom, qbyte *translationTable) sourceB = colorB + (bottom * 256); for(i=0;i<256;i++) { - if (bottom > 0 && (colorB[i] != 255)) + if (bottom > 0 && (colorB[i] != 255)) translationTable[i] = sourceB[i]; - else if (top > 0 && (colorA[i] != 255)) + else if (top > 0 && (colorA[i] != 255)) translationTable[i] = sourceA[i]; else translationTable[i] = i; @@ -401,7 +401,7 @@ void M_Menu_Keys_f (void) "3", "4" }; - MC_AddCvarCombo(menu, 16, y, "Force client", &cl_forcesplitclient, texts, values); + MC_AddCvarCombo(menu, 16, y, "Force client", &cl_forcesplitclient, (const char **)texts, (const char **)values); y+=8; } diff --git a/engine/client/p_script.c b/engine/client/p_script.c index ff34315ca..5883f7874 100644 --- a/engine/client/p_script.c +++ b/engine/client/p_script.c @@ -59,7 +59,7 @@ struct extern qbyte *host_basepal; extern particleengine_t pe_classic; -extern particleengine_t *fallback = NULL; +particleengine_t *fallback = NULL; //does this really need to be 'extern'? #define FALLBACKBIAS 0x1000000 static int pt_pointfile = P_INVALID; diff --git a/engine/client/r_surf.c b/engine/client/r_surf.c index 35a5742f4..0168c649f 100644 --- a/engine/client/r_surf.c +++ b/engine/client/r_surf.c @@ -2529,8 +2529,8 @@ void Surf_BuildLightmaps (void) lightmap_bgra = true; #endif break; -#ifdef GLQUAKE case QR_OPENGL: +#ifdef GLQUAKE /*favour bgra if the gpu supports it, otherwise use rgb only if it'll be used*/ lightmap_bgra = false; if (gl_config.gles) diff --git a/engine/client/snd_directx.c b/engine/client/snd_directx.c index e56198003..2fbd3e283 100644 --- a/engine/client/snd_directx.c +++ b/engine/client/snd_directx.c @@ -486,7 +486,7 @@ inside the recirculating dma buffer, so the mixing code will know how many sample are required to fill it up. =============== */ -static int DSOUND_GetDMAPos(soundcardinfo_t *sc) +static unsigned int DSOUND_GetDMAPos(soundcardinfo_t *sc) { DWORD mmtime; int s; @@ -528,7 +528,7 @@ Direct-Sound support */ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum) { - extern cvar_t snd_eax, snd_inactive; + extern cvar_t snd_inactive; // snd_eax unused DSBUFFERDESC dsbuf; DSBCAPS dsbcaps; DWORD dwSize, dwWrite; diff --git a/engine/client/snd_linux.c b/engine/client/snd_linux.c index 400144b11..87fa10345 100644 --- a/engine/client/snd_linux.c +++ b/engine/client/snd_linux.c @@ -158,7 +158,7 @@ static int OSS_InitCard(soundcardinfo_t *sc, int cardnum) return 0; } Q_strncpyz(sc->name, snddev, sizeof(sc->name)); - + //reset it rc = ioctl(sc->audio_fd, SNDCTL_DSP_RESET, 0); if (rc < 0) @@ -254,7 +254,7 @@ static int OSS_InitCard(soundcardinfo_t *sc, int cardnum) //choose speed //use the default - menu set value. tmp = sc->sn.speed; - if (ioctl(sc->audio_fd, SNDCTL_DSP_SPEED, &tmp) != 0) + if (ioctl(sc->audio_fd, SNDCTL_DSP_SPEED, &tmp) != 0) { //humph, default didn't work. Go for random preset ones that should work. for (i=0 ; inext) @@ -110,7 +110,7 @@ static void WAV_Shutdown (soundcardinfo_t *sc) if (wh->hWaveHdr) { - GlobalUnlock(wh->hWaveHdr); + GlobalUnlock(wh->hWaveHdr); GlobalFree(wh->hWaveHdr); } @@ -145,7 +145,7 @@ inside the recirculating dma buffer, so the mixing code will know how many sample are required to fill it up. =============== */ -static int WAV_GetDMAPos(soundcardinfo_t *sc) +static unsigned int WAV_GetDMAPos(soundcardinfo_t *sc) { int s; @@ -205,19 +205,19 @@ static void WAV_Submit(soundcardinfo_t *sc, int start, int end) h = wh->lpWaveHdr + ( sc->snd_sent&WAV_MASK ); sc->snd_sent++; - /* - * Now the data block can be sent to the output device. The - * waveOutWrite function returns immediately and waveform - * data is sent to the output device in the background. - */ - wResult = waveOutWrite(wh->hWaveOut, h, sizeof(WAVEHDR)); + /* + * Now the data block can be sent to the output device. The + * waveOutWrite function returns immediately and waveform + * data is sent to the output device in the background. + */ + wResult = waveOutWrite(wh->hWaveOut, h, sizeof(WAVEHDR)); if (wResult != MMSYSERR_NOERROR) - { + { Con_SafePrintf ("Failed to write block to device\n"); WAV_Shutdown (sc); - return; - } + return; + } } } @@ -232,7 +232,7 @@ Crappy windows multimedia base */ int WAV_InitCard (soundcardinfo_t *sc, int cardnum) { - WAVEFORMATEX format; + WAVEFORMATEX format; int i; HRESULT hr; wavhandle_t *wh; @@ -241,13 +241,13 @@ int WAV_InitCard (soundcardinfo_t *sc, int cardnum) return 2; //we only support one card, at the moment. wh = sc->handle = Z_Malloc(sizeof(wavhandle_t)); - + sc->snd_sent = 0; sc->snd_completed = 0; if (sc->sn.speed > 48000) // limit waveout to 48000 until that buffer issue gets solved sc->sn.speed = 48000; - + memset (&format, 0, sizeof(format)); format.wFormatTag = WAVE_FORMAT_PCM; format.nChannels = sc->sn.numchannels; @@ -257,9 +257,9 @@ int WAV_InitCard (soundcardinfo_t *sc, int cardnum) *format.wBitsPerSample / 8; format.cbSize = 0; format.nAvgBytesPerSec = format.nSamplesPerSec - *format.nBlockAlign; - - /* Open a waveform device for output using window callback. */ + *format.nBlockAlign; + + /* Open a waveform device for output using window callback. */ while ((hr = waveOutOpen((LPHWAVEOUT)&wh->hWaveOut, WAVE_MAPPER, &format, 0, 0L, CALLBACK_NULL)) != MMSYSERR_NOERROR) @@ -269,7 +269,7 @@ int WAV_InitCard (soundcardinfo_t *sc, int cardnum) if (hr == WAVERR_BADFORMAT) Con_SafePrintf (CON_ERROR "waveOutOpen failed, format not supported\n"); else - Con_SafePrintf (CON_ERROR "waveOutOpen failed, return code %i\n", hr); + Con_SafePrintf (CON_ERROR "waveOutOpen failed, return code %i\n", (int)hr); WAV_Shutdown (sc); return false; } @@ -285,61 +285,61 @@ int WAV_InitCard (soundcardinfo_t *sc, int cardnum) WAV_Shutdown (sc); return false; // } - } + } - /* - * Allocate and lock memory for the waveform data. The memory - * for waveform data must be globally allocated with - * GMEM_MOVEABLE and GMEM_SHARE flags. + /* + * Allocate and lock memory for the waveform data. The memory + * for waveform data must be globally allocated with + * GMEM_MOVEABLE and GMEM_SHARE flags. - */ + */ wh->gSndBufSize = WAV_BUFFERS*WAV_BUFFER_SIZE; - wh->hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, wh->gSndBufSize); - if (!wh->hData) - { + wh->hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, wh->gSndBufSize); + if (!wh->hData) + { Con_SafePrintf (CON_ERROR "Sound: Out of memory.\n"); WAV_Shutdown (sc); - return false; + return false; } wh->lpData = GlobalLock(wh->hData); if (!wh->lpData) - { + { Con_SafePrintf (CON_ERROR "Sound: Failed to lock.\n"); WAV_Shutdown (sc); - return false; - } + return false; + } memset (wh->lpData, 0, wh->gSndBufSize); - /* - * Allocate and lock memory for the header. This memory must - * also be globally allocated with GMEM_MOVEABLE and - * GMEM_SHARE flags. - */ - wh->hWaveHdr = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, - (DWORD) sizeof(WAVEHDR) * WAV_BUFFERS); + /* + * Allocate and lock memory for the header. This memory must + * also be globally allocated with GMEM_MOVEABLE and + * GMEM_SHARE flags. + */ + wh->hWaveHdr = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, + (DWORD) sizeof(WAVEHDR) * WAV_BUFFERS); if (wh->hWaveHdr == NULL) - { + { Con_SafePrintf (CON_ERROR "Sound: Failed to Alloc header.\n"); WAV_Shutdown (sc); - return false; - } + return false; + } - wh->lpWaveHdr = (LPWAVEHDR) GlobalLock(wh->hWaveHdr); + wh->lpWaveHdr = (LPWAVEHDR) GlobalLock(wh->hWaveHdr); if (wh->lpWaveHdr == NULL) - { + { Con_SafePrintf (CON_ERROR "Sound: Failed to lock header.\n"); WAV_Shutdown (sc); - return false; + return false; } memset (wh->lpWaveHdr, 0, sizeof(WAVEHDR) * WAV_BUFFERS); - /* After allocation, set up and prepare headers. */ + /* After allocation, set up and prepare headers. */ for (i=0 ; ilpWaveHdr[i].dwBufferLength = WAV_BUFFER_SIZE; + wh->lpWaveHdr[i].dwBufferLength = WAV_BUFFER_SIZE; wh->lpWaveHdr[i].lpData = wh->lpData + i*WAV_BUFFER_SIZE; if (waveOutPrepareHeader(wh->hWaveOut, wh->lpWaveHdr+i, sizeof(WAVEHDR)) != diff --git a/engine/client/sys_linux.c b/engine/client/sys_linux.c index 76f523933..cbee0c4e0 100644 --- a/engine/client/sys_linux.c +++ b/engine/client/sys_linux.c @@ -478,7 +478,7 @@ void *Sys_GetGameAPI(void *parms) char curpath[MAX_OSPATH]; char *searchpath; const char *gamename = "gamei386.so"; - size_t result; + char *result; void *ret; @@ -583,7 +583,7 @@ void Sys_LowFPPrecision (void) { } -int main (int c, char **v) +int main (int c, const char **v) { double time, oldtime, newtime; quakeparms_t parms; diff --git a/engine/client/sys_win.c b/engine/client/sys_win.c index 0884629ba..cf568b8f5 100644 --- a/engine/client/sys_win.c +++ b/engine/client/sys_win.c @@ -411,7 +411,9 @@ int *debug; DWORD dwExtraInfo; } KBDLLHOOKSTRUCT; #elif defined(MINGW) - #define LLKHF_UP 0x00000080 + #ifndef LLKHF_UP + #define LLKHF_UP 0x00000080 + #endif #endif HHOOK llkeyboardhook; @@ -598,7 +600,7 @@ void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) str, sizeof(str), NULL); - Sys_Error("Protection change failed!\nError %d: %s\n", GetLastError(), str); + Sys_Error("Protection change failed!\nError %d: %s\n", (int)GetLastError(), str); } } @@ -1545,7 +1547,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin GetModuleFileName(NULL, cwd, sizeof(cwd)-1); strcpy(exename, COM_SkipPath(cwd)); - parms.argv = argv; + parms.argv = (const char **)argv; COM_InitArgv (parms.argc, parms.argv); diff --git a/engine/common/cmd.c b/engine/common/cmd.c index b9f202c77..7a90e4ad4 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -522,9 +522,9 @@ void Cmd_Exec_f (void) else Q_strncpyz(name, Cmd_Argv(1), sizeof(name)); - if (FS_LoadFile(name, &f) != -1) + if (FS_LoadFile(name, (void **)&f) != -1) ; - else if (FS_LoadFile(va("%s.cfg", name), &f) != -1) + else if (FS_LoadFile(va("%s.cfg", name), (void **)&f) != -1) ; else { diff --git a/engine/common/common.c b/engine/common/common.c index 0b60e7d1a..0099db264 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -3457,7 +3457,7 @@ void COM_Effectinfo_Reload(void) COM_Effectinfo_Add(dpnames[i]); - FS_LoadFile("effectinfo.txt", &f); + FS_LoadFile("effectinfo.txt", (void **)&f); if (!f) return; buf = f; diff --git a/engine/common/fs_win32.c b/engine/common/fs_win32.c index 21a4af02e..99e8b0057 100644 --- a/engine/common/fs_win32.c +++ b/engine/common/fs_win32.c @@ -179,7 +179,7 @@ static vfsfile_t *VFSW32_OpenVFS(void *handle, flocation_t *loc, const char *mod static void VFSW32_PrintPath(void *handle) { - Con_Printf("%s\n", handle); + Con_Printf("%s\n", (char *)handle); } static void VFSW32_ClosePath(void *handle) { diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index a6c90042b..b889a60ae 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -1904,7 +1904,7 @@ closesvstream: if (newsock != INVALID_SOCKET) { int _true = true; - ioctlsocket(newsock, FIONBIO, &_true); + ioctlsocket(newsock, FIONBIO, (u_long *)&_true); setsockopt(newsock, IPPROTO_TCP, TCP_NODELAY, (char *)&_true, sizeof(_true)); con->active++; @@ -2444,7 +2444,7 @@ qboolean FTENET_IRCConnect_GetPacket(ftenet_generic_connection_t *gcon) } else { - code = strtoul(s, &s, 10); + code = strtoul(s, (char ** __restrict__)&s, 10); switch (code) { case 001: diff --git a/engine/common/plugin.c b/engine/common/plugin.c index a215ee446..07e676b86 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -23,11 +23,11 @@ struct gnutls_session_int; typedef struct gnutls_session_int* gnutls_session; typedef void * gnutls_transport_ptr; -typedef enum gnutls_kx_algorithm { GNUTLS_KX_RSA=1, GNUTLS_KX_DHE_DSS, +typedef enum gnutls_kx_algorithm { GNUTLS_KX_RSA=1, GNUTLS_KX_DHE_DSS, GNUTLS_KX_DHE_RSA, GNUTLS_KX_ANON_DH, GNUTLS_KX_SRP, GNUTLS_KX_RSA_EXPORT, GNUTLS_KX_SRP_RSA, GNUTLS_KX_SRP_DSS } gnutls_kx_algorithm; -typedef enum gnutls_certificate_type { GNUTLS_CRT_X509=1, GNUTLS_CRT_OPENPGP +typedef enum gnutls_certificate_type { GNUTLS_CRT_X509=1, GNUTLS_CRT_OPENPGP } gnutls_certificate_type; typedef enum gnutls_connection_end { GNUTLS_SERVER=1, GNUTLS_CLIENT } gnutls_connection_end; typedef enum gnutls_credentials_type { GNUTLS_CRD_CERTIFICATE=1, GNUTLS_CRD_ANON, GNUTLS_CRD_SRP } gnutls_credentials_type; @@ -265,7 +265,7 @@ int Plug_SystemCallsVM(void *offset, quintptr_t mask, int fn, const int *arg) fn = fn+1; if (fn>=0 && fn < numplugbuiltins && plugbuiltins[fn].func!=NULL) - return plugbuiltins[fn].func(offset, mask, args); + return plugbuiltins[fn].func(offset, mask, (const long int *)args); #undef args Sys_Error("QVM Plugin tried calling invalid builtin %i", fn); return 0; @@ -816,7 +816,7 @@ qintptr_t VARGS Plug_Net_TCPListen(void *offset, quintptr_t mask, const qintptr_ Con_Printf("Failed to create socket\n"); return -2; } - if (ioctlsocket (sock, FIONBIO, &_true) == -1) + if (ioctlsocket (sock, FIONBIO, (u_long *)&_true) == -1) { closesocket(sock); return -2; @@ -858,7 +858,7 @@ qintptr_t VARGS Plug_Net_Accept(void *offset, quintptr_t mask, const qintptr_t * if (sock < 0) return -1; - if (ioctlsocket (sock, FIONBIO, &_true) == -1) //now make it non blocking. + if (ioctlsocket (sock, FIONBIO, (u_long *)&_true) == -1) //now make it non blocking. { closesocket(sock); return -1; @@ -922,7 +922,7 @@ qintptr_t VARGS Plug_Net_TCPConnect(void *offset, quintptr_t mask, const qintptr return -2; } - if (ioctlsocket (sock, FIONBIO, &_true) == -1) //now make it non blocking. + if (ioctlsocket (sock, FIONBIO, (u_long *)&_true) == -1) //now make it non blocking. { return -1; } diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index 44aed1844..6b8e3be7f 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -19,7 +19,7 @@ void Q1BSP_CheckHullNodes(hull_t *hull) if (node->children[c] >= 0) if (node->children[c] < hull->firstclipnode || node->children[c] > hull->lastclipnode) Sys_Error ("Q1BSP_CheckHull: bad node number"); - + } } @@ -97,7 +97,7 @@ reenter: } /*its a node*/ - + /*get the node info*/ node = hull->clipnodes + num; plane = hull->planes + node->planenum; @@ -112,7 +112,7 @@ reenter: t1 = DotProduct (plane->normal, p1) - plane->dist; t2 = DotProduct (plane->normal, p2) - plane->dist; } - + /*if its completely on one side, resume on that side*/ if (t1 >= 0 && t2 >= 0) { @@ -151,7 +151,7 @@ reenter: rht = Q1BSP_RecursiveHullTrace(hull, node->children[side^1], midf, p2f, mid, p2, trace); if (rht != rht_solid) return rht; - + trace->fraction = midf; if (side) { @@ -444,7 +444,7 @@ qboolean Q1BSP_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3] { vec3_t iaxis[3]; vec3_t norm; - Matrix3_Invert_Simple(axis, iaxis); + Matrix3_Invert_Simple((void *)axis, iaxis); VectorCopy(trace->plane.normal, norm); trace->plane.normal[0] = DotProduct(norm, iaxis[0]); trace->plane.normal[1] = DotProduct(norm, iaxis[1]); @@ -459,7 +459,7 @@ qboolean Q1BSP_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3] VectorSubtract(start, offset, start_l); VectorSubtract(end, offset, end_l); Q1BSP_RecursiveHullCheck(hull, hull->firstclipnode, 0, 1, start_l, end_l, trace); - + if (trace->fraction == 1) { VectorCopy (end, trace->endpos); @@ -746,7 +746,7 @@ int Fragment_ClipPolyToPlane(float *inverts, float *outverts, int incount, float char keep[MAXFRAGMENTVERTS+1]; #define KEEP_KILL 0 #define KEEP_KEEP 1 -#define KEEP_BORDER 2 +#define KEEP_BORDER 2 int i; int outcount = 0; int clippedcount = 0; diff --git a/engine/common/qvm.c b/engine/common/qvm.c index 549908099..8ceb8ac48 100644 --- a/engine/common/qvm.c +++ b/engine/common/qvm.c @@ -340,7 +340,7 @@ qvm_t *QVM_LoadVM(const char *name, sys_callqvm_t syscall) unsigned int i; sprintf(path, "%s.qvm", name); - FS_LoadFile(path, &raw); + FS_LoadFile(path, (void **)&raw); // file not found if(!raw) return NULL; srcheader=(vmHeader_t*)raw; diff --git a/engine/d3d/d3d_backend.c b/engine/d3d/d3d_backend.c index e1d6ac75d..137cec1b4 100644 --- a/engine/d3d/d3d_backend.c +++ b/engine/d3d/d3d_backend.c @@ -10,7 +10,7 @@ extern LPDIRECT3DDEVICE9 pD3DDev9; //#define d3dcheck(foo) foo -#define d3dcheck(foo) do{HRESULT err = foo; if (FAILED(err)) Sys_Error("D3D reported error on backend line %i - error 0x%x\n", __LINE__, err);} while(0) +#define d3dcheck(foo) do{HRESULT err = foo; if (FAILED(err)) Sys_Error("D3D reported error on backend line %i - error 0x%x\n", __LINE__, (unsigned int)err);} while(0) #define MAX_TMUS 4 @@ -59,15 +59,15 @@ static void FTable_Init(void) t = (double)i / (double)FTABLE_SIZE; r_sintable[i] = sin(t * 2*M_PI); - - if (t < 0.25) + + if (t < 0.25) r_triangletable[i] = t * 4.0; else if (t < 0.75) r_triangletable[i] = 2 - 4.0 * t; else r_triangletable[i] = (t - 0.75) * 4.0 - 1.0; - if (t < 0.5) + if (t < 0.5) r_squaretable[i] = 1.0f; else r_squaretable[i] = -1.0f; @@ -165,7 +165,7 @@ static d3dbackend_t shaderstate; extern int be_maxpasses; -enum +enum { D3D_VDEC_COL4B = 1<<0, //D3D_VDEC_NORMS = 1<<1, @@ -327,7 +327,7 @@ void D3DBE_Reset(qboolean before) IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, shaderstate.dynst_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &shaderstate.dynst_buff[tmu], NULL); IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, shaderstate.dyncol_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &shaderstate.dyncol_buff, NULL); IDirect3DDevice9_CreateIndexBuffer(pD3DDev9, shaderstate.dynidx_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, D3DFMT_QINDEX, D3DPOOL_DEFAULT, &shaderstate.dynidx_buff, NULL); - + for (i = 0; i < MAX_TMUS; i++) { shaderstate.tmuflags[i] = ~0; @@ -522,7 +522,7 @@ static unsigned int allocindexbuffer(void **dest, unsigned int entries) shaderstate.dynidx_offs += bytes; } - d3dcheck(IDirect3DIndexBuffer9_Lock(shaderstate.dynidx_buff, offset, entries, dest, offset?D3DLOCK_NOOVERWRITE:D3DLOCK_DISCARD)); + d3dcheck(IDirect3DIndexBuffer9_Lock(shaderstate.dynidx_buff, offset, (unsigned int)entries, dest, offset?D3DLOCK_NOOVERWRITE:D3DLOCK_DISCARD)); return offset/sizeof(index_t); } @@ -690,7 +690,7 @@ static void SelectPassTexture(unsigned int tu, shaderpass_t *pass) } } -static void colourgenbyte(const shaderpass_t *pass, int cnt, const byte_vec4_t *src, byte_vec4_t *dst, const mesh_t *mesh) +static void colourgenbyte(const shaderpass_t *pass, int cnt, byte_vec4_t *src, byte_vec4_t *dst, const mesh_t *mesh) { D3DCOLOR block; switch (pass->rgbgen) @@ -815,7 +815,7 @@ static void colourgenbyte(const shaderpass_t *pass, int cnt, const byte_vec4_t * } } -static void alphagenbyte(const shaderpass_t *pass, int cnt, const byte_vec4_t *src, byte_vec4_t *dst, const mesh_t *mesh) +static void alphagenbyte(const shaderpass_t *pass, int cnt, byte_vec4_t *src, byte_vec4_t *dst, const mesh_t *mesh) { /*FIXME: Skip this if the rgbgen did it*/ float *table; @@ -901,7 +901,7 @@ static void alphagenbyte(const shaderpass_t *pass, int cnt, const byte_vec4_t *s int i; VectorSubtract(r_origin, shaderstate.curentity->origin, v1); - if (!Matrix3_Compare(shaderstate.curentity->axis, axisDefault)) + if (!Matrix3_Compare(shaderstate.curentity->axis, (void *)axisDefault)) { Matrix3_Multiply_Vec3(shaderstate.curentity->axis, v2, v2); } @@ -1010,7 +1010,7 @@ static unsigned int BE_GenerateColourMods(unsigned int vertcount, const shaderpa /*********************************************************************************************************/ /*========================================== texture coord generation =====================================*/ -static void tcgen_environment(float *st, unsigned int numverts, float *xyz, float *normal) +static void tcgen_environment(float *st, unsigned int numverts, float *xyz, float *normal) { int i; vec3_t viewer, reflected; @@ -1020,7 +1020,7 @@ static void tcgen_environment(float *st, unsigned int numverts, float *xyz, floa RotateLightVector(shaderstate.curentity->axis, shaderstate.curentity->origin, r_origin, rorg); - for (i = 0 ; i < numverts ; i++, xyz += 3, normal += 3, st += 2 ) + for (i = 0 ; i < numverts ; i++, xyz += 3, normal += 3, st += 2 ) { VectorSubtract (rorg, xyz, viewer); VectorNormalizeFast (viewer); @@ -1161,7 +1161,8 @@ static void tcmod(const tcmod_t *tcmod, int cnt, const float *src, float *dst, c static void GenerateTCMods(const shaderpass_t *pass, float *dest) { mesh_t *mesh; - unsigned int fvertex = 0, mno; + unsigned int mno; + // unsigned int fvertex = 0; //unused variable int i; float *src; for (mno = 0; mno < shaderstate.nummeshes; mno++) @@ -1188,7 +1189,7 @@ static void GenerateTCMods(const shaderpass_t *pass, float *dest) //end texture coords /*******************************************************************************************************************/ -static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV_t *dst, const mesh_t *mesh) +static void deformgen(const deformv_t *deformv, int cnt, vecV_t *src, vecV_t *dst, const mesh_t *mesh) { float *table; int j, k; @@ -1198,14 +1199,14 @@ static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV { default: case DEFORMV_NONE: - if (src != (const avec4_t*)dst) + if (src != dst) memcpy(dst, src, sizeof(*src)*cnt); break; case DEFORMV_WAVE: if (!mesh->normals_array) { - if (src != (const avec4_t*)dst) + if (src != dst) memcpy(dst, src, sizeof(*src)*cnt); return; } @@ -1227,7 +1228,7 @@ static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV case DEFORMV_NORMAL: //normal does not actually move the verts, but it does change the normals array //we don't currently support that. - if (src != (const avec4_t*)dst) + if (src != dst) memcpy(dst, src, sizeof(*src)*cnt); /* args[0] = deformv->args[1] * shaderstate.curtime; @@ -1310,7 +1311,7 @@ static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV for (j = 2; j >= 0; j--) { quad[3] = (float *)(dst + mesh->indexes[k+3+j]); - if (!VectorEquals (quad[3], quad[0]) && + if (!VectorEquals (quad[3], quad[0]) && !VectorEquals (quad[3], quad[1]) && !VectorEquals (quad[3], quad[2])) { @@ -1415,7 +1416,7 @@ static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV for (j = 0; j < 4; j++) { VectorSubtract(quad[j], rot_centre, tv); - Matrix3_Multiply_Vec3(result, tv, quad[j]); + Matrix3_Multiply_Vec3((void *)result, tv, quad[j]); VectorAdd(rot_centre, quad[j], quad[j]); } } @@ -1488,8 +1489,8 @@ static qboolean BE_DrawMeshChain_SetupPass(shaderpass_t *pass, unsigned int vert } shaderstate.lastpasscount = tmu; -// if (meshchain->normals_array && -// meshchain->2 && +// if (meshchain->normals_array && +// meshchain->2 && // meshchain->tnormals_array) // vdec |= D3D_VDEC_NORMS; @@ -1506,12 +1507,12 @@ static qboolean BE_DrawMeshChain_SetupPass(shaderpass_t *pass, unsigned int vert static void BE_RenderMeshProgram(unsigned int vertcount, unsigned int idxfirst, unsigned int idxcount) { shader_t *s = shaderstate.curshader; - shaderpass_t *pass = s->passes; + //shaderpass_t *pass = s->passes; //unused variable IDirect3DDevice9_SetVertexShader(pD3DDev9, s->prog->handle[0].hlsl.vert); IDirect3DDevice9_SetPixelShader(pD3DDev9, s->prog->handle[0].hlsl.frag); -// IDirect3DDevice9_SetVertexShaderConstantF(pD3DDev9, +// IDirect3DDevice9_SetVertexShaderConstantF(pD3DDev9, d3dcheck(IDirect3DDevice9_DrawIndexedPrimitive(pD3DDev9, D3DPT_TRIANGLELIST, 0, 0, vertcount, idxfirst, idxcount/3)); IDirect3DDevice9_SetVertexShader(pD3DDev9, NULL); @@ -1554,7 +1555,7 @@ static void BE_DrawMeshChain_Internal(void) unsigned int mno; unsigned int passno = 0; shaderpass_t *pass = shaderstate.curshader->passes; - extern cvar_t r_polygonoffset_submodel_offset, r_polygonoffset_submodel_factor; + extern cvar_t r_polygonoffset_submodel_offset; // r_polygonoffset_submodel_factor // unused variable float pushdepth; // float pushfactor; @@ -1672,7 +1673,7 @@ void D3DBE_GenBrushModelVBO(model_t *mod) char *vboedata; mesh_t *m; char *vbovdata; - + if (!mod->numsurfaces) return; @@ -2198,7 +2199,7 @@ static void TransformDir(vec3_t in, vec3_t planea[3], vec3_t viewa[3], vec3_t re VectorMA(result, d, viewa[i], result); } } -static R_RenderScene(void) +static void R_RenderScene(void) { IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_PROJECTION, (D3DMATRIX*)r_refdef.m_projection); IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_VIEW, (D3DMATRIX*)r_refdef.m_view); diff --git a/engine/d3d/d3d_image.c b/engine/d3d/d3d_image.c index ffc8f897d..31f39717b 100644 --- a/engine/d3d/d3d_image.c +++ b/engine/d3d/d3d_image.c @@ -405,7 +405,7 @@ texid_t D3D9_LoadTexture (char *identifier, int width, int height, enum uploadfm tid.ptr = D3D9_LoadTexture_32(tex, data, width, height, flags); return tid; default: - OutputDebugString(va("D3D_LoadTextureFmt doesn't support fmt %i (%s)", fmt, name)); + OutputDebugString(va("D3D_LoadTexture doesn't support fmt %i", fmt)); return r_nulltex; } } diff --git a/engine/d3d/vid_d3d.c b/engine/d3d/vid_d3d.c index d356cbda2..0dc71a2cb 100644 --- a/engine/d3d/vid_d3d.c +++ b/engine/d3d/vid_d3d.c @@ -53,7 +53,7 @@ int gl_bumpmappingpossible; -static void D3D9_GetBufferSize(int *width, int *height); +//static void D3D9_GetBufferSize(int *width, int *height); //not defined static void resetD3D9(void); static LPDIRECT3D9 pD3D; LPDIRECT3DDEVICE9 pD3DDev9; @@ -637,15 +637,15 @@ static qboolean D3D9_VID_Init(rendererstate_t *info, unsigned char *palette) { DWORD width = info->width; DWORD height = info->height; - DWORD bpp = info->bpp; - DWORD zbpp = 16; - DWORD flags = 0; + //DWORD bpp = info->bpp; + //DWORD zbpp = 16; + //DWORD flags = 0; DWORD wstyle; RECT rect; MSG msg; extern cvar_t vid_conwidth; - extern cvar_t vid_conheight; + //extern cvar_t vid_conheight; //DDGAMMARAMP gammaramp; //int i; @@ -889,17 +889,17 @@ void D3D9_Set2D (void) static int d3d9error(int i) { if (FAILED(i))// != D3D_OK) - Con_Printf("D3D error: %x %i\n", i); + Con_Printf("D3D error: %i\n", i); return i; } static void (D3D9_SCR_UpdateScreen) (void) { - extern int keydown[]; - extern cvar_t vid_conheight; + //extern int keydown[]; + //extern cvar_t vid_conheight; int uimenu; #ifdef TEXTEDITOR - extern qboolean editormodal; + //extern qboolean editormodal; #endif qboolean nohud, noworld; RSpeedMark(); diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index 735f7a2bb..18f0f866a 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -1316,7 +1316,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius) // if (e->shaderRGBAf[3] < 0.5) // return; - RotateLightVector(e->axis, e->origin, lightpos, lightorg); + RotateLightVector((void *)e->axis, e->origin, lightpos, lightorg); if (Length(lightorg) > radius + clmodel->radius) return; diff --git a/engine/gl/gl_hlmdl.c b/engine/gl/gl_hlmdl.c index c1c9e59b9..7048ee3ef 100644 --- a/engine/gl/gl_hlmdl.c +++ b/engine/gl/gl_hlmdl.c @@ -12,8 +12,8 @@ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. fromquake.h - - - render.c - apart from calculations (mostly range checking or value conversion code is a mix of standard Quake 1 + + render.c - apart from calculations (mostly range checking or value conversion code is a mix of standard Quake 1 meshing, and vertex deforms. The rendering loop uses standard Quake 1 drawing, after SetupBones deforms the vertex. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -80,7 +80,7 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer) { /*~~*/ int i; - + hlmodelcache_t *model; hlmdl_header_t *header; hlmdl_header_t *texheader; @@ -105,20 +105,20 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer) QCRC_Init(&crc); for (len = com_filesize, p = buffer; len; len--, p++) QCRC_ProcessByte(&crc, *p); - + sprintf(st, "%d", (int) crc); - Info_SetValueForKey (cls.userinfo[0], + Info_SetValueForKey (cls.userinfo[0], (mod->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, st, sizeof(cls.userinfo[0])); if (cls.state >= ca_connected) { - CL_SendClientCommand(true, "setinfo %s %d", + CL_SendClientCommand(true, "setinfo %s %d", (mod->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, (int)crc); } } - + start = Hunk_LowMark (); @@ -173,7 +173,7 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer) texheader = header; else header->numtextures = texheader->numtextures; - + tex = (hlmdl_tex_t *) ((qbyte *) texheader + texheader->textures); bones = (hlmdl_bone_t *) ((qbyte *) header + header->boneindex); bonectls = (hlmdl_bonecontroller_t *) ((qbyte *) header + header->controllerindex); @@ -210,12 +210,12 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer) // // move the complete, relocatable alias model to the cache -// +// end = Hunk_LowMark (); total = end - start; mod->type = mod_halflife; - + Cache_Alloc (&mod->cache, total, mod->name); if (!mod->cache.data) return false; @@ -505,7 +505,7 @@ void HL_SetupBones(hlmodel_t *model, int seqnum, int firstbone, int lastbone, fl { HL_CalculateBones(0, frame, frametime, model->adjust, model->bones + i, animation + i, positions[0]); HL_CalculateBones(3, frame, frametime, model->adjust, model->bones + i, animation + i, quaternions[0]); - + HL_CalculateBones(3, frame, frametime, model->adjust, model->bones + i, animation + i + model->header->numbones, quaternions[1]); QuaternionSlerp(quaternions[0], quaternions[1], subblendfrac, blended); @@ -646,12 +646,12 @@ void R_DrawHLModel(entity_t *curent) /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - for(v = 0; v < amodel->numverts; v++) // Transform per the matrix + for(v = 0; v < amodel->numverts; v++) // Transform per the matrix { - VectorTransform(verts[v], transform_matrix[bone[v]], transformed[v]); + VectorTransform(verts[v], (void *)transform_matrix[bone[v]], transformed[v]); // glVertex3fv(verts[v]); // glVertex3f( verts[v][0]+10*verts[v][0], -// verts[v][1]+10*verts[v][1], +// verts[v][1]+10*verts[v][1], // verts[v][2]+10*verts[v][2]); } @@ -661,18 +661,18 @@ void R_DrawHLModel(entity_t *curent) //what's also weird is that the meshes use these up! /* glDisable(GL_TEXTURE_2D); glBegin(GL_LINES); - for(v = 0; v < amodel->unknown3[0]; v++) // Transform per the matrix + for(v = 0; v < amodel->unknown3[0]; v++) // Transform per the matrix { VectorTransform(norms[v], transform_matrix[bone[v]], transformednorms[v]); glVertex3fv(transformednorms[v]); glVertex3f( transformednorms[v][0]+10*transformednorms[v][0], - transformednorms[v][1]+10*transformednorms[v][1], + transformednorms[v][1]+10*transformednorms[v][1], transformednorms[v][2]+10*transformednorms[v][2]); } glEnd(); glEnable(GL_TEXTURE_2D); */ - + /* Draw each mesh */ for(m = 0; m < amodel->nummesh; m++) diff --git a/engine/gl/gl_shadow.c b/engine/gl/gl_shadow.c index 601304cda..a17465596 100644 --- a/engine/gl/gl_shadow.c +++ b/engine/gl/gl_shadow.c @@ -1640,7 +1640,7 @@ static void Sh_DrawBrushModelShadow(dlight_t *dl, entity_t *e) if (BE_LightCullModel(e->origin, e->model)) return; - RotateLightVector(e->axis, e->origin, dl->origin, lightorg); + RotateLightVector((void *)e->axis, e->origin, dl->origin, lightorg); BE_SelectEntity(e); diff --git a/engine/gl/gl_vidnt.c b/engine/gl/gl_vidnt.c index fa9702d33..e6f248234 100644 --- a/engine/gl/gl_vidnt.c +++ b/engine/gl/gl_vidnt.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -71,7 +71,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef LWA_ALPHA #define LWA_ALPHA 0x00000002 #endif -typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); +typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); extern cvar_t vid_conwidth, vid_conautoscale; @@ -267,7 +267,7 @@ qboolean GLInitialise (char *renderer) } else hInstGL = NULL; - + if (!hInstGL) { unsigned int emode; @@ -442,7 +442,7 @@ qboolean VID_SetWindowedMode (rendererstate_t *info) if (pSetLayeredWindowAttributes) { - // Set WS_EX_LAYERED on this window + // Set WS_EX_LAYERED on this window SetWindowLong(dibwindow, GWL_EXSTYLE, GetWindowLong(dibwindow, GWL_EXSTYLE) | WS_EX_LAYERED); // Make this window 70% alpha @@ -537,7 +537,7 @@ qboolean VID_SetFullDIBMode (rendererstate_t *info) if (ChangeDisplaySettings (&gdevmode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { - Con_SafePrintf((gdevmode.dmFields&DM_DISPLAYFREQUENCY)?"Windows rejected mode %i*%i*%i*%i\n":"Windows rejected mode %i*%i*%i\n", gdevmode.dmPelsWidth, gdevmode.dmPelsHeight, gdevmode.dmBitsPerPel, gdevmode.dmDisplayFrequency); + Con_SafePrintf((gdevmode.dmFields&DM_DISPLAYFREQUENCY)?"Windows rejected mode %i*%i*%i*%i\n":"Windows rejected mode %i*%i*%i\n", (int)gdevmode.dmPelsWidth, (int)gdevmode.dmPelsHeight, (int)gdevmode.dmBitsPerPel, (int)gdevmode.dmDisplayFrequency); return false; } } @@ -909,7 +909,7 @@ qboolean VID_AttachGL (rendererstate_t *info) TRACE(("dbg: VID_AttachGL: failed to find a valid dll\n")); return false; } while(1); - + TRACE(("dbg: VID_AttachGL: qwglCreateContext\n")); baseRC = qwglCreateContext(maindc); @@ -1072,10 +1072,11 @@ void VID_Wait_Override_Callback(struct cvar_s *var, char *oldvalue) void GLVID_Recenter_f(void) { - int nw = vid_width.value; - int nh = vid_height.value; - int nx = 0; - int ny = 0; + // 4 unused variables + //int nw = vid_width.value; + //int nh = vid_height.value; + //int nx = 0; + //int ny = 0; if (sys_parentwindow && modestate==MS_WINDOWED) { @@ -1106,7 +1107,7 @@ void VID_WndAlpha_Override_Callback(struct cvar_s *var, char *oldvalue) if (pSetLayeredWindowAttributes) { - // Set WS_EX_LAYERED on this window + // Set WS_EX_LAYERED on this window if (av < 255) { @@ -1182,7 +1183,7 @@ void GLVID_SetPalette (unsigned char *palette) g = pal[1]; b = pal[2]; pal += 3; - + // v = (255<<24) + (r<<16) + (g<<8) + (b<<0); // v = (255<<0) + (r<<8) + (g<<16) + (b<<24); v = (255<<24) + (r<<0) + (g<<8) + (b<<16); @@ -1202,7 +1203,7 @@ void GLVID_SetPalette (unsigned char *palette) g = gammatable[pal[1]]; b = gammatable[pal[2]]; pal += 3; - + // v = (255<<24) + (r<<16) + (g<<8) + (b<<0); // v = (255<<0) + (r<<8) + (g<<16) + (b<<24); v = (255<<24) + (r<<0) + (g<<8) + (b<<16); @@ -1437,7 +1438,7 @@ BOOL bSetupPixelFormat(HDC hDC) if (SetPixelFormat(hDC, pixelformat, &pfd)) { TRACE(("dbg: bSetupPixelFormat: we can use the stencil buffer. woot\n")); - DescribePixelFormat(hDC, pixelformat, sizeof(pfd), &pfd); + DescribePixelFormat(hDC, pixelformat, sizeof(pfd), &pfd); FixPaletteInDescriptor(hDC, &pfd); gl_canstencil = pfd.cStencilBits; return TRUE; @@ -1450,14 +1451,14 @@ BOOL bSetupPixelFormat(HDC hDC) if ( (pixelformat = ChoosePixelFormat(hDC, &pfd)) == 0 ) { - Con_Printf("bSetupPixelFormat: ChoosePixelFormat failed (%i)\n", GetLastError()); + Con_Printf("bSetupPixelFormat: ChoosePixelFormat failed (%i)\n", (int)GetLastError()); return FALSE; } } if (SetPixelFormat(hDC, pixelformat, &pfd) == FALSE) { - Con_Printf("bSetupPixelFormat: SetPixelFormat failed (%i)\n", GetLastError()); + Con_Printf("bSetupPixelFormat: SetPixelFormat failed (%i)\n", (int)GetLastError()); return FALSE; } @@ -1481,7 +1482,7 @@ ClearAllStates void ClearAllStates (void) { int i; - + // send an up event for each key, to make sure the server clears them all for (i=0 ; i<256 ; i++) { @@ -1547,7 +1548,7 @@ qboolean GLAppActivate(BOOL fActive, BOOL minimize) { if (modestate != MS_WINDOWED) { - if (vid_canalttab) { + if (vid_canalttab) { ChangeDisplaySettings (NULL, 0); vid_wassuspended = true; } @@ -1687,7 +1688,7 @@ LONG WINAPI GLMainWndProc ( // JACK: This is the mouse wheel with the Intellimouse // Its delta is either positive or neg, and we generate the proper // Event. - case WM_MOUSEWHEEL: + case WM_MOUSEWHEEL: if (!vid_initializing) { if ((short) HIWORD(wParam) > 0) @@ -1764,7 +1765,7 @@ LONG WINAPI GLMainWndProc ( case MM_MCINOTIFY: lRet = CDAudio_MessageHandler (hWnd, uMsg, wParam, lParam); break; - + default: /* pass all unhandled messages to DefWindowProc */ lRet = DefWindowProc (hWnd, uMsg, wParam, lParam); @@ -1781,7 +1782,7 @@ qboolean GLVID_Is8bit(void) { } -void VID_Init8bitPalette(void) +void VID_Init8bitPalette(void) { #ifdef GL_USE8BITTEX #ifdef GL_EXT_paletted_texture diff --git a/engine/gl/gl_warp.c b/engine/gl/gl_warp.c index 959d8cace..5f24c5dbc 100644 --- a/engine/gl/gl_warp.c +++ b/engine/gl/gl_warp.c @@ -470,7 +470,7 @@ static void R_DrawSkyMesh(batch_t *batch, mesh_t *m, shader_t *shader) VectorCopy(r_refdef.vieworg, skyent.origin); skyent.axis[0][0] = skydist; skyent.axis[0][1] = 0; - skyent.axis[0][3] = 0; + skyent.axis[0][2] = 0; skyent.axis[1][0] = 0; skyent.axis[1][1] = skydist; skyent.axis[1][2] = 0; diff --git a/engine/http/ftpserver.c b/engine/http/ftpserver.c index 6cde15975..7c74eb0ef 100644 --- a/engine/http/ftpserver.c +++ b/engine/http/ftpserver.c @@ -37,7 +37,7 @@ typedef struct FTPclient_s{ char messagebuffer[256]; int cmdbuflen; int msgbuflen; - + int controlsock; int datasock; //FTP only allows one transfer per connection. int dataislisten; @@ -52,7 +52,7 @@ typedef struct FTPclient_s{ FTPclient_t *FTPclient; qboolean FTP_ServerInit(int port) -{ +{ struct sockaddr_in address; unsigned long _true = true; int i; @@ -84,7 +84,7 @@ qboolean FTP_ServerInit(int port) address.sin_port = 0; else address.sin_port = htons((short)port); - + if( bind (ftpserversocket, (void *)&address, sizeof(address)) == -1) { IWebPrintf("FTP_ServerInit: failed to bind socket\n"); @@ -92,7 +92,7 @@ qboolean FTP_ServerInit(int port) ftpserverfailed = true; return false; } - + listen(ftpserversocket, 3); ftpserverinitied = true; @@ -137,7 +137,7 @@ static int SendFileNameTo(const char *rawname, int size, void *param) sprintf(buffer, "drw-r--r--\t1\troot\troot\t%8u Jan 1 12:00 %s\r\n", size, fname); else sprintf(buffer, "-rw-r--r--\t1\troot\troot\t%8u Jan 1 12:00 %s\r\n", size, fname); - + // strcpy(buffer, fname); // for (i = strlen(buffer); i < 40; i+=8) // strcat(buffer, "\t"); @@ -151,7 +151,7 @@ int FTP_SV_makelistensocket(unsigned long nblocking) char name[256]; int sock; struct hostent *hent; - + struct sockaddr_in address; // int fromlen; @@ -175,13 +175,13 @@ int FTP_SV_makelistensocket(unsigned long nblocking) { Sys_Error ("FTP_TCP_OpenSocket: ioctl FIONBIO: %s", strerror(qerrno)); } - + if( bind (sock, (void *)&address, sizeof(address)) == -1) { closesocket(sock); return INVALID_SOCKET; } - + listen(sock, 2); return sock; @@ -193,7 +193,7 @@ iwboolean FTP_SVSocketToString (int socket, char *s) if (getsockname(socket, (struct sockaddr*)&addr, &adrlen) == -1) return false; - + sprintf(s, "%i,%i,%i,%i,%i,%i", ((qbyte *)&addr.sin_addr)[0], ((qbyte *)&addr.sin_addr)[1], ((qbyte *)&addr.sin_addr)[2], ((qbyte *)&addr.sin_addr)[3], ((qbyte *)&addr.sin_port)[0], ((qbyte *)&addr.sin_port)[1]); return true; } @@ -205,7 +205,7 @@ iwboolean FTP_SVRemoteSocketToString (int socket, char *s) addr.sin_family = AF_INET; if (getpeername(socket, (struct sockaddr*)&addr, &adrlen) == -1) return false; - + sprintf(s, "%i,%i,%i,%i,%i,%i", ((qbyte *)&addr.sin_addr)[0], ((qbyte *)&addr.sin_addr)[1], ((qbyte *)&addr.sin_addr)[2], ((qbyte *)&addr.sin_addr)[3], ((qbyte *)&addr.sin_port)[0], ((qbyte *)&addr.sin_port)[1]); return true; } @@ -270,7 +270,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) cl->datasock = INVALID_SOCKET; VFS_CLOSE(cl->file); cl->file = NULL; - + QueueMessage (cl, "226 Transfer complete .\r\n"); cl->datadir = 0; } @@ -296,7 +296,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) } pos = cl->datadir?1:!cl->blocking; - if (ioctlsocket (cl->controlsock, FIONBIO, &pos) == -1) + if (ioctlsocket (cl->controlsock, FIONBIO, (u_long *)&pos) == -1) { IWebPrintf ("FTP_ServerRun: blocking error: %s\n", strerror(qerrno)); return 0; @@ -306,7 +306,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) { int len; while((len = recv(cl->datasock, resource, sizeof(resource), 0)) >0 ) - { + { VFS_WRITE(cl->file, resource, len); } if (len == -1) @@ -332,7 +332,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) } } - ret = recv(cl->controlsock, cl->commandbuffer+cl->cmdbuflen, sizeof(cl->commandbuffer)-1 - cl->cmdbuflen, 0); + ret = recv(cl->controlsock, cl->commandbuffer+cl->cmdbuflen, sizeof(cl->commandbuffer)-1 - cl->cmdbuflen, 0); if (ret == -1) { if (qerrno == EWOULDBLOCK) @@ -341,7 +341,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) if (qerrno == ECONNABORTED || qerrno == ECONNRESET) return true; - Con_TPrintf (TL_NETGETPACKETERROR, strerror(qerrno)); + Con_TPrintf (TL_NETGETPACKETERROR, strerror(qerrno)); return true; } if (*cl->messagebuffer) @@ -385,7 +385,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) } else if (!stricmp(mode, "user")) { - msg = COM_ParseOut(msg, cl->name, sizeof(cl->name)); + msg = COM_ParseOut(msg, cl->name, sizeof(cl->name)); QueueMessage (cl, "331 User name received, will be checked with password.\r\n"); } @@ -488,7 +488,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) Sys_Error ("FTP_UDP_OpenSocket: socket: %s", strerror(qerrno)); } - if (ioctlsocket (cl->datasock, FIONBIO, &_true) == -1) + if (ioctlsocket (cl->datasock, FIONBIO, (u_long *)&_true) == -1) { Sys_Error ("FTTP_UDP_OpenSocket: ioctl FIONBIO: %s", strerror(qerrno)); } @@ -498,7 +498,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) from.sin_addr.s_addr = INADDR_ANY; from.sin_port = 0; - + if( bind (cl->datasock, (void *)&from, sizeof(from)) == -1) { closesocket(cl->datasock); @@ -507,7 +507,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) QueueMessage (cl, "425 server bind error.\r\n"); continue; } - + fromlen = sizeof(from); FTP_StringToAdr(resource, (qbyte *)&from.sin_addr, (qbyte *)&from.sin_port); @@ -540,7 +540,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) continue; } else - ioctlsocket(cl->datasock, FIONBIO, &_true); + ioctlsocket(cl->datasock, FIONBIO, (u_long *)&_true); } if (cl->datasock == INVALID_SOCKET) { @@ -595,7 +595,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) continue; } else - ioctlsocket(cl->datasock, FIONBIO, &_true); + ioctlsocket(cl->datasock, FIONBIO, (u_long *)&_true); } if (cl->datasock == INVALID_SOCKET) { @@ -604,7 +604,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) } msg = COM_ParseOut(msg, resource, sizeof(resource)); - if (!cl->auth & IWEBACC_READ) + if (!cl->auth & IWEBACC_READ) { QueueMessage (cl, "550 No read access.\r\n"); continue; @@ -674,7 +674,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) continue; } else - ioctlsocket(cl->datasock, FIONBIO, &_true); + ioctlsocket(cl->datasock, FIONBIO, (u_long *)&_true); } if (cl->datasock == INVALID_SOCKET) { @@ -790,7 +790,7 @@ unsigned long _true = true; FTP_ServerShutdown(); return false; } - + prevcl = NULL; for (cl = FTPclient; cl; cl = cl->next) { @@ -819,7 +819,7 @@ unsigned long _true = true; if (!cl) //kills loop break; - } + } } prevcl = cl; } diff --git a/engine/http/httpserver.c b/engine/http/httpserver.c index cc3097225..dea76dc6a 100644 --- a/engine/http/httpserver.c +++ b/engine/http/httpserver.c @@ -17,7 +17,7 @@ typedef enum {HTTP_WAITINGFORREQUEST,HTTP_SENDING} http_mode_t; qboolean HTTP_ServerInit(int port) -{ +{ struct sockaddr_in address; unsigned long _true = true; int i; @@ -51,7 +51,7 @@ qboolean HTTP_ServerInit(int port) address.sin_port = 0; else address.sin_port = htons((short)port); - + if( bind (httpserversocket, (void *)&address, sizeof(address)) == -1) { closesocket(httpserversocket); @@ -59,7 +59,7 @@ qboolean HTTP_ServerInit(int port) httpserverfailed = true; return false; } - + listen(httpserversocket, 3); httpserverinitied = true; @@ -271,7 +271,7 @@ cont: msg++; break; //that was our blank line. } - + while(*msg == ' ') msg++; @@ -346,7 +346,7 @@ cont: cl->file = NULL; else cl->file = FS_OpenVFS(resource+1, "rb", FS_GAME); - + if (!cl->file) { cl->file = IWebGenerateFile(resource+1, content, contentlen); @@ -384,7 +384,7 @@ cont: if (*mode == 'H' || *mode == 'h') { - + VFS_CLOSE(cl->file); cl->file = NULL; } @@ -542,7 +542,7 @@ qboolean HTTP_ServerPoll(qboolean httpserverwanted, int portnum) //loop while tr return false; } - if (ioctlsocket (clientsock, FIONBIO, &_true) == -1) + if (ioctlsocket (clientsock, FIONBIO, (u_long *)&_true) == -1) { IWebPrintf ("HTTP_ServerInit: ioctl FIONBIO: %s\n", strerror(qerrno)); closesocket(clientsock); @@ -559,7 +559,7 @@ qboolean HTTP_ServerPoll(qboolean httpserverwanted, int portnum) //loop while tr cl->datasock = clientsock; cl->next = HTTP_ServerConnections; - HTTP_ServerConnections = cl; + HTTP_ServerConnections = cl; httpconnectioncount++; return true; diff --git a/engine/server/sv_mvd.c b/engine/server/sv_mvd.c index f053fdae8..b8770ec5d 100644 --- a/engine/server/sv_mvd.c +++ b/engine/server/sv_mvd.c @@ -375,7 +375,7 @@ void SV_MVD_RunPendingConnections(void) { char hash[512]; int md4sum[4]; - + snprintf(hash, sizeof(hash), "%s%s", p->challenge, qtv_password.string); Com_BlockFullChecksum (hash, strlen(hash), (unsigned char*)md4sum); sprintf(hash, "%X%X%X%X", md4sum[0], md4sum[1], md4sum[2], md4sum[3]); @@ -674,7 +674,7 @@ int Sys_listdirFound(const char *fname, int fsize, void *uptr) dir_t *Sys_listdir (char *path, char *ext, qboolean usesorting) { char searchterm[MAX_QPATH]; - + unsigned int maxfiles = MAX_DIRFILES; dir_t *dir = malloc(sizeof(*dir) + sizeof(*dir->files)*maxfiles); memset(dir, 0, sizeof(*dir)); @@ -2039,7 +2039,7 @@ void SV_MVD_QTVReverse_f (void) return; } - if (ioctlsocket (sock, FIONBIO, &nonblocking) == INVALID_SOCKET) + if (ioctlsocket (sock, FIONBIO, (u_long *)&nonblocking) == INVALID_SOCKET) { closesocket(sock); Con_Printf ("qtvreverse: ioctl FIONBIO: %s\n", strerror(qerrno)); @@ -2294,7 +2294,7 @@ int MVD_StreamStartListening(int port) Sys_Error ("MVD_StreamStartListening: socket: %s", strerror(qerrno)); } - if (ioctlsocket (sock, FIONBIO, &nonblocking) == INVALID_SOCKET) + if (ioctlsocket (sock, FIONBIO, (u_long *)&nonblocking) == INVALID_SOCKET) { Sys_Error ("FTP_TCP_OpenSocket: ioctl FIONBIO: %s", strerror(qerrno)); } @@ -2364,7 +2364,7 @@ void SV_MVDStream_Poll(void) if (client == INVALID_SOCKET) return; - ioctlsocket(client, FIONBIO, &_true); + ioctlsocket(client, FIONBIO, (u_long *)&_true); if (qtv_maxstreams.value > 0) { @@ -2480,7 +2480,7 @@ void SV_UserCmdMVDList_f (void) SV_ClientPrintf(host_client, PRINT_HIGH, "%d: %s %dk\n", i, list->name, list->size/1024); } } - + for (d = demo.dest; d; d = d->nextdest) dir->size += d->totalsize; diff --git a/engine/server/sv_sys_unix.c b/engine/server/sv_sys_unix.c index d2a355f23..50ea59f0e 100644 --- a/engine/server/sv_sys_unix.c +++ b/engine/server/sv_sys_unix.c @@ -653,7 +653,7 @@ int main(int argc, char *argv[]) memset (&parms, 0, sizeof(parms)); - COM_InitArgv (argc, argv); + COM_InitArgv (argc, (const char **)argv); TL_InitLanguages(); parms.argc = com_argc; parms.argv = com_argv; @@ -826,7 +826,7 @@ void *Sys_GetGameAPI(void *parms) char curpath[MAX_OSPATH]; char *searchpath; const char *gamename = "gamei386.so"; - size_t result; + char *result; void *ret; diff --git a/engine/server/sv_sys_win.c b/engine/server/sv_sys_win.c index 843c6ad0e..96f666764 100644 --- a/engine/server/sv_sys_win.c +++ b/engine/server/sv_sys_win.c @@ -533,6 +533,8 @@ void Sys_Error (const char *error, ...) CloseHandle(processinfo.hThread); Sys_Quit (); + + exit (1); // this function is NORETURN type, complains without this } /* @@ -1097,7 +1099,7 @@ void Signal_Error_Handler (int sig) void StartQuakeServer(void) { quakeparms_t parms; - static char cwd[1024]; + //static char cwd[1024]; //unused variable int t; TL_InitLanguages(); @@ -1287,7 +1289,7 @@ int main (int argc, char **argv) __try #endif { - COM_InitArgv (argc, argv); + COM_InitArgv (argc, (const char **)argv); #ifdef USESERVICE if (COM_CheckParm("-register")) { diff --git a/engine/server/svq3_game.c b/engine/server/svq3_game.c index fe7d338f6..fc2040ab6 100644 --- a/engine/server/svq3_game.c +++ b/engine/server/svq3_game.c @@ -1397,7 +1397,7 @@ static qintptr_t Q3G_SystemCalls(void *offset, unsigned int mask, qintptr_t fn, return ret; } -static int Q3G_SystemCallsVM(void *offset, unsigned int mask, int fn, const int *arg) +static int Q3G_SystemCallsVM(void *offset, quintptr_t mask, int fn, const int *arg) { qintptr_t args[13];