From 49fe9f5db13f15460a49c5771ee0d2c6b8bfdc3c Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Tue, 12 Feb 2019 23:47:17 +0100 Subject: [PATCH] Use empty instead of size --- Source/Core/Common/IniFile.cpp | 10 +++++----- Source/Core/Common/StringUtil.cpp | 2 +- Source/Core/Core/ActionReplay.cpp | 10 +++++----- Source/Core/Core/FifoPlayer/FifoRecorder.cpp | 2 +- Source/Core/Core/GeckoCodeConfig.cpp | 8 ++++---- Source/Core/Core/HLE/HLE.cpp | 2 +- Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp | 10 +++++----- Source/Core/Core/IOS/IOS.cpp | 6 +++--- Source/Core/Core/IOS/Network/IP/Top.cpp | 2 +- Source/Core/Core/IOS/Network/SSL.cpp | 4 ++-- Source/Core/Core/IOS/Network/Socket.cpp | 4 ++-- Source/Core/Core/IOS/WFS/WFSSRV.cpp | 2 +- Source/Core/Core/MemoryWatcher.cpp | 2 +- Source/Core/Core/NetPlayServer.cpp | 2 +- Source/Core/Core/PatchEngine.cpp | 8 ++++---- Source/Core/DiscIO/WbfsBlob.cpp | 2 +- Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp | 2 +- Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp | 2 +- Source/Core/DolphinQt/Debugger/WatchWidget.cpp | 2 +- Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp | 2 +- Source/Core/DolphinQt/GameList/GameList.cpp | 2 +- Source/Core/DolphinQt/MainWindow.cpp | 2 +- Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp | 2 +- .../ControlReference/ControlReference.cpp | 2 +- Source/Core/UICommon/CommandLineParse.cpp | 4 ++-- Source/Core/UICommon/GameFileCache.cpp | 2 +- Source/Core/VideoBackends/OGL/Render.cpp | 2 +- Source/Core/VideoCommon/PostProcessing.cpp | 12 ++++++------ 28 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index 85fd180cd5..43bbe7b50b 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -265,7 +265,7 @@ bool IniFile::Load(const std::string& filename, bool keep_current_data) } #endif - if (line.size() > 0) + if (!line.empty()) { if (line[0] == '[') { @@ -288,8 +288,8 @@ bool IniFile::Load(const std::string& filename, bool keep_current_data) // Lines starting with '$', '*' or '+' are kept verbatim. // Kind of a hack, but the support for raw lines inside an // INI is a hack anyway. - if ((key == "" && value == "") || - (line.size() >= 1 && (line[0] == '$' || line[0] == '+' || line[0] == '*'))) + if ((key.empty() && value.empty()) || + (!line.empty() && (line[0] == '$' || line[0] == '+' || line[0] == '*'))) current_section->m_lines.push_back(line); else current_section->Set(key, value); @@ -315,10 +315,10 @@ bool IniFile::Save(const std::string& filename) for (const Section& section : sections) { - if (section.keys_order.size() != 0 || section.m_lines.size() != 0) + if (!section.keys_order.empty() || !section.m_lines.empty()) out << '[' << section.name << ']' << std::endl; - if (section.keys_order.size() == 0) + if (section.keys_order.empty()) { for (const std::string& s : section.m_lines) out << s << std::endl; diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 2e79fe9176..b946cfd450 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -227,7 +227,7 @@ std::string StripSpaces(const std::string& str) // ends, as done by StripSpaces above, for example. std::string StripQuotes(const std::string& s) { - if (s.size() && '\"' == s[0] && '\"' == *s.rbegin()) + if (!s.empty() && '\"' == s[0] && '\"' == *s.rbegin()) return s.substr(1, s.size() - 2); else return s; diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp index 5df92b3e26..05fd96f905 100644 --- a/Source/Core/Core/ActionReplay.cpp +++ b/Source/Core/Core/ActionReplay.cpp @@ -184,7 +184,7 @@ std::vector LoadCodes(const IniFile& global_ini, const IniFile& local_in local_ini.GetLines("ActionReplay_Enabled", &enabled_lines); for (const std::string& line : enabled_lines) { - if (line.size() != 0 && line[0] == '$') + if (!line.empty() && line[0] == '$') { std::string name = line.substr(1, line.size() - 1); enabled_names.insert(name); @@ -211,12 +211,12 @@ std::vector LoadCodes(const IniFile& global_ini, const IniFile& local_in // Check if the line is a name of the code if (line[0] == '$') { - if (current_code.ops.size()) + if (!current_code.ops.empty()) { codes.push_back(current_code); current_code.ops.clear(); } - if (encrypted_lines.size()) + if (!encrypted_lines.empty()) { DecryptARCode(encrypted_lines, ¤t_code.ops); codes.push_back(current_code); @@ -270,11 +270,11 @@ std::vector LoadCodes(const IniFile& global_ini, const IniFile& local_in } // Handle the last code correctly. - if (current_code.ops.size()) + if (!current_code.ops.empty()) { codes.push_back(current_code); } - if (encrypted_lines.size()) + if (!encrypted_lines.empty()) { DecryptARCode(encrypted_lines, ¤t_code.ops); codes.push_back(current_code); diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp index 8d3cfb9aeb..8e1f14b11a 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp +++ b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp @@ -92,7 +92,7 @@ void FifoRecorder::WriteGPCommand(const u8* data, u32 size) memcpy(&m_FifoData[currentSize], data, size); } - if (m_FrameEnded && m_FifoData.size() > 0) + if (m_FrameEnded && !m_FifoData.empty()) { m_CurrentFrame.fifoData = m_FifoData; diff --git a/Source/Core/Core/GeckoCodeConfig.cpp b/Source/Core/Core/GeckoCodeConfig.cpp index cd7955e7bc..2365794b8f 100644 --- a/Source/Core/Core/GeckoCodeConfig.cpp +++ b/Source/Core/Core/GeckoCodeConfig.cpp @@ -69,7 +69,7 @@ std::vector DownloadCodes(std::string gameid, bool* succeeded) if (line.empty()) { // add the code - if (gcode.codes.size()) + if (!gcode.codes.empty()) gcodes.push_back(gcode); gcode = GeckoCode(); read_state = 0; @@ -126,7 +126,7 @@ std::vector DownloadCodes(std::string gameid, bool* succeeded) } // add the last code - if (gcode.codes.size()) + if (!gcode.codes.empty()) gcodes.push_back(gcode); return gcodes; @@ -157,7 +157,7 @@ std::vector LoadCodes(const IniFile& globalIni, const IniFile& localI case '+': ss.seekg(1); case '$': - if (gcode.name.size()) + if (!gcode.name.empty()) gcodes.push_back(gcode); gcode = GeckoCode(); gcode.enabled = (1 == ss.tellg()); // silly @@ -189,7 +189,7 @@ std::vector LoadCodes(const IniFile& globalIni, const IniFile& localI } // add the last code - if (gcode.name.size()) + if (!gcode.name.empty()) { gcodes.push_back(gcode); } diff --git a/Source/Core/Core/HLE/HLE.cpp b/Source/Core/Core/HLE/HLE.cpp index 51699ffd21..9b4cfcddf2 100644 --- a/Source/Core/Core/HLE/HLE.cpp +++ b/Source/Core/Core/HLE/HLE.cpp @@ -243,7 +243,7 @@ u32 UnPatch(const std::string& patch_name) } const auto& symbols = g_symbolDB.GetSymbolsFromName(patch_name); - if (symbols.size()) + if (!symbols.empty()) { const auto& symbol = symbols[0]; for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4) diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp index 9d4aa83f44..7b5e56678f 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp +++ b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp @@ -470,7 +470,7 @@ inline void GCMemcardDirectory::SyncSaves() m_saves[i].m_used_blocks.clear(); m_saves[i].m_save_data.clear(); } - if (m_saves[i].m_used_blocks.size() == 0) + if (m_saves[i].m_used_blocks.empty()) { SetUsedBlocks(i); } @@ -493,7 +493,7 @@ inline s32 GCMemcardDirectory::SaveAreaRW(u32 block, bool writing) { if (m_saves[i].m_gci_header.m_gamecode != DEntry::UNINITIALIZED_GAMECODE) { - if (m_saves[i].m_used_blocks.size() == 0) + if (m_saves[i].m_used_blocks.empty()) { SetUsedBlocks(i); } @@ -591,7 +591,7 @@ void GCMemcardDirectory::FlushToFile() if (m_saves[i].m_gci_header.m_gamecode != DEntry::UNINITIALIZED_GAMECODE) { m_saves[i].m_dirty = false; - if (m_saves[i].m_save_data.size() == 0) + if (m_saves[i].m_save_data.empty()) { // The save's header has been changed but the actual save blocks haven't been read/written // to @@ -658,7 +658,7 @@ void GCMemcardDirectory::FlushToFile() // this ensures that the save data for all of the current games gci files are stored in the // savestate u32 gamecode = BE32(m_saves[i].m_gci_header.m_gamecode.data()); - if (gamecode != m_game_id && gamecode != 0xFFFFFFFF && m_saves[i].m_save_data.size()) + if (gamecode != m_game_id && gamecode != 0xFFFFFFFF && !m_saves[i].m_save_data.empty()) { INFO_LOG(EXPANSIONINTERFACE, "Flushing savedata to disk for %s", m_saves[i].m_filename.c_str()); @@ -695,7 +695,7 @@ void GCMemcardDirectory::DoState(PointerWrap& p) bool GCIFile::LoadSaveBlocks() { - if (m_save_data.size() == 0) + if (m_save_data.empty()) { if (m_filename.empty()) return false; diff --git a/Source/Core/Core/IOS/IOS.cpp b/Source/Core/Core/IOS/IOS.cpp index 325e6bb5ff..3099fa2421 100644 --- a/Source/Core/Core/IOS/IOS.cpp +++ b/Source/Core/Core/IOS/IOS.cpp @@ -630,7 +630,7 @@ void Kernel::UpdateIPC() if (!IsReady()) return; - if (m_request_queue.size()) + if (!m_request_queue.empty()) { ClearX1(); GenerateAck(m_request_queue.front()); @@ -640,7 +640,7 @@ void Kernel::UpdateIPC() return; } - if (m_reply_queue.size()) + if (!m_reply_queue.empty()) { GenerateReply(m_reply_queue.front()); DEBUG_LOG(IOS, "<<-- Reply to IPC Request @ 0x%08x", m_reply_queue.front()); @@ -648,7 +648,7 @@ void Kernel::UpdateIPC() return; } - if (m_ack_queue.size()) + if (!m_ack_queue.empty()) { GenerateAck(m_ack_queue.front()); WARN_LOG(IOS, "<<-- Double-ack to IPC Request @ 0x%08x", m_ack_queue.front()); diff --git a/Source/Core/Core/IOS/Network/IP/Top.cpp b/Source/Core/Core/IOS/Network/IP/Top.cpp index fc247fe168..2dddb53e54 100644 --- a/Source/Core/Core/IOS/Network/IP/Top.cpp +++ b/Source/Core/Core/IOS/Network/IP/Top.cpp @@ -972,7 +972,7 @@ IPCCommandResult NetIPTop::HandleGetAddressInfoRequest(const IOCtlVRequest& requ // So we have to do a bit of juggling here. std::string nodeNameStr; const char* pNodeName = nullptr; - if (request.in_vectors.size() > 0 && request.in_vectors[0].size > 0) + if (!request.in_vectors.empty() && request.in_vectors[0].size > 0) { nodeNameStr = Memory::GetString(request.in_vectors[0].address, request.in_vectors[0].size); pNodeName = nodeNameStr.c_str(); diff --git a/Source/Core/Core/IOS/Network/SSL.cpp b/Source/Core/Core/IOS/Network/SSL.cpp index aec815f238..22a5a54bb8 100644 --- a/Source/Core/Core/IOS/Network/SSL.cpp +++ b/Source/Core/Core/IOS/Network/SSL.cpp @@ -142,7 +142,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request) u32 BufferOut = 0, BufferOut2 = 0, BufferOut3 = 0; u32 BufferOutSize = 0, BufferOutSize2 = 0, BufferOutSize3 = 0; - if (request.in_vectors.size() > 0) + if (!request.in_vectors.empty()) { BufferIn = request.in_vectors.at(0).address; BufferInSize = request.in_vectors.at(0).size; @@ -158,7 +158,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request) BufferInSize3 = request.in_vectors.at(2).size; } - if (request.io_vectors.size() > 0) + if (!request.io_vectors.empty()) { BufferOut = request.io_vectors.at(0).address; BufferOutSize = request.io_vectors.at(0).size; diff --git a/Source/Core/Core/IOS/Network/Socket.cpp b/Source/Core/Core/IOS/Network/Socket.cpp index 00b8155789..e23821d058 100644 --- a/Source/Core/Core/IOS/Network/Socket.cpp +++ b/Source/Core/Core/IOS/Network/Socket.cpp @@ -292,13 +292,13 @@ void WiiSocket::Update(bool read, bool write, bool except) u32 BufferOut = 0, BufferOut2 = 0; u32 BufferOutSize = 0, BufferOutSize2 = 0; - if (ioctlv.in_vectors.size() > 0) + if (!ioctlv.in_vectors.empty()) { BufferIn = ioctlv.in_vectors.at(0).address; BufferInSize = ioctlv.in_vectors.at(0).size; } - if (ioctlv.io_vectors.size() > 0) + if (!ioctlv.io_vectors.empty()) { BufferOut = ioctlv.io_vectors.at(0).address; BufferOutSize = ioctlv.io_vectors.at(0).size; diff --git a/Source/Core/Core/IOS/WFS/WFSSRV.cpp b/Source/Core/Core/IOS/WFS/WFSSRV.cpp index d09c91b0e4..28c28e4f20 100644 --- a/Source/Core/Core/IOS/WFS/WFSSRV.cpp +++ b/Source/Core/Core/IOS/WFS/WFSSRV.cpp @@ -456,7 +456,7 @@ void WFSSRV::ReleaseFileDescriptor(u16 fd) fd_obj->in_use = false; // Garbage collect and shrink the array if possible. - while (m_fds.size() > 0 && !m_fds[m_fds.size() - 1].in_use) + while (!m_fds.empty() && !m_fds[m_fds.size() - 1].in_use) { m_fds.resize(m_fds.size() - 1); } diff --git a/Source/Core/Core/MemoryWatcher.cpp b/Source/Core/Core/MemoryWatcher.cpp index 635a1ed9e7..e4bd3d0318 100644 --- a/Source/Core/Core/MemoryWatcher.cpp +++ b/Source/Core/Core/MemoryWatcher.cpp @@ -67,7 +67,7 @@ bool MemoryWatcher::LoadAddresses(const std::string& path) while (std::getline(locations, line)) ParseLine(line); - return m_values.size() > 0; + return !m_values.empty(); } void MemoryWatcher::ParseLine(const std::string& line) diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index 206936ed1d..bc9d0010f3 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -347,7 +347,7 @@ unsigned int NetPlayServer::OnConnect(ENetPeer* socket, sf::Packet& rpac) Send(player.socket, spac); // send new client the selected game - if (m_selected_game != "") + if (!m_selected_game.empty()) { spac.clear(); spac << static_cast(NP_MSG_CHANGE_GAME); diff --git a/Source/Core/Core/PatchEngine.cpp b/Source/Core/Core/PatchEngine.cpp index 8d1b3a4a78..8b048d4807 100644 --- a/Source/Core/Core/PatchEngine.cpp +++ b/Source/Core/Core/PatchEngine.cpp @@ -54,7 +54,7 @@ void LoadPatchSection(const std::string& section, std::vector& patches, I localIni.GetLines(enabledSectionName, &enabledLines); for (const std::string& line : enabledLines) { - if (line.size() != 0 && line[0] == '$') + if (!line.empty() && line[0] == '$') { std::string name = line.substr(1, line.size() - 1); enabledNames.insert(name); @@ -71,13 +71,13 @@ void LoadPatchSection(const std::string& section, std::vector& patches, I for (std::string& line : lines) { - if (line.size() == 0) + if (line.empty()) continue; if (line[0] == '$') { // Take care of the previous code - if (currentPatch.name.size()) + if (!currentPatch.name.empty()) { patches.push_back(currentPatch); } @@ -119,7 +119,7 @@ void LoadPatchSection(const std::string& section, std::vector& patches, I } } - if (currentPatch.name.size() && currentPatch.entries.size()) + if (!currentPatch.name.empty() && !currentPatch.entries.empty()) { patches.push_back(currentPatch); } diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp index 0227a692c2..be7403fa1f 100644 --- a/Source/Core/DiscIO/WbfsBlob.cpp +++ b/Source/Core/DiscIO/WbfsBlob.cpp @@ -58,7 +58,7 @@ void WbfsFileReader::OpenAdditionalFiles(const std::string& path) if (path.length() < 4) return; - ASSERT(m_files.size() > 0); // The code below gives .wbf0 for index 0, but it should be .wbfs + ASSERT(!m_files.empty()); // The code below gives .wbf0 for index 0, but it should be .wbfs while (true) { diff --git a/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp b/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp index 2a0caef151..8bf3ab0630 100644 --- a/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp @@ -200,7 +200,7 @@ void IOWindow::OnDetectButtonPressed() { const auto list = m_option_list->findItems(expr, Qt::MatchFixedString); - if (list.size() > 0) + if (!list.empty()) m_option_list->setCurrentItem(list[0]); } diff --git a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp index eb40ab0614..27af010d23 100644 --- a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp @@ -223,7 +223,7 @@ void BreakpointWidget::Update() void BreakpointWidget::OnDelete() { - if (m_table->selectedItems().size() == 0) + if (m_table->selectedItems().empty()) return; auto address = m_table->selectedItems()[0]->data(Qt::UserRole).toUInt(); diff --git a/Source/Core/DolphinQt/Debugger/WatchWidget.cpp b/Source/Core/DolphinQt/Debugger/WatchWidget.cpp index 69057f0dbb..d4bc8ae65a 100644 --- a/Source/Core/DolphinQt/Debugger/WatchWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/WatchWidget.cpp @@ -232,7 +232,7 @@ void WatchWidget::ShowContextMenu() { QMenu* menu = new QMenu(this); - if (m_table->selectedItems().size()) + if (!m_table->selectedItems().empty()) { auto row_variant = m_table->selectedItems()[0]->data(Qt::UserRole); diff --git a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp index 0cded7593b..f71625bdb7 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp @@ -423,7 +423,7 @@ void FIFOAnalyzer::FindPrevious() void FIFOAnalyzer::ShowSearchResult(size_t index) { - if (!m_search_results.size()) + if (m_search_results.empty()) return; if (index > m_search_results.size()) diff --git a/Source/Core/DolphinQt/GameList/GameList.cpp b/Source/Core/DolphinQt/GameList/GameList.cpp index a299facf95..577de90d55 100644 --- a/Source/Core/DolphinQt/GameList/GameList.cpp +++ b/Source/Core/DolphinQt/GameList/GameList.cpp @@ -449,7 +449,7 @@ void GameList::CompressISO(bool decompress) auto files = GetSelectedGames(); const auto game = GetSelectedGame(); - if (files.size() == 0 || !game) + if (files.empty() || !game) return; bool wii_warning_given = false; diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 8d49e3c5c8..16a9557a41 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -1417,7 +1417,7 @@ void MainWindow::dropEvent(QDropEvent* event) else { Settings& settings = Settings::Instance(); - const bool show_confirm = settings.GetPaths().size() != 0; + const bool show_confirm = !settings.GetPaths().empty(); for (const QString& folder : folders) { diff --git a/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp index 91713b5c3f..0da0bc6194 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp @@ -265,7 +265,7 @@ void NetPlaySetupDialog::accept() else { auto items = m_host_games->selectedItems(); - if (items.size() == 0) + if (items.empty()) { QMessageBox::critical(this, tr("Error"), tr("You must select a game to host!")); return; diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.cpp b/Source/Core/InputCommon/ControlReference/ControlReference.cpp index b2aa13f1c0..b3355418e2 100644 --- a/Source/Core/InputCommon/ControlReference/ControlReference.cpp +++ b/Source/Core/InputCommon/ControlReference/ControlReference.cpp @@ -126,7 +126,7 @@ ciface::Core::Device::Control* InputReference::Detect(const unsigned int ms, unsigned int time = 0; std::vector states(device->Inputs().size()); - if (device->Inputs().size() == 0) + if (device->Inputs().empty()) return nullptr; // get starting state of all inputs, diff --git a/Source/Core/UICommon/CommandLineParse.cpp b/Source/Core/UICommon/CommandLineParse.cpp index 69f1491ad7..46838f05c3 100644 --- a/Source/Core/UICommon/CommandLineParse.cpp +++ b/Source/Core/UICommon/CommandLineParse.cpp @@ -25,10 +25,10 @@ public: const std::string& audio_backend) : ConfigLayerLoader(Config::LayerType::CommandLine) { - if (video_backend.size()) + if (!video_backend.empty()) m_values.emplace_back(std::make_tuple(Config::MAIN_GFX_BACKEND.location, video_backend)); - if (audio_backend.size()) + if (!audio_backend.empty()) m_values.emplace_back( std::make_tuple(Config::MAIN_DSP_HLE.location, ValueToString(audio_backend == "HLE"))); diff --git a/Source/Core/UICommon/GameFileCache.cpp b/Source/Core/UICommon/GameFileCache.cpp index 7fa558d889..aad527e612 100644 --- a/Source/Core/UICommon/GameFileCache.cpp +++ b/Source/Core/UICommon/GameFileCache.cpp @@ -232,7 +232,7 @@ bool GameFileCache::SyncCacheFile(bool save) else { std::vector buffer(f.GetSize()); - if (buffer.size() && f.ReadBytes(buffer.data(), buffer.size())) + if (!buffer.empty() && f.ReadBytes(buffer.data(), buffer.size())) { u8* ptr = buffer.data(); PointerWrap p(&ptr, PointerWrap::MODE_READ); diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 68e888f6bf..b72941583e 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -890,7 +890,7 @@ void Renderer::UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRec { const u32 cacheType = (type == EFBAccessType::PeekZ ? 0 : 1); - if (!s_efbCache[cacheType][cacheRectIdx].size()) + if (s_efbCache[cacheType][cacheRectIdx].empty()) s_efbCache[cacheType][cacheRectIdx].resize(EFB_CACHE_RECT_SIZE * EFB_CACHE_RECT_SIZE); u32 targetPixelRcWidth = targetPixelRc.right - targetPixelRc.left; diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index 756bcea5e0..a83469e451 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -70,7 +70,7 @@ PostProcessingShaderConfiguration::~PostProcessingShaderConfiguration() = defaul std::string PostProcessingShaderConfiguration::LoadShader(std::string shader) { // Load the shader from the configuration if there isn't one sent to us. - if (shader == "") + if (shader.empty()) shader = g_ActiveConfig.sPostProcessingShader; m_current_shader = shader; @@ -81,7 +81,7 @@ std::string PostProcessingShaderConfiguration::LoadShader(std::string shader) std::string code; std::string path = File::GetUserPath(D_SHADERS_IDX) + sub_dir + shader + ".glsl"; - if (shader == "") + if (shader.empty()) { code = s_default_shader; } @@ -150,7 +150,7 @@ void PostProcessingShaderConfiguration::LoadOptions(const std::string& code) } #endif - if (line.size() > 0) + if (!line.empty()) { if (line[0] == '[') { @@ -171,7 +171,7 @@ void PostProcessingShaderConfiguration::LoadOptions(const std::string& code) std::string key, value; IniFile::ParseLine(line, &key, &value); - if (!(key == "" && value == "")) + if (!(key.empty() && value.empty())) current_strings->m_options.emplace_back(key, value); } } @@ -272,7 +272,7 @@ void PostProcessingShaderConfiguration::LoadOptionsConfiguration() { std::string value; ini.GetOrCreateSection(section)->Get(it.second.m_option_name, &value); - if (value != "") + if (!value.empty()) TryParseVector(value, &it.second.m_integer_values); } break; @@ -280,7 +280,7 @@ void PostProcessingShaderConfiguration::LoadOptionsConfiguration() { std::string value; ini.GetOrCreateSection(section)->Get(it.second.m_option_name, &value); - if (value != "") + if (!value.empty()) TryParseVector(value, &it.second.m_float_values); } break;