[FL-2520] FW build with -Wextra (#1185)

* Fixing compiler warnings with -Wextra
* More warnings suppression, WIP
* Even more warning fixes
* Added new lines at end of text files.
* Padding fix
* Additional fixes to warnings on different build configurations; added -Wextra to default build pipeline
* Fixes for Secplus v1
* -additional warnings
* +-Wredundant-decls fixes
* FuriHal: print stack overflow task name in console
* FuriHal: add missing include

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
hedger
2022-05-06 16:37:10 +03:00
committed by GitHub
parent 1ca98170d9
commit 4d6b170769
461 changed files with 940 additions and 519 deletions

View File

@@ -6,7 +6,8 @@
bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx) {
size_t array_size = files_array_size(model->files);
if((idx >= model->array_offset + array_size) || (idx < model->array_offset)) {
if((idx >= (uint32_t)model->array_offset + array_size) ||
(idx < (uint32_t)model->array_offset)) {
return false;
}
@@ -20,12 +21,14 @@ void archive_update_offset(ArchiveBrowserView* browser) {
browser->view, (ArchiveBrowserViewModel * model) {
uint16_t bounds = model->item_cnt > 3 ? 2 : model->item_cnt;
if(model->item_cnt > 3 && model->item_idx >= model->item_cnt - 1) {
if((model->item_cnt > 3u) && ((uint32_t)model->item_idx >= (model->item_cnt - 1))) {
model->list_offset = model->item_idx - 3;
} else if(model->list_offset < model->item_idx - bounds) {
model->list_offset = CLAMP(model->item_idx - 2, model->item_cnt - bounds, 0);
model->list_offset =
CLAMP((uint32_t)model->item_idx - 2, model->item_cnt - bounds, 0u);
} else if(model->list_offset > model->item_idx - bounds) {
model->list_offset = CLAMP(model->item_idx - 1, model->item_cnt - bounds, 0);
model->list_offset =
CLAMP((uint32_t)model->item_idx - 1, model->item_cnt - bounds, 0u);
}
return true;
@@ -77,7 +80,7 @@ void archive_set_item_count(ArchiveBrowserView* browser, uint32_t count) {
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
model->item_cnt = count;
model->item_idx = CLAMP(model->item_idx, model->item_cnt - 1, 0);
model->item_idx = CLAMP((uint32_t)model->item_idx, model->item_cnt - 1, 0u);
return false;
});
archive_update_offset(browser);
@@ -94,7 +97,7 @@ void archive_file_array_rm_selected(ArchiveBrowserView* browser) {
model->item_idx - model->array_offset,
model->item_idx - model->array_offset + 1);
model->item_cnt--;
model->item_idx = CLAMP(model->item_idx, model->item_cnt - 1, 0);
model->item_idx = CLAMP((uint32_t)model->item_idx, model->item_cnt - 1, 0u);
items_cnt = model->item_cnt;
return false;
});
@@ -113,14 +116,14 @@ void archive_file_array_swap(ArchiveBrowserView* browser, int8_t dir) {
browser->view, (ArchiveBrowserViewModel * model) {
ArchiveFile_t temp;
size_t array_size = files_array_size(model->files) - 1;
uint8_t swap_idx = CLAMP(model->item_idx + dir, array_size, 0);
uint8_t swap_idx = CLAMP((size_t)(model->item_idx + dir), array_size, 0u);
if(model->item_idx == 0 && dir < 0) {
ArchiveFile_t_init(&temp);
files_array_pop_at(&temp, model->files, array_size);
files_array_push_at(model->files, model->item_idx, temp);
ArchiveFile_t_clear(&temp);
} else if(model->item_idx == array_size && dir > 0) {
} else if(((uint32_t)model->item_idx == array_size) && (dir > 0)) {
ArchiveFile_t_init(&temp);
files_array_pop_at(&temp, model->files, 0);
files_array_push_at(model->files, array_size, temp);
@@ -157,7 +160,7 @@ bool archive_file_array_load(ArchiveBrowserView* browser, int8_t dir) {
} else {
offset_new = model->item_idx - FILE_LIST_BUF_LEN / 4 * 1;
}
offset_new = CLAMP(offset_new, model->item_cnt - FILE_LIST_BUF_LEN, 0);
offset_new = CLAMP((uint32_t)offset_new, model->item_cnt - FILE_LIST_BUF_LEN, 0u);
}
return false;
});
@@ -196,7 +199,7 @@ ArchiveFile_t* archive_get_file_at(ArchiveBrowserView* browser, size_t idx) {
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
idx = CLAMP(idx - model->array_offset, files_array_size(model->files), 0);
idx = CLAMP(idx - model->array_offset, files_array_size(model->files), 0u);
selected = files_array_size(model->files) ? files_array_get(model->files, idx) : NULL;
return false;
});
@@ -247,6 +250,7 @@ void archive_set_tab(ArchiveBrowserView* browser, ArchiveTabEnum tab) {
});
}
void archive_set_last_tab(ArchiveBrowserView* browser, ArchiveTabEnum tab) {
UNUSED(tab); // FIXME?
furi_assert(browser);
with_view_model(