Skip to content

Commit

Permalink
Update clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
gsurkov committed Jul 15, 2024
1 parent 0d24aee commit d61295a
Show file tree
Hide file tree
Showing 438 changed files with 3,032 additions and 3,018 deletions.
21 changes: 11 additions & 10 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ AlignConsecutiveAssignments:
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
Enabled: true
AcrossEmptyLines: true
AcrossComments: true
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
Expand All @@ -25,10 +25,10 @@ AlignConsecutiveDeclarations:
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveMacros:
Enabled: false
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AcrossComments: true
AlignCompound: true
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveShortCaseStatements:
Expand All @@ -47,7 +47,7 @@ AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
Expand Down Expand Up @@ -108,6 +108,7 @@ ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
- M_EACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
Expand Down Expand Up @@ -136,7 +137,7 @@ IndentRequiresClause: false
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertBraces: false
InsertNewlineAtEOF: false
InsertNewlineAtEOF: true
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
Expand Down Expand Up @@ -179,7 +180,7 @@ ReferenceAlignment: Pointer
ReflowComments: false
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RemoveSemicolon: true
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
Expand Down Expand Up @@ -226,7 +227,7 @@ SpacesInParensOptions:
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: c++03
Standard: c++20
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
Expand Down
6 changes: 3 additions & 3 deletions applications/debug/battery_test_app/views/battery_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <gui/elements.h>
#include <assets_icons.h>

#define LOW_CHARGE_THRESHOLD 10
#define LOW_CHARGE_THRESHOLD 10
#define HIGH_DRAIN_CURRENT_THRESHOLD 100

struct BatteryInfo {
Expand All @@ -17,7 +17,7 @@ static void draw_stat(Canvas* canvas, int x, int y, const Icon* icon, char* val)
canvas_draw_box(canvas, x - 4, y + 16, 24, 6);
canvas_set_color(canvas, ColorBlack);
canvas_draw_str_aligned(canvas, x + 8, y + 22, AlignCenter, AlignBottom, val);
};
}

static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
char emote[20] = {};
Expand Down Expand Up @@ -85,7 +85,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
canvas_draw_str_aligned(canvas, 92, y + 3, AlignCenter, AlignCenter, emote);
canvas_draw_str_aligned(canvas, 92, y + 15, AlignCenter, AlignCenter, header);
canvas_draw_str_aligned(canvas, 92, y + 27, AlignCenter, AlignCenter, value);
};
}

static void battery_info_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/bt_debug_app/views/bt_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ typedef struct {
} BtTestModel;

#define BT_TEST_START_MESSAGE "Ok - Start"
#define BT_TEST_STOP_MESSAGE "Ok - Stop"
#define BT_TEST_STOP_MESSAGE "Ok - Stop"

static void bt_test_process_up(BtTest* bt_test);
static void bt_test_process_down(BtTest* bt_test);
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/ccid_test/iso7816_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ void iso7816_xfr_datablock_callback(
const uint8_t* dataBlock,
uint32_t dataBlockLen,
uint8_t* responseDataBlock,
uint32_t* responseDataBlockLen);
uint32_t* responseDataBlockLen);
2 changes: 1 addition & 1 deletion applications/debug/ccid_test/iso7816_response.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
void iso7816_set_response(ISO7816_Response_APDU* responseAPDU, uint16_t responseCode) {
responseAPDU->SW1 = (responseCode >> (8 * 1)) & 0xff;
responseAPDU->SW2 = (responseCode >> (8 * 0)) & 0xff;
}
}
12 changes: 6 additions & 6 deletions applications/debug/ccid_test/iso7816_response.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#define ISO7816_RESPONSE_OK 0x9000

#define ISO7816_RESPONSE_WRONG_LENGTH 0x6700
#define ISO7816_RESPONSE_WRONG_PARAMETERS_P1_P2 0x6A00
#define ISO7816_RESPONSE_WRONG_LE 0x6C00
#define ISO7816_RESPONSE_WRONG_LENGTH 0x6700
#define ISO7816_RESPONSE_WRONG_PARAMETERS_P1_P2 0x6A00
#define ISO7816_RESPONSE_WRONG_LE 0x6C00
#define ISO7816_RESPONSE_INSTRUCTION_NOT_SUPPORTED 0x6D00
#define ISO7816_RESPONSE_CLASS_NOT_SUPPORTED 0x6E00
#define ISO7816_RESPONSE_INTERNAL_EXCEPTION 0x6F00
#define ISO7816_RESPONSE_CLASS_NOT_SUPPORTED 0x6E00
#define ISO7816_RESPONSE_INTERNAL_EXCEPTION 0x6F00

void iso7816_set_response(ISO7816_Response_APDU* responseAPDU, uint16_t responseCode);
void iso7816_set_response(ISO7816_Response_APDU* responseAPDU, uint16_t responseCode);
2 changes: 1 addition & 1 deletion applications/debug/ccid_test/iso7816_t0_apdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ void iso7816_write_response_apdu(
responseDataBufferIndex++;

*readerToPcDataBlockLen = responseDataBufferIndex;
}
}
4 changes: 2 additions & 2 deletions applications/debug/ccid_test/iso7816_t0_apdu.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include "iso7816_atr.h"
#include "core/common_defines.h"

#define ISO7816_READ_COMMAND_APDU_OK 0
#define ISO7816_READ_COMMAND_APDU_ERROR_WRONG_LE 1
#define ISO7816_READ_COMMAND_APDU_OK 0
#define ISO7816_READ_COMMAND_APDU_ERROR_WRONG_LE 1
#define ISO7816_READ_COMMAND_APDU_ERROR_WRONG_LENGTH 2

typedef struct {
Expand Down
4 changes: 2 additions & 2 deletions applications/debug/expansion_test/expansion_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@

#define TAG "ExpansionTest"

#define TEST_DIR_PATH EXT_PATH(TAG)
#define TEST_DIR_PATH EXT_PATH(TAG)
#define TEST_FILE_NAME "test.txt"
#define TEST_FILE_PATH EXT_PATH(TAG "/" TEST_FILE_NAME)

#define HOST_SERIAL_ID (FuriHalSerialIdLpuart)
#define HOST_SERIAL_ID (FuriHalSerialIdLpuart)
#define MODULE_SERIAL_ID (FuriHalSerialIdUsart)

#define RECEIVE_BUFFER_SIZE (sizeof(ExpansionFrame) + sizeof(ExpansionFrameChecksum))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <furi.h>

#define DEFAULT_PATH "/"
#define EXTENSION "*"
#define EXTENSION "*"

bool file_browser_scene_browser_on_event(void* context, SceneManagerEvent event) {
UNUSED(context);
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/lfrfid_debug/lfrfid_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ int32_t lfrfid_debug_app(void* p) {
lfrfid_debug_free(app);

return 0;
}
}
2 changes: 1 addition & 1 deletion applications/debug/speaker_debug/speaker_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <cli/cli.h>
#include <toolbox/args.h>

#define TAG "SpeakerDebug"
#define TAG "SpeakerDebug"
#define CLI_COMMAND "speaker_debug"

typedef enum {
Expand Down
4 changes: 2 additions & 2 deletions applications/debug/subghz_test/helpers/subghz_test_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <furi_hal.h>

#define SUBGHZ_TEST_VERSION_APP "0.1"
#define SUBGHZ_TEST_DEVELOPED "SkorP"
#define SUBGHZ_TEST_GITHUB "https://github.com/flipperdevices/flipperzero-firmware"
#define SUBGHZ_TEST_DEVELOPED "SkorP"
#define SUBGHZ_TEST_GITHUB "https://github.com/flipperdevices/flipperzero-firmware"

typedef enum {
SubGhzTestViewVariableItemList,
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/subghz_test/protocol/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,4 @@ uint8_t subghz_protocol_blocks_xor_bytes(uint8_t const message[], size_t size) {
result ^= message[i];
}
return result;
}
}
2 changes: 1 addition & 1 deletion applications/debug/subghz_test/protocol/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
(value) &= ~(_one << (bit)); \
})
#define bit_write(value, bit, bitvalue) (bitvalue ? bit_set(value, bit) : bit_clear(value, bit))
#define DURATION_DIFF(x, y) (((x) < (y)) ? ((y) - (x)) : ((x) - (y)))
#define DURATION_DIFF(x, y) (((x) < (y)) ? ((y) - (x)) : ((x) - (y)))

#ifdef __cplusplus
extern "C" {
Expand Down
10 changes: 5 additions & 5 deletions applications/debug/subghz_test/protocol/princeton_for_testing.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
*
*/

#define SUBGHZ_PT_SHORT 300
#define SUBGHZ_PT_LONG (SUBGHZ_PT_SHORT * 3)
#define SUBGHZ_PT_GUARD (SUBGHZ_PT_SHORT * 30)
#define SUBGHZ_PT_SHORT 300
#define SUBGHZ_PT_LONG (SUBGHZ_PT_SHORT * 3)
#define SUBGHZ_PT_GUARD (SUBGHZ_PT_SHORT * 30)
#define SUBGHZ_PT_COUNT_KEY_433 9
#define SUBGHZ_PT_TIMEOUT_433 900
#define SUBGHZ_PT_TIMEOUT_433 900
#define SUBGHZ_PT_COUNT_KEY_868 9
#define SUBGHZ_PT_TIMEOUT_868 14000
#define SUBGHZ_PT_TIMEOUT_868 14000

#define TAG "SubGhzProtocolPrinceton"

Expand Down
4 changes: 2 additions & 2 deletions applications/debug/uart_echo/uart_echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include <notification/notification.h>
#include <notification/notification_messages.h>

#define LINES_ON_SCREEN 6
#define LINES_ON_SCREEN 6
#define COLUMNS_ON_SCREEN 21
#define TAG "UartEcho"
#define TAG "UartEcho"
#define DEFAULT_BAUD_RATE 230400

typedef struct UartDumpModel UartDumpModel;
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/unit_tests/test_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void test_runner_free(TestRunner* instance) {
free(instance);
}

#define TEST_RUNNER_TMP_DIR EXT_PATH(".tmp")
#define TEST_RUNNER_TMP_DIR EXT_PATH(".tmp")
#define TEST_RUNNER_TMP_UNIT_TESTS_DIR TEST_RUNNER_TMP_DIR "/unit_tests"

static bool test_runner_run_plugin(TestRunner* instance, const char* path) {
Expand Down
2 changes: 1 addition & 1 deletion applications/debug/unit_tests/test_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ TestRunner* test_runner_alloc(Cli* cli, FuriString* args);

void test_runner_free(TestRunner* isntance);

void test_runner_run(TestRunner* isntance);
void test_runner_run(TestRunner* isntance);
2 changes: 1 addition & 1 deletion applications/debug/unit_tests/tests/bt/bt_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <storage/storage.h>

#define BT_TEST_KEY_STORAGE_FILE_PATH EXT_PATH("unit_tests/bt_test.keys")
#define BT_TEST_NVM_RAM_BUFF_SIZE (507 * 4) // The same as in ble NVM storage
#define BT_TEST_NVM_RAM_BUFF_SIZE (507 * 4) // The same as in ble NVM storage

typedef struct {
Storage* storage;
Expand Down
4 changes: 2 additions & 2 deletions applications/debug/unit_tests/tests/compress/compress_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ It was compressed with heatshrink using the following command:
`python3 -m heatshrink2 compress -w 9 -l 4 hsstream.out.bin hsstream.in.bin`
*/

#define HSSTREAM_IN COMPRESS_UNIT_TESTS_PATH("hsstream.in.bin")
#define HSSTREAM_IN COMPRESS_UNIT_TESTS_PATH("hsstream.in.bin")
#define HSSTREAM_OUT COMPRESS_UNIT_TESTS_PATH("hsstream.out.bin")

static void compress_test_heatshrink_stream() {
Expand Down Expand Up @@ -239,7 +239,7 @@ static void compress_test_heatshrink_stream() {
furi_record_close(RECORD_STORAGE);
}

#define HS_TAR_PATH COMPRESS_UNIT_TESTS_PATH("test.ths")
#define HS_TAR_PATH COMPRESS_UNIT_TESTS_PATH("test.ths")
#define HS_TAR_EXTRACT_PATH COMPRESS_UNIT_TESTS_PATH("tar_out")

static bool file_counter(const char* name, bool is_dir, void* context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include <expansion/expansion_protocol.h>

#define EXPANSION_TEST_GARBAGE_MAGIC (0xB19AF)
#define EXPANSION_TEST_GARBAGE_BUF_SIZE (0x100U)
#define EXPANSION_TEST_GARBAGE_MAGIC (0xB19AF)
#define EXPANSION_TEST_GARBAGE_BUF_SIZE (0x100U)
#define EXPANSION_TEST_GARBAGE_ITERATIONS (100U)

MU_TEST(test_expansion_encoded_size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "../test.h" // IWYU pragma: keep

#define TEST_DIR_NAME EXT_PATH(".tmp/unit_tests/ff")
#define TEST_DIR TEST_DIR_NAME "/"
#define TEST_DIR TEST_DIR_NAME "/"

static const char* test_filetype = "Flipper File test";
static const uint32_t test_version = 666;
Expand Down
10 changes: 5 additions & 5 deletions applications/debug/unit_tests/tests/furi_hal/furi_hal_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#include <lp5562_reg.h>
#include "../test.h" // IWYU pragma: keep

#define DATA_SIZE 4
#define EEPROM_ADDRESS 0b10101000
#define EEPROM_ADDRESS_HIGH (EEPROM_ADDRESS | 0b10)
#define EEPROM_SIZE 512
#define EEPROM_PAGE_SIZE 16
#define DATA_SIZE 4
#define EEPROM_ADDRESS 0b10101000
#define EEPROM_ADDRESS_HIGH (EEPROM_ADDRESS | 0b10)
#define EEPROM_SIZE 512
#define EEPROM_PAGE_SIZE 16
#define EEPROM_WRITE_DELAY_MS 6

static void furi_hal_i2c_int_setup(void) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <common/infrared_common_i.h>
#include "../test.h" // IWYU pragma: keep

#define IR_TEST_FILES_DIR EXT_PATH("unit_tests/infrared/")
#define IR_TEST_FILES_DIR EXT_PATH("unit_tests/infrared/")
#define IR_TEST_FILE_PREFIX "test_"
#define IR_TEST_FILE_SUFFIX ".irtest"

Expand Down
20 changes: 10 additions & 10 deletions applications/debug/unit_tests/tests/lfrfid/lfrfid_protocols.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#define LF_RFID_READ_TIMING_MULTIPLIER 8

#define EM_TEST_DATA {0x58, 0x00, 0x85, 0x64, 0x02}
#define EM_TEST_DATA_SIZE 5
#define EM_TEST_DATA {0x58, 0x00, 0x85, 0x64, 0x02}
#define EM_TEST_DATA_SIZE 5
#define EM_TEST_EMULATION_TIMINGS_COUNT (64 * 2)

const int8_t em_test_timings[EM_TEST_EMULATION_TIMINGS_COUNT] = {
Expand All @@ -20,8 +20,8 @@ const int8_t em_test_timings[EM_TEST_EMULATION_TIMINGS_COUNT] = {
-32, 32, 32, -32, -32, 32, -32, 32, -32, 32, -32, 32, -32, 32,
};

#define HID10301_TEST_DATA {0x8D, 0x48, 0xA8}
#define HID10301_TEST_DATA_SIZE 3
#define HID10301_TEST_DATA {0x8D, 0x48, 0xA8}
#define HID10301_TEST_DATA_SIZE 3
#define HID10301_TEST_EMULATION_TIMINGS_COUNT (541 * 2)

const int8_t hid10301_test_timings[HID10301_TEST_EMULATION_TIMINGS_COUNT] = {
Expand Down Expand Up @@ -69,8 +69,8 @@ const int8_t hid10301_test_timings[HID10301_TEST_EMULATION_TIMINGS_COUNT] = {
5, -5, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4,
};

#define IOPROX_XSF_TEST_DATA {0x65, 0x01, 0x05, 0x39}
#define IOPROX_XSF_TEST_DATA_SIZE 4
#define IOPROX_XSF_TEST_DATA {0x65, 0x01, 0x05, 0x39}
#define IOPROX_XSF_TEST_DATA_SIZE 4
#define IOPROX_XSF_TEST_EMULATION_TIMINGS_COUNT (468 * 2)

const int8_t ioprox_xsf_test_timings[IOPROX_XSF_TEST_EMULATION_TIMINGS_COUNT] = {
Expand Down Expand Up @@ -113,8 +113,8 @@ const int8_t ioprox_xsf_test_timings[IOPROX_XSF_TEST_EMULATION_TIMINGS_COUNT] =
};

#define INDALA26_EMULATION_TIMINGS_COUNT (1024 * 2)
#define INDALA26_TEST_DATA {0x3B, 0x73, 0x64, 0xA8}
#define INDALA26_TEST_DATA_SIZE 4
#define INDALA26_TEST_DATA {0x3B, 0x73, 0x64, 0xA8}
#define INDALA26_TEST_DATA_SIZE 4

const int8_t indala26_test_timings[INDALA26_EMULATION_TIMINGS_COUNT] = {
1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1,
Expand Down Expand Up @@ -205,8 +205,8 @@ const int8_t indala26_test_timings[INDALA26_EMULATION_TIMINGS_COUNT] = {
-1, 1, -1, 1, -1, 1, -1, 1,
};

#define FDXB_TEST_DATA {0x44, 0x88, 0x23, 0xF2, 0x5A, 0x6F, 0x00, 0x01, 0x00, 0x00, 0x00}
#define FDXB_TEST_DATA_SIZE 11
#define FDXB_TEST_DATA {0x44, 0x88, 0x23, 0xF2, 0x5A, 0x6F, 0x00, 0x01, 0x00, 0x00, 0x00}
#define FDXB_TEST_DATA_SIZE 11
#define FDXB_TEST_EMULATION_TIMINGS_COUNT (206)

const int8_t fdxb_test_timings[FDXB_TEST_EMULATION_TIMINGS_COUNT] = {
Expand Down
Loading

0 comments on commit d61295a

Please sign in to comment.