Code clean up + replace some wstring instances with utf8 (#640)

This commit is contained in:
Exzap 2023-01-29 12:53:31 +00:00 committed by GitHub
parent ca79a6aa0d
commit f3ff919be2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 163 additions and 641 deletions

View file

@ -344,10 +344,9 @@ public:
if (L == nullptr)
return false;
FileStream* fs = FileStream::openFile(filename.c_str());
if (fs == nullptr)
if (!fs)
{
forceLogDebug_printfW(L"XMLConfig::Load > failed \"%s\" with error %d", filename.c_str(), errno);
cemuLog_logDebug(LogType::Force, "XMLConfig::Load > failed \"{}\" with error {}", boost::nowide::narrow(filename), errno);
return false;
}
std::vector<uint8> xmlData;
@ -360,7 +359,7 @@ public:
const bool success = error == tinyxml2::XML_SUCCESS;
if (error != 0)
{
forceLogDebug_printf("XMLConfig::Load > LoadFile %d", error);
cemuLog_logDebug(LogType::Force, "XMLConfig::Load > LoadFile {}", error);
}
if (success)
{
@ -401,9 +400,9 @@ public:
#else
file = fopen(boost::nowide::narrow(tmp_name).c_str(), "wb");
#endif
if (file == nullptr)
if (!file)
{
forceLogDebug_printfW(L"XMLConfig::Save > failed \"%s\" with error %d", filename.c_str(), errno);
cemuLog_logDebug(LogType::Force, "XMLConfig::Save > failed \"{}\" with error {}", boost::nowide::narrow(filename), errno);
return false;
}
@ -417,7 +416,7 @@ public:
const tinyxml2::XMLError error = doc.SaveFile(file);
const bool success = error == tinyxml2::XML_SUCCESS;
if(error != 0)
forceLogDebug_printfW(L"XMLConfig::Save > SaveFile %d", error);
cemuLog_logDebug(LogType::Force, "XMLConfig::Save > SaveFile {}", error);
fflush(file);
fclose(file);
@ -425,7 +424,7 @@ public:
fs::rename(tmp_name, filename, err);
if(err)
{
forceLog_printf("can't save settings to file: %s", err.message().c_str());
cemuLog_log(LogType::Force, "Unable to save settings to file: {}", err.message().c_str());
fs::remove(tmp_name, err);
}