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
+32 -43
View File
@@ -4,103 +4,93 @@
#include "detection/font/font.h"
#include "modules/font/font.h"
bool ffPrintFont(FFFontOptions* options)
{
bool ffPrintFont(FFFontOptions* options) {
bool success = false;
FFFontResult font;
for(uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i)
for (uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i) {
ffStrbufInit(&font.fonts[i]);
}
ffStrbufInit(&font.display);
const char* error = ffDetectFont(&font);
if(error)
{
if (error) {
ffPrintError(FF_FONT_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error);
}
else
{
if(options->moduleArgs.outputFormat.length == 0)
{
} else {
if (options->moduleArgs.outputFormat.length == 0) {
ffPrintLogoAndKey(FF_FONT_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
ffStrbufPutTo(&font.display, stdout);
}
else
{
} else {
FF_PRINT_FORMAT_CHECKED(FF_FONT_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
FF_ARG(font.fonts[0], "font1"),
FF_ARG(font.fonts[1], "font2"),
FF_ARG(font.fonts[2], "font3"),
FF_ARG(font.fonts[3], "font4"),
FF_ARG(font.display, "combined"),
}));
FF_ARG(font.fonts[0], "font1"),
FF_ARG(font.fonts[1], "font2"),
FF_ARG(font.fonts[2], "font3"),
FF_ARG(font.fonts[3], "font4"),
FF_ARG(font.display, "combined"),
}));
}
success = true;
}
ffStrbufDestroy(&font.display);
for (uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i)
for (uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i) {
ffStrbufDestroy(&font.fonts[i]);
}
return success;
}
void ffParseFontJsonObject(FFFontOptions* options, yyjson_val* module)
{
void ffParseFontJsonObject(FFFontOptions* 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;
}
ffPrintError(FF_FONT_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Unknown JSON key %s", unsafe_yyjson_get_str(key));
}
}
void ffGenerateFontJsonConfig(FFFontOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
void ffGenerateFontJsonConfig(FFFontOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
}
bool ffGenerateFontJsonResult(FF_MAYBE_UNUSED FFFontOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
bool ffGenerateFontJsonResult(FF_MAYBE_UNUSED FFFontOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
bool success = false;
FFFontResult font;
for(uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i)
for (uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i) {
ffStrbufInit(&font.fonts[i]);
}
ffStrbufInit(&font.display);
const char* error = ffDetectFont(&font);
if(error)
{
if (error) {
yyjson_mut_obj_add_str(doc, module, "error", error);
}
else
{
} else {
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
yyjson_mut_obj_add_strbuf(doc, obj, "display", &font.display);
yyjson_mut_val* fontsArr = yyjson_mut_obj_add_arr(doc, obj, "fonts");
for (uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i)
for (uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i) {
yyjson_mut_arr_add_strbuf(doc, fontsArr, &font.fonts[i]);
}
success = true;
}
ffStrbufDestroy(&font.display);
for (uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i)
for (uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i) {
ffStrbufDestroy(&font.fonts[i]);
}
return success;
}
void ffInitFontOptions(FFFontOptions* options)
{
void ffInitFontOptions(FFFontOptions* options) {
ffOptionInitModuleArg(&options->moduleArgs, "");
}
void ffDestroyFontOptions(FFFontOptions* options)
{
void ffDestroyFontOptions(FFFontOptions* options) {
ffOptionDestroyModuleArg(&options->moduleArgs);
}
@@ -119,5 +109,4 @@ FFModuleBaseInfo ffFontModuleInfo = {
{"Font 3", "font3"},
{"Font 4", "font4"},
{"Combined fonts for display", "combined"},
}))
};
}))};
+1 -2
View File
@@ -2,8 +2,7 @@
#include "common/option.h"
typedef struct FFFontOptions
{
typedef struct FFFontOptions {
FFModuleArgs moduleArgs;
} FFFontOptions;