Format all C++ and Java code via clang-format

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-17 14:32:37 +07:00
parent 9f0290c0ec
commit bfffa1fff4
2169 changed files with 56441 additions and 64188 deletions

View File

@@ -16,14 +16,11 @@ class AsyncGuiThread
public:
AsyncGuiThread()
{
GetPlatform().SetGuiThread(std::make_unique<base::DelayedThreadPool>(
1 /* threadsCount */, base::DelayedThreadPool::Exit::ExecPending));
GetPlatform().SetGuiThread(
std::make_unique<base::DelayedThreadPool>(1 /* threadsCount */, base::DelayedThreadPool::Exit::ExecPending));
}
virtual ~AsyncGuiThread()
{
GetPlatform().SetGuiThread(std::make_unique<platform::GuiThread>());
}
virtual ~AsyncGuiThread() { GetPlatform().SetGuiThread(std::make_unique<platform::GuiThread>()); }
private:
Platform::ThreadRunner m_runner;

View File

@@ -19,23 +19,19 @@ ScopedDir::ScopedDir(std::string const & relativePath)
Platform::EError ret = Platform::MkDir(GetFullPath());
switch (ret)
{
case Platform::ERR_OK:
break;
case Platform::ERR_FILE_ALREADY_EXISTS:
Platform::EFileType type;
TEST_EQUAL(Platform::ERR_OK, Platform::GetFileType(GetFullPath(), type), ());
TEST_EQUAL(Platform::EFileType::Directory, type, ());
break;
default:
TEST(false, ("Can't create directory:", GetFullPath(), "error:", ret));
break;
case Platform::ERR_OK: break;
case Platform::ERR_FILE_ALREADY_EXISTS:
Platform::EFileType type;
TEST_EQUAL(Platform::ERR_OK, Platform::GetFileType(GetFullPath(), type), ());
TEST_EQUAL(Platform::EFileType::Directory, type, ());
break;
default: TEST(false, ("Can't create directory:", GetFullPath(), "error:", ret)); break;
}
}
ScopedDir::ScopedDir(ScopedDir const & parent, std::string const & name)
: ScopedDir(base::JoinPath(parent.GetRelativePath(), name))
{
}
{}
ScopedDir::~ScopedDir()
{
@@ -46,17 +42,12 @@ ScopedDir::~ScopedDir()
Platform::EError ret = Platform::RmDir(fullPath);
switch (ret)
{
case Platform::ERR_OK:
break;
case Platform::ERR_FILE_DOES_NOT_EXIST:
LOG(LERROR, (fullPath, "was deleted before destruction of ScopedDir."));
break;
case Platform::ERR_DIRECTORY_NOT_EMPTY:
LOG(LERROR, ("There are files in", fullPath));
break;
default:
LOG(LERROR, ("Platform::RmDir() error for", fullPath, ":", ret));
break;
case Platform::ERR_OK: break;
case Platform::ERR_FILE_DOES_NOT_EXIST:
LOG(LERROR, (fullPath, "was deleted before destruction of ScopedDir."));
break;
case Platform::ERR_DIRECTORY_NOT_EMPTY: LOG(LERROR, ("There are files in", fullPath)); break;
default: LOG(LERROR, ("Platform::RmDir() error for", fullPath, ":", ret)); break;
}
}

View File

@@ -20,20 +20,16 @@ namespace platform
{
namespace tests_support
{
ScopedFile::ScopedFile(std::string const & relativePath, Mode mode)
: ScopedFile(relativePath, {} /* contents */, mode)
{
}
ScopedFile::ScopedFile(std::string const & relativePath, Mode mode) : ScopedFile(relativePath, {} /* contents */, mode)
{}
ScopedFile::ScopedFile(std::string const & relativePath, std::string const & contents)
: ScopedFile(relativePath, contents, Mode::Create)
{
}
{}
ScopedFile::ScopedFile(ScopedDir const & dir, CountryFile const & countryFile, MapFileType type)
: ScopedFile(base::JoinPath(dir.GetRelativePath(), countryFile.GetFileName(type)), Mode::Create)
{
}
: ScopedFile(base::JoinPath(dir.GetRelativePath(), countryFile.GetFileName(type)), Mode::Create)
{}
ScopedFile::ScopedFile(std::string const & relativePath, std::string const & contents, Mode mode)
: m_fullPath(base::JoinPath(GetPlatform().WritableDir(), relativePath))

View File

@@ -37,4 +37,4 @@ ScopedMwm::ScopedMwm(std::string const & relativePath) : m_file(relativePath, Sc
}
}
} // namespace tests_support
} // namespace platfotm
} // namespace platform

View File

@@ -12,7 +12,10 @@ namespace platform
{
namespace tests_support
{
TestSocket::~TestSocket() { m_isConnected = false; }
TestSocket::~TestSocket()
{
m_isConnected = false;
}
bool TestSocket::Open(string const & host, uint16_t port)
{
@@ -23,7 +26,10 @@ bool TestSocket::Open(string const & host, uint16_t port)
return true;
}
void TestSocket::Close() { m_isConnected = false; }
void TestSocket::Close()
{
m_isConnected = false;
}
bool TestSocket::Read(uint8_t * data, uint32_t count)
{
@@ -54,12 +60,14 @@ bool TestSocket::Write(uint8_t const * data, uint32_t count)
return true;
}
void TestSocket::SetTimeout(uint32_t milliseconds) { m_timeoutMs = milliseconds; }
void TestSocket::SetTimeout(uint32_t milliseconds)
{
m_timeoutMs = milliseconds;
}
size_t TestSocket::ReadServer(vector<uint8_t> & destination)
{
unique_lock<mutex> lock(m_outputMutex);
m_outputCondition.wait_for(lock, milliseconds(m_timeoutMs),
[this]() { return !m_output.empty(); });
m_outputCondition.wait_for(lock, milliseconds(m_timeoutMs), [this]() { return !m_output.empty(); });
size_t const outputSize = m_output.size();
destination.insert(destination.end(), m_output.begin(), m_output.end());

View File

@@ -7,11 +7,11 @@ class WritableDirChanger
public:
enum class SettingsDirPolicy
{
UseDefault, UseWritableDir
UseDefault,
UseWritableDir
};
WritableDirChanger(std::string const & testDir,
SettingsDirPolicy settingsDirPolicy = SettingsDirPolicy::UseDefault);
WritableDirChanger(std::string const & testDir, SettingsDirPolicy settingsDirPolicy = SettingsDirPolicy::UseDefault);
~WritableDirChanger();
private: