Commit 47d2e0d3 authored by Bkg2k's avatar Bkg2k Committed by MikaXII

Resolve "Code cleanup # 1 (tidy-clang compliance)"

parent 73fdecf3
......@@ -52,7 +52,7 @@ void CommandThread::run() {
continue;
}
SystemData *system = NULL;
SystemData *system = nullptr;
for (auto tmp = SystemData::sSystemVector.begin(); tmp != SystemData::sSystemVector.end(); tmp ++) {
if ((*tmp)->getName() == tokens[1]) {
system = *tmp;
......@@ -61,14 +61,14 @@ void CommandThread::run() {
}
// The system is not a valid one
if (system == NULL)
if (system == nullptr)
{
LOG(LogError) << "Invalid system on network command: " << tokens[1];
continue;
}
FileData* result = system->getRootFolder()->LookupGame(tokens[2], FileData::SearchAttributes::ByNameWithExt);
if (result != NULL)
if (result != nullptr)
{
LOG(LogInfo) << "Starting game " << tokens[2] << " for system " << tokens[1];
runGame(result);
......
......@@ -18,7 +18,7 @@ DemoMode::DemoMode(Window& window)
// Build system list filtered by user config
const std::vector<SystemData*>& allSystems = SystemData::getAllSystems();
bool systemListExists = !mRecalboxConf.get("global.demo.systemlist").empty();
for(int i=(int)allSystems.size(); --i>= 0;)
for (int i=(int)allSystems.size(); --i>= 0;)
{
const std::string& name = allSystems[i]->getName();
bool includeSystem = mRecalboxConf.getBool(name + ".demo.include");
......@@ -35,7 +35,7 @@ DemoMode::DemoMode(Window& window)
// Check if there is at least one system.
// If not, get all system with no filtering
if (mDemoSystems.empty())
for(int i=(int)allSystems.size(); --i>= 0;)
for (int i=(int)allSystems.size(); --i>= 0;)
{
mDemoSystems.push_back(allSystems[i]);
mDurations.push_back(mDefaultDuration);
......@@ -52,7 +52,7 @@ bool DemoMode::getRandomSystem(SystemData*& outputSystem, int& outputDuration)
if (mDemoSystems.empty()) return false;
std::uniform_int_distribution<int> random(0, (int)mDemoSystems.size() - 1);
for(int i=5; --i>=0; ) // Maximum 5 tries to find a new game to launch
for (int i=5; --i>=0; ) // Maximum 5 tries to find a new game to launch
{
// Select random system
int randomPosition = random(mRandomGenerator);
......@@ -84,7 +84,7 @@ bool DemoMode::getRandomGame(FileData*& outputGame, int& outputDuration)
if (gamelist.empty()) return false;
std::uniform_int_distribution<int> random(0, (int)gamelist.size() - 1);
for(int i=5; --i>=0; ) // Maximum 5 tries to find a new game to launch
for (int i=5; --i>=0; ) // Maximum 5 tries to find a new game to launch
{
// Select game
outputGame = gamelist[random(mRandomGenerator)];
......
......@@ -9,7 +9,7 @@ namespace fs = boost::filesystem;
FileData::FileData(ItemType type, const fs::path& path, SystemData* system)
: mSystem(system),
mParent(NULL),
mParent(nullptr),
mType(type),
mPath(path),
mMetadata(getCleanName(), type) // TODO: Move clean name into metadata
......
......@@ -14,7 +14,7 @@ namespace fs = boost::filesystem;
FolderData::~FolderData()
{
for(FileData* fd : mChildren)
for (FileData* fd : mChildren)
{
delete fd;
}
......@@ -23,7 +23,7 @@ FolderData::~FolderData()
void FolderData::addChild(FileData* file, bool lukeImYourFather)
{
assert(file->getParent() == NULL || !lukeImYourFather);
assert(file->getParent() == nullptr || !lukeImYourFather);
mChildren.push_back(file);
if (lukeImYourFather)
......@@ -32,7 +32,7 @@ void FolderData::addChild(FileData* file, bool lukeImYourFather)
void FolderData::removeChild(FileData* file)
{
for(auto it = mChildren.begin(); it != mChildren.end(); it++)
for (auto it = mChildren.begin(); it != mChildren.end(); it++)
if(*it == file)
{
mChildren.erase(it);
......@@ -71,7 +71,7 @@ void FolderData::populateRecursiveFolder(const std::string& filteredExtensions,
// Keep temporary object outside the loop to avoid construction/destruction and keep memory allocated AMAP
fs::path filePath;
std::string extension, key, stem;
for(fs::directory_iterator end, dir(folderPath); dir != end; ++dir)
for (fs::directory_iterator end, dir(folderPath); dir != end; ++dir)
{
filePath = (*dir).path();
stem = filePath.stem().string();
......@@ -131,7 +131,7 @@ void FolderData::populateRecursiveFolder(const std::string& filteredExtensions,
int FolderData::getItemsRecursively(FileData::List& to, Filter includes, bool includefolders) const
{
int gameCount = 0;
for(FileData* fd : mChildren)
for (FileData* fd : mChildren)
{
if (fd->isFolder())
{
......@@ -159,7 +159,7 @@ int FolderData::getItemsRecursively(FileData::List& to, Filter includes, bool in
int FolderData::countItemsRecursively(Filter includes, bool includefolders) const
{
int result = 0;
for(FileData* fd : mChildren)
for (FileData* fd : mChildren)
{
if (fd->isFolder())
{
......@@ -185,7 +185,7 @@ int FolderData::countItemsRecursively(Filter includes, bool includefolders) cons
int FolderData::getItems(FileData::List& to, Filter includes, bool includefolders) const
{
int gameCount = 0;
for(FileData* fd : mChildren)
for (FileData* fd : mChildren)
{
if (fd->isFolder())
{
......@@ -231,7 +231,7 @@ int FolderData::getItems(FileData::List& to, Filter includes, bool includefolder
int FolderData::countItems(Filter includes, bool includefolders) const
{
int result = 0;
for(FileData* fd : mChildren)
for (FileData* fd : mChildren)
{
if (fd->isFolder())
{
......@@ -273,7 +273,7 @@ int FolderData::countItems(Filter includes, bool includefolders) const
bool FolderData::hasDetailedData() const
{
for(FileData* fd : mChildren)
for (FileData* fd : mChildren)
{
if (fd->isFolder())
{
......@@ -325,14 +325,14 @@ FileData* FolderData::LookupGame(const std::string& item, SearchAttributes attri
}
}
}
return NULL;
return nullptr;
}
FileData* FolderData::GetNextFavoriteTo(FileData* reference)
{
// Look for position index. If not found, start from the begining
int position = 0;
for(int i = (int)mChildren.size(); --i >= 0; )
for (int i = (int)mChildren.size(); --i >= 0; )
if (mChildren[i] == reference)
{
position = i;
......@@ -340,11 +340,11 @@ FileData* FolderData::GetNextFavoriteTo(FileData* reference)
}
// Look forward
for(int i = position; i < (int)mChildren.size(); i++)
for (int i = position; i < (int)mChildren.size(); i++)
if (mChildren[i]->Metadata().Favorite())
return mChildren[i];
// Look backward
for(int i = position; --i >= 0; )
for (int i = position; --i >= 0; )
if (mChildren[i]->Metadata().Favorite())
return mChildren[i];
......
......@@ -4,7 +4,7 @@
#include "LibretroRatio.h"
LibretroRatio *LibretroRatio::sInstance = NULL;
LibretroRatio *LibretroRatio::sInstance = nullptr;
LibretroRatio::LibretroRatio() {
ratioMap = new std::map<std::string, std::string>
......@@ -36,7 +36,7 @@ LibretroRatio::LibretroRatio() {
}
LibretroRatio *LibretroRatio::getInstance() {
if (sInstance == NULL)
if (sInstance == nullptr)
sInstance = new LibretroRatio();
return sInstance;
......
#define NULL 0
#define nullptr 0
#include <string>
#include <vector>
......@@ -30451,7 +30451,7 @@ const char* mameNameToRealName[] = {
"youkaidk", "Yokai Douchuuki (Japan new version)",
"zzyzzyx2", "Zzyzzyxx (set 2)",
NULL
nullptr
};
std::vector<std::string> mameBioses = {
......@@ -88,7 +88,7 @@ MetadataDescriptor MetadataDescriptor::BuildDefaultValueMetadataDescriptor()
int count = 0;
const MetadataFieldDescriptor* fields = GetMetadataFieldDescriptors(ItemType::Game, count);
for(; --count >= 0; )
for (; --count >= 0; )
{
// Get field descriptor
const MetadataFieldDescriptor& field = fields[count];
......@@ -175,7 +175,7 @@ bool MetadataDescriptor::IntToHex(int from, std::string& to)
char result[9];
result[sizeof(result) - 1] = 0;
for(int i = sizeof(result), p = 0; -- i >= 0;)
for (int i = sizeof(result), p = 0; -- i >= 0;)
result[p++] = hexa[(from >> (i << 2)) & 0xF];
to = result;
......@@ -283,7 +283,7 @@ bool MetadataDescriptor::Deserialize(const TreeNode& from, const std::string& re
// Extract default name
std::string defaultName = std::move(_Name);
for(; --count >= 0; )
for (; --count >= 0; )
{
// Get field descriptor
const MetadataFieldDescriptor& field = fields[count];
......@@ -414,7 +414,7 @@ void MetadataDescriptor::Serialize(Tree& parentTree, const std::string& filePath
tree.put("path", relative);
// Metadata
for(; --count >= 0; )
for (; --count >= 0; )
{
// Get field descriptor
const MetadataFieldDescriptor& field = fields[count];
......@@ -495,7 +495,7 @@ void MetadataDescriptor::Merge(const MetadataDescriptor& sourceMetadata)
int count = 0;
const MetadataFieldDescriptor* fields = GetMetadataFieldDescriptors(_Type, count);
for(; --count >= 0; )
for (; --count >= 0; )
{
// Get field descriptor
const MetadataFieldDescriptor& field = fields[count];
......@@ -562,7 +562,7 @@ void MetadataDescriptor::FreeAll()
int count = 0;
const MetadataFieldDescriptor* fields = GetMetadataFieldDescriptors(_Type, count);
for(; --count >= 0; )
for (; --count >= 0; )
{
// Get field descriptor
const MetadataFieldDescriptor& field = fields[count];
......
......@@ -47,7 +47,7 @@ void NetworkThread::run()
boost::this_thread::sleep(boost::posix_time::seconds(5));
}
if (changelog != "")
if (!changelog.empty())
{
std::string message = changelog;
std::string updateVersion = RecalboxUpgrade::getInstance()->getUpdateVersion();
......
......@@ -93,10 +93,10 @@ namespace PlatformIds
PlatformId getPlatformId(const char* str)
{
if(str == NULL)
if(str == nullptr)
return PLATFORM_UNKNOWN;
for(unsigned int i = 1; i < PLATFORM_COUNT; i++)
for (unsigned int i = 1; i < PLATFORM_COUNT; i++)
{
if(strcmp(PlatformNames[i], str) == 0)
return (PlatformId)i;
......@@ -114,7 +114,7 @@ namespace PlatformIds
{
const char** mameNames = mameNameToRealName;
while(*mameNames != NULL && strcmp(from, *mameNames) != 0)
while(*mameNames != nullptr && strcmp(from, *mameNames) != 0)
mameNames += 2;
if(*mameNames)
......
......@@ -65,10 +65,10 @@ int run_scraper_cmdline()
if(system_choice == "y" || system_choice == "Y")
{
out << "Will scrape all platforms.\n";
for(auto i = SystemData::sSystemVector.begin(); i != SystemData::sSystemVector.end(); i++)
for (auto& i : SystemData::sSystemVector)
{
out << " " << (*i)->getName() << " (" << (*i)->getGameCount() << " games)\n";
systems.push_back(*i);
out << " " << i->getName() << " (" << i->getGameCount() << " games)\n";
systems.push_back(i);
}
}else{
......@@ -78,14 +78,14 @@ int run_scraper_cmdline()
out << "Type nothing and press enter when you are ready to continue.\n";
do {
for(auto i = SystemData::sSystemVector.begin(); i != SystemData::sSystemVector.end(); i++)
for (auto& i : SystemData::sSystemVector)
{
if(std::find(systems.begin(), systems.end(), (*i)) != systems.end())
if(std::find(systems.begin(), systems.end(), i) != systems.end())
out << " C ";
else
out << " ";
out << "\"" << (*i)->getName() << "\" (" << (*i)->getGameCount() << " games)\n";
out << "\"" << i->getName() << "\" (" << i->getGameCount() << " games)\n";
}
std::getline(std::cin, sys_name);
......@@ -94,11 +94,11 @@ int run_scraper_cmdline()
break;
bool found = false;
for(auto i = SystemData::sSystemVector.begin(); i != SystemData::sSystemVector.end(); i++)
for (auto& i : SystemData::sSystemVector)
{
if((*i)->getName() == sys_name)
if(i->getName() == sys_name)
{
systems.push_back(*i);
systems.push_back(i);
found = true;
break;
}
......
......@@ -360,7 +360,10 @@ SystemData *createSystem(const SystemData::Tree &system)
// if there appears to be an actual platform ID supplied but it didn't match the list, warn
if (str != nullptr && str[0] != '\0' && platformId == PlatformIds::PLATFORM_UNKNOWN)
LOG(LogWarning) << " Unknown platform for system \"" << name << "\" (platform \"" << str << "\" from list \"" << platformList << "\")";
{
LOG(LogWarning) << " Unknown platform for system \"" << name << "\" (platform \"" << str << "\" from list \""
<< platformList << "\")";
}
else if (platformId != PlatformIds::PLATFORM_UNKNOWN)
platformIds.push_back(platformId);
}
......
......@@ -86,7 +86,7 @@ void VolumeControl::init()
{
LOG(LogDebug) << "VolumeControl::init() - Attached to default card";
//ok. register simple element class
if (snd_mixer_selem_register(mixerHandle, NULL, NULL) >= 0)
if (snd_mixer_selem_register(mixerHandle, nullptr, nullptr) >= 0)
{
LOG(LogDebug) << "VolumeControl::init() - Registered simple element class";
//ok. load registered elements
......@@ -143,7 +143,7 @@ void VolumeControl::init()
//Windows older than Vista. use mixer API. open default mixer
if (mixerHandle == nullptr)
{
if (mixerOpen(&mixerHandle, 0, NULL, 0, 0) == MMSYSERR_NOERROR)
if (mixerOpen(&mixerHandle, 0, nullptr, 0, 0) == MMSYSERR_NOERROR)
{
//retrieve info on the volume slider control for the "Speaker Out" line
MIXERLINECONTROLS mixerLineControls;
......
......@@ -68,10 +68,10 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
mMD_Grid = std::make_shared<ComponentGrid>(mWindow, Vector2i(2, mMD_Pairs.size()*2 - 1));
unsigned int i = 0;
for(auto it = mMD_Pairs.begin(); it != mMD_Pairs.end(); it++)
for (auto& mMD_Pair : mMD_Pairs)
{
mMD_Grid->setEntry(it->first, Vector2i(0, i), false, true);
mMD_Grid->setEntry(it->second, Vector2i(1, i), false, it->resize);
mMD_Grid->setEntry(mMD_Pair.first, Vector2i(0, i), false, true);
mMD_Grid->setEntry(mMD_Pair.second, Vector2i(1, i), false, mMD_Pair.resize);
i += 2;
}
......@@ -146,15 +146,15 @@ void ScraperSearchComponent::resizeMetadata()
// update label fonts
float maxLblWidth = 0;
for(auto it = mMD_Pairs.begin(); it != mMD_Pairs.end(); it++)
for (auto& mMD_Pair : mMD_Pairs)
{
it->first->setFont(fontLbl);
it->first->setSize(0, 0);
if(it->first->getSize().x() > maxLblWidth)
maxLblWidth = it->first->getSize().x() + 6;
mMD_Pair.first->setFont(fontLbl);
mMD_Pair.first->setSize(0, 0);
if(mMD_Pair.first->getSize().x() > maxLblWidth)
maxLblWidth = mMD_Pair.first->getSize().x() + 6;
}
for(unsigned int i = 0; i < mMD_Pairs.size(); i++)
for (unsigned int i = 0; i < mMD_Pairs.size(); i++)
{
mMD_Grid->setRowHeightPerc(i*2, (fontLbl->getLetterHeight() + 2) / mMD_Grid->getSize().y());
}
......@@ -254,7 +254,7 @@ void ScraperSearchComponent::onSearchDone(const std::vector<ScraperSearchResult>
mGrid.resetCursor();
}else{
ComponentListRow row;
for(int i = 0; i < end; i++)
for (int i = 0; i < end; i++)
{
row.elements.clear();
row.addElement(std::make_shared<TextComponent>(mWindow, strToUpper(results.at(i).mdl.Name()), font, color), true);
......
......@@ -61,16 +61,16 @@ public:
inline void setFont(const std::shared_ptr<Font>& font)
{
mFont = font;
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
it->data.textCache.reset();
for (auto& entry : mEntries)
entry.data.textCache.reset();
}
inline void setUppercase(bool uppercase)
{
(void)uppercase;
mUppercase = true; // TODO: Check
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
it->data.textCache.reset();
for (auto& entry : mEntries)
entry.data.textCache.reset();
}
inline void setSelectorHeight(float selectorScale) { mSelectorHeight = selectorScale; }
......@@ -184,7 +184,7 @@ void TextListComponent<T>::render(const Eigen::Affine3f& parentTrans)
Renderer::pushClipRect(Eigen::Vector2i((int)(trans.translation().x() + mHorizontalMargin), (int)trans.translation().y()),
Eigen::Vector2i((int)(dim.x() - mHorizontalMargin*2), (int)dim.y()));
for(int i = startEntry; i < listCutoff; i++)
for (int i = startEntry; i < listCutoff; i++)
{
typename IList<TextListData, T>::Entry& entry = mEntries.at((unsigned int)i);
......
......@@ -171,7 +171,7 @@ GuiGamelistOptions::~GuiGamelistOptions()
SystemData::deleteSystems();
SystemData::loadConfig();
GuiComponent *gui;
while ((gui = window->peekGui()) != NULL) window->removeGui(gui);
while ((gui = window->peekGui()) != nullptr) window->removeGui(gui);
ViewController::init(window);
ViewController::get()->reloadAll();
window->pushGui(ViewController::get());
......
......@@ -30,10 +30,10 @@ GuiHashStart::GuiHashStart(Window* window)
// add systems (all with a platformid specified selected)
mSystems = std::make_shared< OptionListComponent<SystemData*> >(mWindow, _("HASH THESE SYSTEMS"), true);
for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++)
for (auto& it : SystemData::sSystemVector)
{
if(RecalboxConf::getInstance()->isInList("global.netplay.systems", (*it)->getName()))
mSystems->add((*it)->getFullName(), *it, true);
if(RecalboxConf::getInstance()->isInList("global.netplay.systems", it->getName()))
mSystems->add(it->getFullName(), it, true);
}
mMenu.addWithLabel(mSystems, _("SYSTEMS"));
......@@ -45,7 +45,7 @@ GuiHashStart::GuiHashStart(Window* window)
void GuiHashStart::start()
{
for(auto system : mSystems->getSelectedObjects()) {
for (auto system : mSystems->getSelectedObjects()) {
std::string command = "/recalbox/scripts/recalbox-hash.sh -s \"" + system->getName() + "\" -t";
......@@ -87,7 +87,7 @@ void GuiHashStart::start()
int totalRoms = 0;
for(pugi::xml_node fileNode = root.child(tag); fileNode; fileNode = fileNode.next_sibling(tag))
for (pugi::xml_node fileNode = root.child(tag); fileNode; fileNode = fileNode.next_sibling(tag))
{
totalRoms++;
}
......@@ -97,7 +97,7 @@ void GuiHashStart::start()
std::string busyText;
std::string systemName = system->getFullName();
for(pugi::xml_node fileNode = root.child(tag); fileNode; fileNode = fileNode.next_sibling(tag))
for (pugi::xml_node fileNode = root.child(tag); fileNode; fileNode = fileNode.next_sibling(tag))
{
currentRom++;
......
......@@ -86,7 +86,7 @@ void GuiLoading::update(int deltaTime) {
mBusyAnim.update(deltaTime);
if (!mRunning) {
if(mFunc2 != NULL)
if(mFunc2 != nullptr)
mFunc2(result);
delete this;
}
......
This diff is collapsed.
......@@ -153,7 +153,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
std::string currentEmulator = mMetaData.Emulator();
std::string mainConfigEmulator = RecalboxConf::getInstance()->get(system->getName() + ".emulator");
if (mainConfigEmulator == "" || mainConfigEmulator == "default")
if (mainConfigEmulator.empty() || mainConfigEmulator == "default")
{
mainConfigEmulator = emulatorDefaults.emulator;
}
......@@ -173,7 +173,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
if (emulatorName == "default")
{
std::string mainConfigCore = RecalboxConf::getInstance()->get(system->getName() + ".core");
if (mainConfigCore == "" || mainConfigCore == "default")
if (mainConfigCore.empty() || mainConfigCore == "default")
{
mainConfigCore = emulatorDefaults.core;
}
......@@ -184,7 +184,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
std::vector<std::string> cores = system->getCores(emulatorName);
std::string currentCore = mMetaData.Core();
if (currentCore == "")
if (currentCore.empty())
{
currentCore = "default";
}
......
......@@ -23,12 +23,12 @@ using namespace Eigen;
bool compareLowerCase(std::string str1, std::string str2)
{
for(unsigned int i = 0; i < str1.length(); i++)
for (unsigned int i = 0; i < str1.length(); i++)
{
str1[i] = tolower(str1[i]);
}
for(unsigned int i = 0; i < str2.length(); i++)
for (unsigned int i = 0; i < str2.length(); i++)
{
str2[i] = tolower(str2[i]);
}
......@@ -48,7 +48,7 @@ GuiNetPlay::GuiNetPlay(Window* window)
mGrid(window, Eigen::Vector2i(1, 3)),
mGridMeta(new ComponentGrid(window, Eigen::Vector2i(2, 1))),
mGridMetaRight(new ComponentGrid(window, Eigen::Vector2i(2, 11))),
mList(NULL)
mList(nullptr)
{
addChild(&mBackground);
addChild(&mGrid);
......@@ -122,7 +122,7 @@ bool GuiNetPlay::parseLobby()
{
continue;
}
FileData* tmp = NULL;
FileData* tmp = nullptr;
if (array_element.second.get<std::string>("fields.game_crc") != "00000000") {
tmp = findGame(array_element.second.get<std::string>("fields.game_crc"));
}
......@@ -213,7 +213,7 @@ void GuiNetPlay::populateGrid()
if (mGames[i]->getHash() == v.second.get<std::string>("fields.game_crc")) {
text = "\uf1c0 " + gameName;
}
else if (getCoreInfo(v.second.get<std::string>("fields.core_name")).first != "") {
else if (!getCoreInfo(v.second.get<std::string>("fields.core_name")).first.empty()) {
text = "\uf1c1 " + gameName;
} else
{
......@@ -266,7 +266,7 @@ void GuiNetPlay::populateGridMeta(int i)
}
std::pair<std::string, std::string> CoreInfo = getCoreInfo(mRooms[i].second.get<std::string>("fields.core_name"));
coreVerMatch = CoreInfo.second == mRooms[i].second.get<std::string>("fields.core_version");
coreMatch = CoreInfo.first != "";
coreMatch = !CoreInfo.first.empty();
std::string username = mRooms[i].second.get<std::string>("fields.username", "N/A");
std::string frontend = mRooms[i].second.get<std::string>("fields.frontend");
......@@ -331,7 +331,7 @@ void GuiNetPlay::launch()
Eigen::Vector3f target(Renderer::getScreenWidth() / 2.0f, Renderer::getScreenHeight() / 2.0f, 0);
int index = mList->getCursor();
std::string core = getCoreInfo(mRooms[index].second.get<std::string>("fields.core_name")).first;
if (core != "")
if (!core.empty())
{
std::string ip, port;
if (mRooms[index].second.get<std::string>("fields.host_method") == "3") {
......@@ -366,8 +366,8 @@ FileData* GuiNetPlay::findGame(std::string gameNameOrHash)
std::pair<std::string, std::string> GuiNetPlay::getCoreInfo(const std::string &name) {
boost::regex validLine("^(?<key>[^;|#].*?);(?<val>.*?)$");
std::pair<std::string, std::string> result;
result.first = "";
result.second = "";
result.first.clear();
result.second.clear();
std::map<std::string, std::string> coreMap;
std::string line;
std::string filePath = "/recalbox/share/system/configs/retroarch.corenames";
......@@ -394,7 +394,7 @@ std::pair<std::string, std::string> GuiNetPlay::getCoreInfo(const std::string &n
result.first = token;
s.erase(0, pos + delimiter.length());
}
if (result.first != "")
if (!result.first.empty())
{
result.second = s;
}
......@@ -418,7 +418,7 @@ void GuiNetPlay::pingLobby()
std::string GuiNetPlay::pingHost(const std::string& ip)
{
std::pair<std::string, int> ping = RecalboxSystem::getInstance()->execute("ping -c 1 -w 1 " + ip + " | grep \"min/avg/max\" | cut -d '/' -f 5");
if (ping.first != "") {
if (!ping.first.empty()) {
float latency = strtof(ping.first.c_str(), 0);
if (latency <=80) {
return "\uF1c8 " + _("good") + " (" + std::to_string((int)latency) + "ms)";
......
......@@ -85,8 +85,8 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
GuiScraperMulti::~GuiScraperMulti()
{
// view type probably changed (basic -> detailed)
for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++)
ViewController::get()->reloadGameListView(*it, false);
for (auto& system : SystemData::sSystemVector)
ViewController::get()->reloadGameListView(system, false);
}
void GuiScraperMulti::onSizeChanged()
......
......@@ -25,10 +25,10 @@ GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window),
// add systems (all with a platformid specified selected)
mSystems = std::make_shared< OptionListComponent<SystemData*> >(mWindow, _("SCRAPE THESE SYSTEMS"), true);
for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++)
for (auto& it : SystemData::sSystemVector)
{
if(!(*it)->hasPlatformId(PlatformIds::PLATFORM_IGNORE))
mSystems->add((*it)->getFullName(), *it, !(*it)->getPlatformIds().empty());
if(!it->hasPlatformId(PlatformIds::PLATFORM_IGNORE))
mSystems->add(it->getFullName(), it, !it->getPlatformIds().empty());
}
mMenu.addWithLabel(mSystems, _("SYSTEMS"));
......@@ -54,9 +54,9 @@ GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window),
void GuiScraperStart::pressedStart()
{
std::vector<SystemData*> sys = mSystems->getSelectedObjects();
for(auto it = sys.begin(); it != sys.end(); it++)
for (auto& sy : sys)
{
if((*it)->getPlatformIds().empty())
if(sy->getPlatformIds().empty())
{
mWindow->pushGui(new GuiMsgBox(mWindow,
_("WARNING: SOME OF YOUR SELECTED SYSTEMS DO NOT HAVE A PLATFORM SET. RESULTS MAY BE EVEN MORE INACCURATE THAN USUAL!\nCONTINUE ANYWAY?"),
......@@ -90,16 +90,16 @@ void GuiScraperStart::start()
std::queue<ScraperSearchParams> GuiScraperStart::getSearches(std::vector<SystemData*> systems, GameFilterFunc selector)