[FL-2870] Printf function attributes (#1841)

* Furi strings: printf attribute
* Logs: printf attribute
* Plugins: adapt
* Plugins: accommodate
* Unit tests: accommodate

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Sergey Gavrilov
2022-10-07 23:35:15 +10:00
committed by GitHub
parent 1f742b611a
commit 4000f0cac5
78 changed files with 187 additions and 156 deletions
+2 -2
View File
@@ -77,7 +77,7 @@ static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) {
notification_message(bt->notification, &sequence_display_backlight_on);
FuriString* pin_str;
dialog_message_set_icon(bt->dialog_message, &I_BLE_Pairing_128x64, 0, 0);
pin_str = furi_string_alloc_printf("Verify code\n%06d", pin);
pin_str = furi_string_alloc_printf("Verify code\n%06ld", pin);
dialog_message_set_text(
bt->dialog_message, furi_string_get_cstr(pin_str), 64, 4, AlignCenter, AlignTop);
dialog_message_set_buttons(bt->dialog_message, "Cancel", "OK", NULL);
@@ -277,7 +277,7 @@ static bool bt_on_gap_event_callback(GapEvent event, void* context) {
static void bt_on_key_storage_change_callback(uint8_t* addr, uint16_t size, void* context) {
furi_assert(context);
Bt* bt = context;
FURI_LOG_I(TAG, "Changed addr start: %08lX, size changed: %d", addr, size);
FURI_LOG_I(TAG, "Changed addr start: %p, size changed: %d", addr, size);
BtMessage message = {.type = BtMessageTypeKeysStorageUpdated};
furi_check(
furi_message_queue_put(bt->message_queue, &message, FuriWaitForever) == FuriStatusOk);
@@ -304,7 +304,7 @@ static bool animation_storage_load_frames(
if(file_info.size > max_filesize) {
FURI_LOG_E(
TAG,
"Filesize %d, max: %d (width %d, height %d)",
"Filesize %lld, max: %d (width %d, height %d)",
file_info.size,
max_filesize,
width,
@@ -329,7 +329,7 @@ static bool animation_storage_load_frames(
if(!frames_ok) {
FURI_LOG_E(
TAG,
"Load \'%s\' failed, %dx%d, size: %d",
"Load \'%s\' failed, %dx%d, size: %lld",
furi_string_get_cstr(filename),
width,
height,
@@ -171,7 +171,7 @@ void dolphin_state_on_deed(DolphinState* dolphin_state, DolphinDeed deed) {
FURI_LOG_D(
TAG,
"icounter %d, butthurt %d",
"icounter %ld, butthurt %ld",
dolphin_state->data.icounter,
dolphin_state->data.butthurt);
}
+3 -3
View File
@@ -260,7 +260,7 @@ void gui_input(Gui* gui, InputEvent* input_event) {
"non-complementary input, discarding key: %s type: %s, sequence: %p",
input_get_key_name(input_event->key),
input_get_type_name(input_event->type),
input_event->sequence);
(void*)input_event->sequence);
return;
}
@@ -290,7 +290,7 @@ void gui_input(Gui* gui, InputEvent* input_event) {
view_port,
input_get_key_name(input_event->key),
input_get_type_name(input_event->type),
input_event->sequence);
(void*)input_event->sequence);
view_port_input(gui->ongoing_input_view_port, input_event);
} else {
FURI_LOG_D(
@@ -300,7 +300,7 @@ void gui_input(Gui* gui, InputEvent* input_event) {
view_port,
input_get_key_name(input_event->key),
input_get_type_name(input_event->type),
input_event->sequence);
(void*)input_event->sequence);
}
gui_unlock(gui);
@@ -291,7 +291,7 @@ static int32_t browser_worker(void* context) {
browser_folder_init(browser, path, filename, &items_cnt, &file_idx);
FURI_LOG_D(
TAG,
"Enter folder: %s items: %u idx: %d",
"Enter folder: %s items: %lu idx: %ld",
furi_string_get_cstr(path),
items_cnt,
file_idx);
@@ -313,7 +313,7 @@ static int32_t browser_worker(void* context) {
}
FURI_LOG_D(
TAG,
"Exit to: %s items: %u idx: %d",
"Exit to: %s items: %lu idx: %ld",
furi_string_get_cstr(path),
items_cnt,
file_idx);
@@ -330,7 +330,7 @@ static int32_t browser_worker(void* context) {
browser_folder_init(browser, path, filename, &items_cnt, &file_idx);
FURI_LOG_D(
TAG,
"Refresh folder: %s items: %u idx: %d",
"Refresh folder: %s items: %lu idx: %ld",
furi_string_get_cstr(path),
items_cnt,
browser->item_sel_idx);
@@ -340,7 +340,8 @@ static int32_t browser_worker(void* context) {
}
if(flags & WorkerEvtLoad) {
FURI_LOG_D(TAG, "Load offset: %u cnt: %u", browser->load_offset, browser->load_count);
FURI_LOG_D(
TAG, "Load offset: %lu cnt: %lu", browser->load_offset, browser->load_count);
browser_folder_load(browser, path, browser->load_offset, browser->load_count);
}
+2 -2
View File
@@ -246,7 +246,7 @@ void view_dispatcher_handle_input(ViewDispatcher* view_dispatcher, InputEvent* e
"non-complementary input, discarding key: %s, type: %s, sequence: %p",
input_get_key_name(event->key),
input_get_type_name(event->type),
event->sequence);
(void*)event->sequence);
return;
}
@@ -286,7 +286,7 @@ void view_dispatcher_handle_input(ViewDispatcher* view_dispatcher, InputEvent* e
view_dispatcher->current_view,
input_get_key_name(event->key),
input_get_type_name(event->type),
event->sequence);
(void*)event->sequence);
view_input(view_dispatcher->ongoing_input_view, event);
}
}
+9 -9
View File
@@ -32,7 +32,7 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
furi_assert(!rpc_app->last_id);
furi_assert(!rpc_app->last_data);
FURI_LOG_D(TAG, "StartProcess: id %d", request->command_id);
FURI_LOG_D(TAG, "StartProcess: id %ld", request->command_id);
PB_CommandStatus result = PB_CommandStatus_ERROR_APP_CANT_START;
@@ -63,7 +63,7 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
furi_record_close(RECORD_LOADER);
FURI_LOG_D(TAG, "StartProcess: response id %d, result %d", request->command_id, result);
FURI_LOG_D(TAG, "StartProcess: response id %ld, result %d", request->command_id, result);
rpc_send_and_release_empty(session, request->command_id, result);
}
@@ -108,7 +108,7 @@ static void rpc_system_app_exit_request(const PB_Main* request, void* context) {
PB_CommandStatus status;
if(rpc_app->app_callback) {
FURI_LOG_D(TAG, "ExitRequest: id %d", request->command_id);
FURI_LOG_D(TAG, "ExitRequest: id %ld", request->command_id);
furi_assert(!rpc_app->last_id);
furi_assert(!rpc_app->last_data);
rpc_app->last_id = request->command_id;
@@ -116,7 +116,7 @@ static void rpc_system_app_exit_request(const PB_Main* request, void* context) {
} else {
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
FURI_LOG_E(
TAG, "ExitRequest: APP_NOT_RUNNING, id %d, status: %d", request->command_id, status);
TAG, "ExitRequest: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
rpc_send_and_release_empty(session, request->command_id, status);
}
}
@@ -132,7 +132,7 @@ static void rpc_system_app_load_file(const PB_Main* request, void* context) {
PB_CommandStatus status;
if(rpc_app->app_callback) {
FURI_LOG_D(TAG, "LoadFile: id %d", request->command_id);
FURI_LOG_D(TAG, "LoadFile: id %ld", request->command_id);
furi_assert(!rpc_app->last_id);
furi_assert(!rpc_app->last_data);
rpc_app->last_id = request->command_id;
@@ -141,7 +141,7 @@ static void rpc_system_app_load_file(const PB_Main* request, void* context) {
} else {
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
FURI_LOG_E(
TAG, "LoadFile: APP_NOT_RUNNING, id %d, status: %d", request->command_id, status);
TAG, "LoadFile: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
rpc_send_and_release_empty(session, request->command_id, status);
}
}
@@ -166,7 +166,7 @@ static void rpc_system_app_button_press(const PB_Main* request, void* context) {
} else {
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
FURI_LOG_E(
TAG, "ButtonPress: APP_NOT_RUNNING, id %d, status: %d", request->command_id, status);
TAG, "ButtonPress: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
rpc_send_and_release_empty(session, request->command_id, status);
}
}
@@ -190,7 +190,7 @@ static void rpc_system_app_button_release(const PB_Main* request, void* context)
} else {
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
FURI_LOG_E(
TAG, "ButtonRelease: APP_NOT_RUNNING, id %d, status: %d", request->command_id, status);
TAG, "ButtonRelease: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
rpc_send_and_release_empty(session, request->command_id, status);
}
}
@@ -243,7 +243,7 @@ void rpc_system_app_confirm(RpcAppSystem* rpc_app, RpcAppSystemEvent event, bool
free(rpc_app->last_data);
rpc_app->last_data = NULL;
}
FURI_LOG_D(TAG, "AppConfirm: event %d last_id %d status %d", event, last_id, status);
FURI_LOG_D(TAG, "AppConfirm: event %d last_id %ld status %d", event, last_id, status);
rpc_send_and_release_empty(session, last_id, status);
break;
default:
+1 -1
View File
@@ -44,7 +44,7 @@ void rpc_cli_command_start_session(Cli* cli, FuriString* args, void* context) {
Rpc* rpc = context;
uint32_t mem_before = memmgr_get_free_heap();
FURI_LOG_D(TAG, "Free memory %d", mem_before);
FURI_LOG_D(TAG, "Free memory %ld", mem_before);
furi_hal_usb_lock();
RpcSession* rpc_session = rpc_session_open(rpc);
+2 -2
View File
@@ -158,9 +158,9 @@ void rpc_debug_print_message(const PB_Main* message) {
case PB_Main_storage_info_response_tag: {
furi_string_cat_printf(str, "\tinfo_response {\r\n");
furi_string_cat_printf(
str, "\t\ttotal_space: %lu\r\n", message->content.storage_info_response.total_space);
str, "\t\ttotal_space: %llu\r\n", message->content.storage_info_response.total_space);
furi_string_cat_printf(
str, "\t\tfree_space: %lu\r\n", message->content.storage_info_response.free_space);
str, "\t\tfree_space: %llu\r\n", message->content.storage_info_response.free_space);
break;
}
case PB_Main_storage_stat_request_tag: {
@@ -119,7 +119,11 @@ bool storage_file_open(
furi_event_flag_free(event);
FURI_LOG_T(
TAG, "File %p - %p open (%s)", (uint32_t)file - SRAM_BASE, file->file_id - SRAM_BASE, path);
TAG,
"File %p - %p open (%s)",
(void*)((uint32_t)file - SRAM_BASE),
(void*)(file->file_id - SRAM_BASE),
path);
return result;
}
@@ -132,7 +136,11 @@ bool storage_file_close(File* file) {
S_API_MESSAGE(StorageCommandFileClose);
S_API_EPILOGUE;
FURI_LOG_T(TAG, "File %p - %p closed", (uint32_t)file - SRAM_BASE, file->file_id - SRAM_BASE);
FURI_LOG_T(
TAG,
"File %p - %p closed",
(void*)((uint32_t)file - SRAM_BASE),
(void*)(file->file_id - SRAM_BASE));
file->type = FileTypeClosed;
return S_RETURN_BOOL;
@@ -291,7 +299,11 @@ bool storage_dir_open(File* file, const char* path) {
furi_event_flag_free(event);
FURI_LOG_T(
TAG, "Dir %p - %p open (%s)", (uint32_t)file - SRAM_BASE, file->file_id - SRAM_BASE, path);
TAG,
"Dir %p - %p open (%s)",
(void*)((uint32_t)file - SRAM_BASE),
(void*)(file->file_id - SRAM_BASE),
path);
return result;
}
@@ -303,7 +315,11 @@ bool storage_dir_close(File* file) {
S_API_MESSAGE(StorageCommandDirClose);
S_API_EPILOGUE;
FURI_LOG_T(TAG, "Dir %p - %p closed", (uint32_t)file - SRAM_BASE, file->file_id - SRAM_BASE);
FURI_LOG_T(
TAG,
"Dir %p - %p closed",
(void*)((uint32_t)file - SRAM_BASE),
(void*)(file->file_id - SRAM_BASE));
file->type = FileTypeClosed;
@@ -675,7 +691,7 @@ File* storage_file_alloc(Storage* storage) {
file->type = FileTypeClosed;
file->storage = storage;
FURI_LOG_T(TAG, "File/Dir %p alloc", (uint32_t)file - SRAM_BASE);
FURI_LOG_T(TAG, "File/Dir %p alloc", (void*)((uint32_t)file - SRAM_BASE));
return file;
}
@@ -697,7 +713,7 @@ void storage_file_free(File* file) {
}
}
FURI_LOG_T(TAG, "File/Dir %p free", (uint32_t)file - SRAM_BASE);
FURI_LOG_T(TAG, "File/Dir %p free", (void*)((uint32_t)file - SRAM_BASE));
free(file);
}
@@ -77,12 +77,12 @@ static int storage_int_device_read(
FURI_LOG_T(
TAG,
"Device read: block %d, off %d, buffer: %p, size %d, translated address: %p",
"Device read: block %ld, off %ld, buffer: %p, size %ld, translated address: %p",
block,
off,
buffer,
size,
address);
(void*)address);
memcpy(buffer, (void*)address, size);
@@ -100,12 +100,12 @@ static int storage_int_device_prog(
FURI_LOG_T(
TAG,
"Device prog: block %d, off %d, buffer: %p, size %d, translated address: %p",
"Device prog: block %ld, off %ld, buffer: %p, size %ld, translated address: %p",
block,
off,
buffer,
size,
address);
(void*)address);
int ret = 0;
while(size > 0) {
@@ -122,7 +122,7 @@ static int storage_int_device_erase(const struct lfs_config* c, lfs_block_t bloc
LFSData* lfs_data = c->context;
size_t page = lfs_data->start_page + block;
FURI_LOG_D(TAG, "Device erase: page %d, translated page: %x", block, page);
FURI_LOG_D(TAG, "Device erase: page %ld, translated page: %x", block, page);
furi_hal_flash_erase(page);
return 0;
@@ -740,8 +740,8 @@ void storage_int_init(StorageData* storage) {
LFSData* lfs_data = storage_int_lfs_data_alloc();
FURI_LOG_I(
TAG,
"Config: start %p, read %d, write %d, page size: %d, page count: %d, cycles: %d",
lfs_data->start_address,
"Config: start %p, read %ld, write %ld, page size: %ld, page count: %ld, cycles: %ld",
(void*)lfs_data->start_address,
lfs_data->config.read_size,
lfs_data->config.prog_size,
lfs_data->config.block_size,