gui: Access vector element directly instead of using *.at(index)

This commit is contained in:
Joel16 2022-08-04 00:10:01 -04:00
parent 3b45af17ff
commit 6f3d028927
3 changed files with 10 additions and 10 deletions

View File

@ -18,8 +18,8 @@ namespace Popups {
ImGui::Text(strings[cfg.lang][Lang::DeleteMultiplePrompt]);
ImGui::Dummy(ImVec2(0.0f, 5.0f)); // Spacing
ImGui::BeginChild("Scrolling", ImVec2(0, 100));
for (long unsigned int i = 0; i < data.checkbox_data.checked.size(); i++) {
if (data.checkbox_data.checked.at(i))
for (std::size_t i = 0; i < data.checkbox_data.checked.size(); i++) {
if (data.checkbox_data.checked[i])
ImGui::Text(data.entries[i].name);
}
ImGui::EndChild();
@ -43,11 +43,11 @@ namespace Popups {
std::sort(entries.begin(), entries.end(), FileBrowser::Sort);
Log::Exit();
for (long unsigned int i = 0; i < data.checkbox_data.checked.size(); i++) {
for (std::size_t i = 0; i < data.checkbox_data.checked.size(); i++) {
if (std::strncmp(entries[i].name, "..", 2) == 0)
continue;
if (data.checkbox_data.checked.at(i)) {
if (data.checkbox_data.checked[i]) {
if (R_FAILED(ret = FS::Delete(entries[i]))) {
FS::GetDirList(cwd, data.entries);
Windows::ResetCheckbox(data);

View File

@ -28,11 +28,11 @@ namespace Options {
std::sort(entries.begin(), entries.end(), FileBrowser::Sort);
for (long unsigned int i = 0; i < data.checkbox_data.checked_copy.size(); i++) {
for (std::size_t i = 0; i < data.checkbox_data.checked_copy.size(); i++) {
if (std::strncmp(entries[i].name, "..", 2) == 0)
continue;
if (data.checkbox_data.checked_copy.at(i)) {
if (data.checkbox_data.checked_copy[i]) {
FS::Copy(entries[i], data.checkbox_data.cwd);
if (R_FAILED((*func)())) {

View File

@ -103,10 +103,10 @@ namespace Tabs {
ImGui::PushItemWidth(160.f);
if (ImGui::BeginCombo("", device.c_str())) {
for (std::size_t i = 0; i < devices_list.size(); i++) {
const bool is_selected = (device == devices_list.at(i));
const bool is_selected = (device == devices_list[i]);
if (ImGui::Selectable(devices_list.at(i).c_str(), is_selected)) {
device = devices_list.at(i);
if (ImGui::Selectable(devices_list[i].c_str(), is_selected)) {
device = devices_list[i];
fs = std::addressof(devices[i]);
std::strncpy(cwd, "/", 2);
data.entries.clear();
@ -161,7 +161,7 @@ namespace Tabs {
ImGui::TableNextColumn();
ImGui::PushID(i);
if ((data.checkbox_data.checked.at(i)) && (strcasecmp(data.checkbox_data.cwd, cwd) == 0))
if ((data.checkbox_data.checked[i]) && (strcasecmp(data.checkbox_data.cwd, cwd) == 0))
ImGui::Image(reinterpret_cast<ImTextureID>(check_icon.id), tex_size);
else
ImGui::Image(reinterpret_cast<ImTextureID>(uncheck_icon.id), tex_size);