mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Using const reference for C++17 range-based loop and freq used objects
This commit is contained in:
parent
da318e0974
commit
315340fc62
13 changed files with 20 additions and 20 deletions
|
@ -426,7 +426,7 @@ void CPUInfo::Detect() {
|
|||
if (GetLogicalProcessorInformation(&processors[0], &len)) {
|
||||
num_cores = 0;
|
||||
logical_cpu_count = 0;
|
||||
for (auto processor : processors) {
|
||||
for (const auto &processor : processors) {
|
||||
if (processor.Relationship == RelationProcessorCore) {
|
||||
num_cores++;
|
||||
for (int i = 0; i < sizeof(processor.ProcessorMask) * 8; ++i) {
|
||||
|
|
|
@ -404,7 +404,7 @@ bool VulkanMayBeAvailable() {
|
|||
ERROR_LOG(G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res));
|
||||
goto bail;
|
||||
}
|
||||
for (auto iter : instanceExts) {
|
||||
for (const auto &iter : instanceExts) {
|
||||
INFO_LOG(G3D, "VulkanMaybeAvailable: Instance extension found: %s (%08x)", iter.extensionName, iter.specVersion);
|
||||
if (platformSurfaceExtension && !strcmp(iter.extensionName, platformSurfaceExtension)) {
|
||||
INFO_LOG(G3D, "VulkanMayBeAvailable: Found platform surface extension '%s'", platformSurfaceExtension);
|
||||
|
|
|
@ -259,10 +259,10 @@ void ScreenManager::sendMessage(UIMessage message, const char *value) {
|
|||
|
||||
void ScreenManager::shutdown() {
|
||||
std::lock_guard<std::recursive_mutex> guard(inputLock_);
|
||||
for (auto layer : stack_)
|
||||
for (const auto &layer : stack_)
|
||||
delete layer.screen;
|
||||
stack_.clear();
|
||||
for (auto layer : nextStack_)
|
||||
for (const auto &layer : nextStack_)
|
||||
delete layer.screen;
|
||||
nextStack_.clear();
|
||||
delete overlayScreen_;
|
||||
|
|
|
@ -68,7 +68,7 @@ void WebSocketHLEThreadList(DebuggerRequest &req) {
|
|||
|
||||
JsonWriter &json = req.Respond();
|
||||
json.pushArray("threads");
|
||||
for (auto th : threads) {
|
||||
for (const auto &th : threads) {
|
||||
json.pushDict();
|
||||
json.writeUint("id", th.id);
|
||||
json.writeString("name", th.name);
|
||||
|
@ -114,7 +114,7 @@ static bool ThreadInfoForStatus(DebuggerRequest &req, DebugThreadInfo *result) {
|
|||
return false;
|
||||
|
||||
auto threads = GetThreadsInfo();
|
||||
for (auto t : threads) {
|
||||
for (const auto &t : threads) {
|
||||
if (t.id == threadID) {
|
||||
*result = t;
|
||||
return true;
|
||||
|
|
|
@ -880,7 +880,7 @@ std::set<std::string> SavedataParam::GetSecureFileNames(const std::string &dirPa
|
|||
auto entries = GetSFOEntries(dirPath);
|
||||
|
||||
std::set<std::string> secureFileNames;
|
||||
for (auto entry : entries) {
|
||||
for (const auto &entry : entries) {
|
||||
char temp[14];
|
||||
truncate_cpy(temp, entry.filename);
|
||||
secureFileNames.insert(temp);
|
||||
|
|
|
@ -1192,7 +1192,7 @@ static int sceFontFindOptimumFont(u32 libHandle, u32 fontStylePtr, u32 errorCode
|
|||
for (size_t i = 0; i < internalFonts.size(); i++) {
|
||||
MatchQuality q = internalFonts[i]->MatchesStyle(*requestedStyle);
|
||||
if (q != MATCH_NONE) {
|
||||
auto matchStyle = internalFonts[i]->GetFontStyle();
|
||||
const auto &matchStyle = internalFonts[i]->GetFontStyle();
|
||||
if (requestedStyle->fontH > 0.0f) {
|
||||
float hDist = fabs(matchStyle.fontHRes * matchStyle.fontH - hRes * requestedStyle->fontH);
|
||||
if (hDist < nearestDist) {
|
||||
|
@ -1255,7 +1255,7 @@ static int sceFontFindFont(u32 libHandle, u32 fontStylePtr, u32 errorCodePtr) {
|
|||
float hRes = requestedStyle->fontHRes > 0.0f ? (float)requestedStyle->fontHRes : fontLib->FontHRes();
|
||||
for (size_t i = 0; i < internalFonts.size(); i++) {
|
||||
if (internalFonts[i]->MatchesStyle(*requestedStyle) != MATCH_NONE) {
|
||||
auto matchStyle = internalFonts[i]->GetFontStyle();
|
||||
const auto &matchStyle = internalFonts[i]->GetFontStyle();
|
||||
if (requestedStyle->fontH > 0.0f) {
|
||||
float hDist = fabs(matchStyle.fontHRes * matchStyle.fontH - hRes * requestedStyle->fontH);
|
||||
if (hDist > 0.001f) {
|
||||
|
|
|
@ -354,7 +354,7 @@ public:
|
|||
bool foundBroken = false;
|
||||
auto importedFuncsState = importedFuncs;
|
||||
importedFuncs.clear();
|
||||
for (auto func : importedFuncsState) {
|
||||
for (const auto &func : importedFuncsState) {
|
||||
if (func.moduleName[KERNELOBJECT_MAX_NAME_LENGTH] != '\0' || !Memory::IsValidAddress(func.stubAddr)) {
|
||||
foundBroken = true;
|
||||
} else {
|
||||
|
|
|
@ -291,8 +291,8 @@ std::vector<const ShaderInfo *> GetPostShaderChain(const std::string &name) {
|
|||
|
||||
std::vector<const ShaderInfo *> GetFullPostShadersChain(const std::vector<std::string> &names) {
|
||||
std::vector<const ShaderInfo *> fullChain;
|
||||
for (auto shaderName : names) {
|
||||
auto shaderChain = GetPostShaderChain(shaderName);
|
||||
for (const auto &shaderName : names) {
|
||||
const auto &shaderChain = GetPostShaderChain(shaderName);
|
||||
fullChain.insert(fullChain.end(), shaderChain.begin(), shaderChain.end());
|
||||
}
|
||||
return fullChain;
|
||||
|
|
|
@ -1501,7 +1501,7 @@ std::string VertexDecoder::GetString(DebugShaderStringType stringType) {
|
|||
// No disassembler defined
|
||||
#endif
|
||||
std::string buffer;
|
||||
for (auto line : lines) {
|
||||
for (const auto &line : lines) {
|
||||
buffer += line;
|
||||
buffer += "\n";
|
||||
}
|
||||
|
|
|
@ -1192,7 +1192,7 @@ void ShaderManagerGLES::SaveCache(const Path &filename, DrawEngineGLES *drawEngi
|
|||
fsCache_.Iterate([&](const ShaderID &id, Shader *shader) {
|
||||
fwrite(&id, 1, sizeof(id), f);
|
||||
});
|
||||
for (auto iter : linkedShaderCache_) {
|
||||
for (const auto &iter : linkedShaderCache_) {
|
||||
ShaderID vsid, fsid;
|
||||
vsCache_.Iterate([&](const ShaderID &id, Shader *shader) {
|
||||
if (iter.vs == shader)
|
||||
|
|
|
@ -1114,17 +1114,17 @@ void JitCompareScreen::UpdateDisasm() {
|
|||
// Alright. First generate the MIPS disassembly.
|
||||
|
||||
// TODO: Need a way to communicate branch continuing.
|
||||
for (auto line : debugInfo.origDisasm) {
|
||||
for (const auto &line : debugInfo.origDisasm) {
|
||||
leftDisasm_->Add(new TextView(line))->SetFocusable(true);
|
||||
}
|
||||
|
||||
// TODO : When we have both target and IR, need a third column.
|
||||
if (debugInfo.targetDisasm.size()) {
|
||||
for (auto line : debugInfo.targetDisasm) {
|
||||
for (const auto &line : debugInfo.targetDisasm) {
|
||||
rightDisasm_->Add(new TextView(line))->SetFocusable(true);
|
||||
}
|
||||
} else {
|
||||
for (auto line : debugInfo.irDisasm) {
|
||||
for (const auto &line : debugInfo.irDisasm) {
|
||||
rightDisasm_->Add(new TextView(line))->SetFocusable(true);
|
||||
}
|
||||
}
|
||||
|
@ -1377,7 +1377,7 @@ void ShaderViewScreen::CreateViews() {
|
|||
std::vector<std::string> lines;
|
||||
SplitString(gpu->DebugGetShaderString(id_, type_, SHADER_STRING_SOURCE_CODE), '\n', lines);
|
||||
|
||||
for (auto line : lines) {
|
||||
for (const auto &line : lines) {
|
||||
lineLayout->Add(new TextView(line, FLAG_DYNAMIC_ASCII | FLAG_WRAP_TEXT, true));
|
||||
}
|
||||
|
||||
|
|
|
@ -511,7 +511,7 @@ bool GameScreen::isRecentGame(const Path &gamePath) {
|
|||
return false;
|
||||
|
||||
const std::string resolved = File::ResolvePath(gamePath.ToString());
|
||||
for (auto iso : g_Config.RecentIsos()) {
|
||||
for (const auto &iso : g_Config.RecentIsos()) {
|
||||
const std::string recent = File::ResolvePath(iso);
|
||||
if (resolved == recent)
|
||||
return true;
|
||||
|
|
|
@ -485,7 +485,7 @@ void ReportFinishScreen::ShowSuggestions() {
|
|||
resultItems_->Clear();
|
||||
bool shownConfig = false;
|
||||
bool valid = false;
|
||||
for (auto item : suggestions) {
|
||||
for (const auto &item : suggestions) {
|
||||
const char *suggestion = nullptr;
|
||||
if (item == "Upgrade") {
|
||||
suggestion = rp->T("SuggestionUpgrade", "Upgrade to a newer PPSSPP build");
|
||||
|
|
Loading…
Add table
Reference in a new issue