From a6d90107bf09b99ba5ce07c99e762b8b7b17d4a7 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Thu, 18 Apr 2024 00:46:57 +0300 Subject: [PATCH 1/2] Re-format with clang-format recently changed files --- Descent3/Mission.cpp | 4 ++-- Descent3/cockpit.cpp | 12 ++++++------ Descent3/gamesave.cpp | 2 +- Descent3/scorch.cpp | 2 +- lib/hogfile.h | 8 ++++---- model/newstyle.cpp | 12 ++++++------ 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Descent3/Mission.cpp b/Descent3/Mission.cpp index 0bed0d6b2..16228d127 100644 --- a/Descent3/Mission.cpp +++ b/Descent3/Mission.cpp @@ -1836,8 +1836,8 @@ bool mn3_Open(const char *mn3file) { // concatanate the mn3 extension if it isn't there. char tempMn3File[PSPATHNAME_LEN]; if (!IS_MN3_FILE(mn3file)) { - strncpy(tempMn3File, mn3file, sizeof(tempMn3File) - 1); - tempMn3File[sizeof(tempMn3File) - 1] = 0; + strncpy(tempMn3File, mn3file, sizeof(tempMn3File) - 1); + tempMn3File[sizeof(tempMn3File) - 1] = 0; strcat(tempMn3File, ".mn3"); mn3file = tempMn3File; } diff --git a/Descent3/cockpit.cpp b/Descent3/cockpit.cpp index 757a540a3..7af4ac813 100644 --- a/Descent3/cockpit.cpp +++ b/Descent3/cockpit.cpp @@ -199,12 +199,12 @@ #define BUFFET_PERIOD 0.25f #define COCKPIT_SHIFT_DELTA 0.02f typedef struct tCockpitCfgInfo { - char modelname[PSFILENAME_LEN+1]; - char shieldrings[NUM_SHIELD_GAUGE_FRAMES][PSFILENAME_LEN+1]; - char shipimg[PSFILENAME_LEN+1]; - char burnimg[PSFILENAME_LEN+1]; - char energyimg[PSFILENAME_LEN+1]; - char invpulseimg[PSFILENAME_LEN+1]; + char modelname[PSFILENAME_LEN + 1]; + char shieldrings[NUM_SHIELD_GAUGE_FRAMES][PSFILENAME_LEN + 1]; + char shipimg[PSFILENAME_LEN + 1]; + char burnimg[PSFILENAME_LEN + 1]; + char energyimg[PSFILENAME_LEN + 1]; + char invpulseimg[PSFILENAME_LEN + 1]; } tCockpitCfgInfo; typedef struct tCockpitInfo { int state; // current state of cockpit on screen. diff --git a/Descent3/gamesave.cpp b/Descent3/gamesave.cpp index 60b4e9962..b7d0f4b58 100644 --- a/Descent3/gamesave.cpp +++ b/Descent3/gamesave.cpp @@ -321,7 +321,7 @@ void QuickSaveGame() { SaveGameDialog(); } else { // verify savegame still exists in the appropriate slot, if not just run dialog, if so then save - char filename[PSFILENAME_LEN+1]; + char filename[PSFILENAME_LEN + 1]; char pathname[PSPATHNAME_LEN]; char desc[GAMESAVE_DESCLEN + 1]; FILE *fp; diff --git a/Descent3/scorch.cpp b/Descent3/scorch.cpp index 9c7cb3d6f..4e9c7561e 100644 --- a/Descent3/scorch.cpp +++ b/Descent3/scorch.cpp @@ -183,7 +183,7 @@ void AddScorch(int roomnum, int facenum, vector *pos, int texture_handle, float float size = (float)sp->size / 16.0; // Increment count, and stop drawing if hit limit - if (sp->roomface == roomface) { // Found one! + if (sp->roomface == roomface) { // Found one! count += std::max((int)size, 1); // count large marks more if (count >= MAX_VIS_COUNT) return; diff --git a/lib/hogfile.h b/lib/hogfile.h index bfc662e87..f20410a17 100644 --- a/lib/hogfile.h +++ b/lib/hogfile.h @@ -54,10 +54,10 @@ typedef struct tHogHeader { } tHogHeader; typedef struct tHogFileEntry { - char name[HOG_FILENAME_LEN]; // file name - unsigned flags; // extra info - unsigned len; // length of file - unsigned long timestamp; // time of file. + char name[HOG_FILENAME_LEN]; // file name + unsigned flags; // extra info + unsigned len; // length of file + unsigned long timestamp; // time of file. } tHogFileEntry; #define HOGMAKER_ERROR 0 // Incorrect number of files passed in diff --git a/model/newstyle.cpp b/model/newstyle.cpp index aeec337cf..877e34ca5 100644 --- a/model/newstyle.cpp +++ b/model/newstyle.cpp @@ -1158,7 +1158,7 @@ float ComputeDefaultSizeFunc(int handle, float *size_ptr, vector *offset_ptr, bo vector max_xyz; bool first_pnt = true; - for(frame_index = start_frame; frame_index <= end_frame; frame_index++) { + for (frame_index = start_frame; frame_index <= end_frame; frame_index++) { // Because size changes with animation, we need the worst case point -- so, check every keyframe // NOTE: This code does not currently account for all $turret and $rotate positions @@ -1166,11 +1166,11 @@ float ComputeDefaultSizeFunc(int handle, float *size_ptr, vector *offset_ptr, bo SetModelAnglesAndPos(pm, normalized_time); - for (model_index = 0;model_index < pm->n_models; model_index++) { + for (model_index = 0; model_index < pm->n_models; model_index++) { bsp_info *sm = &pm->submodel[model_index]; // For every vertex - for(sm_vert_index = 0; sm_vert_index < sm->nverts; sm_vert_index++) { + for (sm_vert_index = 0; sm_vert_index < sm->nverts; sm_vert_index++) { vector pnt; int mn; @@ -1228,7 +1228,7 @@ float ComputeDefaultSizeFunc(int handle, float *size_ptr, vector *offset_ptr, bo *offset_ptr = geometric_center; } - for(frame_index = start_frame; frame_index <= end_frame; frame_index++) { + for (frame_index = start_frame; frame_index <= end_frame; frame_index++) { // Because size changes with animation, we need the worst case point -- so, check every keyframe // NOTE: This code does not currently account for all $turret and $rotate positions @@ -1236,11 +1236,11 @@ float ComputeDefaultSizeFunc(int handle, float *size_ptr, vector *offset_ptr, bo SetModelAnglesAndPos(pm, normalized_time); - for(model_index = 0; model_index < pm->n_models; model_index++) { + for (model_index = 0; model_index < pm->n_models; model_index++) { bsp_info *sm = &pm->submodel[model_index]; // For every vertex - for(sm_vert_index = 0; sm_vert_index < sm->nverts; sm_vert_index++) { + for (sm_vert_index = 0; sm_vert_index < sm->nverts; sm_vert_index++) { vector pnt; int mn; From d83acc28624c2ed43b4120c47ba77dab988cd8cf Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Thu, 18 Apr 2024 00:49:26 +0300 Subject: [PATCH 2/2] clang-format-ignore support appears in 18 version Remove temp file. --- #.clang-format# | 137 ----------------------- .github/workflows/clang-format-check.yml | 2 +- 2 files changed, 1 insertion(+), 138 deletions(-) delete mode 100644 #.clang-format# diff --git a/#.clang-format# b/#.clang-format# deleted file mode 100644 index ee9ea4a06..000000000 --- a/#.clang-format# +++ /dev/null @@ -1,137 +0,0 @@ --Colu-- -Language: Cpp -# BasedOnStyle: LLVM -AccessModifierOffset: -2 -AlignAfterOpenBracket: Align -AlignConsecutiveMacros: false -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AlignEscapedNewlines: Right -AlignOperands: true -AlignTrailingComments: true -AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: Never -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: All -AllowShortLambdasOnASingleLine: All -AllowShortIfStatementsOnASingleLine: Never -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: MultiLine -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterControlStatement: false - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true - SplitEmptyNamespace: true -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Attach -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: true -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DeriveLineEnding: true -DerivePointerAlignment: false -DisableFormat: false -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: true -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -IncludeBlocks: Preserve -IncludeCategories: - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - SortPriority: 0 - - Regex: '^(<|"(gtest|gmock|isl|json)/)' - Priority: 3 - SortPriority: 0 - - Regex: '.*' - Priority: 1 - SortPriority: 0 -IncludeIsMainRegex: '(Test)?$' -IncludeIsMainSourceRegex: '' -IndentCaseLabels: false -IndentGotoLabels: true -IndentPPDirectives: None -IndentWidth: 2 -IndentWrappedFunctionNames: false -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 2 -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right -ReflowComments: true -SortIncludes: true -SortUsingDeclarations: true -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInConditionalStatement: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false -Standard: Latest -StatementMacros: - - Q_UNUSED - - QT_REQUIRE_VERSION -TabWidth: 8 -UseCRLF: false -UseTab: Never -... - diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 0c623400c..8f5a0cee2 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -10,4 +10,4 @@ jobs: - name: Run clang-format style check for C/C++/Protobuf programs. uses: jidicula/clang-format-action@v4.11.0 with: - clang-format-version: '17' + clang-format-version: '18'