src/haptic/win32/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2575 57ea8810b5f0
parent 2574 c1f07fdd1e2d
child 2578 72c4ac55f73c
equal deleted inserted replaced
2574:c1f07fdd1e2d 2575:57ea8810b5f0
   164  * Callback to find the haptic devices.
   164  * Callback to find the haptic devices.
   165  */
   165  */
   166 static BOOL CALLBACK
   166 static BOOL CALLBACK
   167 EnumHapticsCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
   167 EnumHapticsCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
   168 {
   168 {
   169    memcpy(&SDL_hapticlist[SDL_numhaptics].instance, pdidInstance,
   169    SDL_memcpy(&SDL_hapticlist[SDL_numhaptics].instance, pdidInstance,
   170          sizeof(DIDEVICEINSTANCE));
   170          sizeof(DIDEVICEINSTANCE));
   171    SDL_numhaptics++;
   171    SDL_numhaptics++;
   172 
   172 
   173    if (SDL_numhaptics >= MAX_HAPTICS)
   173    if (SDL_numhaptics >= MAX_HAPTICS)
   174       return DIENUM_STOP;
   174       return DIENUM_STOP;
   374    IDirectInputDevice2_Unacquire(haptic->hwdata->device);
   374    IDirectInputDevice2_Unacquire(haptic->hwdata->device);
   375 query_err:
   375 query_err:
   376    IDirectInputDevice2_Release(haptic->hwdata->device);   
   376    IDirectInputDevice2_Release(haptic->hwdata->device);   
   377 creat_err:
   377 creat_err:
   378    if (haptic->hwdata != NULL) {
   378    if (haptic->hwdata != NULL) {
   379       free(haptic->hwdata);
   379       SDL_free(haptic->hwdata);
   380       haptic->hwdata = NULL;                                              
   380       haptic->hwdata = NULL;                                              
   381    }
   381    }
   382    return -1;
   382    return -1;
   383 
   383 
   384 }
   384 }