From e7450c06b4faec2c45bf507413a8ab660e280928 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Wed, 21 Apr 2021 01:55:32 +0200 Subject: [PATCH] early-access version 1618 --- README.md | 2 +- src/common/logging/backend.cpp | 18 ++++++++++-------- src/common/logging/backend.h | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e56d2eea1..40ae7d932 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1617. +This is the source code for early-access 1618. ## Legal Notice diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index bc82905c0..96efa977d 100755 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -56,10 +56,10 @@ public: void RemoveBackend(std::string_view backend_name) { std::lock_guard lock{writing_mutex}; - const auto it = - std::remove_if(backends.begin(), backends.end(), - [&backend_name](const auto& i) { return backend_name == i->GetName(); }); - backends.erase(it, backends.end()); + + std::erase_if(backends, [&backend_name](const auto& backend) { + return backend_name == backend->GetName(); + }); } const Filter& GetGlobalFilter() const { @@ -148,12 +148,14 @@ void ColorConsoleBackend::Write(const Entry& entry) { PrintColoredMessage(entry); } -FileBackend::FileBackend(const std::string& filename) : bytes_written(0) { - if (FS::Exists(filename + ".old.txt")) { - FS::Delete(filename + ".old.txt"); +FileBackend::FileBackend(const std::string& filename) { + const auto old_filename = filename + ".old.txt"; + + if (FS::Exists(old_filename)) { + FS::Delete(old_filename); } if (FS::Exists(filename)) { - FS::Rename(filename, filename + ".old.txt"); + FS::Rename(filename, old_filename); } // _SH_DENYWR allows read only access to the file for other programs. diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h index 84a544ea4..9dd2589c3 100755 --- a/src/common/logging/backend.h +++ b/src/common/logging/backend.h @@ -94,8 +94,8 @@ public: void Write(const Entry& entry) override; private: - Common::FS::IOFile file; - std::size_t bytes_written; + FS::IOFile file; + std::size_t bytes_written = 0; }; /**