Chore: run clang-format

```bash
find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i
```
This commit is contained in:
李通洲
2026-03-29 09:28:49 +08:00
parent cdd4cee968
commit e0eba8ce21
690 changed files with 28093 additions and 30062 deletions
+1 -2
View File
@@ -2,8 +2,7 @@
#include "common/option.h"
typedef struct FFWMOptions
{
typedef struct FFWMOptions {
FFModuleArgs moduleArgs;
bool detectPlugin;
+33 -45
View File
@@ -5,77 +5,69 @@
#include "detection/wm/wm.h"
#include "modules/wm/wm.h"
bool ffPrintWM(FFWMOptions* options)
{
bool ffPrintWM(FFWMOptions* options) {
const FFDisplayServerResult* result = ffConnectDisplayServer();
if(result->wmPrettyName.length == 0)
{
if (result->wmPrettyName.length == 0) {
ffPrintError(FF_WM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No WM found");
return false;
}
FF_STRBUF_AUTO_DESTROY pluginName = ffStrbufCreate();
if(options->detectPlugin)
if (options->detectPlugin) {
ffDetectWMPlugin(&pluginName);
}
FF_STRBUF_AUTO_DESTROY version = ffStrbufCreate();
if (instance.config.general.detectVersion)
if (instance.config.general.detectVersion) {
ffDetectWMVersion(&result->wmProcessName, &version, options);
}
if(options->moduleArgs.outputFormat.length == 0)
{
if (options->moduleArgs.outputFormat.length == 0) {
ffPrintLogoAndKey(FF_WM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
ffStrbufWriteTo(&result->wmPrettyName, stdout);
if(version.length > 0)
{
if (version.length > 0) {
putchar(' ');
ffStrbufWriteTo(&version, stdout);
}
if(result->wmProtocolName.length > 0)
{
if (result->wmProtocolName.length > 0) {
fputs(" (", stdout);
ffStrbufWriteTo(&result->wmProtocolName, stdout);
putchar(')');
}
if(pluginName.length > 0)
{
if (pluginName.length > 0) {
fputs(" (with ", stdout);
ffStrbufWriteTo(&pluginName, stdout);
putchar(')');
}
putchar('\n');
}
else
{
FF_PRINT_FORMAT_CHECKED(FF_WM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
FF_ARG(result->wmProcessName, "process-name"),
FF_ARG(result->wmPrettyName, "pretty-name"),
FF_ARG(result->wmProtocolName, "protocol-name"),
FF_ARG(pluginName, "plugin-name"),
FF_ARG(version, "version"),
}));
} else {
FF_PRINT_FORMAT_CHECKED(FF_WM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
FF_ARG(result->wmProcessName, "process-name"),
FF_ARG(result->wmPrettyName, "pretty-name"),
FF_ARG(result->wmProtocolName, "protocol-name"),
FF_ARG(pluginName, "plugin-name"),
FF_ARG(version, "version"),
}));
}
return true;
}
void ffParseWMJsonObject(FFWMOptions* options, yyjson_val* module)
{
void ffParseWMJsonObject(FFWMOptions* options, yyjson_val* module) {
yyjson_val *key, *val;
size_t idx, max;
yyjson_obj_foreach(module, idx, max, key, val)
{
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
yyjson_obj_foreach (module, idx, max, key, val) {
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) {
continue;
}
if (unsafe_yyjson_equals_str(key, "detectPlugin"))
{
if (unsafe_yyjson_equals_str(key, "detectPlugin")) {
options->detectPlugin = yyjson_get_bool(val);
continue;
}
@@ -84,30 +76,29 @@ void ffParseWMJsonObject(FFWMOptions* options, yyjson_val* module)
}
}
void ffGenerateWMJsonConfig(FFWMOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
void ffGenerateWMJsonConfig(FFWMOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
yyjson_mut_obj_add_bool(doc, module, "detectPlugin", options->detectPlugin);
}
bool ffGenerateWMJsonResult(FF_MAYBE_UNUSED FFWMOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
bool ffGenerateWMJsonResult(FF_MAYBE_UNUSED FFWMOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
const FFDisplayServerResult* result = ffConnectDisplayServer();
if(result->wmPrettyName.length == 0)
{
if (result->wmPrettyName.length == 0) {
yyjson_mut_obj_add_str(doc, module, "error", "No WM found");
return false;
}
FF_STRBUF_AUTO_DESTROY pluginName = ffStrbufCreate();
if(options->detectPlugin)
if (options->detectPlugin) {
ffDetectWMPlugin(&pluginName);
}
FF_STRBUF_AUTO_DESTROY version = ffStrbufCreate();
if (instance.config.general.detectVersion)
if (instance.config.general.detectVersion) {
ffDetectWMVersion(&result->wmProcessName, &version, options);
}
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
yyjson_mut_obj_add_strbuf(doc, obj, "processName", &result->wmProcessName);
@@ -119,14 +110,12 @@ bool ffGenerateWMJsonResult(FF_MAYBE_UNUSED FFWMOptions* options, yyjson_mut_doc
return true;
}
void ffInitWMOptions(FFWMOptions* options)
{
void ffInitWMOptions(FFWMOptions* options) {
ffOptionInitModuleArg(&options->moduleArgs, "");
options->detectPlugin = true;
}
void ffDestroyWMOptions(FFWMOptions* options)
{
void ffDestroyWMOptions(FFWMOptions* options) {
ffOptionDestroyModuleArg(&options->moduleArgs);
}
@@ -145,5 +134,4 @@ FFModuleBaseInfo ffWMModuleInfo = {
{"WM protocol name", "protocol-name"},
{"WM plugin name", "plugin-name"},
{"WM version", "version"},
}))
};
}))};