Skip to content

Commit

Permalink
Merge pull request #29 from derskythe/dev-master
Browse files Browse the repository at this point in the history
fix: Multiplication result converted to larger type
  • Loading branch information
derskythe authored Nov 4, 2023
2 parents 0da1721 + 8ab3197 commit a0ec919
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion applications/main/archive/helpers/archive_browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void archive_update_focus(ArchiveBrowserView* browser, const char* target) {
browser->view,
ArchiveBrowserViewModel * model,
{
uint16_t idx = 0;
size_t idx = 0;
while(idx < files_array_size(model->files)) {
ArchiveFile_t* current = files_array_get(model->files, idx);
if(!furi_string_search(current->path, target)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void lfrfid_scene_read_success_on_enter(void* context) {
size_t size = protocol_dict_get_data_size(app->dict, app->protocol_id);
uint8_t* data = (uint8_t*)malloc(size);
protocol_dict_get_data(app->dict, app->protocol_id, data, size);
for(uint8_t i = 0; i < size; i++) {
for(size_t i = 0; i < size; i++) {
if(i >= 9) {
furi_string_cat_printf(tmp_string, "..");
break;
Expand Down
2 changes: 1 addition & 1 deletion applications/main/lfrfid/scenes/lfrfid_scene_saved_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void lfrfid_scene_saved_info_on_enter(void* context) {
size_t size = protocol_dict_get_data_size(app->dict, app->protocol_id);
uint8_t* data = (uint8_t*)malloc(size);
protocol_dict_get_data(app->dict, app->protocol_id, data, size);
for(uint8_t i = 0; i < size; i++) {
for(size_t i = 0; i < size; i++) {
if(i != 0) {
furi_string_cat_printf(tmp_string, ":");
}
Expand Down
2 changes: 1 addition & 1 deletion applications/main/nfc/scenes/nfc_scene_emv_read_success.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void nfc_scene_emv_read_success_on_enter(void* context) {
furi_string_cat_printf(temp_str, "AID: %s", furi_string_get_cstr(aid_name));
} else {
furi_string_cat_printf(temp_str, "AID: ");
for(uint8_t i = 0; i < emv_data->aid_len; i++) {
for(uint16_t i = 0; i < emv_data->aid_len; i++) {
furi_string_cat_printf(temp_str, "%02X", emv_data->aid[i]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion applications/services/gui/elements.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void elements_scrollbar_pos(
canvas_draw_box(canvas, x - 3, y, 3, height);
// dot line
canvas_set_color(canvas, ColorBlack);
for(uint8_t i = y; i < height + y; i += 2) {
for(uint16_t i = y; i < height + y; i += 2) {
canvas_draw_dot(canvas, x - 2, i);
}
// Position block
Expand Down
2 changes: 1 addition & 1 deletion applications/services/gui/modules/text_box.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static void text_box_insert_endline(Canvas* canvas, TextBoxModel* model) {
model->text_pos = (char*)model->text;
if(model->focus == TextBoxFocusEnd && line_num > 5) {
// Set text position to 5th line from the end
for(uint8_t i = 0; i < line_num - 5; i++) {
for(size_t i = 0; i < line_num - 5; i++) {
while(*model->text_pos++ != '\n') {
};
}
Expand Down
4 changes: 2 additions & 2 deletions applications/services/storage/storages/storage_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,12 +675,12 @@ static FS_Error storage_int_common_fs_info(
LFSData* lfs_data = lfs_data_get_from_storage(storage);

if(total_space) {
*total_space = lfs_data->config.block_size * lfs_data->config.block_count;
*total_space = (uint64_t)lfs_data->config.block_size * (uint64_t)lfs_data->config.block_count;
}

lfs_ssize_t result = lfs_fs_size(lfs);
if(free_space && (result >= 0)) {
*free_space = (lfs_data->config.block_count - result) * lfs_data->config.block_size;
*free_space = (uint64_t)(lfs_data->config.block_count - result) * (uint64_t)lfs_data->config.block_size;
}

return storage_int_parse_error(result);
Expand Down

0 comments on commit a0ec919

Please sign in to comment.