Skip to content

Commit

Permalink
[#341] Attempt to manually fix some suggestions, edited clang-format …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
Donnie-Ice committed Nov 4, 2024
1 parent 2980a88 commit 28a027b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 26 deletions.
27 changes: 19 additions & 8 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignConsecutiveAssignments:
Enabled: true
AcrossComments: true
AlignCompound: true
AlignConsecutiveDeclarations:
Enabled: true
AcrossComments: true
AlignFunctionPointers: true
AlignFunctionDeclarations: true
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: true
AcrossComments: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
Expand All @@ -17,7 +27,7 @@ AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: true
BinPackParameters: true
BinPackParameters: BinPack
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: true
Expand All @@ -36,7 +46,8 @@ IncludeIsMainRegex: '$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLines:
AtStartOfBlock: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
Expand All @@ -48,16 +59,16 @@ PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
ReflowComments: Always
SortIncludes: Never
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpaceBeforeCpp11BracedList: true
SpacesBeforeTrailingComments: 1
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInParens: Never
SpacesInSquareBrackets: false
Standard: c++11
TabWidth: 8
Expand Down
10 changes: 5 additions & 5 deletions include/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ int32_t Crypto_Get_tmLength(int len);
uint8_t Crypto_Is_AEAD_Algorithm(uint32_t cipher_suite_id);
void Crypto_TM_updatePDU(uint8_t *ingest, int len_ingest);
void Crypto_TM_updateOCF(Telemetry_Frame_Ocf_Fsr_t *report, TM_t *tm_frame);
uint8_t *Crypto_Prepare_TC_AAD(uint8_t *buffer, uint16_t len_aad, uint8_t *abm_buffer);
uint8_t *Crypto_Prepare_TC_AAD(uint8_t *buffer, uint16_t len_aad, uint8_t *abm_buffer);
uint32_t Crypto_Prepare_TM_AAD(const uint8_t *buffer, uint16_t len_aad, const uint8_t *abm_buffer, uint8_t *aad);
uint32_t Crypto_Prepare_AOS_AAD(const uint8_t *buffer, uint16_t len_aad, const uint8_t *abm_buffer, uint8_t *aad);
void Crypto_Local_Config(void);
Expand Down Expand Up @@ -312,11 +312,11 @@ extern AOS_FrameSecurityHeader_t aos_frame_sec_hdr; // Used to reduce bit math d

// Global configuration structs
extern CryptoConfig_t crypto_config;
extern SadbMariaDBConfig_t *sa_mariadb_config;
extern SadbMariaDBConfig_t *sa_mariadb_config;
extern CryptographyKmcCryptoServiceConfig_t *cryptography_kmc_crypto_config;
extern CamConfig_t *cam_config;
extern GvcidManagedParameters_t *gvcid_managed_parameters;
extern GvcidManagedParameters_t *current_managed_parameters;
extern CamConfig_t *cam_config;
extern GvcidManagedParameters_t *gvcid_managed_parameters;
extern GvcidManagedParameters_t *current_managed_parameters;
extern GvcidManagedParameters_t gvcid_managed_parameters_array[GVCID_MAX_PARAM_SIZE];
extern GvcidManagedParameters_t current_managed_parameters_struct;
extern int gvcid_counter;
Expand Down
18 changes: 9 additions & 9 deletions include/crypto_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@
#define CONFIGURATION_ERROR_CODES 100
#define CONFIGURATION_ERROR_CODES_MAX 103

#define CRYPTO_CORE_ERROR_CODES_MAX -59

extern char *crypto_enum_errlist_core[];
extern char *crypto_enum_errlist_config[];
extern char *crypto_enum_errlist_sa_if[];
extern char *crypto_enum_errlist_sa_mariadb[];
extern char *crypto_enum_errlist_crypto_if[];
extern char *crypto_enum_errlist_crypto_kmc[];
extern char *crypto_enum_errlist_crypto_cam[];
#define CRYPTO_CORE_ERROR_CODES_MAX (-59)

extern const char *crypto_enum_errlist_core[];

Check warning on line 155 in include/crypto_error.h

View workflow job for this annotation

GitHub Actions / cpp-linter

include/crypto_error.h:155:20 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'crypto_enum_errlist_core' is non-const and globally accessible, consider making it const
extern const char *crypto_enum_errlist_config[];

Check warning on line 156 in include/crypto_error.h

View workflow job for this annotation

GitHub Actions / cpp-linter

include/crypto_error.h:156:20 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'crypto_enum_errlist_config' is non-const and globally accessible, consider making it const
extern const char *crypto_enum_errlist_sa_if[];

Check warning on line 157 in include/crypto_error.h

View workflow job for this annotation

GitHub Actions / cpp-linter

include/crypto_error.h:157:20 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'crypto_enum_errlist_sa_if' is non-const and globally accessible, consider making it const
extern const char *crypto_enum_errlist_sa_mariadb[];

Check warning on line 158 in include/crypto_error.h

View workflow job for this annotation

GitHub Actions / cpp-linter

include/crypto_error.h:158:20 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'crypto_enum_errlist_sa_mariadb' is non-const and globally accessible, consider making it const
extern const char *crypto_enum_errlist_crypto_if[];

Check warning on line 159 in include/crypto_error.h

View workflow job for this annotation

GitHub Actions / cpp-linter

include/crypto_error.h:159:20 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'crypto_enum_errlist_crypto_if' is non-const and globally accessible, consider making it const
extern const char *crypto_enum_errlist_crypto_kmc[];

Check warning on line 160 in include/crypto_error.h

View workflow job for this annotation

GitHub Actions / cpp-linter

include/crypto_error.h:160:20 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'crypto_enum_errlist_crypto_kmc' is non-const and globally accessible, consider making it const
extern const char *crypto_enum_errlist_crypto_cam[];

Check warning on line 161 in include/crypto_error.h

View workflow job for this annotation

GitHub Actions / cpp-linter

include/crypto_error.h:161:20 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'crypto_enum_errlist_crypto_cam' is non-const and globally accessible, consider making it const

#endif // CRYPTO_ERROR_H
8 changes: 4 additions & 4 deletions support/standalone/standalone.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extern "C"
#define CRYPTO_MAX_INPUT_TOKENS 32
#define CRYPTO_MAX_INPUT_TOKEN_SIZE 64

#define CRYPTO_CMD_UNKNOWN -1
#define CRYPTO_CMD_UNKNOWN (-1)
#define CRYPTO_CMD_HELP 0
#define CRYPTO_CMD_EXIT 1
#define CRYPTO_CMD_NOOP 2
Expand Down Expand Up @@ -113,11 +113,11 @@ extern "C"
int32_t crypto_standalone_udp_init(udp_info_t *sock, int32_t port, uint8_t bind_sock);
int32_t crypto_reset(void);
void crypto_standalone_tc_frame(uint8_t *in_data, uint16_t in_length, uint8_t *out_data, uint16_t *out_length);
void *crypto_standalone_tc_apply(void *socks);
void *crypto_standalone_tc_apply(void *socks);
void crypto_standalone_tm_frame(uint8_t *in_data, uint16_t in_length, uint8_t *out_data, uint16_t *out_length,
uint16_t spi);
void *crypto_standalone_tm_process(void *socks);
void crypto_standalone_cleanup(const int signal);
void *crypto_standalone_tm_process(void *socks);
void crypto_standalone_cleanup(int signal);

#ifdef __cplusplus
} /* Close scope of 'extern "C"' declaration which encloses file. */
Expand Down

0 comments on commit 28a027b

Please sign in to comment.