diff options
| author | 2022-10-26 11:15:25 -0400 | |
|---|---|---|
| committer | 2022-10-26 11:21:48 -0400 | |
| commit | e0ec9ffc36892319a5cd847dfd42f6aba4671685 (patch) | |
| tree | 4ac642ac27c90349d85e46bf84739b508bf9a909 /src/audio_core/out | |
| parent | Merge pull request #9131 from Morph1984/contiguous (diff) | |
| download | yuzu-e0ec9ffc36892319a5cd847dfd42f6aba4671685.tar.gz yuzu-e0ec9ffc36892319a5cd847dfd42f6aba4671685.tar.xz yuzu-e0ec9ffc36892319a5cd847dfd42f6aba4671685.zip | |
audio_in/out_system: Pass Initialize members by value where applicable
applet_resource_user_id isn't actually modified and is just assigned to
a member variable, so this doesn't need to be a mutable reference.
Similarly, the device name itself isn't modified and is only moved. We
pass by value here, since we can still perform the move, but eliminate a
sneaky set of calls that can unintentionally destroy the original
string. Given how nested the calls are, it's good to get rid of this
potential vector for a use-after-move bug.
Diffstat (limited to 'src/audio_core/out')
| -rw-r--r-- | src/audio_core/out/audio_out_system.cpp | 4 | ||||
| -rw-r--r-- | src/audio_core/out/audio_out_system.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/audio_core/out/audio_out_system.cpp b/src/audio_core/out/audio_out_system.cpp index 48a801923..a66208ed9 100644 --- a/src/audio_core/out/audio_out_system.cpp +++ b/src/audio_core/out/audio_out_system.cpp | |||
| @@ -49,8 +49,8 @@ Result System::IsConfigValid(std::string_view device_name, | |||
| 49 | return Service::Audio::ERR_INVALID_CHANNEL_COUNT; | 49 | return Service::Audio::ERR_INVALID_CHANNEL_COUNT; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | Result System::Initialize(std::string& device_name, const AudioOutParameter& in_params, u32 handle_, | 52 | Result System::Initialize(std::string device_name, const AudioOutParameter& in_params, u32 handle_, |
| 53 | u64& applet_resource_user_id_) { | 53 | u64 applet_resource_user_id_) { |
| 54 | auto result = IsConfigValid(device_name, in_params); | 54 | auto result = IsConfigValid(device_name, in_params); |
| 55 | if (result.IsError()) { | 55 | if (result.IsError()) { |
| 56 | return result; | 56 | return result; |
diff --git a/src/audio_core/out/audio_out_system.h b/src/audio_core/out/audio_out_system.h index 0817b2f37..b95cb91be 100644 --- a/src/audio_core/out/audio_out_system.h +++ b/src/audio_core/out/audio_out_system.h | |||
| @@ -88,8 +88,8 @@ public: | |||
| 88 | * @param applet_resource_user_id - Unused. | 88 | * @param applet_resource_user_id - Unused. |
| 89 | * @return Result code. | 89 | * @return Result code. |
| 90 | */ | 90 | */ |
| 91 | Result Initialize(std::string& device_name, const AudioOutParameter& in_params, u32 handle, | 91 | Result Initialize(std::string device_name, const AudioOutParameter& in_params, u32 handle, |
| 92 | u64& applet_resource_user_id); | 92 | u64 applet_resource_user_id); |
| 93 | 93 | ||
| 94 | /** | 94 | /** |
| 95 | * Start this system. | 95 | * Start this system. |