All: Reformat according to new standard

This commit is contained in:
pre-commit-ci[bot]
2025-11-11 13:49:01 +01:00
committed by Kacper Donat
parent eafd18dac0
commit 25c3ba7338
2390 changed files with 154630 additions and 115818 deletions

View File

@@ -25,12 +25,12 @@
#include <FCConfig.h>
#if defined(_MSC_VER)
#include <windows.h>
#include <dbghelp.h>
# include <windows.h>
# include <dbghelp.h>
#endif
#if HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif // HAVE_CONFIG_H
#include <cstdio>
@@ -52,9 +52,9 @@
void PrintInitHelp();
const char sBanner[] =
"(C) 2001-2025 FreeCAD contributors\n"
"FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.\n\n";
const char sBanner[]
= "(C) 2001-2025 FreeCAD contributors\n"
"FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.\n\n";
#if defined(_MSC_VER)
void InitMiniDumpWriter(const std::string&);
@@ -193,8 +193,9 @@ int main(int argc, char** argv)
App::Application::Config()["CopyrightInfo"] = sBanner;
App::Application::Config()["AppIcon"] = "freecad";
App::Application::Config()["SplashScreen"] = "freecadsplash";
App::Application::Config()["AboutImage"] =
App::Application::isDevelopmentVersion() ? "freecadaboutdev" : "freecadabout";
App::Application::Config()["AboutImage"] = App::Application::isDevelopmentVersion()
? "freecadaboutdev"
: "freecadabout";
App::Application::Config()["StartWorkbench"] = "PartDesignWorkbench";
// App::Application::Config()["HiddenDockWindow"] = "Property editor";
App::Application::Config()["SplashAlignment"] = "Bottom|Left";
@@ -219,7 +220,8 @@ int main(int argc, char** argv)
#endif
// to set window icon on wayland, the desktop file has to be available to the compositor
QGuiApplication::setDesktopFileName(
QString::fromStdString(App::Application::Config()["DesktopFileName"]));
QString::fromStdString(App::Application::Config()["DesktopFileName"])
);
#if defined(_MSC_VER)
// create a dump file when the application crashes
@@ -227,11 +229,13 @@ int main(int argc, char** argv)
dmpfile += "crash.dmp";
InitMiniDumpWriter(dmpfile);
#endif
std::map<std::string, std::string>::iterator it =
App::Application::Config().find("NavigationStyle");
std::map<std::string, std::string>::iterator it = App::Application::Config().find(
"NavigationStyle"
);
if (it != App::Application::Config().end()) {
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/View");
"User parameter:BaseApp/Preferences/View"
);
// if not already defined do it now (for the very first start)
std::string style = hGrp->GetASCII("NavigationStyle", it->second.c_str());
hGrp->SetASCII("NavigationStyle", style.c_str());
@@ -272,23 +276,30 @@ int main(int argc, char** argv)
QApplication app(argc, argv);
QString appName = QString::fromStdString(App::Application::Config()["ExeName"]);
QString msg;
msg = QObject::tr("While initializing %1 the following exception occurred: '%2'\n\n"
"Python is searching for its files in the following directories:\n%3\n\n"
"Python version information:\n%4\n")
.arg(appName,
QString::fromUtf8(e.what()),
QString::fromStdString(Base::Interpreter().getPythonPath()),
QString::fromLatin1(Py_GetVersion()));
msg = QObject::tr(
"While initializing %1 the following exception occurred: '%2'\n\n"
"Python is searching for its files in the following directories:\n%3\n\n"
"Python version information:\n%4\n"
)
.arg(
appName,
QString::fromUtf8(e.what()),
QString::fromStdString(Base::Interpreter().getPythonPath()),
QString::fromLatin1(Py_GetVersion())
);
const char* pythonhome = getenv("PYTHONHOME");
if (pythonhome) {
msg += QObject::tr("\nThe environment variable PYTHONHOME is set to '%1'.")
.arg(QString::fromUtf8(pythonhome));
msg += QObject::tr("\nSetting this environment variable might cause Python to fail. "
"Please contact your administrator to unset it on your system.\n\n");
msg += QObject::tr(
"\nSetting this environment variable might cause Python to fail. "
"Please contact your administrator to unset it on your system.\n\n"
);
}
else {
msg += QObject::tr(
"\nPlease contact the application's support team for more information.\n\n");
"\nPlease contact the application's support team for more information.\n\n"
);
}
displayCritical(msg, false);
@@ -298,10 +309,11 @@ int main(int argc, char** argv)
// Popup an own dialog box instead of that one of Windows
QApplication app(argc, argv);
QString appName = QString::fromStdString(App::Application::Config()["ExeName"]);
QString msg =
QObject::tr("Unknown runtime error occurred while initializing %1.\n\n"
"Please contact the application's support team for more information.\n\n")
.arg(appName);
QString msg = QObject::tr(
"Unknown runtime error occurred while initializing %1.\n\n"
"Please contact the application's support team for more information.\n\n"
)
.arg(appName);
displayCritical(msg, false);
exit(101);
}
@@ -348,29 +360,29 @@ int main(int argc, char** argv)
// cleans up
App::Application::destruct();
Base::Console().log("%s completely terminated\n",
App::Application::Config()["ExeName"].c_str());
Base::Console().log("%s completely terminated\n", App::Application::Config()["ExeName"].c_str());
return 0;
}
#if defined(_MSC_VER)
typedef BOOL(__stdcall* tMDWD)(IN HANDLE hProcess,
IN DWORD ProcessId,
IN HANDLE hFile,
IN MINIDUMP_TYPE DumpType,
IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
OPTIONAL IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
OPTIONAL IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
OPTIONAL);
typedef BOOL(__stdcall* tMDWD)(
IN HANDLE hProcess,
IN DWORD ProcessId,
IN HANDLE hFile,
IN MINIDUMP_TYPE DumpType,
IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
OPTIONAL IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
OPTIONAL IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam OPTIONAL
);
static tMDWD s_pMDWD;
static HMODULE s_hDbgHelpMod;
static MINIDUMP_TYPE s_dumpTyp = MiniDumpNormal;
static std::wstring s_szMiniDumpFileName; // initialize with whatever appropriate...
#include <Base/StackWalker.h>
# include <Base/StackWalker.h>
class MyStackWalker: public StackWalker
{
DWORD threadId;
@@ -395,7 +407,7 @@ public:
static LONG __stdcall MyCrashHandlerExceptionFilter(EXCEPTION_POINTERS* pEx)
{
#ifdef _M_IX86
# ifdef _M_IX86
if (pEx->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) {
// be sure that we have enough space...
static char MyStack[1024 * 128];
@@ -406,7 +418,7 @@ static LONG __stdcall MyCrashHandlerExceptionFilter(EXCEPTION_POINTERS* pEx)
__asm mov eax, offset MyStack[1024 * 128];
__asm mov esp, eax;
}
#endif
# endif
MyStackWalker sw;
sw.ShowCallstack(GetCurrentThread(), pEx->ContextRecord);
Base::Console().log("*** Unhandled Exception!\n");
@@ -416,26 +428,22 @@ static LONG __stdcall MyCrashHandlerExceptionFilter(EXCEPTION_POINTERS* pEx)
bool bFailed = true;
HANDLE hFile;
hFile = CreateFileW(s_szMiniDumpFileName.c_str(),
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
hFile = CreateFileW(
s_szMiniDumpFileName.c_str(),
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL
);
if (hFile != INVALID_HANDLE_VALUE) {
MINIDUMP_EXCEPTION_INFORMATION stMDEI;
stMDEI.ThreadId = GetCurrentThreadId();
stMDEI.ExceptionPointers = pEx;
stMDEI.ClientPointers = true;
// try to create a miniDump:
if (s_pMDWD(GetCurrentProcess(),
GetCurrentProcessId(),
hFile,
s_dumpTyp,
&stMDEI,
NULL,
NULL)) {
if (s_pMDWD(GetCurrentProcess(), GetCurrentProcessId(), hFile, s_dumpTyp, &stMDEI, NULL, NULL)) {
bFailed = false; // succeeded
}
CloseHandle(hFile);