comparison src/joystick/win32/SDL_dxjoystick.c @ 2576:034440120c38 gsoc2008_force_feedback

Converted some functions to SDL_mem*.
author Edgar Simo <bobbens@gmail.com>
date Thu, 31 Jul 2008 17:15:36 +0000
parents fe19afb86473
children 72b17d80b426
comparison
equal deleted inserted replaced
2575:57ea8810b5f0 2576:034440120c38
176 } 176 }
177 177
178 static BOOL CALLBACK 178 static BOOL CALLBACK
179 EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) 179 EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
180 { 180 {
181 memcpy(&SYS_Joystick[SYS_NumJoysticks], pdidInstance, 181 SDL_memcpy(&SYS_Joystick[SYS_NumJoysticks], pdidInstance,
182 sizeof(DIDEVICEINSTANCE)); 182 sizeof(DIDEVICEINSTANCE));
183 SYS_NumJoysticks++; 183 SYS_NumJoysticks++;
184 184
185 if (SYS_NumJoysticks >= MAX_JOYSTICKS) 185 if (SYS_NumJoysticks >= MAX_JOYSTICKS)
186 return DIENUM_STOP; 186 return DIENUM_STOP;
206 { 206 {
207 HRESULT result; 207 HRESULT result;
208 LPDIRECTINPUTDEVICE device; 208 LPDIRECTINPUTDEVICE device;
209 DIPROPDWORD dipdw; 209 DIPROPDWORD dipdw;
210 210
211 ZeroMemory(&dipdw, sizeof(DIPROPDWORD)); 211 SDL_memset(&dipdw, 0, sizeof(DIPROPDWORD));
212 dipdw.diph.dwSize = sizeof(DIPROPDWORD); 212 dipdw.diph.dwSize = sizeof(DIPROPDWORD);
213 dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); 213 dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
214 214
215 215
216 /* allocate memory for system specific hardware data */ 216 /* allocate memory for system specific hardware data */
218 (struct joystick_hwdata *) malloc(sizeof(struct joystick_hwdata)); 218 (struct joystick_hwdata *) malloc(sizeof(struct joystick_hwdata));
219 if (joystick->hwdata == NULL) { 219 if (joystick->hwdata == NULL) {
220 SDL_OutOfMemory(); 220 SDL_OutOfMemory();
221 return (-1); 221 return (-1);
222 } 222 }
223 ZeroMemory(joystick->hwdata, sizeof(struct joystick_hwdata)); 223 SDL_memset(joystick->hwdata, 0, sizeof(struct joystick_hwdata));
224 joystick->hwdata->buffered = 1; 224 joystick->hwdata->buffered = 1;
225 joystick->hwdata->Capabilities.dwSize = sizeof(DIDEVCAPS); 225 joystick->hwdata->Capabilities.dwSize = sizeof(DIDEVCAPS);
226 226
227 result = 227 result =
228 IDirectInput_CreateDevice(dinput, 228 IDirectInput_CreateDevice(dinput,