Просмотр исходного кода

audout_u: Use a std::array instead of std::string for holding the audio interface name

Uses a type that doesn't potentially dynamically allocate, and ensures
that the name of the interface is properly null-terminated when writing
it to the buffer.
Lioncash 8 лет назад
Родитель
Сommit
c20cea118b
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      src/core/hle/service/audio/audout_u.cpp

+ 2 - 1
src/core/hle/service/audio/audout_u.cpp

@@ -2,6 +2,7 @@
 // Licensed under GPLv2 or any later version
 // Refer to the license.txt file included.
 
+#include <array>
 #include <vector>
 #include "common/logging/log.h"
 #include "core/core_timing.h"
@@ -167,7 +168,7 @@ void AudOutU::ListAudioOutsImpl(Kernel::HLERequestContext& ctx) {
     LOG_WARNING(Service_Audio, "(STUBBED) called");
     IPC::RequestParser rp{ctx};
 
-    const std::string audio_interface = "AudioInterface";
+    constexpr std::array<char, 15> audio_interface{{"AudioInterface"}};
     ctx.WriteBuffer(audio_interface);
 
     IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0);