1
0
Fork 0
forked from suyu/suyu

audren_u: Use a std::array instead of std::string for holding the audio interface/device name

std::string doesn't include the null-terminator in its data() + size()
range. This ensures that the null-terminator will also be written to the buffer
This commit is contained in:
Lioncash 2018-07-19 23:09:35 -04:00
parent c20cea118b
commit 40c9c5a55c

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <array>
#include "common/alignment.h" #include "common/alignment.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core_timing.h" #include "core/core_timing.h"
@ -298,7 +300,7 @@ private:
LOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const std::string audio_interface = "AudioInterface"; constexpr std::array<char, 15> audio_interface{{"AudioInterface"}};
ctx.WriteBuffer(audio_interface); ctx.WriteBuffer(audio_interface);
IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0);
@ -323,7 +325,7 @@ private:
LOG_WARNING(Service_Audio, "(STUBBED) called"); LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const std::string audio_interface = "AudioDevice"; constexpr std::array<char, 12> audio_interface{{"AudioDevice"}};
ctx.WriteBuffer(audio_interface); ctx.WriteBuffer(audio_interface);
IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0);