Merge pull request #7798 from ShFil119/impr/empty
Use empty instead of size
This commit is contained in:
commit
8d59d1bb11
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -184,7 +184,7 @@ std::vector<ARCode> 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<ARCode> 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<ARCode> 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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ std::vector<GeckoCode> 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<GeckoCode> 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<GeckoCode> 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<GeckoCode> LoadCodes(const IniFile& globalIni, const IniFile& localI
|
|||
}
|
||||
|
||||
// add the last code
|
||||
if (gcode.name.size())
|
||||
if (!gcode.name.empty())
|
||||
{
|
||||
gcodes.push_back(gcode);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<MessageId>(NP_MSG_CHANGE_GAME);
|
||||
|
|
|
@ -54,7 +54,7 @@ void LoadPatchSection(const std::string& section, std::vector<Patch>& 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<Patch>& 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<Patch>& patches, I
|
|||
}
|
||||
}
|
||||
|
||||
if (currentPatch.name.size() && currentPatch.entries.size())
|
||||
if (!currentPatch.name.empty() && !currentPatch.entries.empty())
|
||||
{
|
||||
patches.push_back(currentPatch);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -474,7 +474,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;
|
||||
|
|
|
@ -1418,7 +1418,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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -126,7 +126,7 @@ ciface::Core::Device::Control* InputReference::Detect(const unsigned int ms,
|
|||
unsigned int time = 0;
|
||||
std::vector<bool> states(device->Inputs().size());
|
||||
|
||||
if (device->Inputs().size() == 0)
|
||||
if (device->Inputs().empty())
|
||||
return nullptr;
|
||||
|
||||
// get starting state of all inputs,
|
||||
|
|
|
@ -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")));
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ bool GameFileCache::SyncCacheFile(bool save)
|
|||
else
|
||||
{
|
||||
std::vector<u8> 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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue