mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-16 23:06:03 +00:00
Fix size of memcpy in SDL_AudioDeviceFormatChangedAlreadyLocked
And add diagnostic that allows to find this kind of issue in clang-tidy
This commit is contained in:

committed by
Ryan C. Gordon

parent
4bb426abad
commit
778e8185cd
@@ -1681,7 +1681,7 @@ int SDL_AudioDeviceFormatChangedAlreadyLocked(SDL_AudioDevice *device, const SDL
|
||||
const SDL_bool iscapture = device->iscapture;
|
||||
|
||||
if ((device->spec.format != newspec->format) || (device->spec.channels != newspec->channels) || (device->spec.freq != newspec->freq)) {
|
||||
SDL_memcpy(&device->spec, newspec, sizeof (newspec));
|
||||
SDL_memcpy(&device->spec, newspec, sizeof (*newspec));
|
||||
for (SDL_LogicalAudioDevice *logdev = device->logical_devices; !kill_device && (logdev != NULL); logdev = logdev->next) {
|
||||
for (SDL_AudioStream *stream = logdev->bound_streams; !kill_device && (stream != NULL); stream = stream->next_binding) {
|
||||
if (SDL_SetAudioStreamFormat(stream, iscapture ? &device->spec : NULL, iscapture ? NULL : &device->spec) == -1) {
|
||||
|
Reference in New Issue
Block a user