From 0854ed2b51e4f91f5a1ffa0a87b507a47e4368fb Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 18 Aug 2017 10:41:57 +0200 Subject: [PATCH] misc: get rid of some compiler warnings --- rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp | 7 ++++--- rpcs3/rpcs3qt/game_list_frame.cpp | 2 +- rpcs3/rpcs3qt/main_window.cpp | 8 ++++---- rpcs3/rpcs3qt/pad_settings_dialog.cpp | 2 +- rpcs3/rpcs3qt/rsx_debugger.cpp | 17 +++++++++-------- rpcs3/rpcs3qt/rsx_debugger.h | 2 +- rpcs3/rpcs3qt/save_data_list_dialog.cpp | 2 +- 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp b/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp index 6a548bfb62..056c1804b4 100644 --- a/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp @@ -102,9 +102,10 @@ void auto_pause_settings_dialog::SaveEntries(void) void auto_pause_settings_dialog::UpdateList(void) { + const int entries_size = static_cast(m_entries.size()); pauseList->clearContents(); - pauseList->setRowCount(m_entries.size()); - for (size_t i = 0; i < m_entries.size(); ++i) + pauseList->setRowCount(entries_size); + for (int i = 0; i < entries_size; ++i) { QTableWidgetItem* callItem = new QTableWidgetItem; QTableWidgetItem* typeItem = new QTableWidgetItem; @@ -163,7 +164,7 @@ void auto_pause_settings_dialog::ShowContextMenu(const QPoint &pos) connect(add, &QAction::triggered, [=]() { m_entries.emplace_back(0xFFFFFFFF); UpdateList(); - u32 idx = m_entries.size() - 1; + int idx = static_cast(m_entries.size()) - 1; pauseList->selectRow(idx); OnEntryConfig(idx, true); }); diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 69a2c10135..c33c48a206 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -980,7 +980,7 @@ void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size, co } // Get number of things that'll be in grid and precompute grid size. - int entries = 0; + uint entries = 0; for (const GUI_GameInfo& game : m_game_data) { if (qstr(game.info.category) == category::disc_Game || qstr(game.info.category) == category::hdd_Game) diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 3833c38d42..0039b80e4f 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -900,7 +900,7 @@ void main_window::BootRecentAction(const QAction* act) LOG_ERROR(GENERAL, "Recent Game not valid, removed from Boot Recent list: %s", sstr(pth)); // refill menu with actions - for (uint i = 0; i < m_recentGameActs.count(); i++) + for (int i = 0; i < m_recentGameActs.count(); i++) { m_recentGameActs[i]->setShortcut(tr("Ctrl+%1").arg(i + 1)); m_recentGameActs[i]->setToolTip(m_rg_entries.at(i).second); @@ -1023,7 +1023,7 @@ void main_window::AddRecentAction(const q_string_pair& entry) } // refill menu with actions - for (uint i = 0; i < m_recentGameActs.count(); i++) + for (int i = 0; i < m_recentGameActs.count(); i++) { m_recentGameActs[i]->setShortcut(tr("Ctrl+%1").arg(i+1)); m_recentGameActs[i]->setToolTip(m_rg_entries.at(i).second); @@ -1273,7 +1273,7 @@ void main_window::CreateConnects() resizeIcons(idx); }); - connect(gameListFrame, &game_list_frame::RequestSaveSliderPos, [=](const bool& save){ m_save_slider_pos = true; }); + connect(gameListFrame, &game_list_frame::RequestSaveSliderPos, [=](const bool& save){ Q_UNUSED(save); m_save_slider_pos = true; }); connect(gameListFrame, &game_list_frame::RequestListModeActSet, [=](const bool& isList) { isList ? ui->setlistModeListAct->trigger() : ui->setlistModeGridAct->trigger(); @@ -1402,7 +1402,7 @@ void main_window::ConfigureGuiFromSettings(bool configureAll) } m_recentGameActs.clear(); // Fill the recent games menu - for (uint i = 0; i < m_rg_entries.count(); i++) + for (int i = 0; i < m_rg_entries.count(); i++) { // create new action QAction* act = CreateRecentAction(m_rg_entries[i], i + 1); diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index dce6ddf00d..18d8aecba8 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -274,7 +274,7 @@ void pad_settings_dialog::Init(const u32 max_connect) memset(&m_info, 0, sizeof(PadInfo)); m_info.max_connect = max_connect; LoadSettings(); - m_info.now_connect = std::min(m_pads.size(), (size_t)max_connect); + m_info.now_connect = std::min((u32)m_pads.size(), max_connect); } void pad_settings_dialog::LoadSettings() diff --git a/rpcs3/rpcs3qt/rsx_debugger.cpp b/rpcs3/rpcs3qt/rsx_debugger.cpp index e931ee788d..8677593313 100644 --- a/rpcs3/rpcs3qt/rsx_debugger.cpp +++ b/rpcs3/rpcs3qt/rsx_debugger.cpp @@ -373,7 +373,7 @@ void rsx_debugger::wheelEvent(QWheelEvent* event) namespace { // Opens an image in a new window with original size - void display_buffer(QWidget *parent, const QImage img) + void display_buffer(const QImage& img) { if (img.isNull()) return; //QString title = qstr(fmt::format("Raw Image @ 0x%x", addr)); @@ -388,7 +388,7 @@ namespace } // Draws a formatted and buffered inside the Buffer Widget -void Buffer::showImage(QImage image) +void Buffer::showImage(const QImage& image) { if (image.isNull()) return; m_image = image; @@ -425,7 +425,7 @@ void Buffer::mouseDoubleClickEvent(QMouseEvent* event) //if (0 <= m_id && m_id < 4) SHOW_BUFFER(m_id); - display_buffer(this, m_image); + display_buffer(m_image); if (m_isTex) { @@ -495,6 +495,7 @@ namespace case rsx::surface_color_format::x1r5g5b5_o1r5g5b5: case rsx::surface_color_format::x1r5g5b5_z1r5g5b5: case rsx::surface_color_format::w32z32y32x32: + default: fmt::throw_exception("Unsupported format for display" HERE); } } @@ -532,15 +533,15 @@ void rsx_debugger::OnClickDrawCalls() m_buffer_colorD, }; - size_t width = draw_call.state.surface_clip_width(); - size_t height = draw_call.state.surface_clip_height(); + u32 width = draw_call.state.surface_clip_width(); + u32 height = draw_call.state.surface_clip_height(); for (size_t i = 0; i < 4; i++) { if (width && height && !draw_call.color_buffer[i].empty()) { unsigned char* buffer = convert_to_QImage_buffer(draw_call.state.surface_color(), draw_call.color_buffer[i], width, height); - buffers[i]->showImage(QImage(buffer, width, height, QImage::Format_RGB32)); + buffers[i]->showImage(QImage(buffer, (int)width, (int)height, QImage::Format_RGB32)); } } @@ -581,7 +582,7 @@ void rsx_debugger::OnClickDrawCalls() } } } - m_buffer_depth->showImage(QImage(buffer, width, height, QImage::Format_RGB32)); + m_buffer_depth->showImage(QImage(buffer, (int)width, (int)height, QImage::Format_RGB32)); } } @@ -603,7 +604,7 @@ void rsx_debugger::OnClickDrawCalls() buffer[4 * col + 3 + width * row * 4] = 255; } } - m_buffer_stencil->showImage(QImage(buffer, width, height, QImage::Format_RGB32)); + m_buffer_stencil->showImage(QImage(buffer, (int)width, (int)height, QImage::Format_RGB32)); } } diff --git a/rpcs3/rpcs3qt/rsx_debugger.h b/rpcs3/rpcs3qt/rsx_debugger.h index 94187d4d40..348e71e23c 100644 --- a/rpcs3/rpcs3qt/rsx_debugger.h +++ b/rpcs3/rpcs3qt/rsx_debugger.h @@ -40,7 +40,7 @@ public: Buffer(QWidget* parent, bool isTex, u32 id = 4) : QWidget(parent), m_isTex(isTex), m_id(id){}; - void showImage(QImage image = QImage()); + void showImage(const QImage& image = QImage()); private: void mouseDoubleClickEvent(QMouseEvent* event); diff --git a/rpcs3/rpcs3qt/save_data_list_dialog.cpp b/rpcs3/rpcs3qt/save_data_list_dialog.cpp index 3e9e384920..bcac7e4d4e 100644 --- a/rpcs3/rpcs3qt/save_data_list_dialog.cpp +++ b/rpcs3/rpcs3qt/save_data_list_dialog.cpp @@ -164,7 +164,7 @@ void save_data_list_dialog::OnEntryInfo() void save_data_list_dialog::UpdateList() { m_list->clearContents(); - m_list->setRowCount(m_save_entries.size()); + m_list->setRowCount((int)m_save_entries.size()); gui_settings settings(this); int row = 0;