From a541e2ac10d8b3ccaf3658bdceae0a4b902d71f0 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 20 Sep 2023 17:02:28 -0400 Subject: [PATCH] audio: Change a few SDL_memcpy calls to SDL_copyp. --- src/audio/SDL_audio.c | 6 +++--- src/audio/directsound/SDL_directsound.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index ed7ac96904..9bc1fd4283 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -1250,7 +1250,7 @@ int SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int * return -1; } - SDL_memcpy(spec, &device->spec, sizeof (SDL_AudioSpec)); + SDL_copyp(spec, &device->spec); if (sample_frames) { *sample_frames = device->sample_frames; } @@ -1288,7 +1288,7 @@ static void ClosePhysicalAudioDevice(SDL_AudioDevice *device) SDL_aligned_free(device->postmix_buffer); device->postmix_buffer = NULL; - SDL_memcpy(&device->spec, &device->default_spec, sizeof (SDL_AudioSpec)); + SDL_copyp(&device->spec, &device->default_spec); device->sample_frames = 0; device->silence_value = SDL_GetSilenceValueForFormat(device->spec.format); SDL_AtomicSet(&device->shutdown, 0); // ready to go again. @@ -1390,7 +1390,7 @@ static int OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec } SDL_AudioSpec spec; - SDL_memcpy(&spec, inspec ? inspec : &device->default_spec, sizeof (SDL_AudioSpec)); + SDL_copyp(&spec, inspec ? inspec : &device->default_spec); PrepareAudioFormat(device->iscapture, &spec); /* We allow the device format to change if it's better than the current settings (by various definitions of "better"). This prevents diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c index db68648d7e..ab12c8cd9a 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/src/audio/directsound/SDL_directsound.c @@ -179,7 +179,7 @@ static BOOL CALLBACK FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVO if (str != NULL) { LPGUID cpyguid = (LPGUID)SDL_malloc(sizeof(GUID)); if (cpyguid) { - SDL_memcpy(cpyguid, guid, sizeof(GUID)); + SDL_copyp(cpyguid, guid); /* Note that spec is NULL, because we are required to connect to the * device before getting the channel mask and output format, making