mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -7,17 +7,16 @@
|
||||
#include "base/assert.hpp"
|
||||
#include "base/cancellable.hpp"
|
||||
|
||||
|
||||
namespace storage
|
||||
{
|
||||
namespace diffs
|
||||
{
|
||||
void ApplyDiff(ApplyDiffParams && p, base::Cancellable const & cancellable,
|
||||
OnDiffApplicationFinished const & task)
|
||||
void ApplyDiff(ApplyDiffParams && p, base::Cancellable const & cancellable, OnDiffApplicationFinished const & task)
|
||||
{
|
||||
using namespace generator::mwm_diff;
|
||||
|
||||
GetPlatform().RunTask(Platform::Thread::File, [p = std::move(p), &cancellable, task] {
|
||||
GetPlatform().RunTask(Platform::Thread::File, [p = std::move(p), &cancellable, task]
|
||||
{
|
||||
CHECK(p.m_diffFile, ());
|
||||
CHECK(p.m_oldMwmFile, ());
|
||||
|
||||
@@ -41,13 +40,9 @@ void ApplyDiff(ApplyDiffParams && p, base::Cancellable const & cancellable,
|
||||
std::string const newMwmPath = diffFile->GetPath(MapFileType::Map);
|
||||
std::string const diffApplyingInProgressPath = newMwmPath + DIFF_APPLYING_FILE_EXTENSION;
|
||||
|
||||
result = generator::mwm_diff::ApplyDiff(oldMwmPath, diffApplyingInProgressPath, diffPath,
|
||||
cancellable);
|
||||
if (result == DiffApplicationResult::Ok &&
|
||||
!base::RenameFileX(diffApplyingInProgressPath, newMwmPath))
|
||||
{
|
||||
result = generator::mwm_diff::ApplyDiff(oldMwmPath, diffApplyingInProgressPath, diffPath, cancellable);
|
||||
if (result == DiffApplicationResult::Ok && !base::RenameFileX(diffApplyingInProgressPath, newMwmPath))
|
||||
result = DiffApplicationResult::Failed;
|
||||
}
|
||||
|
||||
Platform::RemoveFileIfExists(diffApplyingInProgressPath);
|
||||
|
||||
@@ -57,23 +52,16 @@ void ApplyDiff(ApplyDiffParams && p, base::Cancellable const & cancellable,
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case DiffApplicationResult::Ok:
|
||||
diffFile->DeleteFromDisk(MapFileType::Diff);
|
||||
break;
|
||||
case DiffApplicationResult::Cancelled:
|
||||
// The diff file will be deleted by storage.
|
||||
// Another way would be to leave it on disk but all consequences
|
||||
// of interacting with storage are much harder to be taken into account that way.
|
||||
break;
|
||||
case DiffApplicationResult::Failed:
|
||||
diffFile->DeleteFromDisk(MapFileType::Diff);
|
||||
break;
|
||||
case DiffApplicationResult::Ok: diffFile->DeleteFromDisk(MapFileType::Diff); break;
|
||||
case DiffApplicationResult::Cancelled:
|
||||
// The diff file will be deleted by storage.
|
||||
// Another way would be to leave it on disk but all consequences
|
||||
// of interacting with storage are much harder to be taken into account that way.
|
||||
break;
|
||||
case DiffApplicationResult::Failed: diffFile->DeleteFromDisk(MapFileType::Diff); break;
|
||||
}
|
||||
|
||||
GetPlatform().RunTask(Platform::Thread::Gui, [task, result]()
|
||||
{
|
||||
task(result);
|
||||
});
|
||||
GetPlatform().RunTask(Platform::Thread::Gui, [task, result]() { task(result); });
|
||||
});
|
||||
}
|
||||
} // namespace diffs
|
||||
|
||||
Reference in New Issue
Block a user