Merge pull request #51 from winterheart/clang-format

Clang format
This commit is contained in:
Azamat H. Hackimov 2024-04-18 01:14:22 +03:00 committed by GitHub
commit b36325cc5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 21 additions and 158 deletions

View File

@ -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
...

View File

@ -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'

View File

@ -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;
}

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;