diff options
| author | 2022-08-28 19:31:16 +0200 | |
|---|---|---|
| committer | 2022-09-02 00:50:32 +0200 | |
| commit | 65718e2876374aecf2ac29856387dab4394ca47f (patch) | |
| tree | 5826079e7f63131021fa11120f17173e6c8e2307 /src/core | |
| parent | core/ldn_types: Minor corrections and additions (diff) | |
| download | yuzu-65718e2876374aecf2ac29856387dab4394ca47f.tar.gz yuzu-65718e2876374aecf2ac29856387dab4394ca47f.tar.xz yuzu-65718e2876374aecf2ac29856387dab4394ca47f.zip | |
Address review comments
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/ldn/ldn_types.h | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/core/hle/service/ldn/ldn_types.h b/src/core/hle/service/ldn/ldn_types.h index 0af653164..6231e936d 100644 --- a/src/core/hle/service/ldn/ldn_types.h +++ b/src/core/hle/service/ldn/ldn_types.h | |||
| @@ -145,26 +145,19 @@ struct NetworkId { | |||
| 145 | static_assert(sizeof(NetworkId) == 0x20, "NetworkId is an invalid size"); | 145 | static_assert(sizeof(NetworkId) == 0x20, "NetworkId is an invalid size"); |
| 146 | 146 | ||
| 147 | struct Ssid { | 147 | struct Ssid { |
| 148 | u8 length; | 148 | u8 length{}; |
| 149 | std::array<char, SsidLengthMax + 1> raw; | 149 | std::array<char, SsidLengthMax + 1> raw{}; |
| 150 | 150 | ||
| 151 | Ssid() { | 151 | Ssid() = default; |
| 152 | length = 0; | ||
| 153 | std::memset(raw.data(), 0, raw.size()); | ||
| 154 | } | ||
| 155 | 152 | ||
| 156 | Ssid(std::string data) { | 153 | explicit Ssid(std::string_view data) { |
| 157 | length = static_cast<u8>(std::min(data.size(), SsidLengthMax)); | 154 | length = static_cast<u8>(std::min(data.size(), SsidLengthMax)); |
| 158 | std::memcpy(raw.data(), data.data(), length); | 155 | data.copy(raw.data(), length); |
| 159 | raw[length] = 0; | 156 | raw[length] = 0; |
| 160 | } | 157 | } |
| 161 | 158 | ||
| 162 | std::string GetStringValue() const { | 159 | std::string GetStringValue() const { |
| 163 | return std::string(raw.data(), length); | 160 | return std::string(raw.data()); |
| 164 | } | ||
| 165 | |||
| 166 | bool operator==(const Ssid& b) const { | ||
| 167 | return (length == b.length) && (std::memcmp(raw.data(), b.raw.data(), length) == 0); | ||
| 168 | } | 161 | } |
| 169 | }; | 162 | }; |
| 170 | static_assert(sizeof(Ssid) == 0x22, "Ssid is an invalid size"); | 163 | static_assert(sizeof(Ssid) == 0x22, "Ssid is an invalid size"); |