UI: Fix some sign/size comparison warnings.

Mostly size_t vs int.
This commit is contained in:
Unknown W. Brackets 2022-01-06 20:40:29 -08:00
parent b2bb0be05d
commit a397bf811b
6 changed files with 8 additions and 8 deletions

View file

@ -175,7 +175,7 @@ void SingleControlMapper::MappedCallback(KeyDef kdf) {
bool success = KeyMap::ReplaceSingleKeyMapping(pspKey_, actionIndex_, kdf); bool success = KeyMap::ReplaceSingleKeyMapping(pspKey_, actionIndex_, kdf);
if (!success) { if (!success) {
replaceAllButton_->SetFocus(); // Last got removed as a duplicate replaceAllButton_->SetFocus(); // Last got removed as a duplicate
} else if (actionIndex_ < rows_.size()) { } else if (actionIndex_ < (int)rows_.size()) {
rows_[actionIndex_]->SetFocus(); rows_[actionIndex_]->SetFocus();
} else { } else {
SetFocus(); SetFocus();
@ -223,7 +223,7 @@ UI::EventReturn SingleControlMapper::OnDelete(UI::EventParams &params) {
KeyMap::g_controllerMap[pspKey_].erase(KeyMap::g_controllerMap[pspKey_].begin() + index); KeyMap::g_controllerMap[pspKey_].erase(KeyMap::g_controllerMap[pspKey_].begin() + index);
KeyMap::g_controllerMapGeneration++; KeyMap::g_controllerMapGeneration++;
if (index + 1 < rows_.size()) if (index + 1 < (int)rows_.size())
rows_[index]->SetFocus(); rows_[index]->SetFocus();
else else
SetFocus(); SetFocus();

View file

@ -358,7 +358,7 @@ bool CwCheatScreen::RebuildCheatFile(int index) {
return false; return false;
} }
for (int i = 0; i < lines.size(); ++i) { for (size_t i = 0; i < lines.size(); ++i) {
fprintf(out, "%s", lines[i].c_str()); fprintf(out, "%s", lines[i].c_str());
if (i != lines.size() - 1) if (i != lines.size() - 1)
fputc('\n', out); fputc('\n', out);

View file

@ -349,7 +349,7 @@ void GameSettingsScreen::CreateViews() {
graphicsSettings->Add(new ItemHeader(gr->T("Postprocessing effect"))); graphicsSettings->Add(new ItemHeader(gr->T("Postprocessing effect")));
std::set<std::string> alreadyAddedShader; std::set<std::string> alreadyAddedShader;
for (int i = 0; i < g_Config.vPostShaderNames.size() + 1 && i < ARRAY_SIZE(shaderNames_); ++i) { for (int i = 0; i < (int)g_Config.vPostShaderNames.size() + 1 && i < ARRAY_SIZE(shaderNames_); ++i) {
// Vector element pointer get invalidated on resize, cache name to have always a valid reference in the rendering thread // Vector element pointer get invalidated on resize, cache name to have always a valid reference in the rendering thread
shaderNames_[i] = i == g_Config.vPostShaderNames.size() ? "Off" : g_Config.vPostShaderNames[i]; shaderNames_[i] = i == g_Config.vPostShaderNames.size() ? "Off" : g_Config.vPostShaderNames[i];
postProcChoice_ = graphicsSettings->Add(new ChoiceWithValueDisplay(&shaderNames_[i], StringFromFormat("%s #%d", gr->T("Postprocessing Shader"), i + 1), &PostShaderTranslateName)); postProcChoice_ = graphicsSettings->Add(new ChoiceWithValueDisplay(&shaderNames_[i], StringFromFormat("%s #%d", gr->T("Postprocessing Shader"), i + 1), &PostShaderTranslateName));

View file

@ -525,7 +525,7 @@ void PostProcScreen::CreateViews() {
shaders_ = GetAllPostShaderInfo(); shaders_ = GetAllPostShaderInfo();
std::vector<std::string> items; std::vector<std::string> items;
int selected = -1; int selected = -1;
const std::string selectedName = id_ >= g_Config.vPostShaderNames.size() ? "Off" : g_Config.vPostShaderNames[id_]; const std::string selectedName = id_ >= (int)g_Config.vPostShaderNames.size() ? "Off" : g_Config.vPostShaderNames[id_];
for (int i = 0; i < (int)shaders_.size(); i++) { for (int i = 0; i < (int)shaders_.size(); i++) {
if (!shaders_[i].visible) if (!shaders_[i].visible)
continue; continue;
@ -541,7 +541,7 @@ void PostProcScreen::OnCompleted(DialogResult result) {
if (result != DR_OK) if (result != DR_OK)
return; return;
const std::string &value = shaders_[listView_->GetSelected()].section; const std::string &value = shaders_[listView_->GetSelected()].section;
if (id_ < g_Config.vPostShaderNames.size()) if (id_ < (int)g_Config.vPostShaderNames.size())
g_Config.vPostShaderNames[id_] = value; g_Config.vPostShaderNames[id_] = value;
else else
g_Config.vPostShaderNames.push_back(value); g_Config.vPostShaderNames.push_back(value);

View file

@ -121,7 +121,7 @@ void CMemoryDlg::searchBoxRedraw(std::vector<u32> results) {
wchar_t temp[256]{}; wchar_t temp[256]{};
SendMessage(srcListHdl, WM_SETREDRAW, FALSE, 0); SendMessage(srcListHdl, WM_SETREDRAW, FALSE, 0);
ListBox_ResetContent(srcListHdl); ListBox_ResetContent(srcListHdl);
for (int i = 0; i < results.size(); i++) { for (size_t i = 0; i < results.size(); i++) {
wsprintf(temp, L"0x%08X", results[i]); wsprintf(temp, L"0x%08X", results[i]);
int index = (int)ListBox_AddString(srcListHdl, temp); int index = (int)ListBox_AddString(srcListHdl, temp);
ListBox_SetItemData(srcListHdl, index, results[i]); ListBox_SetItemData(srcListHdl, index, results[i]);

View file

@ -671,7 +671,7 @@ protected:
float MeasureWidth(const char *str, size_t bytes) override { float MeasureWidth(const char *str, size_t bytes) override {
// Simple case for unit testing. // Simple case for unit testing.
int w = 0; int w = 0;
for (UTF8 utf(str); !utf.end() && utf.byteIndex() < bytes; ) { for (UTF8 utf(str); !utf.end() && (size_t)utf.byteIndex() < bytes; ) {
uint32_t c = utf.next(); uint32_t c = utf.next();
switch (c) { switch (c) {
case ' ': case ' ':