[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:
@@ -7,8 +7,8 @@
|
||||
|
||||
uint16_t archive_favorites_count(void* context);
|
||||
bool archive_favorites_read(void* context);
|
||||
bool archive_favorites_delete(const char* format, ...);
|
||||
bool archive_is_favorite(const char* format, ...);
|
||||
bool archive_favorites_delete(const char* format, ...) _ATTRIBUTE((__format__(__printf__, 1, 2)));
|
||||
bool archive_is_favorite(const char* format, ...) _ATTRIBUTE((__format__(__printf__, 1, 2)));
|
||||
bool archive_favorites_rename(const char* src, const char* dst);
|
||||
void archive_add_to_favorites(const char* file_path);
|
||||
void archive_favorites_save(void* context);
|
||||
|
||||
@@ -86,5 +86,7 @@ ARRAY_DEF(
|
||||
|
||||
void archive_set_file_type(ArchiveFile_t* file, const char* path, bool is_folder, bool is_app);
|
||||
bool archive_get_items(void* context, const char* path);
|
||||
void archive_file_append(const char* path, const char* format, ...);
|
||||
void archive_delete_file(void* context, const char* format, ...);
|
||||
void archive_file_append(const char* path, const char* format, ...)
|
||||
_ATTRIBUTE((__format__(__printf__, 2, 3)));
|
||||
void archive_delete_file(void* context, const char* format, ...)
|
||||
_ATTRIBUTE((__format__(__printf__, 2, 3)));
|
||||
|
||||
@@ -323,7 +323,7 @@ static bool ducky_set_usb_id(BadUsbScript* bad_usb, const char* line) {
|
||||
}
|
||||
FURI_LOG_D(
|
||||
WORKER_TAG,
|
||||
"set id: %04X:%04X mfr:%s product:%s",
|
||||
"set id: %04lX:%04lX mfr:%s product:%s",
|
||||
bad_usb->hid_cfg.vid,
|
||||
bad_usb->hid_cfg.pid,
|
||||
bad_usb->hid_cfg.manuf,
|
||||
@@ -388,7 +388,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil
|
||||
return 0;
|
||||
} else if(delay_val < 0) { // Script error
|
||||
bad_usb->st.error_line = bad_usb->st.line_cur - 1;
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %lu", bad_usb->st.line_cur - 1);
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur - 1);
|
||||
return SCRIPT_STATE_ERROR;
|
||||
} else {
|
||||
return (delay_val + bad_usb->defdelay);
|
||||
@@ -420,7 +420,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil
|
||||
delay_val = ducky_parse_line(bad_usb, bad_usb->line);
|
||||
if(delay_val < 0) {
|
||||
bad_usb->st.error_line = bad_usb->st.line_cur;
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %lu", bad_usb->st.line_cur);
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur);
|
||||
return SCRIPT_STATE_ERROR;
|
||||
} else {
|
||||
return (delay_val + bad_usb->defdelay);
|
||||
|
||||
@@ -91,7 +91,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) {
|
||||
furi_string_reset(disp_str);
|
||||
canvas_draw_icon(canvas, 117, 22, &I_Percent_10x14);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
furi_string_printf(disp_str, "delay %us", model->state.delay_remain);
|
||||
furi_string_printf(disp_str, "delay %lus", model->state.delay_remain);
|
||||
canvas_draw_str_aligned(
|
||||
canvas, 127, 46, AlignRight, AlignBottom, furi_string_get_cstr(disp_str));
|
||||
furi_string_reset(disp_str);
|
||||
|
||||
@@ -31,7 +31,7 @@ bool elf_resolve_from_hashtable(const char* name, Elf32_Addr* address) {
|
||||
|
||||
auto find_res = std::lower_bound(elf_api_table.cbegin(), elf_api_table.cend(), key);
|
||||
if((find_res == elf_api_table.cend() || (find_res->hash != gnu_sym_hash))) {
|
||||
FURI_LOG_W(TAG, "Cant find symbol '%s' (hash %x)!", name, gnu_sym_hash);
|
||||
FURI_LOG_W(TAG, "Cant find symbol '%s' (hash %lx)!", name, gnu_sym_hash);
|
||||
result = false;
|
||||
} else {
|
||||
result = true;
|
||||
|
||||
@@ -92,14 +92,14 @@ static void infrared_find_vacant_remote_name(FuriString* name, const char* path)
|
||||
uint32_t i = 1;
|
||||
do {
|
||||
furi_string_printf(
|
||||
path_temp, "%s%u%s", furi_string_get_cstr(base_path), ++i, INFRARED_APP_EXTENSION);
|
||||
path_temp, "%s%lu%s", furi_string_get_cstr(base_path), ++i, INFRARED_APP_EXTENSION);
|
||||
status = storage_common_stat(storage, furi_string_get_cstr(path_temp), NULL);
|
||||
} while(status == FSE_OK);
|
||||
|
||||
furi_string_free(path_temp);
|
||||
|
||||
if(status == FSE_NOT_EXIST) {
|
||||
furi_string_cat_printf(name, "%u", i);
|
||||
furi_string_cat_printf(name, "%lu", i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ static bool infrared_signal_is_raw_valid(InfraredRawSignal* raw) {
|
||||
if((raw->frequency > INFRARED_MAX_FREQUENCY) || (raw->frequency < INFRARED_MIN_FREQUENCY)) {
|
||||
FURI_LOG_E(
|
||||
TAG,
|
||||
"Frequency is out of range (%lX - %lX): %lX",
|
||||
"Frequency is out of range (%X - %X): %lX",
|
||||
INFRARED_MIN_FREQUENCY,
|
||||
INFRARED_MAX_FREQUENCY,
|
||||
raw->frequency);
|
||||
@@ -74,7 +74,7 @@ static bool infrared_signal_is_raw_valid(InfraredRawSignal* raw) {
|
||||
} else if((raw->timings_size <= 0) || (raw->timings_size > MAX_TIMINGS_AMOUNT)) {
|
||||
FURI_LOG_E(
|
||||
TAG,
|
||||
"Timings amount is out of range (0 - %lX): %lX",
|
||||
"Timings amount is out of range (0 - %X): %X",
|
||||
MAX_TIMINGS_AMOUNT,
|
||||
raw->timings_size);
|
||||
return false;
|
||||
|
||||
@@ -27,7 +27,7 @@ void nfc_scene_mf_classic_keys_list_prepare(Nfc* nfc, MfClassicDict* dict) {
|
||||
char* current_key = (char*)malloc(sizeof(char) * 13);
|
||||
strncpy(current_key, furi_string_get_cstr(temp_key), 12);
|
||||
MfClassicUserKeys_push_back(nfc->mfc_key_strs, current_key);
|
||||
FURI_LOG_D("ListKeys", "Key %d: %s", index, current_key);
|
||||
FURI_LOG_D("ListKeys", "Key %ld: %s", index, current_key);
|
||||
submenu_add_item(
|
||||
submenu, current_key, index++, nfc_scene_mf_classic_keys_list_submenu_callback, nfc);
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ void nfc_scene_mf_desfire_read_success_on_enter(void* context) {
|
||||
|
||||
uint32_t bytes_total = 1 << (data->version.sw_storage >> 1);
|
||||
uint32_t bytes_free = data->free_memory ? data->free_memory->bytes : 0;
|
||||
furi_string_cat_printf(temp_str, "\n%d", bytes_total);
|
||||
furi_string_cat_printf(temp_str, "\n%ld", bytes_total);
|
||||
if(data->version.sw_storage & 1) {
|
||||
furi_string_push_back(temp_str, '+');
|
||||
}
|
||||
furi_string_cat_printf(temp_str, " bytes, %d bytes free\n", bytes_free);
|
||||
furi_string_cat_printf(temp_str, " bytes, %ld bytes free\n", bytes_free);
|
||||
|
||||
uint16_t n_apps = 0;
|
||||
uint16_t n_files = 0;
|
||||
|
||||
@@ -59,11 +59,11 @@ void nfc_scene_nfc_data_info_on_enter(void* context) {
|
||||
MifareDesfireData* data = &dev_data->mf_df_data;
|
||||
uint32_t bytes_total = 1 << (data->version.sw_storage >> 1);
|
||||
uint32_t bytes_free = data->free_memory ? data->free_memory->bytes : 0;
|
||||
furi_string_cat_printf(temp_str, "\n%d", bytes_total);
|
||||
furi_string_cat_printf(temp_str, "\n%ld", bytes_total);
|
||||
if(data->version.sw_storage & 1) {
|
||||
furi_string_push_back(temp_str, '+');
|
||||
}
|
||||
furi_string_cat_printf(temp_str, " bytes, %d bytes free\n", bytes_free);
|
||||
furi_string_cat_printf(temp_str, " bytes, %ld bytes free\n", bytes_free);
|
||||
|
||||
uint16_t n_apps = 0;
|
||||
uint16_t n_files = 0;
|
||||
|
||||
@@ -149,7 +149,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
||||
|
||||
FURI_LOG_T(
|
||||
TAG,
|
||||
"RSSI: avg %f, max %f at %u, min %f",
|
||||
"RSSI: avg %f, max %f at %lu, min %f",
|
||||
(double)(rssi_avg / rssi_avg_samples),
|
||||
(double)frequency_rssi.rssi_coarse,
|
||||
frequency_rssi.frequency_coarse,
|
||||
@@ -180,7 +180,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
||||
|
||||
rssi = furi_hal_subghz_get_rssi();
|
||||
|
||||
FURI_LOG_T(TAG, "#:%u:%f", frequency, (double)rssi);
|
||||
FURI_LOG_T(TAG, "#:%lu:%f", frequency, (double)rssi);
|
||||
|
||||
if(frequency_rssi.rssi_fine < rssi) {
|
||||
frequency_rssi.rssi_fine = rssi;
|
||||
@@ -193,7 +193,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
||||
// Deliver results fine
|
||||
if(frequency_rssi.rssi_fine > SUBGHZ_FREQUENCY_ANALYZER_THRESHOLD) {
|
||||
FURI_LOG_D(
|
||||
TAG, "=:%u:%f", frequency_rssi.frequency_fine, (double)frequency_rssi.rssi_fine);
|
||||
TAG, "=:%lu:%f", frequency_rssi.frequency_fine, (double)frequency_rssi.rssi_fine);
|
||||
|
||||
instance->sample_hold_counter = 20;
|
||||
rssi_temp = frequency_rssi.rssi_fine;
|
||||
@@ -217,7 +217,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
|
||||
(instance->sample_hold_counter < 10)) {
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
"~:%u:%f",
|
||||
"~:%lu:%f",
|
||||
frequency_rssi.frequency_coarse,
|
||||
(double)frequency_rssi.rssi_coarse);
|
||||
|
||||
|
||||
@@ -151,8 +151,8 @@ void subghz_cli_command_tx(Cli* cli, FuriString* args, void* context) {
|
||||
"Protocol: Princeton\n"
|
||||
"Bit: 24\n"
|
||||
"Key: 00 00 00 00 00 %02X %02X %02X\n"
|
||||
"TE: %d\n"
|
||||
"Repeat: %d\n",
|
||||
"TE: %ld\n"
|
||||
"Repeat: %ld\n",
|
||||
(uint8_t)((key >> 16) & 0xFF),
|
||||
(uint8_t)((key >> 8) & 0xFF),
|
||||
(uint8_t)(key & 0xFF),
|
||||
@@ -794,7 +794,7 @@ static bool subghz_on_system_start_istream_decode_band(
|
||||
|
||||
FURI_LOG_I(
|
||||
"SubGhzOnStart",
|
||||
"Add allowed band: start %dHz, stop %dHz, power_limit %ddBm, duty_cycle %d%%",
|
||||
"Add allowed band: start %ldHz, stop %ldHz, power_limit %ddBm, duty_cycle %d%%",
|
||||
band.start,
|
||||
band.end,
|
||||
band.power_limit,
|
||||
|
||||
@@ -60,7 +60,7 @@ void subghz_get_frequency_modulation(SubGhz* subghz, FuriString* frequency, Furi
|
||||
subghz->txrx->preset->frequency / 10000 % 100);
|
||||
}
|
||||
if(modulation != NULL) {
|
||||
furi_string_printf(modulation, "%0.2s", furi_string_get_cstr(subghz->txrx->preset->name));
|
||||
furi_string_printf(modulation, "%2s", furi_string_get_cstr(subghz->txrx->preset->name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user