diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/logging/backend.cpp | 18 | ||||
| -rw-r--r-- | src/common/logging/backend.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/time/time.cpp | 8 |
3 files changed, 17 insertions, 13 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index bc82905c0..96efa977d 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -56,10 +56,10 @@ public: | |||
| 56 | 56 | ||
| 57 | void RemoveBackend(std::string_view backend_name) { | 57 | void RemoveBackend(std::string_view backend_name) { |
| 58 | std::lock_guard lock{writing_mutex}; | 58 | std::lock_guard lock{writing_mutex}; |
| 59 | const auto it = | 59 | |
| 60 | std::remove_if(backends.begin(), backends.end(), | 60 | std::erase_if(backends, [&backend_name](const auto& backend) { |
| 61 | [&backend_name](const auto& i) { return backend_name == i->GetName(); }); | 61 | return backend_name == backend->GetName(); |
| 62 | backends.erase(it, backends.end()); | 62 | }); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | const Filter& GetGlobalFilter() const { | 65 | const Filter& GetGlobalFilter() const { |
| @@ -148,12 +148,14 @@ void ColorConsoleBackend::Write(const Entry& entry) { | |||
| 148 | PrintColoredMessage(entry); | 148 | PrintColoredMessage(entry); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | FileBackend::FileBackend(const std::string& filename) : bytes_written(0) { | 151 | FileBackend::FileBackend(const std::string& filename) { |
| 152 | if (FS::Exists(filename + ".old.txt")) { | 152 | const auto old_filename = filename + ".old.txt"; |
| 153 | FS::Delete(filename + ".old.txt"); | 153 | |
| 154 | if (FS::Exists(old_filename)) { | ||
| 155 | FS::Delete(old_filename); | ||
| 154 | } | 156 | } |
| 155 | if (FS::Exists(filename)) { | 157 | if (FS::Exists(filename)) { |
| 156 | FS::Rename(filename, filename + ".old.txt"); | 158 | FS::Rename(filename, old_filename); |
| 157 | } | 159 | } |
| 158 | 160 | ||
| 159 | // _SH_DENYWR allows read only access to the file for other programs. | 161 | // _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 100644 --- a/src/common/logging/backend.h +++ b/src/common/logging/backend.h | |||
| @@ -94,8 +94,8 @@ public: | |||
| 94 | void Write(const Entry& entry) override; | 94 | void Write(const Entry& entry) override; |
| 95 | 95 | ||
| 96 | private: | 96 | private: |
| 97 | Common::FS::IOFile file; | 97 | FS::IOFile file; |
| 98 | std::size_t bytes_written; | 98 | std::size_t bytes_written = 0; |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | /** | 101 | /** |
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 63e0247de..32f372d71 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp | |||
| @@ -294,16 +294,17 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { | |||
| 294 | return; | 294 | return; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | ctx.WriteBuffer(clock_snapshot); | ||
| 298 | |||
| 297 | IPC::ResponseBuilder rb{ctx, 2}; | 299 | IPC::ResponseBuilder rb{ctx, 2}; |
| 298 | rb.Push(RESULT_SUCCESS); | 300 | rb.Push(RESULT_SUCCESS); |
| 299 | ctx.WriteBuffer(clock_snapshot); | ||
| 300 | } | 301 | } |
| 301 | 302 | ||
| 302 | void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx) { | 303 | void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx) { |
| 303 | IPC::RequestParser rp{ctx}; | 304 | IPC::RequestParser rp{ctx}; |
| 304 | const auto type{rp.PopEnum<Clock::TimeType>()}; | 305 | const auto type{rp.PopEnum<Clock::TimeType>()}; |
| 305 | 306 | ||
| 306 | rp.AlignWithPadding(); | 307 | rp.Skip(1, false); |
| 307 | 308 | ||
| 308 | const Clock::SystemClockContext user_context{rp.PopRaw<Clock::SystemClockContext>()}; | 309 | const Clock::SystemClockContext user_context{rp.PopRaw<Clock::SystemClockContext>()}; |
| 309 | const Clock::SystemClockContext network_context{rp.PopRaw<Clock::SystemClockContext>()}; | 310 | const Clock::SystemClockContext network_context{rp.PopRaw<Clock::SystemClockContext>()}; |
| @@ -319,9 +320,10 @@ void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLEReques | |||
| 319 | return; | 320 | return; |
| 320 | } | 321 | } |
| 321 | 322 | ||
| 323 | ctx.WriteBuffer(clock_snapshot); | ||
| 324 | |||
| 322 | IPC::ResponseBuilder rb{ctx, 2}; | 325 | IPC::ResponseBuilder rb{ctx, 2}; |
| 323 | rb.Push(RESULT_SUCCESS); | 326 | rb.Push(RESULT_SUCCESS); |
| 324 | ctx.WriteBuffer(clock_snapshot); | ||
| 325 | } | 327 | } |
| 326 | 328 | ||
| 327 | void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser( | 329 | void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser( |