Skip to content

Commit f90d38c

Browse files
committed
Run ./utils/clang-format.ps1
1 parent d65bd4b commit f90d38c

File tree

869 files changed

+12259
-11884
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

869 files changed

+12259
-11884
lines changed

Client/ceflauncher_DLL/CCefApp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class CCefApp : public CefApp, public CefRenderProcessHandler
4141
if (!node)
4242
return;
4343

44-
if (node->GetType() == CefDOMNode::Type::DOM_NODE_TYPE_ELEMENT && node->GetFormControlElementType() != CefDOMNode::FormControlType::DOM_FORM_CONTROL_TYPE_UNSUPPORTED)
44+
if (node->GetType() == CefDOMNode::Type::DOM_NODE_TYPE_ELEMENT &&
45+
node->GetFormControlElementType() != CefDOMNode::FormControlType::DOM_FORM_CONTROL_TYPE_UNSUPPORTED)
4546
{
4647
auto message = CefProcessMessage::Create("InputFocus");
4748
message->GetArgumentList()->SetBool(0, true);

Client/ceflauncher_DLL/CCefAppAuth.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ namespace CefAppAuth
2929
return false;
3030

3131
auto& authCode = AuthCodeStorage();
32-
32+
3333
// Block messages until initialized (prevents race condition)
3434
if (authCode.empty()) [[unlikely]]
3535
return false;
36-
36+
3737
CefRefPtr<CefListValue> args = message->GetArgumentList();
38-
const auto size = args->GetSize();
38+
const auto size = args->GetSize();
3939
args->SetSize(size + 1);
4040
args->SetString(size, authCode.c_str());
4141
return true;
4242
}
43-
}
43+
} // namespace CefAppAuth

Client/ceflauncher_DLL/Main.cpp

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@
3030
#include <SharedUtil.h>
3131

3232
#ifdef CEF_ENABLE_SANDBOX
33-
#include <cef3/cef/include/cef_sandbox_win.h>
34-
#pragma comment(lib, "cef_sandbox.lib")
33+
#include <cef3/cef/include/cef_sandbox_win.h>
34+
#pragma comment(lib, "cef_sandbox.lib")
3535
#endif
3636

3737
// Return codes
38-
inline constexpr int CEF_INIT_SUCCESS = 0;
39-
inline constexpr int CEF_INIT_ERROR_NO_BASE_DIR = -1;
40-
inline constexpr int CEF_INIT_ERROR_DLL_LOAD_FAILED = -2;
38+
inline constexpr int CEF_INIT_SUCCESS = 0;
39+
inline constexpr int CEF_INIT_ERROR_NO_BASE_DIR = -1;
40+
inline constexpr int CEF_INIT_ERROR_DLL_LOAD_FAILED = -2;
4141

42-
inline constexpr DWORD CEF_PARENT_CHECK_INTERVAL = 1000;
43-
inline constexpr const char* CEF_DLL_NAME = "libcef.dll";
44-
inline constexpr const char* CEF_MTA_SUBDIR = "MTA";
42+
inline constexpr DWORD CEF_PARENT_CHECK_INTERVAL = 1000;
43+
inline constexpr const char* CEF_DLL_NAME = "libcef.dll";
44+
inline constexpr const char* CEF_MTA_SUBDIR = "MTA";
4545

46-
inline constexpr DWORD PARENT_CHECK_ERROR_NO_QUERY_FUNC = 1;
47-
inline constexpr DWORD PARENT_CHECK_ERROR_QUERY_FAILED = 2;
48-
inline constexpr DWORD PARENT_CHECK_ERROR_OPEN_FAILED = 3;
46+
inline constexpr DWORD PARENT_CHECK_ERROR_NO_QUERY_FUNC = 1;
47+
inline constexpr DWORD PARENT_CHECK_ERROR_QUERY_FAILED = 2;
48+
inline constexpr DWORD PARENT_CHECK_ERROR_OPEN_FAILED = 3;
4949

5050
using NtQueryInformationProcessFunc = NTSTATUS(NTAPI*)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);
5151

5252
// Safe parent monitor thread shutdown
53-
std::atomic<bool> g_bShouldTerminateMonitor{false};
53+
std::atomic<bool> g_bShouldTerminateMonitor{false};
5454
std::atomic<HANDLE> g_hMonitorThread{nullptr};
5555

5656
namespace
@@ -60,19 +60,19 @@ namespace
6060
const auto ntdll = GetModuleHandleW(L"ntdll.dll");
6161
if (!ntdll)
6262
return nullptr;
63-
63+
6464
const auto procAddr = GetProcAddress(ntdll, "NtQueryInformationProcess");
6565
if (!procAddr)
6666
return nullptr;
67-
67+
6868
return reinterpret_cast<NtQueryInformationProcessFunc>(procAddr);
6969
}
7070

7171
[[nodiscard]] auto GetParentProcessId(NtQueryInformationProcessFunc queryFunc) noexcept -> DWORD
7272
{
7373
PROCESS_BASIC_INFORMATION info{};
74-
ULONG returnLength = 0;
75-
74+
ULONG returnLength = 0;
75+
7676
if (const auto status = queryFunc(GetCurrentProcess(), ProcessBasicInformation, &info, sizeof(info), &returnLength);
7777
!NT_SUCCESS(status) || returnLength < sizeof(PROCESS_BASIC_INFORMATION))
7878
{
@@ -87,7 +87,7 @@ namespace
8787
while (!g_bShouldTerminateMonitor.load(std::memory_order_acquire))
8888
{
8989
const DWORD result = WaitForSingleObject(parentProcess, CEF_PARENT_CHECK_INTERVAL);
90-
90+
9191
if (result == WAIT_OBJECT_0)
9292
{
9393
DWORD exitCode = 0;
@@ -120,7 +120,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, [[maybe_unused]] LPVOID l
120120
{
121121
g_bShouldTerminateMonitor.store(true, std::memory_order_release);
122122
}
123-
123+
124124
return TRUE;
125125
}
126126

@@ -130,30 +130,28 @@ extern "C" [[nodiscard]] __declspec(dllexport) auto InitCEF() noexcept -> int
130130
const std::wstring_view cmdLine{GetCommandLineW()};
131131
if (const auto pos = cmdLine.find(L"--kgfiv8n="); pos != std::wstring_view::npos)
132132
{
133-
const auto valueStart = pos + 11; // Skip "--kgfiv8n="
133+
const auto valueStart = pos + 11; // Skip "--kgfiv8n="
134134
const auto valueEnd = cmdLine.find_first_of(L" \t\"", valueStart);
135-
const auto authCodeW = cmdLine.substr(valueStart,
136-
valueEnd == std::wstring_view::npos ? 30 : std::min<size_t>(30, valueEnd - valueStart));
137-
135+
const auto authCodeW = cmdLine.substr(valueStart, valueEnd == std::wstring_view::npos ? 30 : std::min<size_t>(30, valueEnd - valueStart));
136+
138137
std::string authCode;
139138
authCode.reserve(30);
140-
std::transform(authCodeW.begin(), authCodeW.end(), std::back_inserter(authCode),
141-
[](const wchar_t wc) { return static_cast<char>(wc); });
142-
139+
std::transform(authCodeW.begin(), authCodeW.end(), std::back_inserter(authCode), [](const wchar_t wc) { return static_cast<char>(wc); });
140+
143141
CefAppAuth::AuthCodeStorage() = std::move(authCode);
144142
}
145143

146144
const auto baseDir = SharedUtil::GetMTAProcessBaseDir();
147145
if (baseDir.empty())
148146
return CEF_INIT_ERROR_NO_BASE_DIR;
149-
147+
150148
const auto mtaDir = SharedUtil::PathJoin(baseDir, CEF_MTA_SUBDIR);
151149
SetDllDirectoryW(SharedUtil::FromUTF8(mtaDir));
152150

153151
if (FAILED(__HrLoadAllImportsForDll(CEF_DLL_NAME)))
154152
return CEF_INIT_ERROR_DLL_LOAD_FAILED;
155153

156-
const CefMainArgs mainArgs(GetModuleHandleW(nullptr));
154+
const CefMainArgs mainArgs(GetModuleHandleW(nullptr));
157155
const CefRefPtr<CCefApp> app{new CCefApp};
158156

159157
void* sandboxInfo = nullptr;

Client/cefweb/CAjaxResourceHandler.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ void CAjaxResourceHandler::GetResponseHeaders(CefRefPtr<CefResponse> response, i
6666
constexpr int HTTP_OK = 200;
6767
response->SetStatus(HTTP_OK);
6868
response->SetStatusText("OK");
69-
69+
7070
// Use default MIME type if none provided
7171
if (!m_strMime.empty())
7272
response->SetMimeType(m_strMime);
7373
else
7474
response->SetMimeType("application/octet-stream");
75-
75+
7676
response_length = -1;
7777
}
7878

@@ -116,10 +116,10 @@ bool CAjaxResourceHandler::ReadResponse(void* data_out, int bytes_to_read, int&
116116
const auto copyBytes = std::min(static_cast<size_t>(bytes_to_read), remainingBytes);
117117

118118
memcpy(data_out, m_strResponse.c_str() + m_DataOffset, copyBytes);
119-
119+
120120
// copyBytes is bounded by bytes_to_read (an int), so cast is always safe
121121
bytes_read = static_cast<int>(copyBytes);
122-
122+
123123
m_DataOffset += copyBytes;
124124

125125
return true;

Client/cefweb/CAjaxResourceHandler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CAjaxResourceHandler : public CefResourceHandler, public CAjaxResourceHand
2525

2626
std::vector<std::string>& GetGetData() override { return m_vecGetData; }
2727
std::vector<std::string>& GetPostData() override { return m_vecPostData; }
28-
void SetResponse(std::string data) override;
28+
void SetResponse(std::string data) override;
2929

3030
// CefResourceHandler
3131
virtual void Cancel() override;
@@ -37,7 +37,7 @@ class CAjaxResourceHandler : public CefResourceHandler, public CAjaxResourceHand
3737
DISALLOW_COPY_AND_ASSIGN(CAjaxResourceHandler);
3838

3939
private:
40-
CefRefPtr<CefCallback> m_callback;
40+
CefRefPtr<CefCallback> m_callback;
4141
std::vector<std::string> m_vecGetData;
4242
std::vector<std::string> m_vecPostData;
4343
std::string m_strResponse;

Client/cefweb/CWebApp.cpp

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ namespace
110110

111111
[[nodiscard]] CefRefPtr<CefResourceHandler> CWebApp::HandleError(const SString& strError, unsigned int uiError)
112112
{
113-
auto stream = CefStreamReader::CreateForData(
114-
(void*)strError.c_str(),
115-
strError.length()
116-
);
113+
auto stream = CefStreamReader::CreateForData((void*)strError.c_str(), strError.length());
117114
if (!stream)
118115
return nullptr;
119116
return CefRefPtr<CefResourceHandler>(new CefStreamResourceHandler(uiError, strError, "text/plain", CefResponse::HeaderMap(), stream));
@@ -131,7 +128,7 @@ void CWebApp::OnBeforeChildProcessLaunch(CefRefPtr<CefCommandLine> command_line)
131128

132129
const CefString processType = command_line->GetSwitchValue("type");
133130
ConfigureCommandLineSwitches(command_line, processType);
134-
131+
135132
// Attach IPC validation code for render processes
136133
// This runs in browser process context where g_pCore and webCore are valid
137134
// The auth code is generated in CWebCore constructor and passed to subprocesses
@@ -186,7 +183,7 @@ CefRefPtr<CefResourceHandler> CWebApp::Create(CefRefPtr<CefBrowser> browser, Cef
186183
path = path.substr(1); // Remove slash at the front
187184
if (const auto slashPos = path.find('/'); slashPos == std::string::npos)
188185
{
189-
static constexpr auto ERROR_404 = "404 - Not found";
186+
static constexpr auto ERROR_404 = "404 - Not found";
190187
static constexpr unsigned int CODE_404 = 404;
191188
return HandleError(ERROR_404, CODE_404);
192189
}
@@ -197,7 +194,7 @@ CefRefPtr<CefResourceHandler> CWebApp::Create(CefRefPtr<CefBrowser> browser, Cef
197194

198195
if (resourcePath.empty())
199196
{
200-
static constexpr auto ERROR_404 = "404 - Not found";
197+
static constexpr auto ERROR_404 = "404 - Not found";
201198
static constexpr unsigned int CODE_404 = 404;
202199
return HandleError(ERROR_404, CODE_404);
203200
}
@@ -223,7 +220,7 @@ CefRefPtr<CefResourceHandler> CWebApp::Create(CefRefPtr<CefBrowser> browser, Cef
223220
{
224221
const SString strGet = UTF16ToMbUTF8(urlParts.query.str);
225222
std::vector<SString> vecTmp;
226-
vecTmp.reserve(8); // Reserve space for common query parameter count
223+
vecTmp.reserve(8); // Reserve space for common query parameter count
227224
strGet.Split("&", vecTmp);
228225

229226
const size_t paramCount = vecTmp.size();
@@ -251,7 +248,7 @@ CefRefPtr<CefResourceHandler> CWebApp::Create(CefRefPtr<CefBrowser> browser, Cef
251248
{
252249
// Limit to 5MiB and allow byte data only
253250
constexpr size_t MAX_POST_SIZE = 5 * 1024 * 1024;
254-
size_t bytesCount = post->GetBytesCount();
251+
size_t bytesCount = post->GetBytesCount();
255252
if (bytesCount > MAX_POST_SIZE || post->GetType() != CefPostDataElement::Type::PDE_TYPE_BYTES)
256253
continue;
257254

@@ -294,7 +291,7 @@ CefRefPtr<CefResourceHandler> CWebApp::Create(CefRefPtr<CefBrowser> browser, Cef
294291
// Calculate absolute path
295292
if (!pWebView->GetFullPathFromLocal(path))
296293
{
297-
static constexpr auto ERROR_404 = "404 - Not found";
294+
static constexpr auto ERROR_404 = "404 - Not found";
298295
static constexpr unsigned int CODE_404 = 404;
299296
return HandleError(ERROR_404, CODE_404);
300297
}
@@ -303,7 +300,7 @@ CefRefPtr<CefResourceHandler> CWebApp::Create(CefRefPtr<CefBrowser> browser, Cef
303300
CBuffer fileData;
304301
if (!pWebView->VerifyFile(path, fileData))
305302
{
306-
static constexpr auto ERROR_403 = "403 - Access Denied";
303+
static constexpr auto ERROR_403 = "403 - Access Denied";
307304
static constexpr unsigned int CODE_403 = 403;
308305
return HandleError(ERROR_403, CODE_403);
309306
}
@@ -315,17 +312,14 @@ CefRefPtr<CefResourceHandler> CWebApp::Create(CefRefPtr<CefBrowser> browser, Cef
315312
fileData = CBuffer(emptyStr, std::size(emptyStr));
316313
}
317314

318-
auto stream = CefStreamReader::CreateForData(
319-
fileData.GetData(),
320-
fileData.GetSize()
321-
);
315+
auto stream = CefStreamReader::CreateForData(fileData.GetData(), fileData.GetSize());
322316
if (!stream)
323317
{
324-
static constexpr auto ERROR_404 = "404 - Not found";
318+
static constexpr auto ERROR_404 = "404 - Not found";
325319
static constexpr unsigned int CODE_404 = 404;
326320
return HandleError(ERROR_404, CODE_404);
327321
}
328-
322+
329323
return CefRefPtr<CefResourceHandler>(new CefStreamResourceHandler(mimeType, stream));
330324
}
331325
}

Client/cefweb/CWebAppAuth.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ namespace WebAppAuth
5252

5353
// Auth code configuration
5454
inline constexpr std::size_t AUTH_CODE_LENGTH = 30;
55-
inline constexpr char AUTH_CODE_MIN_CHAR = 'A';
56-
inline constexpr char AUTH_CODE_MAX_CHAR = 'Z';
55+
inline constexpr char AUTH_CODE_MIN_CHAR = 'A';
56+
inline constexpr char AUTH_CODE_MAX_CHAR = 'Z';
5757

5858
// Generates random 30-character auth code (A-Z)
5959
[[nodiscard]] inline std::string GenerateAuthCode()
6060
{
6161
std::array<char, AUTH_CODE_LENGTH> buffer{};
62-
62+
6363
// Use mt19937 with time-based seed (fast, cryptographic strength not needed for DoS prevention)
64-
static std::mt19937 rng(static_cast<unsigned int>(std::chrono::high_resolution_clock::now().time_since_epoch().count()));
64+
static std::mt19937 rng(static_cast<unsigned int>(std::chrono::high_resolution_clock::now().time_since_epoch().count()));
6565
std::uniform_int_distribution<int> dist(0, AUTH_CODE_MAX_CHAR - AUTH_CODE_MIN_CHAR);
66-
66+
6767
for (auto& ch : buffer)
6868
ch = static_cast<char>(AUTH_CODE_MIN_CHAR + dist(rng));
6969

@@ -77,7 +77,7 @@ namespace WebAppAuth
7777
return;
7878

7979
const std::lock_guard<std::mutex> lock{GetSharedAuthMutex()};
80-
80+
8181
// Always use webCore->m_AuthCode (already populated in CWebCore constructor)
8282
// No need for fallback - webCore is guaranteed to exist before this is called
8383
if (!::g_pCore || !IsReadablePointer(::g_pCore, sizeof(void*))) [[unlikely]]
@@ -93,4 +93,4 @@ namespace WebAppAuth
9393

9494
commandLine->AppendSwitchWithValue("kgfiv8n", webCore->m_AuthCode);
9595
}
96-
}
96+
} // namespace WebAppAuth

0 commit comments

Comments
 (0)