Bläddra i källkod

audio: Change a few SDL_memcpy calls to SDL_copyp.

Ryan C. Gordon 1 år sedan
förälder
incheckning
a541e2ac10
2 ändrade filer med 4 tillägg och 4 borttagningar
  1. 3 3
      src/audio/SDL_audio.c
  2. 1 1
      src/audio/directsound/SDL_directsound.c

+ 3 - 3
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

+ 1 - 1
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