Fix: comparison of narrow type to wide type in loop (potential for infinite loops)

This commit is contained in:
Rubidium
2021-05-10 23:43:52 +02:00
committed by rubidium42
parent 031e91de6e
commit bb9121dbd4
10 changed files with 21 additions and 20 deletions

View File

@@ -776,7 +776,7 @@ public:
case WID_SB_SEL_PAGE: {
/* Get max title width. */
for (uint16 i = 0; i < this->story_pages.size(); i++) {
for (size_t i = 0; i < this->story_pages.size(); i++) {
const StoryPage *s = this->story_pages[i];
if (s->title != nullptr) {
@@ -822,7 +822,7 @@ public:
if (!list.empty()) {
/* Get the index of selected page. */
int selected = 0;
for (uint16 i = 0; i < this->story_pages.size(); i++) {
for (size_t i = 0; i < this->story_pages.size(); i++) {
const StoryPage *p = this->story_pages[i];
if (p->index == this->selected_page_id) break;
selected++;