浏览代码

Zero out the audio hotplug event structure, so the "padded" fields are sane.

Just in case we ever need those bits in the future.
Ryan C. Gordon 10 年之前
父节点
当前提交
537b68b9f0
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/audio/SDL_audio.c

+ 2 - 0
src/audio/SDL_audio.c

@@ -351,6 +351,7 @@ SDL_AddAudioDevice(const int iscapture, const char *name, void *handle)
         /* Post the event, if desired */
         /* Post the event, if desired */
         if (SDL_GetEventState(SDL_AUDIODEVICEADDED) == SDL_ENABLE) {
         if (SDL_GetEventState(SDL_AUDIODEVICEADDED) == SDL_ENABLE) {
             SDL_Event event;
             SDL_Event event;
+            SDL_zero(event);
             event.adevice.type = SDL_AUDIODEVICEADDED;
             event.adevice.type = SDL_AUDIODEVICEADDED;
             event.adevice.which = device_index;
             event.adevice.which = device_index;
             event.adevice.iscapture = iscapture;
             event.adevice.iscapture = iscapture;
@@ -377,6 +378,7 @@ void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device)
     /* Post the event, if desired */
     /* Post the event, if desired */
     if (SDL_GetEventState(SDL_AUDIODEVICEREMOVED) == SDL_ENABLE) {
     if (SDL_GetEventState(SDL_AUDIODEVICEREMOVED) == SDL_ENABLE) {
         SDL_Event event;
         SDL_Event event;
+        SDL_zero(event);
         event.adevice.type = SDL_AUDIODEVICEREMOVED;
         event.adevice.type = SDL_AUDIODEVICEREMOVED;
         event.adevice.which = device->id;
         event.adevice.which = device->id;
         event.adevice.iscapture = device->iscapture ? 1 : 0;
         event.adevice.iscapture = device->iscapture ? 1 : 0;