diff options
| author | 2018-09-15 15:21:06 +0200 | |
|---|---|---|
| committer | 2018-09-15 15:21:06 +0200 | |
| commit | 63c2e32e207d31ecadd9022e1d7cd705c9febac8 (patch) | |
| tree | 8a90e8ef2804f147dff7225a543a8740ecf7160c /src/core/hle/service/acc | |
| parent | Merge pull request #1310 from lioncash/kernel-ns (diff) | |
| download | yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.gz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.xz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.zip | |
Port #4182 from Citra: "Prefix all size_t with std::"
Diffstat (limited to 'src/core/hle/service/acc')
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.cpp | 21 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.h | 22 |
2 files changed, 23 insertions, 20 deletions
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 4ccebef23..0071ca613 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp | |||
| @@ -33,7 +33,7 @@ ProfileManager::~ProfileManager() = default; | |||
| 33 | 33 | ||
| 34 | /// After a users creation it needs to be "registered" to the system. AddToProfiles handles the | 34 | /// After a users creation it needs to be "registered" to the system. AddToProfiles handles the |
| 35 | /// internal management of the users profiles | 35 | /// internal management of the users profiles |
| 36 | boost::optional<size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) { | 36 | boost::optional<std::size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) { |
| 37 | if (user_count >= MAX_USERS) { | 37 | if (user_count >= MAX_USERS) { |
| 38 | return boost::none; | 38 | return boost::none; |
| 39 | } | 39 | } |
| @@ -42,7 +42,7 @@ boost::optional<size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) { | |||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | /// Deletes a specific profile based on it's profile index | 44 | /// Deletes a specific profile based on it's profile index |
| 45 | bool ProfileManager::RemoveProfileAtIndex(size_t index) { | 45 | bool ProfileManager::RemoveProfileAtIndex(std::size_t index) { |
| 46 | if (index >= MAX_USERS || index >= user_count) { | 46 | if (index >= MAX_USERS || index >= user_count) { |
| 47 | return false; | 47 | return false; |
| 48 | } | 48 | } |
| @@ -101,7 +101,7 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) | |||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | /// Returns a users profile index based on their user id. | 103 | /// Returns a users profile index based on their user id. |
| 104 | boost::optional<size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { | 104 | boost::optional<std::size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { |
| 105 | if (!uuid) { | 105 | if (!uuid) { |
| 106 | return boost::none; | 106 | return boost::none; |
| 107 | } | 107 | } |
| @@ -110,16 +110,17 @@ boost::optional<size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { | |||
| 110 | if (iter == profiles.end()) { | 110 | if (iter == profiles.end()) { |
| 111 | return boost::none; | 111 | return boost::none; |
| 112 | } | 112 | } |
| 113 | return static_cast<size_t>(std::distance(profiles.begin(), iter)); | 113 | return static_cast<std::size_t>(std::distance(profiles.begin(), iter)); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | /// Returns a users profile index based on their profile | 116 | /// Returns a users profile index based on their profile |
| 117 | boost::optional<size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const { | 117 | boost::optional<std::size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const { |
| 118 | return GetUserIndex(user.user_uuid); | 118 | return GetUserIndex(user.user_uuid); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | /// Returns the data structure used by the switch when GetProfileBase is called on acc:* | 121 | /// Returns the data structure used by the switch when GetProfileBase is called on acc:* |
| 122 | bool ProfileManager::GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const { | 122 | bool ProfileManager::GetProfileBase(boost::optional<std::size_t> index, |
| 123 | ProfileBase& profile) const { | ||
| 123 | if (index == boost::none || index >= MAX_USERS) { | 124 | if (index == boost::none || index >= MAX_USERS) { |
| 124 | return false; | 125 | return false; |
| 125 | } | 126 | } |
| @@ -143,14 +144,16 @@ bool ProfileManager::GetProfileBase(const ProfileInfo& user, ProfileBase& profil | |||
| 143 | 144 | ||
| 144 | /// Returns the current user count on the system. We keep a variable which tracks the count so we | 145 | /// Returns the current user count on the system. We keep a variable which tracks the count so we |
| 145 | /// don't have to loop the internal profile array every call. | 146 | /// don't have to loop the internal profile array every call. |
| 146 | size_t ProfileManager::GetUserCount() const { | 147 | |
| 148 | std::size_t ProfileManager::GetUserCount() const { | ||
| 147 | return user_count; | 149 | return user_count; |
| 148 | } | 150 | } |
| 149 | 151 | ||
| 150 | /// Lists the current "opened" users on the system. Users are typically not open until they sign | 152 | /// Lists the current "opened" users on the system. Users are typically not open until they sign |
| 151 | /// into something or pick a profile. As of right now users should all be open until qlaunch is | 153 | /// into something or pick a profile. As of right now users should all be open until qlaunch is |
| 152 | /// booting | 154 | /// booting |
| 153 | size_t ProfileManager::GetOpenUserCount() const { | 155 | |
| 156 | std::size_t ProfileManager::GetOpenUserCount() const { | ||
| 154 | return std::count_if(profiles.begin(), profiles.end(), | 157 | return std::count_if(profiles.begin(), profiles.end(), |
| 155 | [](const ProfileInfo& p) { return p.is_open; }); | 158 | [](const ProfileInfo& p) { return p.is_open; }); |
| 156 | } | 159 | } |
| @@ -206,7 +209,7 @@ UUID ProfileManager::GetLastOpenedUser() const { | |||
| 206 | } | 209 | } |
| 207 | 210 | ||
| 208 | /// Return the users profile base and the unknown arbitary data. | 211 | /// Return the users profile base and the unknown arbitary data. |
| 209 | bool ProfileManager::GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile, | 212 | bool ProfileManager::GetProfileBaseAndData(boost::optional<std::size_t> index, ProfileBase& profile, |
| 210 | ProfileData& data) const { | 213 | ProfileData& data) const { |
| 211 | if (GetProfileBase(index, profile)) { | 214 | if (GetProfileBase(index, profile)) { |
| 212 | data = profiles[index.get()].data; | 215 | data = profiles[index.get()].data; |
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index cd8df93a5..bffd4cf4d 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | #include "core/hle/result.h" | 12 | #include "core/hle/result.h" |
| 13 | 13 | ||
| 14 | namespace Service::Account { | 14 | namespace Service::Account { |
| 15 | constexpr size_t MAX_USERS = 8; | 15 | constexpr std::size_t MAX_USERS = 8; |
| 16 | constexpr size_t MAX_DATA = 128; | 16 | constexpr std::size_t MAX_DATA = 128; |
| 17 | constexpr u128 INVALID_UUID{{0, 0}}; | 17 | constexpr u128 INVALID_UUID{{0, 0}}; |
| 18 | 18 | ||
| 19 | struct UUID { | 19 | struct UUID { |
| @@ -87,18 +87,18 @@ public: | |||
| 87 | ResultCode AddUser(const ProfileInfo& user); | 87 | ResultCode AddUser(const ProfileInfo& user); |
| 88 | ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username); | 88 | ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username); |
| 89 | ResultCode CreateNewUser(UUID uuid, const std::string& username); | 89 | ResultCode CreateNewUser(UUID uuid, const std::string& username); |
| 90 | boost::optional<size_t> GetUserIndex(const UUID& uuid) const; | 90 | boost::optional<std::size_t> GetUserIndex(const UUID& uuid) const; |
| 91 | boost::optional<size_t> GetUserIndex(const ProfileInfo& user) const; | 91 | boost::optional<std::size_t> GetUserIndex(const ProfileInfo& user) const; |
| 92 | bool GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const; | 92 | bool GetProfileBase(boost::optional<std::size_t> index, ProfileBase& profile) const; |
| 93 | bool GetProfileBase(UUID uuid, ProfileBase& profile) const; | 93 | bool GetProfileBase(UUID uuid, ProfileBase& profile) const; |
| 94 | bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; | 94 | bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; |
| 95 | bool GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile, | 95 | bool GetProfileBaseAndData(boost::optional<std::size_t> index, ProfileBase& profile, |
| 96 | ProfileData& data) const; | 96 | ProfileData& data) const; |
| 97 | bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const; | 97 | bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const; |
| 98 | bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, | 98 | bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, |
| 99 | ProfileData& data) const; | 99 | ProfileData& data) const; |
| 100 | size_t GetUserCount() const; | 100 | std::size_t GetUserCount() const; |
| 101 | size_t GetOpenUserCount() const; | 101 | std::size_t GetOpenUserCount() const; |
| 102 | bool UserExists(UUID uuid) const; | 102 | bool UserExists(UUID uuid) const; |
| 103 | void OpenUser(UUID uuid); | 103 | void OpenUser(UUID uuid); |
| 104 | void CloseUser(UUID uuid); | 104 | void CloseUser(UUID uuid); |
| @@ -110,9 +110,9 @@ public: | |||
| 110 | 110 | ||
| 111 | private: | 111 | private: |
| 112 | std::array<ProfileInfo, MAX_USERS> profiles{}; | 112 | std::array<ProfileInfo, MAX_USERS> profiles{}; |
| 113 | size_t user_count = 0; | 113 | std::size_t user_count = 0; |
| 114 | boost::optional<size_t> AddToProfiles(const ProfileInfo& profile); | 114 | boost::optional<std::size_t> AddToProfiles(const ProfileInfo& profile); |
| 115 | bool RemoveProfileAtIndex(size_t index); | 115 | bool RemoveProfileAtIndex(std::size_t index); |
| 116 | UUID last_opened_user{INVALID_UUID}; | 116 | UUID last_opened_user{INVALID_UUID}; |
| 117 | }; | 117 | }; |
| 118 | 118 | ||