From 57f3bce8e30e9ba8edd3e475990357091680da5b Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Tue, 16 Jul 2024 01:01:17 +0300 Subject: [PATCH] merge manually formatted stuff too --- .../debug/speaker_debug/speaker_debug.c | 3 +- applications/debug/uart_echo/uart_echo.c | 5 ++- .../debug/unit_tests/tests/rpc/rpc_test.c | 5 ++- .../unit_tests/tests/subghz/subghz_test.c | 3 +- .../drivers/subghz/cc1101_ext/cc1101_ext.c | 7 ++-- .../example_ble_beacon/ble_beacon_app.c | 2 +- .../main/archive/helpers/archive_browser.c | 2 +- .../main/archive/helpers/archive_browser.h | 2 +- .../main/bad_usb/helpers/ducky_script.c | 11 +++--- .../bad_usb/helpers/ducky_script_commands.c | 5 ++- .../main/infrared/views/infrared_move_view.c | 2 +- .../main/nfc/plugins/supported_cards/hi.c | 3 +- .../nfc/plugins/supported_cards/microel.c | 3 +- .../main/nfc/plugins/supported_cards/mizip.c | 3 +- .../main/nfc/plugins/supported_cards/saflok.c | 3 +- .../main/nfc/plugins/supported_cards/umarsh.c | 2 +- .../main/subghz/helpers/subghz_chat.c | 3 +- .../subghz/helpers/subghz_threshold_rssi.c | 3 +- .../main/subghz/helpers/subghz_txrx.c | 15 +++----- .../subghz/scenes/subghz_scene_decode_raw.c | 3 +- applications/main/subghz/subghz_i.c | 2 +- applications/main/subghz/views/receiver.c | 2 +- applications/main/u2f/u2f.c | 7 ++-- applications/main/u2f/u2f_hid.c | 3 +- applications/services/cli/cli.c | 2 +- .../gui/modules/file_browser_worker.c | 6 +-- applications/services/gui/modules/menu.c | 2 +- .../services/gui/modules/text_input.c | 2 +- applications/services/loader/loader.c | 3 +- applications/services/locale/locale.c | 2 +- .../services/notification/notification_app.c | 9 ++--- applications/services/rpc/rpc.c | 2 +- .../services/storage/filesystem_api.c | 2 +- applications/services/storage/storage_cli.c | 2 +- .../services/storage/storage_external_api.c | 4 +- .../services/storage/storages/storage_ext.c | 18 ++++----- .../services/storage/storages/storage_int.c | 23 +++++------ .../system/hid_app/views/hid_mouse_clicker.c | 3 +- .../system/js_app/modules/js_serial.c | 7 ++-- .../storage_move_to_sd/storage_move_to_sd.c | 2 +- .../updater/util/update_task_worker_flasher.c | 4 +- furi/core/kernel.c | 12 +++--- furi/core/memmgr_heap.c | 2 +- furi/core/stream_buffer.c | 2 +- lib/drivers/st25r3916_reg.c | 2 +- lib/lfrfid/lfrfid_raw_file.c | 2 +- lib/lfrfid/lfrfid_worker.c | 2 +- lib/lfrfid/protocols/protocol_electra.c | 4 +- lib/lfrfid/protocols/protocol_em4100.c | 4 +- lib/lfrfid/protocols/protocol_fdx_a.c | 2 +- lib/lfrfid/protocols/protocol_nexwatch.c | 2 +- lib/lfrfid/protocols/protocol_securakey.c | 3 +- lib/nfc/helpers/felica_crc.c | 2 +- lib/nfc/helpers/iso13239_crc.c | 2 +- lib/nfc/helpers/iso14443_crc.c | 2 +- lib/nfc/helpers/nfc_util.c | 2 +- lib/nfc/protocols/felica/felica_listener_i.c | 9 ++--- lib/nfc/protocols/mf_classic/mf_classic.c | 38 ++++++++----------- lib/nfc/protocols/mf_plus/mf_plus_poller.c | 2 +- .../protocols/mf_ultralight/mf_ultralight.c | 2 +- .../mf_ultralight/mf_ultralight_listener_i.c | 6 +-- lib/one_wire/one_wire_slave.c | 2 +- lib/subghz/protocols/bin_raw.c | 2 +- lib/subghz/protocols/came.c | 7 ++-- lib/subghz/protocols/clemsa.c | 11 +++--- lib/subghz/protocols/doitrand.c | 4 +- lib/subghz/protocols/gate_tx.c | 4 +- lib/subghz/protocols/holtek.c | 2 +- lib/subghz/protocols/keeloq.c | 2 +- lib/subghz/protocols/linear.c | 4 +- lib/subghz/protocols/mastercode.c | 14 +++---- lib/subghz/protocols/phoenix_v2.c | 4 +- lib/subghz/protocols/power_smart.c | 3 +- lib/subghz/protocols/princeton.c | 3 +- lib/subghz/protocols/raw.c | 3 +- lib/toolbox/hex.c | 4 +- lib/toolbox/level_duration.h | 4 +- lib/toolbox/stream/stream.c | 2 +- lib/toolbox/stream/string_stream.c | 2 +- lib/toolbox/tar/tar_archive.c | 22 +++++------ lib/u8g2/u8g2_glue.c | 2 +- targets/f7/ble_glue/ble_glue.c | 2 +- targets/f7/furi_hal/furi_hal_crypto.c | 6 +-- targets/f7/furi_hal/furi_hal_ibutton.c | 3 +- targets/f7/furi_hal/furi_hal_memory.c | 4 +- targets/f7/furi_hal/furi_hal_nfc.c | 2 +- targets/f7/furi_hal/furi_hal_random.c | 4 +- targets/f7/furi_hal/furi_hal_rfid.c | 5 +-- targets/f7/furi_hal/furi_hal_sd.c | 2 +- targets/f7/furi_hal/furi_hal_subghz.c | 2 +- targets/f7/furi_hal/furi_hal_usb_cdc.c | 2 +- targets/f7/furi_hal/furi_hal_usb_u2f.c | 2 +- 92 files changed, 220 insertions(+), 209 deletions(-) diff --git a/applications/debug/speaker_debug/speaker_debug.c b/applications/debug/speaker_debug/speaker_debug.c index 42f31ab66..3f685ab30 100644 --- a/applications/debug/speaker_debug/speaker_debug.c +++ b/applications/debug/speaker_debug/speaker_debug.c @@ -4,7 +4,8 @@ #include #include -#define TAG "SpeakerDebug" +#define TAG "SpeakerDebug" + #define CLI_COMMAND "speaker_debug" typedef enum { diff --git a/applications/debug/uart_echo/uart_echo.c b/applications/debug/uart_echo/uart_echo.c index 130fd8e21..8e1884e9a 100644 --- a/applications/debug/uart_echo/uart_echo.c +++ b/applications/debug/uart_echo/uart_echo.c @@ -9,9 +9,10 @@ #include #include +#define TAG "UartEcho" + #define LINES_ON_SCREEN 6 #define COLUMNS_ON_SCREEN 21 -#define TAG "UartEcho" #define DEFAULT_BAUD_RATE 230400 typedef struct UartDumpModel UartDumpModel; @@ -147,7 +148,7 @@ static void uart_echo_push_to_list(UartDumpModel* model, const char data) { bool new_string_needed = false; if(furi_string_size(model->list[model->line]->text) >= COLUMNS_ON_SCREEN) { new_string_needed = true; - } else if((data == '\n' || data == '\r')) { + } else if(data == '\n' || data == '\r') { // pack line breaks if(model->last_char != '\n' && model->last_char != '\r') { new_string_needed = true; diff --git a/applications/debug/unit_tests/tests/rpc/rpc_test.c b/applications/debug/unit_tests/tests/rpc/rpc_test.c index d5a902a2b..63ea706ed 100644 --- a/applications/debug/unit_tests/tests/rpc/rpc_test.c +++ b/applications/debug/unit_tests/tests/rpc/rpc_test.c @@ -42,7 +42,8 @@ typedef struct { static RpcSessionContext rpc_session[TEST_RPC_SESSIONS]; -#define TAG "UnitTestsRpc" +#define TAG "UnitTestsRpc" + #define MAX_RECEIVE_OUTPUT_TIMEOUT 3000 #define MAX_NAME_LENGTH 255 #define MAX_DATA_SIZE 512u // have to be exact as in rpc_storage.c @@ -554,7 +555,7 @@ static bool test_rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_ time_left = MAX(time_left, 0); bytes_received = furi_stream_buffer_receive(session_context->output_stream, buf, count, time_left); - return (count == bytes_received); + return count == bytes_received; } static void diff --git a/applications/debug/unit_tests/tests/subghz/subghz_test.c b/applications/debug/unit_tests/tests/subghz/subghz_test.c index 8d1600097..3e93ac4c3 100644 --- a/applications/debug/unit_tests/tests/subghz/subghz_test.c +++ b/applications/debug/unit_tests/tests/subghz/subghz_test.c @@ -10,7 +10,8 @@ #include #include -#define TAG "SubGhzTest" +#define TAG "SubGhzTest" + #define KEYSTORE_DIR_NAME EXT_PATH("subghz/assets/keeloq_mfcodes") #define CAME_ATOMO_DIR_NAME EXT_PATH("subghz/assets/came_atomo") #define NICE_FLOR_S_DIR_NAME EXT_PATH("subghz/assets/nice_flor_s") diff --git a/applications/drivers/subghz/cc1101_ext/cc1101_ext.c b/applications/drivers/subghz/cc1101_ext/cc1101_ext.c index 470c00974..ac72ab5c1 100644 --- a/applications/drivers/subghz/cc1101_ext/cc1101_ext.c +++ b/applications/drivers/subghz/cc1101_ext/cc1101_ext.c @@ -390,7 +390,7 @@ bool subghz_device_cc1101_ext_is_rx_data_crc_valid(void) { cc1101_read_reg( subghz_device_cc1101_ext->spi_bus_handle, CC1101_STATUS_LQI | CC1101_BURST, data); furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); - if(((data[0] >> 7) & 0x01)) { + if((data[0] >> 7) & 0x01) { return true; } else { return false; @@ -879,9 +879,8 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb } bool subghz_device_cc1101_ext_is_async_tx_complete(void) { - return ( - (subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx) && - (LL_TIM_GetAutoReload(TIM17) == 0)); + return (subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx) && + (LL_TIM_GetAutoReload(TIM17) == 0); } void subghz_device_cc1101_ext_stop_async_tx(void) { diff --git a/applications/examples/example_ble_beacon/ble_beacon_app.c b/applications/examples/example_ble_beacon/ble_beacon_app.c index af2133602..faa3feb91 100644 --- a/applications/examples/example_ble_beacon/ble_beacon_app.c +++ b/applications/examples/example_ble_beacon/ble_beacon_app.c @@ -5,7 +5,7 @@ #include -#define TAG "ble_beacon_app" +#define TAG "BleBeaconApp" static bool ble_beacon_app_custom_event_callback(void* context, uint32_t event) { furi_assert(context); diff --git a/applications/main/archive/helpers/archive_browser.c b/applications/main/archive/helpers/archive_browser.c index cd55d7e52..bd9b00745 100644 --- a/applications/main/archive/helpers/archive_browser.c +++ b/applications/main/archive/helpers/archive_browser.c @@ -344,7 +344,7 @@ bool archive_is_home(ArchiveBrowserView* browser) { } const char* default_path = archive_get_default_path(archive_get_tab(browser)); - return (furi_string_cmp_str(browser->path, default_path) == 0); + return furi_string_cmp_str(browser->path, default_path) == 0; } const char* archive_get_name(ArchiveBrowserView* browser) { diff --git a/applications/main/archive/helpers/archive_browser.h b/applications/main/archive/helpers/archive_browser.h index 61c52e752..1e1cdc881 100644 --- a/applications/main/archive/helpers/archive_browser.h +++ b/applications/main/archive/helpers/archive_browser.h @@ -67,7 +67,7 @@ static inline const char* archive_get_default_path(ArchiveTabEnum tab) { } inline bool archive_is_known_app(ArchiveFileTypeEnum type) { - return (type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown); + return type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown; } bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx); diff --git a/applications/main/bad_usb/helpers/ducky_script.c b/applications/main/bad_usb/helpers/ducky_script.c index d47e26490..f098d9da3 100644 --- a/applications/main/bad_usb/helpers/ducky_script.c +++ b/applications/main/bad_usb/helpers/ducky_script.c @@ -8,7 +8,8 @@ #include "ducky_script_i.h" #include -#define TAG "BadUsb" +#define TAG "BadUsb" + #define WORKER_TAG TAG "Worker" #define BADUSB_ASCII_TO_KEY(script, x) \ @@ -46,7 +47,7 @@ uint32_t ducky_get_command_len(const char* line) { } bool ducky_is_line_end(const char chr) { - return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n')); + return (chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n'); } uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept_chars) { @@ -56,7 +57,7 @@ uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept } if((accept_chars) && (strlen(param) > 0)) { - return (BADUSB_ASCII_TO_KEY(bad_usb, param[0]) & 0xFF); + return BADUSB_ASCII_TO_KEY(bad_usb, param[0]) & 0xFF; } return 0; } @@ -309,7 +310,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur - 1U); return SCRIPT_STATE_ERROR; } else { - return (delay_val + bad_usb->defdelay); + return delay_val + bad_usb->defdelay; } } @@ -348,7 +349,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur); return SCRIPT_STATE_ERROR; } else { - return (delay_val + bad_usb->defdelay); + return delay_val + bad_usb->defdelay; } } else { furi_string_push_back(bad_usb->line, bad_usb->file_buf[i]); diff --git a/applications/main/bad_usb/helpers/ducky_script_commands.c b/applications/main/bad_usb/helpers/ducky_script_commands.c index 137cd0c4e..79dcdd531 100644 --- a/applications/main/bad_usb/helpers/ducky_script_commands.c +++ b/applications/main/bad_usb/helpers/ducky_script_commands.c @@ -215,7 +215,8 @@ static const DuckyCmd ducky_commands[] = { {"GLOBE", ducky_fnc_globe, -1}, }; -#define TAG "BadUsb" +#define TAG "BadUsb" + #define WORKER_TAG TAG "Worker" int32_t ducky_execute_cmd(BadUsbScript* bad_usb, const char* line) { @@ -231,7 +232,7 @@ int32_t ducky_execute_cmd(BadUsbScript* bad_usb, const char* line) { if(ducky_commands[i].callback == NULL) { return 0; } else { - return ((ducky_commands[i].callback)(bad_usb, line, ducky_commands[i].param)); + return (ducky_commands[i].callback)(bad_usb, line, ducky_commands[i].param); } } } diff --git a/applications/main/infrared/views/infrared_move_view.c b/applications/main/infrared/views/infrared_move_view.c index 653f2509c..f3fc6dde1 100644 --- a/applications/main/infrared/views/infrared_move_view.c +++ b/applications/main/infrared/views/infrared_move_view.c @@ -98,7 +98,7 @@ static bool infrared_move_view_input_callback(InputEvent* event, void* context) bool consumed = false; - if(((event->type == InputTypeShort || event->type == InputTypeRepeat)) && + if((event->type == InputTypeShort || event->type == InputTypeRepeat) && ((event->key == InputKeyUp) || (event->key == InputKeyDown))) { with_view_model( move_view->view, diff --git a/applications/main/nfc/plugins/supported_cards/hi.c b/applications/main/nfc/plugins/supported_cards/hi.c index 151a6f6c2..1206b807e 100644 --- a/applications/main/nfc/plugins/supported_cards/hi.c +++ b/applications/main/nfc/plugins/supported_cards/hi.c @@ -5,7 +5,8 @@ #include -#define TAG "HI!" +#define TAG "HI!" + #define KEY_LENGTH 6 #define HI_KEY_TO_GEN 5 #define UID_LENGTH 7 diff --git a/applications/main/nfc/plugins/supported_cards/microel.c b/applications/main/nfc/plugins/supported_cards/microel.c index 086a3184d..469cc847b 100644 --- a/applications/main/nfc/plugins/supported_cards/microel.c +++ b/applications/main/nfc/plugins/supported_cards/microel.c @@ -5,7 +5,8 @@ #include -#define TAG "Microel" +#define TAG "Microel" + #define KEY_LENGTH 6 #define UID_LENGTH 4 diff --git a/applications/main/nfc/plugins/supported_cards/mizip.c b/applications/main/nfc/plugins/supported_cards/mizip.c index 16a93aafb..c00fef6b5 100644 --- a/applications/main/nfc/plugins/supported_cards/mizip.c +++ b/applications/main/nfc/plugins/supported_cards/mizip.c @@ -5,7 +5,8 @@ #include -#define TAG "MiZIP" +#define TAG "MiZIP" + #define KEY_LENGTH 6 #define MIZIP_KEY_TO_GEN 5 #define UID_LENGTH 4 diff --git a/applications/main/nfc/plugins/supported_cards/saflok.c b/applications/main/nfc/plugins/supported_cards/saflok.c index 6d7200d46..a9ca2bc5c 100644 --- a/applications/main/nfc/plugins/supported_cards/saflok.c +++ b/applications/main/nfc/plugins/supported_cards/saflok.c @@ -9,7 +9,8 @@ #include -#define TAG "Saflok" +#define TAG "Saflok" + #define MAGIC_TABLE_SIZE 192 #define KEY_LENGTH 6 #define UID_LENGTH 4 diff --git a/applications/main/nfc/plugins/supported_cards/umarsh.c b/applications/main/nfc/plugins/supported_cards/umarsh.c index a6dc5450c..927263615 100644 --- a/applications/main/nfc/plugins/supported_cards/umarsh.c +++ b/applications/main/nfc/plugins/supported_cards/umarsh.c @@ -38,7 +38,7 @@ bool parse_datetime(uint16_t date, DateTime* result) { result->year = 2000 + (date >> 9); result->month = date >> 5 & 0x0F; result->day = date & 0x1F; - return (date != 0); + return date != 0; } static bool umarsh_parse(const NfcDevice* device, FuriString* parsed_data) { diff --git a/applications/main/subghz/helpers/subghz_chat.c b/applications/main/subghz/helpers/subghz_chat.c index 3ca6a5a86..b8124026f 100644 --- a/applications/main/subghz/helpers/subghz_chat.c +++ b/applications/main/subghz/helpers/subghz_chat.c @@ -1,7 +1,8 @@ #include "subghz_chat.h" #include -#define TAG "SubGhzChat" +#define TAG "SubGhzChat" + #define SUBGHZ_CHAT_WORKER_TIMEOUT_BETWEEN_MESSAGES 500 struct SubGhzChatWorker { diff --git a/applications/main/subghz/helpers/subghz_threshold_rssi.c b/applications/main/subghz/helpers/subghz_threshold_rssi.c index 6c1c666f8..f413babae 100644 --- a/applications/main/subghz/helpers/subghz_threshold_rssi.c +++ b/applications/main/subghz/helpers/subghz_threshold_rssi.c @@ -2,7 +2,8 @@ #include #include "../subghz_i.h" -#define TAG "SubGhzThresholdRssi" +#define TAG "SubGhzThresholdRssi" + #define THRESHOLD_RSSI_LOW_COUNT 10 struct SubGhzThresholdRssi { diff --git a/applications/main/subghz/helpers/subghz_txrx.c b/applications/main/subghz/helpers/subghz_txrx.c index d4e3926a0..8e00bd6af 100644 --- a/applications/main/subghz/helpers/subghz_txrx.c +++ b/applications/main/subghz/helpers/subghz_txrx.c @@ -528,22 +528,19 @@ SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* instance) { bool subghz_txrx_protocol_is_serializable(SubGhzTxRx* instance) { furi_assert(instance); - return ( - (instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) == - SubGhzProtocolFlag_Save); + return (instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) == + SubGhzProtocolFlag_Save; } bool subghz_txrx_protocol_is_transmittable(SubGhzTxRx* instance, bool check_type) { furi_assert(instance); const SubGhzProtocol* protocol = instance->decoder_result->protocol; if(check_type) { - return ( - ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) && - protocol->encoder->deserialize && protocol->type == SubGhzProtocolTypeStatic); + return ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) && + protocol->encoder->deserialize && protocol->type == SubGhzProtocolTypeStatic; } - return ( - ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) && - protocol->encoder->deserialize); + return ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) && + protocol->encoder->deserialize; } void subghz_txrx_receiver_set_filter(SubGhzTxRx* instance, SubGhzProtocolFlag filter) { diff --git a/applications/main/subghz/scenes/subghz_scene_decode_raw.c b/applications/main/subghz/scenes/subghz_scene_decode_raw.c index 791f5cc72..b6c57414f 100644 --- a/applications/main/subghz/scenes/subghz_scene_decode_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_decode_raw.c @@ -1,6 +1,7 @@ #include "../subghz_i.h" -#define TAG "SubGhzDecodeRaw" +#define TAG "SubGhzDecodeRaw" + #define SAMPLES_TO_READ_PER_TICK 400 static void subghz_scene_receiver_update_statusbar(void* context) { diff --git a/applications/main/subghz/subghz_i.c b/applications/main/subghz/subghz_i.c index 84f0a43e3..1bdaf07d9 100644 --- a/applications/main/subghz/subghz_i.c +++ b/applications/main/subghz/subghz_i.c @@ -414,7 +414,7 @@ void subghz_unlock(SubGhz* subghz) { bool subghz_is_locked(SubGhz* subghz) { furi_assert(subghz); - return (subghz->lock == SubGhzLockOn); + return subghz->lock == SubGhzLockOn; } void subghz_rx_key_state_set(SubGhz* subghz, SubGhzRxKeyState state) { diff --git a/applications/main/subghz/views/receiver.c b/applications/main/subghz/views/receiver.c index babbf8b2f..a97d442c5 100644 --- a/applications/main/subghz/views/receiver.c +++ b/applications/main/subghz/views/receiver.c @@ -186,7 +186,7 @@ void subghz_view_receiver_add_item_to_menu( item_menu->time = furi_string_alloc_set(time); item_menu->item_str = furi_string_alloc_set(name); item_menu->type = type; - if((model->idx == model->history_item - 1)) { + if(model->idx == model->history_item - 1) { model->history_item++; model->idx++; subghz_view_receiver_show_time_moment(subghz_receiver); diff --git a/applications/main/u2f/u2f.c b/applications/main/u2f/u2f.c index c1c9b66e9..6a37769a8 100644 --- a/applications/main/u2f/u2f.c +++ b/applications/main/u2f/u2f.c @@ -11,7 +11,8 @@ #include #include -#define TAG "U2f" +#define TAG "U2f" + #define WORKER_TAG TAG "Worker" #define MCHECK(expr) furi_check((expr) == 0) @@ -315,7 +316,7 @@ static uint16_t u2f_register(U2fData* U2F, uint8_t* buf) { uint8_t signature_len = u2f_der_encode_signature(resp->cert + cert_len, signature); memcpy(resp->cert + cert_len + signature_len, state_no_error, 2); - return (sizeof(U2fRegisterResp) + cert_len + signature_len + 2); + return sizeof(U2fRegisterResp) + cert_len + signature_len + 2; } static uint16_t u2f_authenticate(U2fData* U2F, uint8_t* buf) { @@ -410,7 +411,7 @@ static uint16_t u2f_authenticate(U2fData* U2F, uint8_t* buf) { if(U2F->callback != NULL) U2F->callback(U2fNotifyAuthSuccess, U2F->context); - return (sizeof(U2fAuthResp) + signature_len + 2); + return sizeof(U2fAuthResp) + signature_len + 2; } uint16_t u2f_msg_parse(U2fData* U2F, uint8_t* buf, uint16_t len) { diff --git a/applications/main/u2f/u2f_hid.c b/applications/main/u2f/u2f_hid.c index c53d67e1b..76d3d7cec 100644 --- a/applications/main/u2f/u2f_hid.c +++ b/applications/main/u2f/u2f_hid.c @@ -8,7 +8,8 @@ #include #include -#define TAG "U2fHid" +#define TAG "U2fHid" + #define WORKER_TAG TAG "Worker" #define U2F_HID_MAX_PAYLOAD_LEN ((HID_U2F_PACKET_LEN - 7) + 128 * (HID_U2F_PACKET_LEN - 5)) diff --git a/applications/services/cli/cli.c b/applications/services/cli/cli.c index a300009f5..34a882c68 100644 --- a/applications/services/cli/cli.c +++ b/applications/services/cli/cli.c @@ -79,7 +79,7 @@ size_t cli_read_timeout(Cli* cli, uint8_t* buffer, size_t size, uint32_t timeout bool cli_is_connected(Cli* cli) { furi_check(cli); if(cli->session != NULL) { - return (cli->session->is_connected()); + return cli->session->is_connected(); } return false; } diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index 80757ab82..7092e15da 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -117,7 +117,7 @@ static bool browser_filter_by_name(BrowserWorker* browser, FuriString* name, boo if(is_folder) { // Skip assets folders (if enabled) if(browser->skip_assets) { - return ((furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true)); + return (furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true); } else { return true; } @@ -303,7 +303,7 @@ static bool browser_folder_load_chunked( furi_record_close(RECORD_STORAGE); - return (items_cnt == count); + return items_cnt == count; } // Load all files at once, may cause memory overflow so need to limit that to about 400 files @@ -571,7 +571,7 @@ void file_browser_worker_folder_enter(BrowserWorker* browser, FuriString* path, bool file_browser_worker_is_in_start_folder(BrowserWorker* browser) { furi_check(browser); - return (furi_string_cmp(browser->path_start, browser->path_current) == 0); + return furi_string_cmp(browser->path_start, browser->path_current) == 0; } void file_browser_worker_folder_exit(BrowserWorker* browser) { diff --git a/applications/services/gui/modules/menu.c b/applications/services/gui/modules/menu.c index 4c526bf92..012fa17d6 100644 --- a/applications/services/gui/modules/menu.c +++ b/applications/services/gui/modules/menu.c @@ -157,7 +157,7 @@ void menu_free(Menu* menu) { View* menu_get_view(Menu* menu) { furi_check(menu); - return (menu->view); + return menu->view; } void menu_add_item( diff --git a/applications/services/gui/modules/text_input.c b/applications/services/gui/modules/text_input.c index 640aa765d..52b00c0f9 100644 --- a/applications/services/gui/modules/text_input.c +++ b/applications/services/gui/modules/text_input.c @@ -136,7 +136,7 @@ static char get_selected_char(TextInputModel* model) { } static bool char_is_lowercase(char letter) { - return (letter >= 0x61 && letter <= 0x7A); + return letter >= 0x61 && letter <= 0x7A; } static char char_to_uppercase(const char letter) { diff --git a/applications/services/loader/loader.c b/applications/services/loader/loader.c index ec0747d55..606fdec4b 100644 --- a/applications/services/loader/loader.c +++ b/applications/services/loader/loader.c @@ -10,7 +10,8 @@ #include #include -#define TAG "Loader" +#define TAG "Loader" + #define LOADER_MAGIC_THREAD_VALUE 0xDEADBEEF // helpers diff --git a/applications/services/locale/locale.c b/applications/services/locale/locale.c index f4ee9c634..6acf2eea9 100644 --- a/applications/services/locale/locale.c +++ b/applications/services/locale/locale.c @@ -31,7 +31,7 @@ float locale_fahrenheit_to_celsius(float temp_f) { } float locale_celsius_to_fahrenheit(float temp_c) { - return (temp_c * 1.8f + 32.f); + return temp_c * 1.8f + 32.f; } void locale_format_time( diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c index 6d5797db2..d4c5b91c8 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -143,17 +143,16 @@ static void notification_apply_notification_leds(NotificationApp* app, const uin // settings uint8_t notification_settings_get_display_brightness(NotificationApp* app, uint8_t value) { - return (value * app->settings.display_brightness); + return value * app->settings.display_brightness; } static uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value) { - return (value * app->settings.led_brightness); + return value * app->settings.led_brightness; } static uint32_t notification_settings_display_off_delay_ticks(NotificationApp* app) { - return ( - (float)(app->settings.display_off_delay_ms) / - (1000.0f / furi_kernel_get_tick_frequency())); + return (float)(app->settings.display_off_delay_ms) / + (1000.0f / furi_kernel_get_tick_frequency()); } // generics diff --git a/applications/services/rpc/rpc.c b/applications/services/rpc/rpc.c index b6dd30b24..c2aa3e27c 100644 --- a/applications/services/rpc/rpc.c +++ b/applications/services/rpc/rpc.c @@ -232,7 +232,7 @@ bool rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_t count) { rpc_debug_print_data("INPUT", buf, bytes_received); #endif - return (count == bytes_received); + return count == bytes_received; } static bool rpc_pb_content_callback(pb_istream_t* stream, const pb_field_t* field, void** arg) { diff --git a/applications/services/storage/filesystem_api.c b/applications/services/storage/filesystem_api.c index e5052e916..cf3803864 100644 --- a/applications/services/storage/filesystem_api.c +++ b/applications/services/storage/filesystem_api.c @@ -40,5 +40,5 @@ const char* filesystem_api_error_get_desc(FS_Error error_id) { bool file_info_is_dir(const FileInfo* file_info) { furi_check(file_info); - return (file_info->flags & FSF_DIRECTORY); + return file_info->flags & FSF_DIRECTORY; } diff --git a/applications/services/storage/storage_cli.c b/applications/services/storage/storage_cli.c index 9b4e5838f..918e796ce 100644 --- a/applications/services/storage/storage_cli.c +++ b/applications/services/storage/storage_cli.c @@ -241,7 +241,7 @@ static void storage_cli_write(Cli* cli, FuriString* path, FuriString* args) { fflush(stdout); read_index++; - if(((read_index % buffer_size) == 0)) { + if((read_index % buffer_size) == 0) { size_t written_size = storage_file_write(file, buffer, buffer_size); if(written_size != buffer_size) { diff --git a/applications/services/storage/storage_external_api.c b/applications/services/storage/storage_external_api.c index e02291506..7803e8f6a 100644 --- a/applications/services/storage/storage_external_api.c +++ b/applications/services/storage/storage_external_api.c @@ -929,12 +929,12 @@ File* storage_file_alloc(Storage* storage) { bool storage_file_is_open(File* file) { furi_check(file); - return (file->type != FileTypeClosed); + return file->type != FileTypeClosed; } bool storage_file_is_dir(File* file) { furi_check(file); - return (file->type == FileTypeOpenDir); + return file->type == FileTypeOpenDir; } void storage_file_free(File* file) { diff --git a/applications/services/storage/storages/storage_ext.c b/applications/services/storage/storages/storage_ext.c index 7e617c0ff..93e06f663 100644 --- a/applications/services/storage/storages/storage_ext.c +++ b/applications/services/storage/storages/storage_ext.c @@ -337,7 +337,7 @@ static bool storage_ext_file_open( file->internal_error_id = f_open(file_data, path, _mode); file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_ext_file_close(void* ctx, File* file) { @@ -347,7 +347,7 @@ static bool storage_ext_file_close(void* ctx, File* file) { file->error_id = storage_ext_parse_error(file->internal_error_id); free(file_data); storage_set_storage_file_data(file, NULL, storage); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static uint16_t @@ -392,7 +392,7 @@ static bool } file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static uint64_t storage_ext_file_tell(void* ctx, File* file) { @@ -416,7 +416,7 @@ static bool storage_ext_file_truncate(void* ctx, File* file) { file->internal_error_id = f_truncate(file_data); file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; #endif } @@ -431,7 +431,7 @@ static bool storage_ext_file_sync(void* ctx, File* file) { file->internal_error_id = f_sync(file_data); file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; #endif } @@ -464,7 +464,7 @@ static bool storage_ext_dir_open(void* ctx, File* file, const char* path) { storage_set_storage_file_data(file, file_data, storage); file->internal_error_id = f_opendir(file_data, path); file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_ext_dir_close(void* ctx, File* file) { @@ -474,7 +474,7 @@ static bool storage_ext_dir_close(void* ctx, File* file) { file->internal_error_id = f_closedir(file_data); file->error_id = storage_ext_parse_error(file->internal_error_id); free(file_data); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_ext_dir_read( @@ -505,7 +505,7 @@ static bool storage_ext_dir_read( file->error_id = FSE_NOT_EXIST; } - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_ext_dir_rewind(void* ctx, File* file) { @@ -514,7 +514,7 @@ static bool storage_ext_dir_rewind(void* ctx, File* file) { file->internal_error_id = f_readdir(file_data, NULL); file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } /******************* Common FS Functions *******************/ diff --git a/applications/services/storage/storages/storage_int.c b/applications/services/storage/storages/storage_int.c index eba765398..324ce6328 100644 --- a/applications/services/storage/storages/storage_int.c +++ b/applications/services/storage/storages/storage_int.c @@ -3,7 +3,8 @@ #include #include -#define TAG "StorageInt" +#define TAG "StorageInt" + #define STORAGE_PATH STORAGE_INT_PATH_PREFIX #define LFS_CLEAN_FINGERPRINT 0 @@ -287,7 +288,7 @@ static bool storage_int_check_for_free_space(StorageData* storage) { lfs_size_t free_space = (lfs_data->config.block_count - result) * lfs_data->config.block_size; - return (free_space > LFS_RESERVED_PAGES_COUNT * furi_hal_flash_get_page_size()); + return free_space > LFS_RESERVED_PAGES_COUNT * furi_hal_flash_get_page_size(); } return false; @@ -344,7 +345,7 @@ static bool storage_int_file_open( file->error_id = storage_int_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_int_file_close(void* ctx, File* file) { @@ -360,7 +361,7 @@ static bool storage_int_file_close(void* ctx, File* file) { file->error_id = storage_int_parse_error(file->internal_error_id); lfs_handle_free(handle); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static uint16_t @@ -430,7 +431,7 @@ static bool } file->error_id = storage_int_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static uint64_t storage_int_file_tell(void* ctx, File* file) { @@ -475,7 +476,7 @@ static bool storage_int_file_truncate(void* ctx, File* file) { file->error_id = storage_int_parse_error(file->internal_error_id); } - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_int_file_sync(void* ctx, File* file) { @@ -490,7 +491,7 @@ static bool storage_int_file_sync(void* ctx, File* file) { } file->error_id = storage_int_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static uint64_t storage_int_file_size(void* ctx, File* file) { @@ -557,7 +558,7 @@ static bool storage_int_dir_open(void* ctx, File* file, const char* path) { } file->error_id = storage_int_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_int_dir_close(void* ctx, File* file) { @@ -573,7 +574,7 @@ static bool storage_int_dir_close(void* ctx, File* file) { file->error_id = storage_int_parse_error(file->internal_error_id); lfs_handle_free(handle); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_int_dir_read( @@ -614,7 +615,7 @@ static bool storage_int_dir_read( file->error_id = storage_int_parse_error(file->internal_error_id); } - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_int_dir_rewind(void* ctx, File* file) { @@ -629,7 +630,7 @@ static bool storage_int_dir_rewind(void* ctx, File* file) { } file->error_id = storage_int_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } /******************* Common FS Functions *******************/ diff --git a/applications/system/hid_app/views/hid_mouse_clicker.c b/applications/system/hid_app/views/hid_mouse_clicker.c index 2b1ff8ee7..0bb815249 100644 --- a/applications/system/hid_app/views/hid_mouse_clicker.c +++ b/applications/system/hid_app/views/hid_mouse_clicker.c @@ -4,7 +4,8 @@ #include "hid_icons.h" -#define TAG "HidMouseClicker" +#define TAG "HidMouseClicker" + #define DEFAULT_CLICK_RATE 1 #define MAXIMUM_CLICK_RATE 60 diff --git a/applications/system/js_app/modules/js_serial.c b/applications/system/js_app/modules/js_serial.c index 2e7aa8fcf..293798a12 100644 --- a/applications/system/js_app/modules/js_serial.c +++ b/applications/system/js_app/modules/js_serial.c @@ -4,7 +4,8 @@ #include "../js_modules.h" #include -#define TAG "js_serial" +#define TAG "JsSerial" + #define RX_BUF_LEN 2048 typedef struct { @@ -529,14 +530,14 @@ static int32_t js_serial_expect_check_pattern_start( int32_t pattern_last) { size_t array_len = PatternArray_size(patterns); if((pattern_last + 1) >= (int32_t)array_len) { - return (-1); + return -1; } for(size_t i = pattern_last + 1; i < array_len; i++) { if(PatternArray_get(patterns, i)->data[0] == value) { return i; } } - return (-1); + return -1; } static void js_serial_expect(struct mjs* mjs) { diff --git a/applications/system/storage_move_to_sd/storage_move_to_sd.c b/applications/system/storage_move_to_sd/storage_move_to_sd.c index bc587f3eb..44e73c689 100644 --- a/applications/system/storage_move_to_sd/storage_move_to_sd.c +++ b/applications/system/storage_move_to_sd/storage_move_to_sd.c @@ -18,7 +18,7 @@ static bool storage_move_to_sd_check_entry(const char* name, FileInfo* fileinfo, return true; } - return (name && (*name != '.')); + return name && (*name != '.'); } static void storage_move_to_sd_remove_region() { diff --git a/applications/system/updater/util/update_task_worker_flasher.c b/applications/system/updater/util/update_task_worker_flasher.c index ec390b112..848cc5494 100644 --- a/applications/system/updater/util/update_task_worker_flasher.c +++ b/applications/system/updater/util/update_task_worker_flasher.c @@ -36,7 +36,7 @@ static bool page_task_compare_flash( const uint8_t* update_block, uint16_t update_block_len) { const size_t page_addr = furi_hal_flash_get_base() + furi_hal_flash_get_page_size() * i_page; - return (memcmp(update_block, (void*)page_addr, update_block_len) == 0); + return memcmp(update_block, (void*)page_addr, update_block_len) == 0; } /* Verifies a flash operation address for fitting into writable memory @@ -44,7 +44,7 @@ static bool page_task_compare_flash( static bool check_address_boundaries(const size_t address) { const size_t min_allowed_address = furi_hal_flash_get_base(); const size_t max_allowed_address = (size_t)furi_hal_flash_get_free_end_address(); - return ((address >= min_allowed_address) && (address < max_allowed_address)); + return (address >= min_allowed_address) && (address < max_allowed_address); } static bool update_task_flash_program_page( diff --git a/furi/core/kernel.c b/furi/core/kernel.c index 52c0e285e..f3f84e692 100644 --- a/furi/core/kernel.c +++ b/furi/core/kernel.c @@ -29,7 +29,7 @@ bool furi_kernel_is_irq_or_masked(void) { } /* Return context, 0: thread context, 1: IRQ context */ - return (irq); + return irq; } bool furi_kernel_is_running(void) { @@ -58,7 +58,7 @@ int32_t furi_kernel_lock(void) { } /* Return previous lock state */ - return (lock); + return lock; } int32_t furi_kernel_unlock(void) { @@ -88,7 +88,7 @@ int32_t furi_kernel_unlock(void) { } /* Return previous lock state */ - return (lock); + return lock; } int32_t furi_kernel_restore_lock(int32_t lock) { @@ -119,12 +119,12 @@ int32_t furi_kernel_restore_lock(int32_t lock) { } /* Return new lock state */ - return (lock); + return lock; } uint32_t furi_kernel_get_tick_frequency(void) { /* Return frequency in hertz */ - return (configTICK_RATE_HZ_RAW); + return configTICK_RATE_HZ_RAW; } void furi_delay_tick(uint32_t ticks) { @@ -160,7 +160,7 @@ FuriStatus furi_delay_until_tick(uint32_t tick) { } /* Return execution status */ - return (stat); + return stat; } uint32_t furi_get_tick(void) { diff --git a/furi/core/memmgr_heap.c b/furi/core/memmgr_heap.c index 3827ddde3..359d0e3db 100644 --- a/furi/core/memmgr_heap.c +++ b/furi/core/memmgr_heap.c @@ -528,7 +528,7 @@ void vPortFree(void* pv) { xFreeBytesRemaining += pxLink->xBlockSize; traceFREE(pv, pxLink->xBlockSize); memset(pv, 0, pxLink->xBlockSize - xHeapStructSize); - prvInsertBlockIntoFreeList(((BlockLink_t*)pxLink)); + prvInsertBlockIntoFreeList((BlockLink_t*)pxLink); } (void)xTaskResumeAll(); } else { diff --git a/furi/core/stream_buffer.c b/furi/core/stream_buffer.c index ee582bacb..ef8869dea 100644 --- a/furi/core/stream_buffer.c +++ b/furi/core/stream_buffer.c @@ -106,7 +106,7 @@ bool furi_stream_buffer_is_full(FuriStreamBuffer* stream_buffer) { bool furi_stream_buffer_is_empty(FuriStreamBuffer* stream_buffer) { furi_check(stream_buffer); - return (xStreamBufferIsEmpty((StreamBufferHandle_t)stream_buffer) == pdTRUE); + return xStreamBufferIsEmpty((StreamBufferHandle_t)stream_buffer) == pdTRUE; } FuriStatus furi_stream_buffer_reset(FuriStreamBuffer* stream_buffer) { diff --git a/lib/drivers/st25r3916_reg.c b/lib/drivers/st25r3916_reg.c index 76a882755..f7a47d463 100644 --- a/lib/drivers/st25r3916_reg.c +++ b/lib/drivers/st25r3916_reg.c @@ -253,5 +253,5 @@ bool st25r3916_check_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t mask, uint8_t reg_val = 0; st25r3916_read_reg(handle, reg, ®_val); - return ((reg_val & mask) == val); + return (reg_val & mask) == val; } diff --git a/lib/lfrfid/lfrfid_raw_file.c b/lib/lfrfid/lfrfid_raw_file.c index 0db56ded1..c0aac71be 100644 --- a/lib/lfrfid/lfrfid_raw_file.c +++ b/lib/lfrfid/lfrfid_raw_file.c @@ -71,7 +71,7 @@ bool lfrfid_raw_file_write_header( .max_buffer_size = max_buffer_size}; size_t size = stream_write(file->stream, (uint8_t*)&header, sizeof(LFRFIDRawFileHeader)); - return (size == sizeof(LFRFIDRawFileHeader)); + return size == sizeof(LFRFIDRawFileHeader); } bool lfrfid_raw_file_write_buffer(LFRFIDRawFile* file, uint8_t* buffer_data, size_t buffer_size) { diff --git a/lib/lfrfid/lfrfid_worker.c b/lib/lfrfid/lfrfid_worker.c index 9554957f1..96f0c1f23 100644 --- a/lib/lfrfid/lfrfid_worker.c +++ b/lib/lfrfid/lfrfid_worker.c @@ -155,7 +155,7 @@ void lfrfid_worker_stop_thread(LFRFIDWorker* worker) { bool lfrfid_worker_check_for_stop(LFRFIDWorker* worker) { UNUSED(worker); uint32_t flags = furi_thread_flags_get(); - return (flags & LFRFIDEventStopMode); + return flags & LFRFIDEventStopMode; } size_t lfrfid_worker_dict_get_data_size(LFRFIDWorker* worker, LFRFIDProtocol protocol) { diff --git a/lib/lfrfid/protocols/protocol_electra.c b/lib/lfrfid/protocols/protocol_electra.c index 27c2fe5a0..25fcdc514 100644 --- a/lib/lfrfid/protocols/protocol_electra.c +++ b/lib/lfrfid/protocols/protocol_electra.c @@ -198,7 +198,7 @@ static bool electra_can_be_decoded( parity_sum += (*base_data >> (EM_FIRST_ROW_POS - i * EM_BITS_PER_ROW_COUNT + j)) & 1; } - if((parity_sum % 2)) { + if(parity_sum % 2) { return false; } } @@ -211,7 +211,7 @@ static bool electra_can_be_decoded( parity_sum += (*base_data >> (EM_COLUMN_POS - i + j * EM_BITS_PER_ROW_COUNT)) & 1; } - if((parity_sum % 2)) { + if(parity_sum % 2) { FURI_LOG_D( TAG, "Unexpected column parity found. EM4100 data: %016llX", diff --git a/lib/lfrfid/protocols/protocol_em4100.c b/lib/lfrfid/protocols/protocol_em4100.c index 75b5c8dbb..e68bc0e2e 100644 --- a/lib/lfrfid/protocols/protocol_em4100.c +++ b/lib/lfrfid/protocols/protocol_em4100.c @@ -173,7 +173,7 @@ static bool em4100_can_be_decoded( parity_sum += (*card_data >> (EM_FIRST_ROW_POS - i * EM_BITS_PER_ROW_COUNT + j)) & 1; } - if((parity_sum % 2)) { + if(parity_sum % 2) { return false; } } @@ -186,7 +186,7 @@ static bool em4100_can_be_decoded( parity_sum += (*card_data >> (EM_COLUMN_POS - i + j * EM_BITS_PER_ROW_COUNT)) & 1; } - if((parity_sum % 2)) { + if(parity_sum % 2) { return false; } } diff --git a/lib/lfrfid/protocols/protocol_fdx_a.c b/lib/lfrfid/protocols/protocol_fdx_a.c index 98ebd01e3..9849a39b6 100644 --- a/lib/lfrfid/protocols/protocol_fdx_a.c +++ b/lib/lfrfid/protocols/protocol_fdx_a.c @@ -104,7 +104,7 @@ static bool protocol_fdx_a_can_be_decoded(const uint8_t* data) { decoded_data[i] &= 0x7F; } - return (parity_sum == 0); + return parity_sum == 0; } bool protocol_fdx_a_decoder_feed(ProtocolFDXA* protocol, bool level, uint32_t duration) { diff --git a/lib/lfrfid/protocols/protocol_nexwatch.c b/lib/lfrfid/protocols/protocol_nexwatch.c index f88c62197..a794a4a8e 100644 --- a/lib/lfrfid/protocols/protocol_nexwatch.c +++ b/lib/lfrfid/protocols/protocol_nexwatch.c @@ -71,7 +71,7 @@ static bool protocol_nexwatch_check_preamble(uint8_t* data, size_t bit_index) { } static uint8_t protocol_nexwatch_parity_swap(uint8_t parity) { - uint8_t a = (((parity >> 3) & 1)); + uint8_t a = ((parity >> 3) & 1); a |= (((parity >> 1) & 1) << 1); a |= (((parity >> 2) & 1) << 2); a |= ((parity & 1) << 3); diff --git a/lib/lfrfid/protocols/protocol_securakey.c b/lib/lfrfid/protocols/protocol_securakey.c index 4de305d20..a4bfeca60 100644 --- a/lib/lfrfid/protocols/protocol_securakey.c +++ b/lib/lfrfid/protocols/protocol_securakey.c @@ -10,7 +10,8 @@ #include "lfrfid_protocols.h" #include -#define TAG "SECURAKEY" +#define TAG "SECURAKEY" + #define SECURAKEY_RKKT_ENCODED_FULL_SIZE_BITS (96) #define SECURAKEY_RKKT_ENCODED_FULL_SIZE_BYTE (12) diff --git a/lib/nfc/helpers/felica_crc.c b/lib/nfc/helpers/felica_crc.c index bba7cee34..e1b4fc287 100644 --- a/lib/nfc/helpers/felica_crc.c +++ b/lib/nfc/helpers/felica_crc.c @@ -45,7 +45,7 @@ bool felica_crc_check(const BitBuffer* buf) { const uint8_t* data = bit_buffer_get_data(buf); const uint16_t crc_calc = felica_crc_calculate(data, data_size - FELICA_CRC_SIZE); - return (crc_calc == crc_received); + return crc_calc == crc_received; } void felica_crc_trim(BitBuffer* buf) { diff --git a/lib/nfc/helpers/iso13239_crc.c b/lib/nfc/helpers/iso13239_crc.c index 1a97471e5..3837382e3 100644 --- a/lib/nfc/helpers/iso13239_crc.c +++ b/lib/nfc/helpers/iso13239_crc.c @@ -55,7 +55,7 @@ bool iso13239_crc_check(Iso13239CrcType type, const BitBuffer* buf) { const uint8_t* data = bit_buffer_get_data(buf); const uint16_t crc_calc = iso13239_crc_calculate(type, data, data_size - ISO13239_CRC_SIZE); - return (crc_calc == crc_received); + return crc_calc == crc_received; } void iso13239_crc_trim(BitBuffer* buf) { diff --git a/lib/nfc/helpers/iso14443_crc.c b/lib/nfc/helpers/iso14443_crc.c index 33789bd71..88d5f41d2 100644 --- a/lib/nfc/helpers/iso14443_crc.c +++ b/lib/nfc/helpers/iso14443_crc.c @@ -50,7 +50,7 @@ bool iso14443_crc_check(Iso14443CrcType type, const BitBuffer* buf) { const uint8_t* data = bit_buffer_get_data(buf); const uint16_t crc_calc = iso14443_crc_calculate(type, data, data_size - ISO14443_CRC_SIZE); - return (crc_calc == crc_received); + return crc_calc == crc_received; } void iso14443_crc_trim(BitBuffer* buf) { diff --git a/lib/nfc/helpers/nfc_util.c b/lib/nfc/helpers/nfc_util.c index 3002f8ba9..f502b4bfb 100644 --- a/lib/nfc/helpers/nfc_util.c +++ b/lib/nfc/helpers/nfc_util.c @@ -17,7 +17,7 @@ uint8_t nfc_util_even_parity32(uint32_t data) { // data ^= data >> 16; // data ^= data >> 8; // return !nfc_util_odd_byte_parity[data]; - return (__builtin_parity(data) & 0xFF); + return __builtin_parity(data) & 0xFF; } uint8_t nfc_util_odd_parity8(uint8_t data) { diff --git a/lib/nfc/protocols/felica/felica_listener_i.c b/lib/nfc/protocols/felica/felica_listener_i.c index 61a66c8df..b3ae24635 100644 --- a/lib/nfc/protocols/felica/felica_listener_i.c +++ b/lib/nfc/protocols/felica/felica_listener_i.c @@ -39,10 +39,9 @@ static uint32_t felica_wcnt_get_max_value(const FelicaData* data) { static bool felica_wcnt_check_warning_boundary(const FelicaData* data) { const uint32_t* wcnt_ptr = (uint32_t*)data->data.fs.wcnt.data; - return ( - FELICA_SYSTEM_BLOCK_RO_ACCESS(data) && - ((*wcnt_ptr > FELICA_WCNT_MC2_00_WARNING_BEGIN_VALUE) && - (*wcnt_ptr < FELICA_WCNT_MC2_00_WARNING_END_VALUE))); + return FELICA_SYSTEM_BLOCK_RO_ACCESS(data) && + ((*wcnt_ptr > FELICA_WCNT_MC2_00_WARNING_BEGIN_VALUE) && + (*wcnt_ptr < FELICA_WCNT_MC2_00_WARNING_END_VALUE)); } static bool felica_wcnt_check_error_boundary(const FelicaData* data) { @@ -138,7 +137,7 @@ static bool felica_listener_check_write_request_data_size( uint8_t possible_data_size = fact_item_cnt * FELICA_DATA_BLOCK_SIZE; uint8_t fact_data_size = request->base.length - sizeof(FelicaListenerGenericRequest) - instance->block_list_size; - return (possible_data_size <= fact_data_size); + return possible_data_size <= fact_data_size; } static bool felica_listener_test_block_list_size_bounds(const FelicaListenerGenericRequest* req) { diff --git a/lib/nfc/protocols/mf_classic/mf_classic.c b/lib/nfc/protocols/mf_classic/mf_classic.c index 8bf96bff4..4f92201e3 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic.c +++ b/lib/nfc/protocols/mf_classic/mf_classic.c @@ -546,7 +546,7 @@ void mf_classic_set_key_not_found( bool mf_classic_is_block_read(const MfClassicData* data, uint8_t block_num) { furi_check(data); - return (FURI_BIT(data->block_read_mask[block_num / 32], block_num % 32) == 1); + return FURI_BIT(data->block_read_mask[block_num / 32], block_num % 32) == 1; } void mf_classic_set_block_read(MfClassicData* data, uint8_t block_num, MfClassicBlock* block_data) { @@ -661,22 +661,20 @@ static bool mf_classic_is_allowed_access_sector_trailer( } case MfClassicActionKeyAWrite: case MfClassicActionKeyBWrite: { - return ( - (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x01)) || - (key_type == MfClassicKeyTypeB && - (AC == 0x00 || AC == 0x04 || AC == 0x03 || AC == 0x01))); + return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x01)) || + (key_type == MfClassicKeyTypeB && + (AC == 0x00 || AC == 0x04 || AC == 0x03 || AC == 0x01)); } case MfClassicActionKeyBRead: { return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x02 || AC == 0x01)) || (key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x02 || AC == 0x01)); } case MfClassicActionACRead: { - return ((key_type == MfClassicKeyTypeA) || (key_type == MfClassicKeyTypeB)); + return (key_type == MfClassicKeyTypeA) || (key_type == MfClassicKeyTypeB); } case MfClassicActionACWrite: { - return ( - (key_type == MfClassicKeyTypeA && (AC == 0x01)) || - (key_type == MfClassicKeyTypeB && (AC == 0x01 || AC == 0x03 || AC == 0x05))); + return (key_type == MfClassicKeyTypeA && (AC == 0x01)) || + (key_type == MfClassicKeyTypeB && (AC == 0x01 || AC == 0x03 || AC == 0x05)); } default: return false; @@ -727,25 +725,21 @@ bool mf_classic_is_allowed_access_data_block( switch(action) { case MfClassicActionDataRead: { - return ( - (key_type == MfClassicKeyTypeA && !(AC == 0x03 || AC == 0x05 || AC == 0x07)) || - (key_type == MfClassicKeyTypeB && !(AC == 0x07))); + return (key_type == MfClassicKeyTypeA && !(AC == 0x03 || AC == 0x05 || AC == 0x07)) || + (key_type == MfClassicKeyTypeB && !(AC == 0x07)); } case MfClassicActionDataWrite: { - return ( - (key_type == MfClassicKeyTypeA && (AC == 0x00)) || - (key_type == MfClassicKeyTypeB && - (AC == 0x00 || AC == 0x04 || AC == 0x06 || AC == 0x03))); + return (key_type == MfClassicKeyTypeA && (AC == 0x00)) || + (key_type == MfClassicKeyTypeB && + (AC == 0x00 || AC == 0x04 || AC == 0x06 || AC == 0x03)); } case MfClassicActionDataInc: { - return ( - (key_type == MfClassicKeyTypeA && (AC == 0x00)) || - (key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06))); + return (key_type == MfClassicKeyTypeA && (AC == 0x00)) || + (key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06)); } case MfClassicActionDataDec: { - return ( - (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x06 || AC == 0x01)) || - (key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06 || AC == 0x01))); + return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x06 || AC == 0x01)) || + (key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06 || AC == 0x01)); } default: return false; diff --git a/lib/nfc/protocols/mf_plus/mf_plus_poller.c b/lib/nfc/protocols/mf_plus/mf_plus_poller.c index 31b55bc3a..8d1cc1c99 100644 --- a/lib/nfc/protocols/mf_plus/mf_plus_poller.c +++ b/lib/nfc/protocols/mf_plus/mf_plus_poller.c @@ -197,7 +197,7 @@ static bool mf_plus_poller_detect(NfcGenericEvent event, void* context) { } } - return (error == MfPlusErrorNone); + return error == MfPlusErrorNone; } const NfcPollerBase mf_plus_poller = { diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight.c b/lib/nfc/protocols/mf_ultralight/mf_ultralight.c index ec77a53c3..d1f08294f 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight.c +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight.c @@ -598,7 +598,7 @@ uint8_t mf_ultralight_get_pwd_page_num(MfUltralightType type) { bool mf_ultralight_is_page_pwd_or_pack(MfUltralightType type, uint16_t page) { uint8_t pwd_page = mf_ultralight_get_pwd_page_num(type); uint8_t pack_page = pwd_page + 1; - return ((pwd_page != 0) && (page == pwd_page || page == pack_page)); + return (pwd_page != 0) && (page == pwd_page || page == pack_page); } bool mf_ultralight_support_feature(const uint32_t feature_set, const uint32_t features_to_check) { diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c b/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c index 737f37f98..f38badae6 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c @@ -125,7 +125,7 @@ static uint8_t mf_ultralight_get_mirror_data_size(MfUltralightMirrorConf mode) { static uint8_t mf_ultralight_get_mirror_last_page(MfUltralightListener* instance) { uint8_t strSize = mf_ultralight_get_mirror_data_size(instance->mirror.actual_mode); - return (instance->config->mirror_page + 1U + strSize / 4); + return instance->config->mirror_page + 1U + strSize / 4; } static uint8_t mf_ultralight_get_ascii_offset(uint8_t start_page, MfUltralightListener* instance) { @@ -207,7 +207,7 @@ void mf_ultraligt_mirror_format_counter(MfUltralightListener* instance) { } bool mf_ultralight_composite_command_in_progress(MfUltralightListener* instance) { - return (instance->composite_cmd.callback != NULL); + return instance->composite_cmd.callback != NULL; } MfUltralightCommand @@ -550,7 +550,7 @@ static bool mf_ultralight_auth_check_attempts(const MfUltralightListener* instan (1U << instance->config->access.authlim) : instance->config->access.authlim; - return (instance->data->auth_attempts >= authlim); + return instance->data->auth_attempts >= authlim; } bool mf_ultralight_auth_limit_check_and_update(MfUltralightListener* instance, bool auth_success) { diff --git a/lib/one_wire/one_wire_slave.c b/lib/one_wire/one_wire_slave.c index 43d228df0..36edc620f 100644 --- a/lib/one_wire/one_wire_slave.c +++ b/lib/one_wire/one_wire_slave.c @@ -150,7 +150,7 @@ static inline bool onewire_slave_receive_and_process_command(OneWireSlave* bus) } } - return (bus->error == OneWireSlaveErrorResetInProgress); + return bus->error == OneWireSlaveErrorResetInProgress; } return false; diff --git a/lib/subghz/protocols/bin_raw.c b/lib/subghz/protocols/bin_raw.c index 860de9e1f..96f40f9fc 100644 --- a/lib/subghz/protocols/bin_raw.c +++ b/lib/subghz/protocols/bin_raw.c @@ -131,7 +131,7 @@ static uint16_t subghz_protocol_bin_raw_get_full_byte(uint16_t bit_count) { if(bit_count & 0x7) { return (bit_count >> 3) + 1; } else { - return (bit_count >> 3); + return bit_count >> 3; } } diff --git a/lib/subghz/protocols/came.c b/lib/subghz/protocols/came.c index 6eb95a762..645f5eee1 100644 --- a/lib/subghz/protocols/came.c +++ b/lib/subghz/protocols/came.c @@ -12,7 +12,8 @@ * */ -#define TAG "SubGhzProtocolCame" +#define TAG "SubGhzProtocolCame" + #define CAME_12_COUNT_BIT 12 #define CAME_24_COUNT_BIT 24 #define PRASTEL_COUNT_BIT 25 @@ -173,7 +174,7 @@ SubGhzProtocolStatus if(ret != SubGhzProtocolStatusOk) { break; } - if((instance->generic.data_count_bit > PRASTEL_COUNT_BIT)) { + if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) { FURI_LOG_E(TAG, "Wrong number of bits in key"); ret = SubGhzProtocolStatusErrorValueBitCount; break; @@ -336,7 +337,7 @@ SubGhzProtocolStatus if(ret != SubGhzProtocolStatusOk) { break; } - if((instance->generic.data_count_bit > PRASTEL_COUNT_BIT)) { + if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) { FURI_LOG_E(TAG, "Wrong number of bits in key"); ret = SubGhzProtocolStatusErrorValueBitCount; break; diff --git a/lib/subghz/protocols/clemsa.c b/lib/subghz/protocols/clemsa.c index a0547a113..5cbffefed 100644 --- a/lib/subghz/protocols/clemsa.c +++ b/lib/subghz/protocols/clemsa.c @@ -267,13 +267,12 @@ void subghz_protocol_decoder_clemsa_feed(void* context, bool level, uint32_t dur } else if( DURATION_DIFF(duration, subghz_protocol_clemsa_const.te_short * 51) < subghz_protocol_clemsa_const.te_delta * 25) { - if((DURATION_DIFF( - instance->decoder.te_last, subghz_protocol_clemsa_const.te_short) < - subghz_protocol_clemsa_const.te_delta)) { + if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_clemsa_const.te_short) < + subghz_protocol_clemsa_const.te_delta) { subghz_protocol_blocks_add_bit(&instance->decoder, 0); - } else if((DURATION_DIFF( - instance->decoder.te_last, subghz_protocol_clemsa_const.te_long) < - subghz_protocol_clemsa_const.te_delta * 3)) { + } else if( + DURATION_DIFF(instance->decoder.te_last, subghz_protocol_clemsa_const.te_long) < + subghz_protocol_clemsa_const.te_delta * 3) { subghz_protocol_blocks_add_bit(&instance->decoder, 1); } else { instance->decoder.parser_step = ClemsaDecoderStepReset; diff --git a/lib/subghz/protocols/doitrand.c b/lib/subghz/protocols/doitrand.c index 69b8bba4a..cf9618fcb 100644 --- a/lib/subghz/protocols/doitrand.c +++ b/lib/subghz/protocols/doitrand.c @@ -219,8 +219,8 @@ void subghz_protocol_decoder_doitrand_feed(void* context, bool level, uint32_t d } break; case DoitrandDecoderStepFoundStartBit: - if(level && ((DURATION_DIFF(duration, (subghz_protocol_doitrand_const.te_short * 2)) < - subghz_protocol_doitrand_const.te_delta * 3))) { + if(level && (DURATION_DIFF(duration, (subghz_protocol_doitrand_const.te_short * 2)) < + subghz_protocol_doitrand_const.te_delta * 3)) { //Found start bit instance->decoder.parser_step = DoitrandDecoderStepSaveDuration; instance->decoder.decode_data = 0; diff --git a/lib/subghz/protocols/gate_tx.c b/lib/subghz/protocols/gate_tx.c index 2ebd6bb03..d6a6bc7c9 100644 --- a/lib/subghz/protocols/gate_tx.c +++ b/lib/subghz/protocols/gate_tx.c @@ -212,8 +212,8 @@ void subghz_protocol_decoder_gate_tx_feed(void* context, bool level, uint32_t du } break; case GateTXDecoderStepFoundStartBit: - if(level && ((DURATION_DIFF(duration, subghz_protocol_gate_tx_const.te_long) < - subghz_protocol_gate_tx_const.te_delta * 3))) { + if(level && (DURATION_DIFF(duration, subghz_protocol_gate_tx_const.te_long) < + subghz_protocol_gate_tx_const.te_delta * 3)) { //Found start bit instance->decoder.parser_step = GateTXDecoderStepSaveDuration; instance->decoder.decode_data = 0; diff --git a/lib/subghz/protocols/holtek.c b/lib/subghz/protocols/holtek.c index b4029cbe9..b4717f5c6 100644 --- a/lib/subghz/protocols/holtek.c +++ b/lib/subghz/protocols/holtek.c @@ -358,7 +358,7 @@ void subghz_protocol_decoder_holtek_get_string(void* context, FuriString* output if((instance->generic.btn & 0xF) == 0xE) { furi_string_cat_printf(output, "ON\r\n"); - } else if(((instance->generic.btn & 0xF) == 0xB)) { + } else if((instance->generic.btn & 0xF) == 0xB) { furi_string_cat_printf(output, "OFF\r\n"); } } diff --git a/lib/subghz/protocols/keeloq.c b/lib/subghz/protocols/keeloq.c index ca9f7a64f..cee45cfd6 100644 --- a/lib/subghz/protocols/keeloq.c +++ b/lib/subghz/protocols/keeloq.c @@ -758,7 +758,7 @@ static inline bool subghz_protocol_keeloq_check_decrypt_centurion( uint8_t btn) { furi_assert(instance); - if((decrypt >> 28 == btn) && (((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0x1CE))) { + if((decrypt >> 28 == btn) && ((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0x1CE)) { instance->cnt = decrypt & 0x0000FFFF; /*FURI_LOG_I( "KL", diff --git a/lib/subghz/protocols/linear.c b/lib/subghz/protocols/linear.c index 8d3735796..f9d7aaca8 100644 --- a/lib/subghz/protocols/linear.c +++ b/lib/subghz/protocols/linear.c @@ -243,8 +243,8 @@ void subghz_protocol_decoder_linear_feed(void* context, bool level, uint32_t dur if(duration >= (subghz_protocol_linear_const.te_short * 5)) { instance->decoder.parser_step = LinearDecoderStepReset; //checking that the duration matches the guardtime - if((DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) > - subghz_protocol_linear_const.te_delta * 20)) { + if(DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) > + subghz_protocol_linear_const.te_delta * 20) { break; } if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_linear_const.te_short) < diff --git a/lib/subghz/protocols/mastercode.c b/lib/subghz/protocols/mastercode.c index 54ad5bfaa..d4c549a42 100644 --- a/lib/subghz/protocols/mastercode.c +++ b/lib/subghz/protocols/mastercode.c @@ -269,14 +269,14 @@ void subghz_protocol_decoder_mastercode_feed(void* context, bool level, uint32_t } else if( DURATION_DIFF(duration, subghz_protocol_mastercode_const.te_short * 15) < subghz_protocol_mastercode_const.te_delta * 15) { - if((DURATION_DIFF( - instance->decoder.te_last, subghz_protocol_mastercode_const.te_short) < - subghz_protocol_mastercode_const.te_delta)) { + if(DURATION_DIFF( + instance->decoder.te_last, subghz_protocol_mastercode_const.te_short) < + subghz_protocol_mastercode_const.te_delta) { subghz_protocol_blocks_add_bit(&instance->decoder, 0); - } else if((DURATION_DIFF( - instance->decoder.te_last, - subghz_protocol_mastercode_const.te_long) < - subghz_protocol_mastercode_const.te_delta * 8)) { + } else if( + DURATION_DIFF( + instance->decoder.te_last, subghz_protocol_mastercode_const.te_long) < + subghz_protocol_mastercode_const.te_delta * 8) { subghz_protocol_blocks_add_bit(&instance->decoder, 1); } else { instance->decoder.parser_step = MastercodeDecoderStepReset; diff --git a/lib/subghz/protocols/phoenix_v2.c b/lib/subghz/protocols/phoenix_v2.c index 2416a9d01..2fabed73d 100644 --- a/lib/subghz/protocols/phoenix_v2.c +++ b/lib/subghz/protocols/phoenix_v2.c @@ -215,8 +215,8 @@ void subghz_protocol_decoder_phoenix_v2_feed(void* context, bool level, uint32_t } break; case Phoenix_V2DecoderStepFoundStartBit: - if(level && ((DURATION_DIFF(duration, (subghz_protocol_phoenix_v2_const.te_short * 6)) < - subghz_protocol_phoenix_v2_const.te_delta * 4))) { + if(level && (DURATION_DIFF(duration, (subghz_protocol_phoenix_v2_const.te_short * 6)) < + subghz_protocol_phoenix_v2_const.te_delta * 4)) { //Found start bit instance->decoder.parser_step = Phoenix_V2DecoderStepSaveDuration; instance->decoder.decode_data = 0; diff --git a/lib/subghz/protocols/power_smart.c b/lib/subghz/protocols/power_smart.c index 129f9d114..828c4a76e 100644 --- a/lib/subghz/protocols/power_smart.c +++ b/lib/subghz/protocols/power_smart.c @@ -7,7 +7,8 @@ #include "../blocks/generic.h" #include "../blocks/math.h" -#define TAG "SubGhzProtocolPowerSmart" +#define TAG "SubGhzProtocolPowerSmart" + #define POWER_SMART_PACKET_HEADER 0xFD000000AA000000 #define POWER_SMART_PACKET_HEADER_MASK 0xFF000000FF000000 diff --git a/lib/subghz/protocols/princeton.c b/lib/subghz/protocols/princeton.c index a47fd3a98..728187c0f 100644 --- a/lib/subghz/protocols/princeton.c +++ b/lib/subghz/protocols/princeton.c @@ -12,7 +12,8 @@ * */ -#define TAG "SubGhzProtocolPrinceton" +#define TAG "SubGhzProtocolPrinceton" + #define PRINCETON_GUARD_TIME_DEFALUT 30 //GUARD_TIME = PRINCETON_GUARD_TIME_DEFALUT * TE // Guard Time value should be between 15 -> 72 otherwise default value will be used diff --git a/lib/subghz/protocols/raw.c b/lib/subghz/protocols/raw.c index b8682b783..96908130e 100644 --- a/lib/subghz/protocols/raw.c +++ b/lib/subghz/protocols/raw.c @@ -8,7 +8,8 @@ #include #include -#define TAG "SubGhzProtocolRaw" +#define TAG "SubGhzProtocolRaw" + #define SUBGHZ_DOWNLOAD_MAX_SIZE 512 static const SubGhzBlockConst subghz_protocol_raw_const = { diff --git a/lib/toolbox/hex.c b/lib/toolbox/hex.c index e5cdfff17..4b5bd30d3 100644 --- a/lib/toolbox/hex.c +++ b/lib/toolbox/hex.c @@ -4,10 +4,10 @@ bool hex_char_to_hex_nibble(char c, uint8_t* nibble) { furi_check(nibble); - if((c >= '0' && c <= '9')) { + if(c >= '0' && c <= '9') { *nibble = c - '0'; return true; - } else if((c >= 'A' && c <= 'F')) { + } else if(c >= 'A' && c <= 'F') { *nibble = c - 'A' + 10; return true; } else if(c >= 'a' && c <= 'f') { diff --git a/lib/toolbox/level_duration.h b/lib/toolbox/level_duration.h index 0669e608d..cb50fa3b4 100644 --- a/lib/toolbox/level_duration.h +++ b/lib/toolbox/level_duration.h @@ -68,11 +68,11 @@ static inline LevelDuration level_duration_reset() { } static inline bool level_duration_is_reset(LevelDuration level_duration) { - return (level_duration == LEVEL_DURATION_RESET); + return level_duration == LEVEL_DURATION_RESET; } static inline bool level_duration_get_level(LevelDuration level_duration) { - return (level_duration > 0); + return level_duration > 0; } static inline uint32_t level_duration_get_duration(LevelDuration level_duration) { diff --git a/lib/toolbox/stream/stream.c b/lib/toolbox/stream/stream.c index 9aff8bd4f..0e4c5fc7a 100644 --- a/lib/toolbox/stream/stream.c +++ b/lib/toolbox/stream/stream.c @@ -144,7 +144,7 @@ static bool stream_write_struct(Stream* stream, const void* context) { furi_check(stream); furi_check(context); const StreamWriteData* write_data = context; - return (stream_write(stream, write_data->data, write_data->size) == write_data->size); + return stream_write(stream, write_data->data, write_data->size) == write_data->size; } bool stream_read_line(Stream* stream, FuriString* str_result) { diff --git a/lib/toolbox/stream/string_stream.c b/lib/toolbox/stream/string_stream.c index 742547fb7..7b014391e 100644 --- a/lib/toolbox/stream/string_stream.c +++ b/lib/toolbox/stream/string_stream.c @@ -51,7 +51,7 @@ static void string_stream_free(StringStream* stream) { } static bool string_stream_eof(StringStream* stream) { - return (string_stream_tell(stream) >= string_stream_size(stream)); + return string_stream_tell(stream) >= string_stream_size(stream); } static void string_stream_clean(StringStream* stream) { diff --git a/lib/toolbox/tar/tar_archive.c b/lib/toolbox/tar/tar_archive.c index ad3b92eda..80144a0f4 100644 --- a/lib/toolbox/tar/tar_archive.c +++ b/lib/toolbox/tar/tar_archive.c @@ -6,7 +6,8 @@ #include #include -#define TAG "TarArch" +#define TAG "TarArch" + #define MAX_NAME_LEN 255 #define FILE_BLOCK_SIZE 512 @@ -245,12 +246,12 @@ bool tar_archive_get_read_progress(TarArchive* archive, int32_t* processed, int3 bool tar_archive_dir_add_element(TarArchive* archive, const char* dirpath) { furi_check(archive); - return (mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS); + return mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS; } bool tar_archive_finalize(TarArchive* archive) { furi_check(archive); - return (mtar_finalize(&archive->tar) == MTAR_ESUCCESS); + return mtar_finalize(&archive->tar) == MTAR_ESUCCESS; } bool tar_archive_store_data( @@ -260,16 +261,15 @@ bool tar_archive_store_data( const int32_t data_len) { furi_check(archive); - return ( - tar_archive_file_add_header(archive, path, data_len) && - tar_archive_file_add_data_block(archive, data, data_len) && - tar_archive_file_finalize(archive)); + return tar_archive_file_add_header(archive, path, data_len) && + tar_archive_file_add_data_block(archive, data, data_len) && + tar_archive_file_finalize(archive); } bool tar_archive_file_add_header(TarArchive* archive, const char* path, const int32_t data_len) { furi_check(archive); - return (mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS); + return mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS; } bool tar_archive_file_add_data_block( @@ -278,12 +278,12 @@ bool tar_archive_file_add_data_block( const int32_t block_len) { furi_check(archive); - return (mtar_write_data(&archive->tar, data_block, block_len) == block_len); + return mtar_write_data(&archive->tar, data_block, block_len) == block_len; } bool tar_archive_file_finalize(TarArchive* archive) { furi_check(archive); - return (mtar_end_data(&archive->tar) == MTAR_ESUCCESS); + return mtar_end_data(&archive->tar) == MTAR_ESUCCESS; } typedef struct { @@ -396,7 +396,7 @@ bool tar_archive_unpack_to( FURI_LOG_I(TAG, "Restoring '%s'", destination); - return (mtar_foreach(&archive->tar, archive_extract_foreach_cb, ¶m) == MTAR_ESUCCESS); + return mtar_foreach(&archive->tar, archive_extract_foreach_cb, ¶m) == MTAR_ESUCCESS; } bool tar_archive_add_file( diff --git a/lib/u8g2/u8g2_glue.c b/lib/u8g2/u8g2_glue.c index 39df5d891..b3e74c229 100644 --- a/lib/u8g2/u8g2_glue.c +++ b/lib/u8g2/u8g2_glue.c @@ -142,7 +142,7 @@ uint8_t u8x8_d_st756x_common(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* a x *= 8; x += u8x8->x_offset; u8x8_cad_SendCmd(u8x8, 0x010 | (x >> 4)); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x & 15))); + u8x8_cad_SendCmd(u8x8, 0x000 | (x & 15)); u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t*)arg_ptr)->y_pos)); c = ((u8x8_tile_t*)arg_ptr)->cnt; diff --git a/targets/f7/ble_glue/ble_glue.c b/targets/f7/ble_glue/ble_glue.c index c50360361..73bb41bad 100644 --- a/targets/f7/ble_glue/ble_glue.c +++ b/targets/f7/ble_glue/ble_glue.c @@ -370,7 +370,7 @@ static void ble_glue_clear_shared_memory(void) { } bool ble_glue_reinit_c2(void) { - return (SHCI_C2_Reinit() == SHCI_Success); + return SHCI_C2_Reinit() == SHCI_Success; } BleGlueCommandResult ble_glue_fus_stack_delete(void) { diff --git a/targets/f7/furi_hal/furi_hal_crypto.c b/targets/f7/furi_hal/furi_hal_crypto.c index 1c8f9011c..1879eb2ca 100644 --- a/targets/f7/furi_hal/furi_hal_crypto.c +++ b/targets/f7/furi_hal/furi_hal_crypto.c @@ -192,7 +192,7 @@ bool furi_hal_crypto_enclave_store_key(FuriHalCryptoKey* key, uint8_t* slot) { SHCI_CmdStatus_t shci_state = SHCI_C2_FUS_StoreUsrKey(&pParam, slot); furi_check(furi_mutex_release(furi_hal_crypto_mutex) == FuriStatusOk); - return (shci_state == SHCI_Success); + return shci_state == SHCI_Success; } static void crypto_key_init(uint32_t* key, uint32_t* iv) { @@ -291,7 +291,7 @@ bool furi_hal_crypto_enclave_unload_key(uint8_t slot) { furi_check(furi_mutex_release(furi_hal_crypto_mutex) == FuriStatusOk); - return (shci_state == SHCI_Success); + return shci_state == SHCI_Success; } bool furi_hal_crypto_load_key(const uint8_t* key, const uint8_t* iv) { @@ -631,7 +631,7 @@ static bool furi_hal_crypto_gcm_compare_tag(const uint8_t* tag1, const uint8_t* diff |= tag1[i] ^ tag2[i]; } - return (diff == 0); + return diff == 0; } bool furi_hal_crypto_gcm( diff --git a/targets/f7/furi_hal/furi_hal_ibutton.c b/targets/f7/furi_hal/furi_hal_ibutton.c index 59becc615..4f7c5e473 100644 --- a/targets/f7/furi_hal/furi_hal_ibutton.c +++ b/targets/f7/furi_hal/furi_hal_ibutton.c @@ -7,7 +7,8 @@ #include -#define TAG "FuriHalIbutton" +#define TAG "FuriHalIbutton" + #define FURI_HAL_IBUTTON_TIMER TIM1 #define FURI_HAL_IBUTTON_TIMER_BUS FuriHalBusTIM1 #define FURI_HAL_IBUTTON_TIMER_IRQ FuriHalInterruptIdTim1UpTim16 diff --git a/targets/f7/furi_hal/furi_hal_memory.c b/targets/f7/furi_hal/furi_hal_memory.c index 780a9d743..cae87342a 100644 --- a/targets/f7/furi_hal/furi_hal_memory.c +++ b/targets/f7/furi_hal/furi_hal_memory.c @@ -65,11 +65,11 @@ void furi_hal_memory_init(void) { TAG, "SRAM2B: 0x%p, %lu", memory->region[SRAM_B].start, memory->region[SRAM_B].size); if((memory->region[SRAM_A].size > 0) || (memory->region[SRAM_B].size > 0)) { - if((memory->region[SRAM_A].size > 0)) { + if(memory->region[SRAM_A].size > 0) { FURI_LOG_I(TAG, "SRAM2A clear"); memset(memory->region[SRAM_A].start, 0, memory->region[SRAM_A].size); } - if((memory->region[SRAM_B].size > 0)) { + if(memory->region[SRAM_B].size > 0) { FURI_LOG_I(TAG, "SRAM2B clear"); memset(memory->region[SRAM_B].start, 0, memory->region[SRAM_B].size); } diff --git a/targets/f7/furi_hal/furi_hal_nfc.c b/targets/f7/furi_hal/furi_hal_nfc.c index 550f1b16e..ee7a04e45 100644 --- a/targets/f7/furi_hal/furi_hal_nfc.c +++ b/targets/f7/furi_hal/furi_hal_nfc.c @@ -253,7 +253,7 @@ FuriHalNfcError furi_hal_nfc_init(void) { } static bool furi_hal_nfc_is_mine(void) { - return (furi_mutex_get_owner(furi_hal_nfc.mutex) == furi_thread_get_current_id()); + return furi_mutex_get_owner(furi_hal_nfc.mutex) == furi_thread_get_current_id(); } FuriHalNfcError furi_hal_nfc_acquire(void) { diff --git a/targets/f7/furi_hal/furi_hal_random.c b/targets/f7/furi_hal/furi_hal_random.c index fd557fa98..8b75a05c5 100644 --- a/targets/f7/furi_hal/furi_hal_random.c +++ b/targets/f7/furi_hal/furi_hal_random.c @@ -75,9 +75,9 @@ void srand(unsigned seed) { } int rand(void) { - return (furi_hal_random_get() & RAND_MAX); + return furi_hal_random_get() & RAND_MAX; } long random(void) { - return (furi_hal_random_get() & RAND_MAX); + return furi_hal_random_get() & RAND_MAX; } diff --git a/targets/f7/furi_hal/furi_hal_rfid.c b/targets/f7/furi_hal/furi_hal_rfid.c index df84f7490..34bb3a516 100644 --- a/targets/f7/furi_hal/furi_hal_rfid.c +++ b/targets/f7/furi_hal/furi_hal_rfid.c @@ -585,7 +585,6 @@ bool furi_hal_rfid_field_is_present(uint32_t* frequency) { furi_check(frequency); *frequency = furi_hal_rfid->field.counter * 10; - return ( - (*frequency >= FURI_HAL_RFID_FIELD_FREQUENCY_MIN) && - (*frequency <= FURI_HAL_RFID_FIELD_FREQUENCY_MAX)); + return (*frequency >= FURI_HAL_RFID_FIELD_FREQUENCY_MIN) && + (*frequency <= FURI_HAL_RFID_FIELD_FREQUENCY_MAX); } diff --git a/targets/f7/furi_hal/furi_hal_sd.c b/targets/f7/furi_hal/furi_hal_sd.c index 5c5f8a394..eca5b6da9 100644 --- a/targets/f7/furi_hal/furi_hal_sd.c +++ b/targets/f7/furi_hal/furi_hal_sd.c @@ -324,7 +324,7 @@ static FuriStatus sd_spi_wait_for_data(uint8_t data, uint32_t timeout_ms) { if(furi_hal_cortex_timer_is_expired(timer)) { return FuriStatusErrorTimeout; } - } while((byte != data)); + } while(byte != data); return FuriStatusOk; } diff --git a/targets/f7/furi_hal/furi_hal_subghz.c b/targets/f7/furi_hal/furi_hal_subghz.c index 095624d40..c2efe1fd3 100644 --- a/targets/f7/furi_hal/furi_hal_subghz.c +++ b/targets/f7/furi_hal/furi_hal_subghz.c @@ -271,7 +271,7 @@ bool furi_hal_subghz_is_rx_data_crc_valid(void) { uint8_t data[1]; cc1101_read_reg(&furi_hal_spi_bus_handle_subghz, CC1101_STATUS_LQI | CC1101_BURST, data); furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); - if(((data[0] >> 7) & 0x01)) { + if((data[0] >> 7) & 0x01) { return true; } else { return false; diff --git a/targets/f7/furi_hal/furi_hal_usb_cdc.c b/targets/f7/furi_hal/furi_hal_usb_cdc.c index 8525022c0..cfedb5e76 100644 --- a/targets/f7/furi_hal/furi_hal_usb_cdc.c +++ b/targets/f7/furi_hal/furi_hal_usb_cdc.c @@ -518,7 +518,7 @@ int32_t furi_hal_cdc_receive(uint8_t if_num, uint8_t* buf, uint16_t max_len) { } else { len = usbd_ep_read(usb_dev, CDC1_RXD_EP, buf, max_len); } - return ((len < 0) ? 0 : len); + return (len < 0) ? 0 : len; } static void cdc_on_wakeup(usbd_device* dev) { diff --git a/targets/f7/furi_hal/furi_hal_usb_u2f.c b/targets/f7/furi_hal/furi_hal_usb_u2f.c index d567795c0..05f498376 100644 --- a/targets/f7/furi_hal/furi_hal_usb_u2f.c +++ b/targets/f7/furi_hal/furi_hal_usb_u2f.c @@ -237,7 +237,7 @@ void furi_hal_hid_u2f_send_response(uint8_t* data, uint8_t len) { uint32_t furi_hal_hid_u2f_get_request(uint8_t* data) { int32_t len = usbd_ep_read(usb_dev, HID_EP_IN, data, HID_U2F_PACKET_LEN); - return ((len < 0) ? 0 : len); + return (len < 0) ? 0 : len; } static void hid_u2f_rx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) {