Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert <krzmbrzl@gmail.com>2020-09-11 19:29:33 +0300
committerRobert <krzmbrzl@gmail.com>2020-09-11 19:29:33 +0300
commitaf7dac72f4063dd8d4dac71973ea51c25896089a (patch)
tree35558695aea94d48fd9e77d164d63fd8b7c76e90 /overlay/overlay_exe
parent40b28b03c150b453e00c6bc4f8d6957caea59c51 (diff)
FORMAT: Run clang-format 10 on all C/CXX source-files
Diffstat (limited to 'overlay/overlay_exe')
-rw-r--r--overlay/overlay_exe/overlay_exe.cpp31
-rw-r--r--overlay/overlay_exe/overlay_exe.h30
2 files changed, 32 insertions, 29 deletions
diff --git a/overlay/overlay_exe/overlay_exe.cpp b/overlay/overlay_exe/overlay_exe.cpp
index 460336b8b..7bca1c3de 100644
--- a/overlay/overlay_exe/overlay_exe.cpp
+++ b/overlay/overlay_exe/overlay_exe.cpp
@@ -4,9 +4,9 @@
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#include <windows.h>
+#include <shellapi.h>
#include <shlwapi.h>
#include <stdio.h>
-#include <shellapi.h>
#include <string>
#include <vector>
@@ -14,17 +14,17 @@
#include "../overlay.h"
#include "overlay_exe.h"
-#define UNUSED(x) ((void)x)
+#define UNUSED(x) ((void) x)
typedef int (*OverlayHelperProcessMain)(unsigned int magic, HANDLE parent);
// Signal to the overlay DLL that it should not inject
// into this process.
-extern "C" __declspec(dllexport) void mumbleSelfDetection() {};
+extern "C" __declspec(dllexport) void mumbleSelfDetection(){};
// Alert shows a fatal error dialog and waits for the user to click OK.
static void Alert(LPCWSTR title, LPCWSTR msg) {
- MessageBox(nullptr, msg, title, MB_OK|MB_ICONERROR);
+ MessageBox(nullptr, msg, title, MB_OK | MB_ICONERROR);
}
// GetExecutableDirPath returns the directory that
@@ -75,15 +75,15 @@ static std::wstring GetAbsoluteMumbleOverlayDllPath() {
// passed to the process.
// If the returned vector has a length of 0, an unknown
// error occurred.
-static std::vector<std::wstring> GetCommandLineArgs() {
- std::vector<std::wstring> args;
+static std::vector< std::wstring > GetCommandLineArgs() {
+ std::vector< std::wstring > args;
LPWSTR cmdLine = GetCommandLine();
if (!cmdLine) {
return args;
}
- int argc = 0;
+ int argc = 0;
LPWSTR *argv = CommandLineToArgvW(cmdLine, &argc);
if (!argv) {
return args;
@@ -115,11 +115,11 @@ int main(int argc, char **argv) {
// initiated launches by checking if we were passed any
// arguments at all. If no parameters are passed, we
// display a nice alert dialog directing users to
- // 'mumble.exe' instead.
+ // 'mumble.exe' instead.
unsigned int magic = 0;
- HANDLE parent = 0;
+ HANDLE parent = 0;
{
- std::vector<std::wstring> args = GetCommandLineArgs();
+ std::vector< std::wstring > args = GetCommandLineArgs();
// If there is only a single argument, it's the program name.
// That probably means that a user has double-clicked
@@ -140,19 +140,19 @@ int main(int argc, char **argv) {
}
std::wstring magicNumberStr = args[1];
- std::wstring handleStr = args[2];
+ std::wstring handleStr = args[2];
try {
unsigned long passedInMagic = std::stoul(magicNumberStr);
- magic = static_cast<unsigned int>(passedInMagic);
+ magic = static_cast< unsigned int >(passedInMagic);
} catch (std::exception &) {
return OVERLAY_HELPER_ERROR_EXE_INVALID_MAGIC_ARGUMENT;
}
try {
unsigned long long passedInHandle = std::stoull(handleStr);
- parent = reinterpret_cast<HANDLE>(passedInHandle & 0xFFFFFFFFULL);
- } catch(std::exception &) {
+ parent = reinterpret_cast< HANDLE >(passedInHandle & 0xFFFFFFFFULL);
+ } catch (std::exception &) {
return OVERLAY_HELPER_ERROR_EXE_INVALID_HANDLE_ARGUMENT;
}
}
@@ -175,7 +175,8 @@ int main(int argc, char **argv) {
return OVERLAY_HELPER_ERROR_EXE_LOAD_DLL;
}
- OverlayHelperProcessMain entryPoint = reinterpret_cast<OverlayHelperProcessMain>(GetProcAddress(dll, "OverlayHelperProcessMain"));
+ OverlayHelperProcessMain entryPoint =
+ reinterpret_cast< OverlayHelperProcessMain >(GetProcAddress(dll, "OverlayHelperProcessMain"));
if (!entryPoint) {
return OVERLAY_HELPER_ERROR_EXE_LOOKUP_ENTRY_POINT;
}
diff --git a/overlay/overlay_exe/overlay_exe.h b/overlay/overlay_exe/overlay_exe.h
index 4daab98fb..9799e3149 100644
--- a/overlay/overlay_exe/overlay_exe.h
+++ b/overlay/overlay_exe/overlay_exe.h
@@ -8,7 +8,7 @@
#if defined(_M_IX86)
const wchar_t *MUMBLE_OVERLAY_DLL_NAME = L"mumble_ol.dll";
-#elif defined (_M_X64)
+#elif defined(_M_X64)
const wchar_t *MUMBLE_OVERLAY_DLL_NAME = L"mumble_ol_x64.dll";
#endif
@@ -17,33 +17,33 @@ const wchar_t *MUMBLE_OVERLAY_DLL_NAME = L"mumble_ol_x64.dll";
enum OverlayHelperError {
/// The overlay helper process was not passed any
/// arguments.
- OVERLAY_HELPER_ERROR_EXE_NO_ARGUMENTS = 0x0F000001,
+ OVERLAY_HELPER_ERROR_EXE_NO_ARGUMENTS = 0x0F000001,
/// The magic number on the command line of the overlay
/// helper process could not be converted to an integer.
- OVERLAY_HELPER_ERROR_EXE_INVALID_MAGIC_ARGUMENT = 0x0F000002,
+ OVERLAY_HELPER_ERROR_EXE_INVALID_MAGIC_ARGUMENT = 0x0F000002,
/// The magic number on the command line of the overlay
/// helper did not match the built-in magic number of
/// the helper process.
- OVERLAY_HELPER_ERROR_EXE_MAGIC_MISMATCH = 0x0F000003,
+ OVERLAY_HELPER_ERROR_EXE_MAGIC_MISMATCH = 0x0F000003,
/// The overlay helper process was unable to configure
/// its environment in preparation of loading the
/// overlay DLL.
- OVERLAY_HELPER_ERROR_EXE_CONFIGURE_ENVIRONMENT = 0x0F000004,
+ OVERLAY_HELPER_ERROR_EXE_CONFIGURE_ENVIRONMENT = 0x0F000004,
/// The overlay helper process was unable to get the
/// path to the overlay DLL.
- OVERLAY_HELPER_ERROR_EXE_GET_DLL_PATH = 0x0F000005,
+ OVERLAY_HELPER_ERROR_EXE_GET_DLL_PATH = 0x0F000005,
/// The overlay helper process was unable to load the
/// overlay DLL.
- OVERLAY_HELPER_ERROR_EXE_LOAD_DLL = 0x0F000006,
+ OVERLAY_HELPER_ERROR_EXE_LOAD_DLL = 0x0F000006,
/// The overlay helper process was uanble to look up
/// the 'OverlayHelperProcessMain' entry point in the
/// overlay DLL.
- OVERLAY_HELPER_ERROR_EXE_LOOKUP_ENTRY_POINT = 0x0F000007,
+ OVERLAY_HELPER_ERROR_EXE_LOOKUP_ENTRY_POINT = 0x0F000007,
/// The overlay helper process was uanble to parse
/// the commandline arguments it was passed.
/// The helper process exepcts two arguments, and this
/// error occurs if it only finds one.
- OVERLAY_HELPER_ERROR_TOO_FEW_ARGUMENTS = 0x0F000008,
+ OVERLAY_HELPER_ERROR_TOO_FEW_ARGUMENTS = 0x0F000008,
/// The magic number on the command line of the overlay
/// helper process could not be converted to a HANDLE.
OVERLAY_HELPER_ERROR_EXE_INVALID_HANDLE_ARGUMENT = 0x0F000009,
@@ -51,21 +51,23 @@ enum OverlayHelperError {
/// The magic number passed to the overlay DLL's
/// OverlayHelperProcessMain function did not match
/// the overlay DLL's built-in magic number.
- OVERLAY_HELPER_ERROR_DLL_MAGIC_MISMATCH = 0x0FF00000,
+ OVERLAY_HELPER_ERROR_DLL_MAGIC_MISMATCH = 0x0FF00000,
/// The overlay helper process exited due to an error
/// in the Windows message loop.
- OVERLAY_HELPER_ERROR_DLL_MESSAGE_LOOP = 0x0FF00001,
+ OVERLAY_HELPER_ERROR_DLL_MESSAGE_LOOP = 0x0FF00001,
/// The parent death thread could not be created.
- OVERLAY_HELPER_ERROR_DLL_PDEATH_THREAD_ERROR = 0x0FF00002,
+ OVERLAY_HELPER_ERROR_DLL_PDEATH_THREAD_ERROR = 0x0FF00002,
/// The helper's WaitForSingleObject call on its parent
/// process failed unexpectedly.
- OVERLAY_HELPER_ERROR_DLL_PDEATH_WAIT_FAIL = 0x0FF00003,
+ OVERLAY_HELPER_ERROR_DLL_PDEATH_WAIT_FAIL = 0x0FF00003,
};
/// OverlayHelperErrorToString converts an OverlayHelperError value
/// to a printable string representation.
static inline const char *OverlayHelperErrorToString(OverlayHelperError err) {
- #define OHE(x) case x: return #x
+#define OHE(x) \
+ case x: \
+ return #x
switch (err) {
OHE(OVERLAY_HELPER_ERROR_EXE_NO_ARGUMENTS);
OHE(OVERLAY_HELPER_ERROR_EXE_INVALID_MAGIC_ARGUMENT);