diff --git a/Utilities/JIT.cpp b/Utilities/JIT.cpp index 8d81d69ceb..53bdb056c4 100644 --- a/Utilities/JIT.cpp +++ b/Utilities/JIT.cpp @@ -433,7 +433,7 @@ public: void reset() { - if (!m_segs.size()) + if (m_segs.empty()) { if (m_curr.addr != nullptr) { diff --git a/Utilities/sysinfo.cpp b/Utilities/sysinfo.cpp index 72962af93c..8396159023 100755 --- a/Utilities/sysinfo.cpp +++ b/Utilities/sysinfo.cpp @@ -186,7 +186,7 @@ std::string utils::get_firmware_version() std::string utils::get_OS_version() { - std::string output = ""; + std::string output; #ifdef _WIN32 // GetVersionEx is deprecated, RtlGetVersion is kernel-mode only and AnalyticsInfo is UWP only. // So we're forced to read PEB instead to get Windows version info. It's ugly but works. diff --git a/rpcs3/Crypto/unedat.cpp b/rpcs3/Crypto/unedat.cpp index e320e58ab7..4397c45e2c 100644 --- a/rpcs3/Crypto/unedat.cpp +++ b/rpcs3/Crypto/unedat.cpp @@ -861,7 +861,7 @@ fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, } // Read the RAP file, if provided. - if (rap_file_name.size()) + if (!rap_file_name.empty()) { fs::file rap(rap_file_name); diff --git a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp index 770ef55ab0..1a58df1f45 100644 --- a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp @@ -46,7 +46,7 @@ avconf_manager::avconf_manager() u32 curindex = 0; auto mic_list = fmt::split(g_cfg.audio.microphone_devices, {"@@@"}); - if (mic_list.size()) + if (!mic_list.empty()) { switch (g_cfg.audio.microphone_type) { diff --git a/rpcs3/Emu/Cell/Modules/cellDmux.cpp b/rpcs3/Emu/Cell/Modules/cellDmux.cpp index 46517146d6..3df2229bba 100644 --- a/rpcs3/Emu/Cell/Modules/cellDmux.cpp +++ b/rpcs3/Emu/Cell/Modules/cellDmux.cpp @@ -627,7 +627,7 @@ public: lv2_obj::sleep(*this); } - if (es.raw_data.size()) + if (!es.raw_data.empty()) { cellDmux.error("dmuxFlushEs: 0x%x bytes lost (es_id=%d)", ::size32(es.raw_data), es.id); } diff --git a/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp b/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp index d07ad03661..4e8ea53ea8 100644 --- a/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp +++ b/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp @@ -52,7 +52,7 @@ s32 cellHttpUtilParseUri(vm::ptr uri, vm::cptr str, vm::ptrusername.set(pool.addr() + usernameOffset); uri->password.set(pool.addr() + passwordOffset); - if (URL.m_Port != "") + if (!URL.m_Port.empty()) { int port = stoi(URL.m_Port); uri->port = port; diff --git a/rpcs3/Emu/Cell/Modules/cellImeJp.cpp b/rpcs3/Emu/Cell/Modules/cellImeJp.cpp index 0cfcadd764..afce196263 100644 --- a/rpcs3/Emu/Cell/Modules/cellImeJp.cpp +++ b/rpcs3/Emu/Cell/Modules/cellImeJp.cpp @@ -140,7 +140,7 @@ error_code cellImeJpOpen(sys_memory_container_t container_id, vm::ptrpath); - manager->dictionary_paths.push_back(std::string(addDicPath->path)); + manager->dictionary_paths.emplace_back(addDicPath->path); } *hImeJpHandle = vm::cast(ime_jp_address); @@ -170,7 +170,7 @@ error_code cellImeJpOpen2(sys_memory_container_t container_id, vm::ptrpath); - manager->dictionary_paths.push_back(std::string(addDicPath->path)); + manager->dictionary_paths.emplace_back(addDicPath->path); } *hImeJpHandle = vm::cast(ime_jp_address); @@ -205,7 +205,7 @@ error_code cellImeJpOpen3(sys_memory_container_t container_id, vm::ptrpath); - manager->dictionary_paths.push_back(std::string(addDicPath[i]->path)); + manager->dictionary_paths.emplace_back(addDicPath[i]->path); } } } diff --git a/rpcs3/Emu/Cell/Modules/cellMic.cpp b/rpcs3/Emu/Cell/Modules/cellMic.cpp index 59fba378ba..6d608c82eb 100644 --- a/rpcs3/Emu/Cell/Modules/cellMic.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMic.cpp @@ -86,7 +86,7 @@ void mic_context::load_config_and_init() { auto device_list = fmt::split(g_cfg.audio.microphone_devices, {"@@@"}); - if (device_list.size() && mic_list.empty()) + if (!device_list.empty() && mic_list.empty()) { switch (g_cfg.audio.microphone_type) { diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index 0a3aa51e1b..8e088ed984 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -1306,7 +1306,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v // Create save directory if necessary - if (psf.size() && save_entry.isNew && !fs::create_dir(dir_path)) + if (!psf.empty() && save_entry.isNew && !fs::create_dir(dir_path)) { cellSaveData.warning("savedata_op(): failed to create %s (%s)", dir_path, fs::g_tls_error); return CELL_SAVEDATA_ERROR_ACCESS_ERROR; diff --git a/rpcs3/Emu/Cell/Modules/cellSearch.cpp b/rpcs3/Emu/Cell/Modules/cellSearch.cpp index e6db07352c..f09afb83dd 100644 --- a/rpcs3/Emu/Cell/Modules/cellSearch.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSearch.cpp @@ -402,7 +402,7 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe auto found = content_map->find(hash); if (found == content_map->end()) // content isn't yet being tracked { - auto ext_offset = item.name.find_last_of("."); // used later if no "Title" found + auto ext_offset = item.name.find_last_of('.'); // used later if no "Title" found std::shared_ptr curr_find = std::make_shared(); if( item_path.length() > CELL_SEARCH_PATH_LEN_MAX ) @@ -455,7 +455,7 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe info.orientation = 0; // CellSearchOrientation info.codec = 0; // CellSearchCodec info.status = 0; // CellSearchContentStatus - strcpy_trunc(info.title, item.name.substr(0, ext_offset).c_str()); + strcpy_trunc(info.title, item.name.substr(0, ext_offset)); strcpy_trunc(info.albumTitle, "ALBUM TITLE"); } else if (type == CELL_SEARCH_CONTENTSEARCHTYPE_VIDEO_ALL) @@ -474,7 +474,7 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe info.videoCodec = 0; // CellSearchCodec info.audioCodec = 0; // CellSearchCodec info.status = 0; // CellSearchContentStatus - strcpy_trunc(info.title, item.name.substr(0, ext_offset).c_str()); // it'll do for the moment... + strcpy_trunc(info.title, item.name.substr(0, ext_offset)); // it'll do for the moment... strcpy_trunc(info.albumTitle, "ALBUM TITLE"); } diff --git a/rpcs3/Emu/Cell/Modules/cellSysCache.cpp b/rpcs3/Emu/Cell/Modules/cellSysCache.cpp index 3cea80eeb2..157a566b2f 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysCache.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysCache.cpp @@ -39,7 +39,7 @@ struct syscache_info syscache_info() noexcept { // Check if dev_hdd1 is mounted by parent process - if (Emu.hdd1.size()) + if (!Emu.hdd1.empty()) { const auto lock = init.init(); diff --git a/rpcs3/Emu/Cell/PPUFunction.cpp b/rpcs3/Emu/Cell/PPUFunction.cpp index 0cd8c88807..653b772bb2 100644 --- a/rpcs3/Emu/Cell/PPUFunction.cpp +++ b/rpcs3/Emu/Cell/PPUFunction.cpp @@ -642,7 +642,7 @@ extern std::string ppu_get_syscall_name(u64 code) // Get function name by FNID extern std::string ppu_get_function_name(const std::string& module, u32 fnid) { - if (module == "") switch (fnid) + if (module.empty()) switch (fnid) { case 0x0d10fd3f: return "module_prologue"; case 0x330f7005: return "module_epilogue"; @@ -2438,7 +2438,7 @@ extern std::string ppu_get_function_name(const std::string& module, u32 fnid) // Get variable name by VNID extern std::string ppu_get_variable_name(const std::string& module, u32 vnid) { - if (module == "") switch (vnid) + if (module.empty()) switch (vnid) { // these arent the actual hash, but its close enough case 0xd7f43016: return "module_info"; diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index 848885b87a..f0edbdb046 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -1528,7 +1528,7 @@ void ppu_load_exec(const ppu_exec_object& elf) auto ppu = idm::make_ptr>("PPU[0x1000000] Thread (main_thread)", p, "main_thread", primary_prio, 1); // Write initial data (exitspawn) - if (Emu.data.size()) + if (!Emu.data.empty()) { std::memcpy(vm::base(ppu->stack_addr + ppu->stack_size - ::size32(Emu.data)), Emu.data.data(), Emu.data.size()); ppu->gpr[1] -= Emu.data.size(); diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index 6e0bacf797..ddb33e3414 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -440,7 +440,7 @@ void spu_cache::initialize() compiler->init(); } - if (compilers.size() && !func_list.empty()) + if (!compilers.empty() && !func_list.empty()) { // Initialize progress dialog (wait for previous progress done) while (g_progr_ptotal) @@ -518,7 +518,7 @@ void spu_cache::initialize() return; } - if (compilers.size() && !func_list.empty()) + if (!compilers.empty() && !func_list.empty()) { spu_log.success("SPU Runtime: Built %u functions.", func_list.size()); } @@ -4491,7 +4491,7 @@ public: bool need_check = false; m_block->bb = &bb; - if (bb.preds.size()) + if (!bb.preds.empty()) { // Initialize registers and build PHI nodes if necessary for (u32 i = 0; i < s_reg_max; i++) diff --git a/rpcs3/Emu/Cell/lv2/sys_config.cpp b/rpcs3/Emu/Cell/lv2/sys_config.cpp index a2e68d5ef3..84637b45c6 100644 --- a/rpcs3/Emu/Cell/lv2/sys_config.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_config.cpp @@ -53,7 +53,7 @@ void fmt_class_string::format(std::string& out // Utilities void dump_buffer(std::string& out, const std::vector& buffer) { - if (buffer.size() > 0) + if (!buffer.empty()) { out.reserve(out.size() + buffer.size() * 2 + 1); fmt::append(out, "0x"); @@ -130,7 +130,7 @@ bool lv2_config_service_listener::check_service(const lv2_config_service& servic // realhw only seems to send the pad connected events to the listeners that provided 0x01 as the first byte of their data buffer // TODO: Figure out how this filter works more properly - if (service_id == SYS_CONFIG_SERVICE_PADMANAGER && (data.size() == 0 || data[0] != 0x01)) + if (service_id == SYS_CONFIG_SERVICE_PADMANAGER && (data.empty() || data[0] != 0x01)) { return false; } diff --git a/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp b/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp index 1d12dfd4a1..af465326fb 100644 --- a/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_event_flag.cpp @@ -130,7 +130,7 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm return {}; } - if (flag.type == SYS_SYNC_WAITER_SINGLE && flag.sq.size()) + if (flag.type == SYS_SYNC_WAITER_SINGLE && !flag.sq.empty()) { return CELL_EPERM; } diff --git a/rpcs3/Emu/Cell/lv2/sys_process.cpp b/rpcs3/Emu/Cell/lv2/sys_process.cpp index 134aa1983f..19695a7d1f 100644 --- a/rpcs3/Emu/Cell/lv2/sys_process.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_process.cpp @@ -336,7 +336,7 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr ar if (Emu.GetCat() == "DG" || Emu.GetCat() == "GD") disc = vfs::get("/dev_bdvd/"); - if (disc.empty() && Emu.GetTitleID().size()) + if (disc.empty() && !Emu.GetTitleID().empty()) disc = vfs::get(Emu.GetDir()); vm::temporary_unlock(ppu); diff --git a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp index 79aa5ab034..43ce5c90db 100644 --- a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp @@ -261,7 +261,7 @@ void usb_handler_thread::operator()() } // If there is no handled devices usb thread is not actively needed - if (!handled_devices.size()) + if (handled_devices.empty()) std::this_thread::sleep_for(500ms); else std::this_thread::sleep_for(200us); @@ -389,7 +389,7 @@ void usb_handler_thread::check_devices_vs_ldds() bool usb_handler_thread::get_event(vm::ptr& arg1, vm::ptr& arg2, vm::ptr& arg3) { - if (usbd_events.size()) + if (!usbd_events.empty()) { const auto& usb_event = usbd_events.front(); *arg1 = std::get<0>(usb_event); diff --git a/rpcs3/Emu/GDB.cpp b/rpcs3/Emu/GDB.cpp index 11d24b014c..b896a1321d 100644 --- a/rpcs3/Emu/GDB.cpp +++ b/rpcs3/Emu/GDB.cpp @@ -239,7 +239,7 @@ char gdb_thread::read_char() u8 gdb_thread::read_hexbyte() { - std::string s = ""; + std::string s; s += read_char(); s += read_char(); return hex_to_u8(s); @@ -548,7 +548,7 @@ bool gdb_thread::cmd_supported(gdb_cmd& cmd) bool gdb_thread::cmd_thread_info(gdb_cmd& cmd) { - std::string result = ""; + std::string result; const auto on_select = [&](u32, cpu_thread& cpu) { if (result.length()) { diff --git a/rpcs3/Emu/Io/Null/NullPadHandler.h b/rpcs3/Emu/Io/Null/NullPadHandler.h index 895c2c7d8c..b3bb43a163 100644 --- a/rpcs3/Emu/Io/Null/NullPadHandler.h +++ b/rpcs3/Emu/Io/Null/NullPadHandler.h @@ -19,7 +19,7 @@ public: std::vector ListDevices() override { std::vector nulllist; - nulllist.push_back("Default Null Device"); + nulllist.emplace_back("Default Null Device"); return nulllist; } diff --git a/rpcs3/Emu/Io/Skylander.cpp b/rpcs3/Emu/Io/Skylander.cpp index 6b18d22976..f7842f237b 100644 --- a/rpcs3/Emu/Io/Skylander.cpp +++ b/rpcs3/Emu/Io/Skylander.cpp @@ -150,7 +150,7 @@ void usb_device_skylander::interrupt_transfer(u32 buf_size, u8* buf, u32 endpoin // Interrupt transfers are slow(6ms, TODO accurate measurement) transfer->expected_time = get_timestamp() + 6000; - if (q_queries.size()) + if (!q_queries.empty()) { memcpy(buf, q_queries.front().data(), 0x20); q_queries.pop(); diff --git a/rpcs3/Emu/Io/usb_device.cpp b/rpcs3/Emu/Io/usb_device.cpp index 555166d7a2..315cc8e090 100644 --- a/rpcs3/Emu/Io/usb_device.cpp +++ b/rpcs3/Emu/Io/usb_device.cpp @@ -205,5 +205,5 @@ void usb_device_emulated::isochronous_transfer(UsbTransfer* transfer) void usb_device_emulated::add_string(char* str) { - strings.push_back(str); + strings.emplace_back(str); } diff --git a/rpcs3/Emu/RSX/Overlays/overlay_fonts.cpp b/rpcs3/Emu/RSX/Overlays/overlay_fonts.cpp index 9d9e1fc897..4f45515fcd 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_fonts.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_fonts.cpp @@ -93,7 +93,7 @@ namespace rsx result.font_names.push_back(font_name); #ifdef _WIN32 - result.lookup_font_dirs.push_back("C:/Windows/Fonts/"); + result.lookup_font_dirs.emplace_back("C:/Windows/Fonts/"); #else char* home = getenv("HOME"); if (home == nullptr) @@ -113,13 +113,13 @@ namespace rsx { case language_class::default_: { - result.font_names.push_back("Arial.ttf"); + result.font_names.emplace_back("Arial.ttf"); #ifndef _WIN32 result.font_names.emplace_back("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"); // ubuntu result.font_names.emplace_back("/usr/share/fonts/TTF/DejaVuSans.ttf"); // arch #endif // Attempt to load a font from dev_flash as a last resort - result.font_names.push_back("SCE-PS3-VR-R-LATIN.TTF"); + result.font_names.emplace_back("SCE-PS3-VR-R-LATIN.TTF"); break; } case language_class::cjk_base: @@ -128,10 +128,10 @@ namespace rsx result.font_names.clear(); // Attempt to load a font from dev_flash before any other source - result.font_names.push_back("SCE-PS3-SR-R-JPN.TTF"); + result.font_names.emplace_back("SCE-PS3-SR-R-JPN.TTF"); // Known system font as last fallback - result.font_names.push_back("Yu Gothic.ttf"); + result.font_names.emplace_back("Yu Gothic.ttf"); break; } case language_class::hangul: @@ -140,10 +140,10 @@ namespace rsx result.font_names.clear(); // Attempt to load a font from dev_flash before any other source - result.font_names.push_back("SCE-PS3-YG-R-KOR.TTF"); + result.font_names.emplace_back("SCE-PS3-YG-R-KOR.TTF"); // Known system font as last fallback - result.font_names.push_back("Malgun Gothic.ttf"); + result.font_names.emplace_back("Malgun Gothic.ttf"); break; } } @@ -172,7 +172,7 @@ namespace rsx break; } - std::string extension = ""; + std::string extension; if (const auto extension_start = font_file.find_last_of('.'); extension_start != std::string::npos) { diff --git a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp index 9e11de5a75..b375b01bfb 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp @@ -76,10 +76,10 @@ namespace rsx _cell.enabled = !(flags & CELL_OSKDIALOG_NO_RETURN); break; case button_flags::_shift: - _cell.enabled |= _cell.outputs.size() > 0; + _cell.enabled |= !_cell.outputs.empty(); break; case button_flags::_mode: - _cell.enabled |= num_layers.size() > 0; + _cell.enabled |= !num_layers.empty(); break; } diff --git a/rpcs3/Emu/RSX/VK/VKTexture.cpp b/rpcs3/Emu/RSX/VK/VKTexture.cpp index 3c2c0c8be5..1b74e22c40 100644 --- a/rpcs3/Emu/RSX/VK/VKTexture.cpp +++ b/rpcs3/Emu/RSX/VK/VKTexture.cpp @@ -654,7 +654,7 @@ namespace vk continue; } - packets.push_back({base, lods }); + packets.emplace_back(base, lods); next_layer = layer; next_level = 1; base = i; @@ -664,7 +664,7 @@ namespace vk if (packets.empty() || (packets.back().first + packets.back().second) < sections.size()) { - packets.push_back({base, lods}); + packets.emplace_back(base, lods); } for (const auto &packet : packets) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 6e924bf3cb..124033b312 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -772,7 +772,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool // Special case (directory scan) m_sfo_dir = GetSfoDirFromGamePath(m_path, GetUsr(), m_title_id); } - else if (disc.size()) + else if (!disc.empty()) { // Check previously used category before it's overwritten if (m_cat == "DG") diff --git a/rpcs3/Input/ds4_pad_handler.cpp b/rpcs3/Input/ds4_pad_handler.cpp index a2e965682b..e34af4fe99 100644 --- a/rpcs3/Input/ds4_pad_handler.cpp +++ b/rpcs3/Input/ds4_pad_handler.cpp @@ -487,7 +487,7 @@ bool ds4_pad_handler::GetCalibrationData(const std::shared_ptr& ds4De void ds4_pad_handler::CheckAddDevice(hid_device* hidDevice, hid_device_info* hidDevInfo) { - std::string serial = ""; + std::string serial; std::shared_ptr ds4Dev = std::make_shared(); ds4Dev->hidDevice = hidDevice; // There isnt a nice 'portable' way with hidapi to detect bt vs wired as the pid/vid's are the same diff --git a/rpcs3/Input/keyboard_pad_handler.cpp b/rpcs3/Input/keyboard_pad_handler.cpp index e5d3d9dc61..49490fd853 100644 --- a/rpcs3/Input/keyboard_pad_handler.cpp +++ b/rpcs3/Input/keyboard_pad_handler.cpp @@ -445,7 +445,7 @@ void keyboard_pad_handler::mouseWheelEvent(QWheelEvent* event) std::vector keyboard_pad_handler::ListDevices() { std::vector list_devices; - list_devices.push_back("Keyboard"); + list_devices.emplace_back("Keyboard"); return list_devices; } diff --git a/rpcs3/Loader/TAR.cpp b/rpcs3/Loader/TAR.cpp index 23358c8208..a5f7e63f87 100644 --- a/rpcs3/Loader/TAR.cpp +++ b/rpcs3/Loader/TAR.cpp @@ -72,7 +72,7 @@ fs::file tar_object::get_file(std::string path) m_map[header.name] = largest_offset; int size = octalToDecimal(atoi(header.size)); - if (path.compare(header.name) == 0) { //path is equal, read file and advance offset to start of next block + if (path == header.name) { //path is equal, read file and advance offset to start of next block std::vector buf(size); m_file.read(buf, size); int offset = ((m_file.pos() - initial_offset + 512 - 1) & ~(512 - 1)) + initial_offset; diff --git a/rpcs3/rpcs3qt/cheat_manager.cpp b/rpcs3/rpcs3qt/cheat_manager.cpp index 632b1a03f3..857e112c67 100644 --- a/rpcs3/rpcs3qt/cheat_manager.cpp +++ b/rpcs3/rpcs3qt/cheat_manager.cpp @@ -330,7 +330,7 @@ std::vector cheat_engine::search(const T value, const std::vector& to_ cpu_thread::suspend_all cpu_lock(nullptr); - if (to_filter.size()) + if (!to_filter.empty()) { for (const auto& off : to_filter) { @@ -460,11 +460,11 @@ bool cheat_engine::is_addr_safe(const u32 offset) { if ((seg.flags & 3)) { - segs.push_back({seg.addr, seg.size}); + segs.emplace_back(seg.addr, seg.size); } } - if (!segs.size()) + if (segs.empty()) { log_cheat.fatal("Couldn't find a +rw-x section"); return false; @@ -496,7 +496,7 @@ u32 cheat_engine::reverse_lookup(const u32 addr, const u32 max_offset, const u32 } // If depth has not been reached dig deeper - if (ptrs.size() && cur_depth < max_depth) + if (!ptrs.empty() && cur_depth < max_depth) { for (const auto& ptr : ptrs) { @@ -586,7 +586,7 @@ cheat_manager_dialog::cheat_manager_dialog(QWidget* parent) bool success; u32 final_offset; - if (cheat->red_script.size()) + if (!cheat->red_script.empty()) { final_offset = 0; if (!cheat_engine::resolve_script(final_offset, cheat->offset, cheat->red_script)) @@ -758,7 +758,7 @@ cheat_manager_dialog::cheat_manager_dialog(QWidget* parent) std::pair results; u32 final_offset; - if (cheat->red_script.size()) + if (!cheat->red_script.empty()) { final_offset = 0; if (!g_cheat.resolve_script(final_offset, cheat->offset, cheat->red_script)) @@ -964,7 +964,7 @@ void cheat_manager_dialog::do_the_search() { lst_search->insertItem(row, tr("0x%1").arg(offsets_found[row], 1, 16).toUpper()); } - btn_filter_results->setEnabled(offsets_found.size()); + btn_filter_results->setEnabled(!offsets_found.empty()); } void cheat_manager_dialog::update_cheat_list() diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index 96bdd9f781..55c7845a02 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -589,7 +589,7 @@ void emu_settings::SetSetting(SettingsType type, const std::string& val) void emu_settings::OpenCorrectionDialog(QWidget* parent) { - if (m_broken_types.size() && QMessageBox::question(parent, tr("Fix invalid settings?"), + if (!m_broken_types.empty() && QMessageBox::question(parent, tr("Fix invalid settings?"), tr( "Your config file contained one or more unrecognized values for settings.\n" "Their default value will be used until they are corrected.\n" diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 082b49b18d..3634158e31 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -2191,7 +2191,7 @@ bool game_list_frame::SearchMatchesApp(const QString& name, const QString& seria std::string game_list_frame::CurrentSelectionIconPath() { - std::string selection = ""; + std::string selection; if (m_gameList->selectedItems().count()) { diff --git a/rpcs3/rpcs3qt/log_frame.cpp b/rpcs3/rpcs3qt/log_frame.cpp index ab6f6e74b1..e0677aa0d6 100644 --- a/rpcs3/rpcs3qt/log_frame.cpp +++ b/rpcs3/rpcs3qt/log_frame.cpp @@ -448,7 +448,7 @@ void log_frame::UpdateUI() break; } - if (buf.size() && m_TTYAct->isChecked()) + if (!buf.empty() && m_TTYAct->isChecked()) { std::stringstream buf_stream; buf_stream.str(buf); diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 4bec15a576..f12ab0953b 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -749,7 +749,7 @@ void main_window::DecryptSPRXLibraries() if (elf_file) { const std::string bin_ext = module.toLower().endsWith(".sprx") ? ".prx" : ".elf"; - const std::string new_path = old_path.substr(0, old_path.find_last_of(".")) + bin_ext; + const std::string new_path = old_path.substr(0, old_path.find_last_of('.')) + bin_ext; if (fs::file new_file{new_path, fs::rewrite}) {