More prefer SDL_zero*()
Transform clearing of arrays into SDL_zeroa(), and
clearing through a T* with size(T) into SDL_zerop().
Extends commit 83fb7b6636.
This commit is contained in:
committed by
Sam Lantinga
parent
83fb7b6636
commit
248223592a
@@ -785,7 +785,7 @@ static bool SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, const SDL_Hap
|
||||
DWORD *axes = NULL;
|
||||
|
||||
// Set global stuff.
|
||||
SDL_memset(dest, 0, sizeof(FFEFFECT));
|
||||
SDL_zerop(dest);
|
||||
dest->dwSize = sizeof(FFEFFECT); // Set the structure size.
|
||||
dest->dwSamplePeriod = 0; // Not used by us.
|
||||
dest->dwGain = 10000; // Gain is set globally, not locally.
|
||||
|
||||
@@ -737,7 +737,7 @@ static int lg4ff_timer(struct lg4ff_device *device)
|
||||
|
||||
// XXX how to detect stacked up effects here?
|
||||
|
||||
SDL_memset(parameters, 0, sizeof(parameters));
|
||||
SDL_zeroa(parameters);
|
||||
|
||||
gain = (Uint16)((Uint32)device->gain * device->app_gain / 0xffff);
|
||||
|
||||
@@ -895,7 +895,7 @@ static void *SDL_HIDAPI_HapticDriverLg4ff_Open(SDL_Joystick *joystick)
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
SDL_memset(ctx, 0, sizeof(lg4ff_device));
|
||||
SDL_zerop(ctx);
|
||||
|
||||
ctx->hid_handle = joystick;
|
||||
if (lg4ff_init_slots(ctx) != 0) {
|
||||
@@ -1200,7 +1200,7 @@ static bool SDL_HIDAPI_HapticDriverLg4ff_SetAutocenter(SDL_HIDAPI_HapticDevice *
|
||||
}
|
||||
expand_a = expand_a >> 1;
|
||||
|
||||
SDL_memset(cmd, 0x00, 7);
|
||||
SDL_zeroa(cmd);
|
||||
cmd[0] = 0xfe;
|
||||
cmd[1] = 0x0d;
|
||||
cmd[2] = (Uint8)(expand_a / 0xaaaa);
|
||||
@@ -1215,7 +1215,7 @@ static bool SDL_HIDAPI_HapticDriverLg4ff_SetAutocenter(SDL_HIDAPI_HapticDevice *
|
||||
}
|
||||
|
||||
// enable
|
||||
SDL_memset(cmd, 0x00, 7);
|
||||
SDL_zeroa(cmd);
|
||||
cmd[0] = 0x14;
|
||||
|
||||
ret = SDL_SendJoystickEffect(ctx->hid_handle, cmd, sizeof(cmd));
|
||||
|
||||
@@ -603,7 +603,7 @@ void SDL_SYS_HapticClose(SDL_Haptic *haptic)
|
||||
}
|
||||
|
||||
// Clear the rest.
|
||||
SDL_memset(haptic, 0, sizeof(SDL_Haptic));
|
||||
SDL_zerop(haptic);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -725,7 +725,7 @@ static bool SDL_SYS_ToFFEffect(struct ff_effect *dest, const SDL_HapticEffect *s
|
||||
const SDL_HapticLeftRight *leftright;
|
||||
|
||||
// Clear up
|
||||
SDL_memset(dest, 0, sizeof(struct ff_effect));
|
||||
SDL_zerop(dest);
|
||||
|
||||
switch (src->type) {
|
||||
case SDL_HAPTIC_CONSTANT:
|
||||
|
||||
@@ -599,7 +599,7 @@ static bool SDL_SYS_ToDIEFFECT(SDL_Haptic *haptic, DIEFFECT *dest,
|
||||
DWORD *axes;
|
||||
|
||||
// Set global stuff.
|
||||
SDL_memset(dest, 0, sizeof(DIEFFECT));
|
||||
SDL_zerop(dest);
|
||||
dest->dwSize = sizeof(DIEFFECT); // Set the structure size.
|
||||
dest->dwSamplePeriod = 0; // Not used by us.
|
||||
dest->dwGain = 10000; // Gain is set globally, not locally.
|
||||
|
||||
Reference in New Issue
Block a user