mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-05 10:52:15 +02:00
More corrections to accountListAllUsers
This commit is contained in:
parent
1e4b2336a6
commit
01ed16ea5f
@ -39,10 +39,10 @@ Service* accountGetService(void);
|
||||
Result accountGetUserCount(s32* user_count);
|
||||
|
||||
/**
|
||||
* @brief Get a list of all user IDs. The returned list will never be larger than ACC_USER_LIST_SIZE
|
||||
* @param userIDs Pointer to array of user IDs
|
||||
* @param max_userIDs Maximum number of user IDs to return
|
||||
* @param actual_total The actual total number of user IDs found
|
||||
* @brief Get a list of all user IDs. The returned list will never be larger than ACC_USER_LIST_SIZE.
|
||||
* @param userIDs Pointer to array of user IDs.
|
||||
* @param max_userIDs Maximum number of user IDs to return.
|
||||
* @param actual_total The actual total number of user IDs found.
|
||||
*/
|
||||
Result accountListAllUsers(u128* userIDs, size_t max_userIDs, size_t *actual_total);
|
||||
|
||||
|
@ -112,7 +112,6 @@ static Result _accountListAllUsers(u128* userIDs)
|
||||
Result accountListAllUsers(u128* userIDs, size_t max_userIDs, size_t *actual_total)
|
||||
{
|
||||
Result rc=0;
|
||||
|
||||
u128 *temp_userIDs;
|
||||
temp_userIDs = malloc(sizeof(u128) * ACC_USER_LIST_SIZE);
|
||||
|
||||
@ -126,13 +125,10 @@ Result accountListAllUsers(u128* userIDs, size_t max_userIDs, size_t *actual_tot
|
||||
}
|
||||
|
||||
if (max_userIDs > total_userIDs) {
|
||||
max_userIDs = total_userIDs;
|
||||
}
|
||||
|
||||
for (int i = 0; i < max_userIDs; i++) {
|
||||
userIDs[i] = temp_userIDs[i];
|
||||
memcpy(&max_userIDs, &total_userIDs, sizeof(size_t));
|
||||
}
|
||||
|
||||
memcpy(userIDs, temp_userIDs, sizeof(u128) * max_userIDs);
|
||||
*actual_total = max_userIDs;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user