Merge pull request #16134 from GermanAizek/master

Code refactor and minor optimize
This commit is contained in:
Henrik Rydgård
2022-10-03 11:22:07 +02:00
committed by GitHub
64 changed files with 132 additions and 133 deletions
-1
View File
@@ -95,7 +95,6 @@ bool decompress_string(const std::string& str, std::string *dest) {
inflateEnd(&zs);
if (ret != Z_STREAM_END) { // an error occurred that was not EOF
std::ostringstream oss;
ERROR_LOG(IO, "Exception during zlib decompression: (%i) %s", ret, zs.msg);
return false;
}
+2 -2
View File
@@ -206,7 +206,7 @@ void Section::Set(const char* key, const char* newValue)
else
{
// The key did not already exist in this section - let's add it.
lines.push_back(std::string(key) + " = " + EscapeComments(newValue));
lines.emplace_back(std::string(key) + " = " + EscapeComments(newValue));
}
}
@@ -272,7 +272,7 @@ void Section::Set(const char* key, const std::vector<std::string>& newValues)
}
void Section::AddComment(const std::string &comment) {
lines.push_back("# " + comment);
lines.emplace_back("# " + comment);
}
bool Section::Get(const char* key, std::vector<std::string>& values)
+1 -1
View File
@@ -39,7 +39,7 @@ const char *I18NCategory::T(const char *key, const char *def) {
if (def)
missedKeyLog_[key] = def;
else
missedKeyLog_[key] = modifiedKey.c_str();
missedKeyLog_[key] = modifiedKey;
// INFO_LOG(SYSTEM, "Missed translation key in %s: %s", name_.c_str(), key);
return def ? def : key;
}
+2 -2
View File
@@ -148,7 +148,7 @@ std::vector<File::FileInfo> ApplyFilter(std::vector<File::FileInfo> files, const
std::string tmp;
while (*filter) {
if (*filter == ':') {
filters.insert("." + tmp);
filters.emplace("." + tmp);
tmp.clear();
} else {
tmp.push_back(*filter);
@@ -156,7 +156,7 @@ std::vector<File::FileInfo> ApplyFilter(std::vector<File::FileInfo> files, const
filter++;
}
if (!tmp.empty())
filters.insert("." + tmp);
filters.emplace("." + tmp);
}
auto pred = [&](const File::FileInfo &info) {
+1 -2
View File
@@ -271,7 +271,7 @@ bool Path::CanNavigateUp() const {
if (type_ == PathType::CONTENT_URI) {
return AndroidContentURI(path_).CanNavigateUp();
}
if (path_ == "/" || path_ == "") {
if (path_ == "/" || path_.empty()) {
return false;
}
if (type_ == PathType::HTTP) {
@@ -357,7 +357,6 @@ bool Path::ComputePathTo(const Path &other, std::string &path) const {
return true;
}
std::string diff;
if (type_ == PathType::CONTENT_URI) {
AndroidContentURI a(path_);
AndroidContentURI b(other.path_);
+1 -1
View File
@@ -47,7 +47,7 @@ LPD3DBLOB CompileShaderToByteCodeD3D9(const char *code, const char *target, std:
pShaderCode = nullptr;
}
} else {
*errorMessage = "";
errorMessage->clear();
}
return pShaderCode;
+2 -2
View File
@@ -51,7 +51,7 @@ static void ParseExtensionsString(const std::string& str, std::set<std::string>
size_t next = 0;
for (size_t pos = 0, len = str.length(); pos < len; ++pos) {
if (str[pos] == ' ') {
output.insert(str.substr(next, pos - next));
output.emplace(str.substr(next, pos - next));
// Skip the delimiter itself.
next = pos + 1;
}
@@ -60,7 +60,7 @@ static void ParseExtensionsString(const std::string& str, std::set<std::string>
if (next == 0 && str.length() != 0) {
output.insert(str);
} else if (next < str.length()) {
output.insert(str.substr(next));
output.emplace(str.substr(next));
}
}
+1
View File
@@ -1203,6 +1203,7 @@ bool OpenGLPipeline::LinkShaders() {
}
std::vector<GLRProgram::Semantic> semantics;
semantics.reserve(8);
// Bind all the common vertex data points. Mismatching ones will be ignored.
semantics.push_back({ SEM_POSITION, "Position" });
semantics.push_back({ SEM_COLOR0, "Color0" });
+1 -1
View File
@@ -235,7 +235,7 @@ bool TranslateShader(std::string *dest, ShaderLanguage destLang, const ShaderLan
return false;
#endif
*errorMessage = "";
errorMessage->clear();
glslang::TProgram program;
const char *shaderStrings[1]{};
-4
View File
@@ -1348,7 +1348,6 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
int n = 0;
int stage = 0;
VkImageMemoryBarrier barriers[2]{};
if (step.render.framebuffer->color.layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
recordBarrier_.TransitionImage(
step.render.framebuffer->color.image,
@@ -1758,9 +1757,6 @@ void VulkanQueueRunner::PerformBlit(const VKRStep &step, VkCommandBuffer cmd) {
// The barrier code doesn't handle this case. We'd need to transition to GENERAL to do an intra-image copy.
_dbg_assert_(step.blit.src != step.blit.dst);
VkImageMemoryBarrier srcBarriers[2]{};
VkImageMemoryBarrier dstBarriers[2]{};
VKRFramebuffer *src = step.blit.src;
VKRFramebuffer *dst = step.blit.dst;
+2 -1
View File
@@ -1083,6 +1083,7 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char
gDesc.fragmentShader = vkshader->Get();
} else {
ERROR_LOG(G3D, "Bad stage");
delete pipeline;
return nullptr;
}
}
@@ -1424,7 +1425,7 @@ std::vector<std::string> VKContext::GetFeatureList() const {
AddFeature(features, "occlusionQueryPrecise", available.occlusionQueryPrecise, enabled.occlusionQueryPrecise);
AddFeature(features, "multiDrawIndirect", available.multiDrawIndirect, enabled.multiDrawIndirect);
features.push_back(std::string("Preferred depth buffer format: ") + VulkanFormatToString(vulkan_->GetDeviceInfo().preferredDepthStencilFormat));
features.emplace_back(std::string("Preferred depth buffer format: ") + VulkanFormatToString(vulkan_->GetDeviceInfo().preferredDepthStencilFormat));
return features;
}
+1 -1
View File
@@ -35,7 +35,7 @@ bool ShouldLogNTimes(const char *identifier, int count) {
std::lock_guard<std::mutex> lock(logNTimesLock);
auto iter = logNTimes.find(identifier);
if (iter == logNTimes.end()) {
logNTimes.insert(std::pair<const char*, int>(identifier, 1));
logNTimes.emplace(identifier, 1);
return true;
} else {
if (iter->second >= count) {
+3 -3
View File
@@ -273,7 +273,7 @@ void SplitString(const std::string& str, const char delim, std::vector<std::stri
size_t next = 0;
for (size_t pos = 0, len = str.length(); pos < len; ++pos) {
if (str[pos] == delim) {
output.push_back(str.substr(next, pos - next));
output.emplace_back(str.substr(next, pos - next));
// Skip the delimiter itself.
next = pos + 1;
}
@@ -282,7 +282,7 @@ void SplitString(const std::string& str, const char delim, std::vector<std::stri
if (next == 0) {
output.push_back(str);
} else if (next < str.length()) {
output.push_back(str.substr(next));
output.emplace_back(str.substr(next));
}
}
@@ -294,7 +294,7 @@ void GetQuotedStrings(const std::string& str, std::vector<std::string>& output)
if (str[pos] == '\"' || str[pos] == '\'') {
if (even) {
//quoted text
output.push_back(str.substr(next, pos - next));
output.emplace_back(str.substr(next, pos - next));
even = 0;
} else {
//non quoted text
+4 -4
View File
@@ -1425,7 +1425,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
// build of PPSSPP, receive an upgrade notice, then start a newer version, and still receive the upgrade notice,
// even if said newer version is >= the upgrade found online.
if ((dismissedVersion == upgradeVersion) || (versionsValid && (installed >= upgrade))) {
upgradeMessage = "";
upgradeMessage.clear();
}
// Check for new version on every 10 runs.
@@ -1637,16 +1637,16 @@ void Config::DownloadCompletedCallback(http::Download &download) {
if (installed >= upgrade) {
INFO_LOG(LOADER, "Version check: Already up to date, erasing any upgrade message");
g_Config.upgradeMessage = "";
g_Config.upgradeMessage.clear();
g_Config.upgradeVersion = upgrade.ToString();
g_Config.dismissedVersion = "";
g_Config.dismissedVersion.clear();
return;
}
if (installed < upgrade && dismissed != upgrade) {
g_Config.upgradeMessage = "New version of PPSSPP available!";
g_Config.upgradeVersion = upgrade.ToString();
g_Config.dismissedVersion = "";
g_Config.dismissedVersion.clear();
}
}
+3 -3
View File
@@ -447,7 +447,7 @@ void Core_MemoryException(u32 address, u32 pc, MemoryExceptionType type) {
ExceptionInfo &e = g_exceptionInfo;
e = {};
e.type = ExceptionType::MEMORY;
e.info = "";
e.info.clear();
e.memory_type = type;
e.address = address;
e.pc = pc;
@@ -483,7 +483,7 @@ void Core_ExecException(u32 address, u32 pc, ExecExceptionType type) {
ExceptionInfo &e = g_exceptionInfo;
e = {};
e.type = ExceptionType::BAD_EXEC_ADDR;
e.info = "";
e.info.clear();
e.exec_type = type;
e.address = address;
e.pc = pc;
@@ -498,7 +498,7 @@ void Core_Break(u32 pc) {
ExceptionInfo &e = g_exceptionInfo;
e = {};
e.type = ExceptionType::BREAK;
e.info = "";
e.info.clear();
e.pc = pc;
if (!g_Config.bIgnoreBadMemAccess) {
+4 -4
View File
@@ -316,7 +316,7 @@ void DisassemblyManager::getLine(u32 address, bool insertSymbols, DisassemblyLin
dest.params = "Disassembly failure";
} else {
dest.name = "-";
dest.params = "";
dest.params.clear();
}
}
@@ -1003,7 +1003,7 @@ void DisassemblyData::createLines()
lines[currentLineStart] = entry;
lineAddresses.push_back(currentLineStart);
currentLine = "";
currentLine.clear();
currentLineStart = pos-1;
inString = false;
}
@@ -1028,7 +1028,7 @@ void DisassemblyData::createLines()
lines[currentLineStart] = entry;
lineAddresses.push_back(currentLineStart);
currentLine = "";
currentLine.clear();
currentLineStart = pos-1;
inString = false;
}
@@ -1099,7 +1099,7 @@ void DisassemblyData::createLines()
lines[currentLineStart] = entry;
lineAddresses.push_back(currentLineStart);
currentLine = "";
currentLine.clear();
currentLineStart = currentPos;
}
+16 -16
View File
@@ -440,7 +440,7 @@ void SymbolMap::AddModule(const char *name, u32 address, u32 size) {
// Just reactivate that one.
it->start = address;
it->size = size;
activeModuleEnds.insert(std::make_pair(it->start + it->size, *it));
activeModuleEnds.emplace(it->start + it->size, *it);
activeNeedUpdate_ = true;
return;
}
@@ -453,7 +453,7 @@ void SymbolMap::AddModule(const char *name, u32 address, u32 size) {
mod.index = (int)modules.size() + 1;
modules.push_back(mod);
activeModuleEnds.insert(std::make_pair(mod.start + mod.size, mod));
activeModuleEnds.emplace(mod.start + mod.size, mod);
activeNeedUpdate_ = true;
}
@@ -560,7 +560,7 @@ void SymbolMap::AddFunction(const char* name, u32 address, u32 size, int moduleI
auto active = activeFunctions.find(address);
if (active != activeFunctions.end() && active->second.module == moduleIndex) {
activeFunctions.erase(active);
activeFunctions.insert(std::make_pair(address, existing->second));
activeFunctions.emplace(address, existing->second);
}
} else {
FunctionEntry func;
@@ -571,7 +571,7 @@ void SymbolMap::AddFunction(const char* name, u32 address, u32 size, int moduleI
functions[symbolKey] = func;
if (IsModuleActive(moduleIndex)) {
activeFunctions.insert(std::make_pair(address, func));
activeFunctions.emplace(address, func);
}
}
@@ -717,27 +717,27 @@ void SymbolMap::UpdateActiveSymbols() {
for (auto it = functions.begin(), end = functions.end(); it != end; ++it) {
const auto mod = activeModuleIndexes.find(it->second.module);
if (it->second.module == 0) {
activeFunctions.insert(std::make_pair(it->second.start, it->second));
activeFunctions.emplace(it->second.start, it->second);
} else if (mod != activeModuleIndexes.end()) {
activeFunctions.insert(std::make_pair(mod->second + it->second.start, it->second));
activeFunctions.emplace(mod->second + it->second.start, it->second);
}
}
for (auto it = labels.begin(), end = labels.end(); it != end; ++it) {
const auto mod = activeModuleIndexes.find(it->second.module);
if (it->second.module == 0) {
activeLabels.insert(std::make_pair(it->second.addr, it->second));
activeLabels.emplace(it->second.addr, it->second);
} else if (mod != activeModuleIndexes.end()) {
activeLabels.insert(std::make_pair(mod->second + it->second.addr, it->second));
activeLabels.emplace(mod->second + it->second.addr, it->second);
}
}
for (auto it = data.begin(), end = data.end(); it != end; ++it) {
const auto mod = activeModuleIndexes.find(it->second.module);
if (it->second.module == 0) {
activeData.insert(std::make_pair(it->second.start, it->second));
activeData.emplace(it->second.start, it->second);
} else if (mod != activeModuleIndexes.end()) {
activeData.insert(std::make_pair(mod->second + it->second.start, it->second));
activeData.emplace(mod->second + it->second.start, it->second);
}
}
@@ -758,7 +758,7 @@ bool SymbolMap::SetFunctionSize(u32 startAddress, u32 newSize) {
if (func != functions.end()) {
func->second.size = newSize;
activeFunctions.erase(funcInfo);
activeFunctions.insert(std::make_pair(startAddress, func->second));
activeFunctions.emplace(startAddress, func->second);
}
}
@@ -830,7 +830,7 @@ void SymbolMap::AddLabel(const char* name, u32 address, int moduleIndex) {
auto active = activeLabels.find(address);
if (active != activeLabels.end() && active->second.module == moduleIndex) {
activeLabels.erase(active);
activeLabels.insert(std::make_pair(address, label));
activeLabels.emplace(address, label);
}
}
} else {
@@ -841,7 +841,7 @@ void SymbolMap::AddLabel(const char* name, u32 address, int moduleIndex) {
labels[symbolKey] = label;
if (IsModuleActive(moduleIndex)) {
activeLabels.insert(std::make_pair(address, label));
activeLabels.emplace(address, label);
}
}
}
@@ -865,7 +865,7 @@ void SymbolMap::SetLabelName(const char* name, u32 address) {
auto active = activeLabels.find(address);
if (active != activeLabels.end() && active->second.module == label->second.module) {
activeLabels.erase(active);
activeLabels.insert(std::make_pair(address, label->second));
activeLabels.emplace(address, label->second);
}
}
}
@@ -948,7 +948,7 @@ void SymbolMap::AddData(u32 address, u32 size, DataType type, int moduleIndex) {
auto active = activeData.find(address);
if (active != activeData.end() && active->second.module == moduleIndex) {
activeData.erase(active);
activeData.insert(std::make_pair(address, existing->second));
activeData.emplace(address, existing->second);
}
} else {
DataEntry entry;
@@ -959,7 +959,7 @@ void SymbolMap::AddData(u32 address, u32 size, DataType type, int moduleIndex) {
data[symbolKey] = entry;
if (IsModuleActive(moduleIndex)) {
activeData.insert(std::make_pair(address, entry));
activeData.emplace(address, entry);
}
}
}
+2 -2
View File
@@ -216,7 +216,7 @@ bool DebuggerRequest::ParamBool(const char *name, bool *out, DebuggerParamType t
*out = true;
return true;
}
if (s == "0" || s == "false" || (s == "" && allowLoose)) {
if (s == "0" || s == "false" || (s.empty() && allowLoose)) {
*out = false;
return true;
}
@@ -262,7 +262,7 @@ bool DebuggerRequest::ParamString(const char *name, std::string *out, DebuggerPa
return true;
} else if (tag == JSON_NULL) {
if (required) {
*out = "";
out->clear();
}
return true;
} else if (tag == JSON_NUMBER) {
+6 -6
View File
@@ -194,21 +194,21 @@ void PSPNetconfDialog::DisplayMessage(std::string text1, std::string text2a, std
PPGeScissor(0, (int)(centerY - h2 - 2), 480, (int)(centerY + h2 + 2));
PPGeDrawTextWrapped(text1.c_str(), 240.0f, centerY - h2 - scrollPos_, WRAP_WIDTH, 0, messageStyle);
if (text2a != "") {
if (text2b != "")
if (!text2a.empty()) {
if (!text2b.empty())
PPGeDrawTextWrapped(text2a.c_str(), 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleRight);
else
PPGeDrawTextWrapped(text2a.c_str(), 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyle);
}
if (text2b != "")
if (!text2b.empty())
PPGeDrawTextWrapped(text2b.c_str(), 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleLeft);
if (text3a != "") {
if (text3b != "")
if (!text3a.empty()) {
if (!text3b.empty())
PPGeDrawTextWrapped(text3a.c_str(), 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleRight);
else
PPGeDrawTextWrapped(text3a.c_str(), 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyle);
}
if (text3b != "")
if (!text3b.empty())
PPGeDrawTextWrapped(text3b.c_str(), 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleLeft);
PPGeScissorReset();
+6 -6
View File
@@ -191,21 +191,21 @@ void PSPNpSigninDialog::DisplayMessage(std::string text1, std::string text2a, st
PPGeScissor(0, (int)(centerY - h2 - 2), 480, (int)(centerY + h2 + 2));
PPGeDrawTextWrapped(text1.c_str(), 240.0f, centerY - h2 - scrollPos_, WRAP_WIDTH, 0, messageStyle);
if (text2a != "") {
if (text2b != "")
if (!text2a.empty()) {
if (!text2b.empty())
PPGeDrawTextWrapped(text2a.c_str(), 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleRight);
else
PPGeDrawTextWrapped(text2a.c_str(), 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyle);
}
if (text2b != "")
if (!text2b.empty())
PPGeDrawTextWrapped(text2b.c_str(), 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + marginTop, WRAP_WIDTH, 0, messageStyleLeft);
if (text3a != "") {
if (text3b != "")
if (!text3a.empty()) {
if (!text3b.empty())
PPGeDrawTextWrapped(text3a.c_str(), 240.0f - 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleRight);
else
PPGeDrawTextWrapped(text3a.c_str(), 240.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyle);
}
if (text3b != "")
if (!text3b.empty())
PPGeDrawTextWrapped(text3b.c_str(), 240.0f + 5.0f, centerY - h2 - scrollPos_ + totalHeight1 + totalHeight2 + marginTop, WRAP_WIDTH, 0, messageStyleLeft);
PPGeScissorReset();
+7 -8
View File
@@ -258,7 +258,7 @@ std::string SavedataParam::GetSaveFilePath(const SceUtilitySavedataParam *param,
inline static std::string FixedToString(const char *str, size_t n)
{
if (!str) {
return std::string("");
return std::string();
} else {
return std::string(str, strnlen(str, n));
}
@@ -353,11 +353,11 @@ int SavedataParam::DeleteData(SceUtilitySavedataParam* param) {
if (!pspFileSystem.GetFileInfo(sfoPath).exists)
return SCE_UTILITY_SAVEDATA_ERROR_RW_DATA_BROKEN;
if (fileName != "" && !pspFileSystem.GetFileInfo(filePath).exists) {
if (!fileName.empty() && !pspFileSystem.GetFileInfo(filePath).exists) {
return SCE_UTILITY_SAVEDATA_ERROR_RW_FILE_NOT_FOUND;
}
if (fileName == "") {
if (fileName.empty()) {
return 0;
}
@@ -533,7 +533,7 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD
// copy back save name in request
strncpy(param->saveName, saveDirName.c_str(), 20);
if (fileName == "") {
if (fileName.empty()) {
delete[] cryptedData;
} else {
if (!WritePSPFile(filePath, data_, saveSize)) {
@@ -583,13 +583,12 @@ int SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &saveD
std::string dirPath = GetSaveFilePath(param, GetSaveDir(param, saveDirName));
std::string fileName = GetFileName(param);
std::string filePath = dirPath + "/" + fileName;
std::string sfoPath = dirPath + "/" + SFO_FILENAME;
if (!pspFileSystem.GetFileInfo(dirPath).exists) {
return isRWMode ? SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA : SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA;
}
if (fileName != "" && !pspFileSystem.GetFileInfo(filePath).exists) {
if (!fileName.empty() && !pspFileSystem.GetFileInfo(filePath).exists) {
return isRWMode ? SCE_UTILITY_SAVEDATA_ERROR_RW_FILE_NOT_FOUND : SCE_UTILITY_SAVEDATA_ERROR_LOAD_FILE_NOT_FOUND;
}
@@ -637,7 +636,7 @@ int SavedataParam::LoadSaveData(SceUtilitySavedataParam *param, const std::strin
std::string filename = GetFileName(param);
std::string filePath = dirPath + "/" + filename;
// Blank filename always means success, if secureVersion was correct.
if (filename == "")
if (filename.empty())
return 0;
s64 readSize;
@@ -1576,7 +1575,7 @@ void SavedataParam::SetFileInfo(SaveFileInfo &saveInfo, PSPFileInfo &info, std::
saveInfo.idx = 0;
saveInfo.modif_time = info.mtime;
std::string saveDir = savrDir == "" ? GetGameName(pspParam) + saveName : savrDir;
std::string saveDir = savrDir.empty() ? GetGameName(pspParam) + saveName : savrDir;
saveInfo.saveDir = saveDir;
// Start with a blank slate.
+1 -1
View File
@@ -283,7 +283,7 @@ std::string ParamSFOData::GenerateFakeID(std::string filename) {
// Generates fake gameID for homebrew based on it's folder name.
// Should probably not be a part of ParamSFO, but it'll be called in same places.
std::string file = PSP_CoreParameter().fileToStart.ToString();
if (filename != "")
if (!filename.empty())
file = filename;
std::size_t lslash = file.find_last_of("/");
+1 -1
View File
@@ -148,7 +148,7 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, BlockDevice *_blockDevic
if (!blockDevice->ReadBlock(16, (u8*)&desc))
blockDevice->NotifyReadError();
entireISO.name = "";
entireISO.name.clear();
entireISO.isDirectory = false;
entireISO.startingPosition = 0;
entireISO.size = _blockDevice->GetNumBlocks();
+1 -2
View File
@@ -81,7 +81,6 @@ void VirtualDiscFileSystem::LoadFileListIndex() {
return;
}
std::string buf;
static const int MAX_LINE_SIZE = 2048;
char linebuf[MAX_LINE_SIZE]{};
while (fgets(linebuf, MAX_LINE_SIZE, f)) {
@@ -330,7 +329,7 @@ int VirtualDiscFileSystem::OpenFile(std::string filename, FileAccess access, con
entry.size = 0;
entry.startOffset = 0;
if (filename == "")
if (filename.empty())
{
entry.type = VFILETYPE_ISO;
entry.fileIndex = -1;
+4 -3
View File
@@ -1325,10 +1325,10 @@ void sendChat(std::string chatString) {
if (IsSocketReady((int)metasocket, false, true) > 0) {
int chatResult = send((int)metasocket, (const char*)&chat, sizeof(chat), MSG_NOSIGNAL);
NOTICE_LOG(SCENET, "Send Chat %s to Adhoc Server", chat.message);
std::string name = g_Config.sNickName.c_str();
std::string name = g_Config.sNickName;
std::lock_guard<std::mutex> guard(chatLogLock);
chatLog.push_back(name.substr(0, 8) + ": " + chat.message);
chatLog.emplace_back(name.substr(0, 8) + ": " + chat.message);
chatMessageGeneration++;
}
}
@@ -1891,6 +1891,7 @@ uint32_t getLocalIp(int sock) {
static std::vector<std::pair<uint32_t, uint32_t>> InitPrivateIPRanges() {
struct sockaddr_in saNet {}, saMask{};
std::vector<std::pair<uint32_t, uint32_t>> ip_ranges;
ip_ranges.reserve(5);
if (1 == inet_pton(AF_INET, "192.168.0.0", &(saNet.sin_addr)) && 1 == inet_pton(AF_INET, "255.255.0.0", &(saMask.sin_addr)))
ip_ranges.push_back({saNet.sin_addr.s_addr, saMask.sin_addr.s_addr});
@@ -1928,7 +1929,7 @@ void getLocalMac(SceNetEtherAddr * addr){
mac[0] &= 0xfc;
}
else
if (!ParseMacAddress(g_Config.sMACAddress.c_str(), mac)) {
if (!ParseMacAddress(g_Config.sMACAddress, mac)) {
ERROR_LOG(SCENET, "Error parsing mac address %s", g_Config.sMACAddress.c_str());
memset(&mac, 0, sizeof(mac));
}
+2 -2
View File
@@ -2007,7 +2007,7 @@ int __KernelFreeTls(TLSPL *tls, SceUID threadID)
__KernelResumeThreadFromWait(waitingThreadID, freedAddress);
// Gotta watch the thread to quit as well, since they've allocated now.
tlsplThreadEndChecks.insert(std::make_pair(waitingThreadID, uid));
tlsplThreadEndChecks.emplace(waitingThreadID, uid);
// No need to continue or free it, we're done.
return 0;
@@ -2234,7 +2234,7 @@ int sceKernelGetTlsAddr(SceUID uid) {
if (allocBlock != -1)
{
tls->usage[allocBlock] = threadID;
tlsplThreadEndChecks.insert(std::make_pair(threadID, uid));
tlsplThreadEndChecks.emplace(threadID, uid);
--tls->ntls.freeBlocks;
needsClear = true;
}
+1 -1
View File
@@ -213,7 +213,7 @@ static void __KernelMutexAcquireLock(PSPMutex *mutex, int count, SceUID thread)
_dbg_assert_msg_((*iter).second != mutex->GetUID(), "Thread %d / mutex %d wasn't removed from mutexHeldLocks properly.", thread, mutex->GetUID());
#endif
mutexHeldLocks.insert(std::make_pair(thread, mutex->GetUID()));
mutexHeldLocks.emplace(thread, mutex->GetUID());
mutex->nm.lockLevel = count;
mutex->nm.lockThread = thread;
+1 -1
View File
@@ -230,7 +230,7 @@ public:
MipsCallManager() : idGen_(0) {}
u32 add(MipsCall *call) {
u32 id = genId();
calls_.insert(std::pair<int, MipsCall *>(id, call));
calls_.emplace(id, call);
return id;
}
MipsCall *get(u32 id) {
+1 -1
View File
@@ -691,7 +691,7 @@ static u32 sceWlanGetEtherAddr(u32 addrAddr) {
addr[0] &= 0xfc;
} else {
// Read MAC Address from config
if (!ParseMacAddress(g_Config.sMACAddress.c_str(), addr)) {
if (!ParseMacAddress(g_Config.sMACAddress, addr)) {
ERROR_LOG(SCENET, "Error parsing mac address %s", g_Config.sMACAddress.c_str());
Memory::Memset(addrAddr, 0, 6);
}
+1 -1
View File
@@ -265,7 +265,7 @@ void __DisplayListenVblank(VblankCallback callback) {
void __DisplayListenFlip(FlipCallback callback, void *userdata) {
std::lock_guard<std::mutex> guard(listenersLock);
flipListeners.push_back(std::make_pair(callback, userdata));
flipListeners.emplace_back(callback, userdata);
}
void __DisplayForgetFlip(FlipCallback callback, void *userdata) {
+1 -1
View File
@@ -60,7 +60,7 @@ FileLoader *ConstructFileLoader(const Path &filename) {
// TODO : improve, look in the file more
IdentifiedFileType Identify_File(FileLoader *fileLoader, std::string *errorString) {
*errorString = "";
errorString->clear();
if (fileLoader == nullptr) {
*errorString = "Invalid fileLoader";
return IdentifiedFileType::ERROR_IDENTIFYING;
+2 -2
View File
@@ -198,7 +198,7 @@ void JitBlockCache::ProxyBlock(u32 rootAddress, u32 startAddress, u32 size, cons
// Make binary searches and stuff work ok
b.normalEntry = codePtr;
b.checkedEntry = codePtr;
proxyBlockMap_.insert(std::make_pair(startAddress, num_blocks_));
proxyBlockMap_.emplace(startAddress, num_blocks_);
AddBlockMap(num_blocks_);
num_blocks_++; //commit the current block
@@ -253,7 +253,7 @@ void JitBlockCache::FinalizeBlock(int block_num, bool block_link) {
if (block_link) {
for (int i = 0; i < MAX_JIT_BLOCK_EXITS; i++) {
if (b.exitAddress[i] != INVALID_EXIT) {
links_to_.insert(std::make_pair(b.exitAddress[i], block_num));
links_to_.emplace(b.exitAddress[i], block_num);
}
}
+2 -1
View File
@@ -771,7 +771,7 @@ namespace MIPSAnalyst {
for (auto iter = functions.begin(); iter != functions.end(); iter++) {
AnalyzedFunction &f = *iter;
if (f.hasHash && f.size > 16) {
hashToFunction.insert(std::make_pair(f.hash, &f));
hashToFunction.emplace(f.hash, &f);
}
}
}
@@ -1420,6 +1420,7 @@ skip:
std::vector<MIPSGPReg> GetOutputRegs(MIPSOpcode op) {
std::vector<MIPSGPReg> vec;
vec.reserve(3);
MIPSInfo info = MIPSGetInfo(op);
if (info & OUT_RD) vec.push_back(MIPS_GET_RD(op));
if (info & OUT_RT) vec.push_back(MIPS_GET_RT(op));
+1 -1
View File
@@ -80,7 +80,7 @@ bool MipsAssembleOpcode(const char *line, DebugInterface *cpu, u32 address) {
g_symbolMap->GetLabels(args.labels);
}
errorText = "";
errorText.clear();
if (!runArmips(args))
{
for (size_t i = 0; i < errors.size(); i++)
+1 -1
View File
@@ -427,7 +427,7 @@ bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) {
if (g_CoreParameter.graphicsContext == nullptr) {
g_CoreParameter.graphicsContext = temp;
}
g_CoreParameter.errorString = "";
g_CoreParameter.errorString.clear();
pspIsIniting = true;
PSP_SetLoading("Loading game...");
+1 -1
View File
@@ -674,7 +674,7 @@ bool GameManager::InstallRawISO(const Path &file, const std::string &originalNam
void GameManager::ResetInstallError() {
if (!installInProgress_) {
installError_ = "";
installError_.clear();
}
}
+1 -1
View File
@@ -297,7 +297,7 @@ static void ForwardDebuggerRequest(const http::Request &request) {
// Check if this is a websocket request...
std::string upgrade;
if (!request.GetHeader("upgrade", &upgrade)) {
upgrade = "";
upgrade.clear();
}
// Yes - proceed with the socket.
+1
View File
@@ -1974,6 +1974,7 @@ VirtualFramebuffer *FramebufferManagerCommon::FindDownloadTempBuffer(VirtualFram
nvfb->fbo = draw_->CreateFramebuffer({ nvfb->bufferWidth, nvfb->bufferHeight, 1, 1, channel == RASTER_DEPTH ? true : false, name });
if (!nvfb->fbo) {
ERROR_LOG(FRAMEBUF, "Error creating FBO! %d x %d", nvfb->renderWidth, nvfb->renderHeight);
delete nvfb;
return nullptr;
}
bvfbs_.push_back(nvfb);
+3 -3
View File
@@ -55,7 +55,7 @@ void LoadPostShaderInfo(Draw::DrawContext *draw, const std::vector<Path> &direct
off.name = "Off";
off.section = "Off";
for (size_t i = 0; i < ARRAY_SIZE(off.settings); ++i) {
off.settings[i].name = "";
off.settings[i].name.clear();
off.settings[i].value = 0.0f;
off.settings[i].minValue = -1.0f;
off.settings[i].maxValue = 1.0f;
@@ -174,7 +174,7 @@ void LoadPostShaderInfo(Draw::DrawContext *draw, const std::vector<Path> &direct
section.Get("UsePreviousFrame", &info.usePreviousFrame, false);
if (info.parent == "Off")
info.parent = "";
info.parent.clear();
for (size_t i = 0; i < ARRAY_SIZE(info.settings); ++i) {
auto &setting = info.settings[i];
@@ -187,7 +187,7 @@ void LoadPostShaderInfo(Draw::DrawContext *draw, const std::vector<Path> &direct
// Populate the default setting value.
std::string section = StringFromFormat("%sSettingValue%d", info.section.c_str(), i + 1);
if (!setting.name.empty() && g_Config.mPostShaderSetting.find(section) == g_Config.mPostShaderSetting.end()) {
g_Config.mPostShaderSetting.insert(std::pair<std::string, float>(section, setting.value));
g_Config.mPostShaderSetting.emplace(section, setting.value);
}
}
+1 -1
View File
@@ -227,7 +227,7 @@ std::string FragmentShaderDesc(const FShaderID &id) {
case STENCIL_VALUE_INCR_4: desc << "StenIncr4 "; break;
case STENCIL_VALUE_INCR_8: desc << "StenIncr8 "; break;
case STENCIL_VALUE_DECR_4: desc << "StenDecr4 "; break;
case STENCIL_VALUE_DECR_8: desc << "StenDecr4 "; break;
case STENCIL_VALUE_DECR_8: desc << "StenDecr8 "; break;
default: desc << "StenUnknown "; break;
}
} else if (id.Bit(FS_BIT_REPLACE_ALPHA_WITH_STENCIL_TYPE)) {
-2
View File
@@ -867,8 +867,6 @@ void TextureCacheCommon::NotifyFramebuffer(VirtualFramebuffer *framebuffer, Fram
// Try to match the new framebuffer to existing textures.
// Backwards from the "usual" texturing case so can't share a utility function.
std::vector<AttachCandidate> candidates;
u64 cacheKey = (u64)fb_addr << 32;
// If it has a clut, those are the low 32 bits, so it'll be inside this range.
// Also, if it's a subsample of the buffer, it'll also be within the FBO.
+1 -1
View File
@@ -339,7 +339,7 @@ void AddAddressBreakpoint(u32 addr, bool temp) {
} else {
// Remove the temporary marking.
breakPCsTemp.erase(addr);
breakPCs.insert(std::make_pair(addr, BreakpointInfo{}));
breakPCs.emplace(addr, BreakpointInfo{});
}
breakPCsCount = breakPCs.size();
+3 -3
View File
@@ -219,9 +219,9 @@ bool SetRestrictPrims(const char *rule) {
// If there's nothing yet, add everything else.
if (updated.empty()) {
if (range.first > 0)
updated.push_back(std::make_pair(0, range.first - 1));
updated.emplace_back(0, range.first - 1);
if (range.second < MAX_PRIMS)
updated.push_back(std::make_pair(range.second + 1, MAX_PRIMS));
updated.emplace_back(range.second + 1, MAX_PRIMS);
continue;
}
@@ -240,7 +240,7 @@ bool SetRestrictPrims(const char *rule) {
// We're slicing a hole in this subrange.
int next = sub.second;
sub.second = range.first - 1;
updated.push_back(std::make_pair(range.second + 1, next));
updated.emplace_back(range.second + 1, next);
continue;
}
+3 -1
View File
@@ -84,6 +84,7 @@ LinkedShader::LinkedShader(GLRenderManager *render, VShaderID VSID, Shader *vs,
std::vector<GLRProgram::Semantic> semantics;
semantics.reserve(7);
semantics.push_back({ ATTR_POSITION, "position" });
semantics.push_back({ ATTR_TEXCOORD, "texcoord" });
if (useHWTransform_)
@@ -185,6 +186,7 @@ LinkedShader::LinkedShader(GLRenderManager *render, VShaderID VSID, Shader *vs,
availableUniforms = vs->GetUniformMask() | fs->GetUniformMask();
std::vector<GLRProgram::Initializer> initialize;
initialize.reserve(7);
initialize.push_back({ &u_tex, 0, TEX_SLOT_PSP_TEXTURE });
initialize.push_back({ &u_fbotex, 0, TEX_SLOT_SHADERBLEND_SRC });
initialize.push_back({ &u_testtex, 0, TEX_SLOT_ALPHATEST });
@@ -993,7 +995,7 @@ void ShaderManagerGLES::Load(const Path &filename) {
if (!f.ReadArray(&fsid, 1)) {
return;
}
diskCachePending_.link.push_back(std::make_pair(vsid, fsid));
diskCachePending_.link.emplace_back(vsid, fsid);
}
// Actual compilation happens in ContinuePrecompile(), called by GPU_GLES's IsReady.
+1
View File
@@ -1737,6 +1737,7 @@ bool PixelJitCache::Jit_ApplyLogicOp(const PixelFuncID &id, RegCache::Reg colorR
}
std::vector<FixupBranch> finishes;
finishes.reserve(11);
FixupBranch skipTable = J(true);
const u8 *tableValues[16]{};
+1 -1
View File
@@ -138,7 +138,7 @@ void ChatMenu::UpdateChat() {
uint32_t textcolor = 0xFFFFFF;
uint32_t infocolor = 0xFDD835;
std::string name = g_Config.sNickName.c_str();
std::string name = g_Config.sNickName;
std::string displayname = i.substr(0, i.find(':'));
std::string chattext = i.substr(displayname.length());
-1
View File
@@ -199,7 +199,6 @@ UI::EventReturn CwCheatScreen::OnImportCheat(UI::EventParams &params) {
WARN_LOG(COMMON, "CWCHEAT: Incorrect ID(%s) - can't import cheats.", gameID_.c_str());
return UI::EVENT_DONE;
}
std::string line;
std::vector<std::string> title;
std::vector<std::string> newList;
+1 -1
View File
@@ -1058,7 +1058,7 @@ void EmuScreen::update() {
errLoadingFile.append(err->T(errorMessage_.c_str()));
screenManager()->push(new PromptScreen(errLoadingFile, "OK", ""));
errorMessage_ = "";
errorMessage_.clear();
quit_ = true;
return;
}
+3 -3
View File
@@ -256,7 +256,7 @@ void GameSettingsScreen::CreateViews() {
root_->Add(settingInfo_);
// Show it again if we recreated the view
if (oldSettingInfo_ != "") {
if (!oldSettingInfo_.empty()) {
settingInfo_->Show(oldSettingInfo_, nullptr);
}
@@ -1231,7 +1231,7 @@ UI::EventReturn GameSettingsScreen::OnChangeMemStickDir(UI::EventParams &e) {
}
UI::EventReturn GameSettingsScreen::OnOpenMemStick(UI::EventParams &e) {
OpenDirectory(File::ResolvePath(g_Config.memStickDirectory.ToString().c_str()).c_str());
OpenDirectory(File::ResolvePath(g_Config.memStickDirectory.ToString()).c_str());
return UI::EVENT_DONE;
}
@@ -1497,7 +1497,7 @@ void GameSettingsScreen::TriggerRestart(const char *why) {
std::string param = "--gamesettings";
if (editThenRestore_) {
// We won't pass the gameID, so don't resume back into settings.
param = "";
param.clear();
} else if (!gamePath_.empty()) {
param += " \"" + ReplaceAll(ReplaceAll(gamePath_.ToString(), "\\", "\\\\"), "\"", "\\\"") + "\"";
}
+1 -1
View File
@@ -259,7 +259,7 @@ void MemStickScreen::CreateViews() {
privateString = StringFromFormat("%s (%s)", iz->T("Skip for now"), privateString.c_str());
}
leftColumn->Add(new RadioButton(&choice_, CHOICE_PRIVATE_DIRECTORY, privateString.c_str()))->OnClick.Handle(this, &MemStickScreen::OnChoiceClick);
leftColumn->Add(new RadioButton(&choice_, CHOICE_PRIVATE_DIRECTORY, privateString))->OnClick.Handle(this, &MemStickScreen::OnChoiceClick);
if (choice_ == CHOICE_PRIVATE_DIRECTORY) {
AddExplanation(leftColumn, (MemStickScreen::Choice)choice_);
}
+1 -1
View File
@@ -176,7 +176,7 @@ bool RemoteISOConnectScreen::FindServer(std::string &resultHost, int &resultPort
};
// Try last server first, if it is set
if (g_Config.iLastRemoteISOPort && g_Config.sLastRemoteISOServer != "") {
if (g_Config.iLastRemoteISOPort && !g_Config.sLastRemoteISOServer.empty()) {
if (TryServer(g_Config.sLastRemoteISOServer.c_str(), g_Config.iLastRemoteISOPort)) {
return true;
}
+1 -1
View File
@@ -502,7 +502,7 @@ void StoreScreen::CreateViews() {
selectedItem->Press();
} else {
lastSelectedName_ = "";
lastSelectedName_.clear();
}
}
root_->Add(content);
+2 -2
View File
@@ -151,7 +151,7 @@ bool ManagedTexture::LoadFromFile(const std::string &filename, ImageFileType typ
size_t fileSize;
uint8_t *buffer = VFSReadFile(filename.c_str(), &fileSize);
if (!buffer) {
filename_ = "";
filename_.clear();
ERROR_LOG(IO, "Failed to read file '%s'", filename.c_str());
return false;
}
@@ -159,7 +159,7 @@ bool ManagedTexture::LoadFromFile(const std::string &filename, ImageFileType typ
if (retval) {
filename_ = filename;
} else {
filename_ = "";
filename_.clear();
ERROR_LOG(IO, "Failed to load texture '%s'", filename.c_str());
}
delete[] buffer;
+1 -1
View File
@@ -139,7 +139,7 @@ static void LoadThemeInfo(const std::vector<Path> &directories) {
std::string tmpPath;
section.Get("UIAtlas", &tmpPath, "");
if (tmpPath != "") {
if (!tmpPath.empty()) {
tmpPath = (path / tmpPath).ToString();
File::FileInfo tmpInfo;
+1 -1
View File
@@ -191,7 +191,7 @@ CtrlDisAsmView::CtrlDisAsmView(HWND _wnd)
matchAddress = -1;
searching = false;
searchQuery = "";
searchQuery.clear();
windowStart = curAddress;
whiteBackground = false;
displaySymbols = true;
+9 -7
View File
@@ -49,7 +49,7 @@ CtrlMemView::CtrlMemView(HWND _wnd)
curAddress = 0;
debugger = 0;
searchQuery = "";
searchQuery.clear();
matchAddress = -1;
searching = false;
@@ -767,10 +767,11 @@ std::vector<u32> CtrlMemView::searchString(const std::string &searchQuery) {
return searchResAddrs;
std::vector<std::pair<u32, u32>> memoryAreas;
memoryAreas.push_back(std::pair<u32, u32>(PSP_GetScratchpadMemoryBase(), PSP_GetScratchpadMemoryEnd()));
memoryAreas.reserve(3);
memoryAreas.emplace_back(PSP_GetScratchpadMemoryBase(), PSP_GetScratchpadMemoryEnd());
// Ignore the video memory mirrors.
memoryAreas.push_back(std::pair<u32, u32>(PSP_GetVidMemBase(), 0x04200000));
memoryAreas.push_back(std::pair<u32, u32>(PSP_GetKernelMemoryBase(), PSP_GetUserMemoryEnd()));
memoryAreas.emplace_back(PSP_GetVidMemBase(), 0x04200000);
memoryAreas.emplace_back(PSP_GetKernelMemoryBase(), PSP_GetUserMemoryEnd());
for (const auto &area : memoryAreas) {
const u32 segmentStart = area.first;
@@ -821,10 +822,11 @@ void CtrlMemView::search(bool continueSearch)
}
std::vector<std::pair<u32, u32>> memoryAreas;
memoryAreas.reserve(3);
// Ignore the video memory mirrors.
memoryAreas.push_back(std::pair<u32,u32>(PSP_GetVidMemBase(), 0x04200000));
memoryAreas.push_back(std::pair<u32,u32>(PSP_GetKernelMemoryBase(), PSP_GetUserMemoryEnd()));
memoryAreas.push_back(std::pair<u32, u32>(PSP_GetScratchpadMemoryBase(), PSP_GetScratchpadMemoryEnd()));
memoryAreas.emplace_back(PSP_GetVidMemBase(), 0x04200000);
memoryAreas.emplace_back(PSP_GetKernelMemoryBase(), PSP_GetUserMemoryEnd());
memoryAreas.emplace_back(PSP_GetScratchpadMemoryBase(), PSP_GetScratchpadMemoryEnd());
searching = true;
redraw(); // so the cursor is disabled
+1 -1
View File
@@ -195,7 +195,7 @@ BOOL CMemoryDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
switch (HIWORD(wParam)) {
case BN_CLICKED:
GetWindowText(searchBoxHdl, temp, 255);
std::vector<u32> results = memView->searchString(ConvertWStringToUTF8(temp).c_str());
std::vector<u32> results = memView->searchString(ConvertWStringToUTF8(temp));
if (results.size() > 0){
searchBoxRedraw(results);
}
+2 -2
View File
@@ -49,12 +49,12 @@ bool InputBox_GetString(HINSTANCE hInst, HWND hParent, const wchar_t *title, con
if (defaultValue.size() < 255)
textBoxContents = ConvertUTF8ToWString(defaultValue);
else
textBoxContents = L"";
textBoxContents.clear();
if (title != NULL)
windowTitle = title;
else
windowTitle = L"";
windowTitle.clear();
if (IDOK == DialogBox(hInst, (LPCWSTR)IDD_INPUTBOX, hParent, InputBoxFunc)) {
outvalue = ConvertWStringToUTF8(out);
+1 -1
View File
@@ -911,7 +911,7 @@ namespace MainWindow {
if (lastSlash) {
fn = lastSlash + 1;
} else {
fn = "";
fn.clear();
}
PSPFileInfo info = pspFileSystem.GetFileInfo(filename);
+2 -2
View File
@@ -144,7 +144,7 @@ namespace W32Util
files.push_back(directory);
} else {
while (*temp) {
files.push_back(directory + "\\" + ConvertWStringToUTF8(temp));
files.emplace_back(directory + "\\" + ConvertWStringToUTF8(temp));
temp += wcslen(temp) + 1;
}
}
@@ -199,7 +199,7 @@ namespace W32Util
switch (type_) {
case DIR:
filename_ = BrowseForFolder(parent_, title_.c_str());
result_ = filename_ != "";
result_ = !filename_.empty();
complete_ = true;
break;
+1 -1
View File
@@ -211,7 +211,7 @@ std::string System_GetProperty(SystemProperty prop) {
if (wstr)
retval = ConvertWStringToUTF8(wstr);
else
retval = "";
retval.clear();
GlobalUnlock(handle);
CloseClipboard();
}
+2 -2
View File
@@ -107,7 +107,7 @@ bool RunTests() {
// Never report from tests.
std::string savedReportHost = g_Config.sReportHost;
g_Config.sReportHost = "";
g_Config.sReportHost.clear();
for (size_t i = 0; i < ARRAY_SIZE(testsToRun); i++) {
std::string testName = testsToRun[i];
@@ -116,7 +116,7 @@ bool RunTests() {
INFO_LOG(SYSTEM, "Preparing to execute '%s'", testName.c_str());
std::string error_string;
output = "";
output.clear();
if (!PSP_Init(coreParam, &error_string)) {
ERROR_LOG(SYSTEM, "Failed to init unittest %s : %s", testsToRun[i], error_string.c_str());
PSP_CoreParameter().pixelWidth = pixel_xres;
+1 -1
View File
@@ -411,7 +411,7 @@ int main(int argc, const char* argv[])
g_Config.bFirstRun = false;
g_Config.bIgnoreBadMemAccess = true;
// Never report from tests.
g_Config.sReportHost = "";
g_Config.sReportHost.clear();
g_Config.bAutoSaveSymbolMap = false;
g_Config.iRenderingMode = FB_BUFFERED_MODE;
g_Config.bHardwareTransform = true;
+1 -1
View File
@@ -634,7 +634,7 @@ static bool TestPath() {
Path path3 = path2 / "foo/bar";
EXPECT_EQ_STR(path3.WithExtraExtension(".txt").ToString(), std::string("/asdf/jkl/foo/bar.txt"));
EXPECT_EQ_STR(Path("foo.bar/hello").GetFileExtension(), std::string(""));
EXPECT_EQ_STR(Path("foo.bar/hello").GetFileExtension(), std::string());
EXPECT_EQ_STR(Path("foo.bar/hello.txt").WithReplacedExtension(".txt", ".html").ToString(), std::string("foo.bar/hello.html"));
EXPECT_EQ_STR(Path("C:\\Yo").NavigateUp().ToString(), std::string("C:"));