diff options
| author | Lioncash <mathew1800@gmail.com> | 2018-07-19 16:10:12 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2018-07-19 17:05:12 -0400 |
| commit | ff500a7b6838f2eaca25b79ce602c499a71b9c10 (patch) | |
| tree | 7813699b6de1c54556817cba997c870cb4846b35 /src/core/hle/service | |
| parent | 7eace8f512305baabef78f5c93dff06b2a4bf47e (diff) | |
hle_ipc: Introduce generic WriteBuffer overload for multiple container types
This introduces a slightly more generic variant of WriteBuffer().
Notably, this variant doesn't constrain the arguments to only accepting
std::vector instances. It accepts whatever adheres to the
ContiguousContainer concept in the C++ standard library.
This essentially means, std::array, std::string, and std::vector can be
used directly with this interface. The interface no longer forces you to
solely use containers that dynamically allocate.
To ensure our overloads play nice with one another, we only enable the
container-based WriteBuffer if the argument is not a pointer, otherwise
we fall back to the pointer-based one.
Diffstat (limited to 'src/core/hle/service')
| -rw-r--r-- | src/core/hle/service/audio/audout_u.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/audio/audren_u.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/set/set.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 8bf273b22..4217ea4fb 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp @@ -168,7 +168,7 @@ void AudOutU::ListAudioOutsImpl(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const std::string audio_interface = "AudioInterface"; - ctx.WriteBuffer(audio_interface.c_str(), audio_interface.size()); + ctx.WriteBuffer(audio_interface); IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index b7f591c6d..3bb15bd9f 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -299,7 +299,7 @@ private: IPC::RequestParser rp{ctx}; const std::string audio_interface = "AudioInterface"; - ctx.WriteBuffer(audio_interface.c_str(), audio_interface.size()); + ctx.WriteBuffer(audio_interface); IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); rb.Push(RESULT_SUCCESS); @@ -324,7 +324,7 @@ private: IPC::RequestParser rp{ctx}; const std::string audio_interface = "AudioDevice"; - ctx.WriteBuffer(audio_interface.c_str(), audio_interface.size()); + ctx.WriteBuffer(audio_interface); IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0); rb.Push(RESULT_SUCCESS); diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index bd295cdf6..886133b74 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -31,7 +31,7 @@ void SET::GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx) { LanguageCode::ZH_HANS, LanguageCode::ZH_HANT, }}; - ctx.WriteBuffer(available_language_codes.data(), available_language_codes.size()); + ctx.WriteBuffer(available_language_codes); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); |
