chore: add .clang-format

This commit is contained in:
leejet 2023-11-19 19:35:33 +08:00
parent 64f6002457
commit 176a00b606
7 changed files with 585 additions and 571 deletions

13
.clang-format Normal file
View File

@ -0,0 +1,13 @@
BasedOnStyle: Chromium
UseTab: Never
IndentWidth: 4
TabWidth: 4
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
ColumnLimit: 0
AccessModifierOffset: -4
NamespaceIndentation: All
FixNamespaceComments: false
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
IndentCaseLabels: true

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ test/
.cache/ .cache/
*.swp *.swp
.vscode/

View File

@ -88,8 +88,7 @@ const char* sample_method_str[] = {
const char* schedule_str[] = { const char* schedule_str[] = {
"default", "default",
"discrete", "discrete",
"karras" "karras"};
};
struct Option { struct Option {
int n_threads = -1; int n_threads = -1;
@ -129,7 +128,7 @@ struct Option {
printf(" sample_steps: %d\n", sample_steps); printf(" sample_steps: %d\n", sample_steps);
printf(" strength: %.2f\n", strength); printf(" strength: %.2f\n", strength);
printf(" rng: %s\n", rng_type_to_str[rng_type]); printf(" rng: %s\n", rng_type_to_str[rng_type]);
printf(" seed: %lld\n", seed); printf(" seed: %ld\n", seed);
} }
}; };
@ -405,6 +404,7 @@ int main(int argc, const char* argv[]) {
vae_decode_only = false; vae_decode_only = false;
int c = 0; int c = 0;
unsigned char* img_data = stbi_load(opt.init_img.c_str(), &opt.w, &opt.h, &c, 3); unsigned char* img_data = stbi_load(opt.init_img.c_str(), &opt.w, &opt.h, &c, 3);
if (img_data == NULL) { if (img_data == NULL) {
fprintf(stderr, "load image from '%s' failed\n", opt.init_img.c_str()); fprintf(stderr, "load image from '%s' failed\n", opt.init_img.c_str());