ipc: Allow all trivially copyable objects to be passed directly into WriteBuffer (#4465)
* ipc: Allow all trivially copyable objects to be passed directly into WriteBuffer With the support of C++20, we can use concepts to deduce if a type is an STL container or not. * More agressive concept for stl containers * Add -fconcepts * Move to common namespace * Add Common::IsBaseOf
This commit is contained in:
parent
6ecae2e559
commit
ecaac59acd
12 changed files with 64 additions and 30 deletions
|
@ -286,9 +286,7 @@ protected:
|
|||
ProfileBase profile_base{};
|
||||
ProfileData data{};
|
||||
if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) {
|
||||
std::array<u8, sizeof(ProfileData)> raw_data;
|
||||
std::memcpy(raw_data.data(), &data, sizeof(ProfileData));
|
||||
ctx.WriteBuffer(raw_data);
|
||||
ctx.WriteBuffer(data);
|
||||
IPC::ResponseBuilder rb{ctx, 16};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushRaw(profile_base);
|
||||
|
@ -333,7 +331,7 @@ protected:
|
|||
std::vector<u8> buffer(size);
|
||||
image.ReadBytes(buffer.data(), buffer.size());
|
||||
|
||||
ctx.WriteBuffer(buffer.data(), buffer.size());
|
||||
ctx.WriteBuffer(buffer);
|
||||
rb.Push<u32>(size);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue