mirror of https://github.com/encounter/SDL.git
Darwin haptic: Fixed a static analysis warning if axes==0.
This commit is contained in:
parent
f99d6e1df8
commit
37f4eb5379
|
@ -771,18 +771,18 @@ static int
|
|||
SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src)
|
||||
{
|
||||
int i;
|
||||
FFCONSTANTFORCE *constant;
|
||||
FFPERIODIC *periodic;
|
||||
FFCONDITION *condition; /* Actually an array of conditions - one per axis. */
|
||||
FFRAMPFORCE *ramp;
|
||||
FFCUSTOMFORCE *custom;
|
||||
FFENVELOPE *envelope;
|
||||
SDL_HapticConstant *hap_constant;
|
||||
SDL_HapticPeriodic *hap_periodic;
|
||||
SDL_HapticCondition *hap_condition;
|
||||
SDL_HapticRamp *hap_ramp;
|
||||
SDL_HapticCustom *hap_custom;
|
||||
DWORD *axes;
|
||||
FFCONSTANTFORCE *constant = NULL;
|
||||
FFPERIODIC *periodic = NULL;
|
||||
FFCONDITION *condition = NULL; /* Actually an array of conditions - one per axis. */
|
||||
FFRAMPFORCE *ramp = NULL;
|
||||
FFCUSTOMFORCE *custom = NULL;
|
||||
FFENVELOPE *envelope = NULL;
|
||||
SDL_HapticConstant *hap_constant = NULL;
|
||||
SDL_HapticPeriodic *hap_periodic = NULL;
|
||||
SDL_HapticCondition *hap_condition = NULL;
|
||||
SDL_HapticRamp *hap_ramp = NULL;
|
||||
SDL_HapticCustom *hap_custom = NULL;
|
||||
DWORD *axes = NULL;
|
||||
|
||||
/* Set global stuff. */
|
||||
SDL_memset(dest, 0, sizeof(FFEFFECT));
|
||||
|
@ -911,6 +911,7 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src)
|
|||
case SDL_HAPTIC_DAMPER:
|
||||
case SDL_HAPTIC_INERTIA:
|
||||
case SDL_HAPTIC_FRICTION:
|
||||
if (dest->cAxes > 0) {
|
||||
hap_condition = &src->condition;
|
||||
condition = SDL_malloc(sizeof(FFCONDITION) * dest->cAxes);
|
||||
if (condition == NULL) {
|
||||
|
@ -931,6 +932,8 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src)
|
|||
CCONVERT(hap_condition->left_sat[i] / 2);
|
||||
condition[i].lDeadBand = CCONVERT(hap_condition->deadband[i] / 2);
|
||||
}
|
||||
}
|
||||
|
||||
dest->cbTypeSpecificParams = sizeof(FFCONDITION) * dest->cAxes;
|
||||
dest->lpvTypeSpecificParams = condition;
|
||||
|
||||
|
|
Loading…
Reference in New Issue