/tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/quick.c:150:9: warning: Potential leak of memory pointed to by 'label.quick_widget' [clang-analyzer-unix.Malloc]
150 | return;
| ^
Found by Clang-19 Static Analyzer.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Make Static Analyzer happy.
lib/widget/listbox.c:119:51: warning: Division by zero [clang-analyzer-core.DivideZero]
119 | line = 1 + ((l->current * (w->lines - 2)) / length);
Found by Clang-19 Static Analyzer.
Reported-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Make Static Analyzer happy.
/tmp/portage/app-misc/mc-9999/work/mc-9999/src/editor/editsearch.c:124:38: warning: Array access (from variable 'search_text') results in a null pointer dereference [clang-analyzer-core.NullDereference]
124 | if (dialog_result == B_CANCEL || search_text[0] == '\0')
| ^
src/editor/editsearch.c:126:9: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
126 | g_free (search_text);
| ^
Found by Clang-19 Static Analyzer.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Make Static Analyzer happy.
src/editor/editcmd.c:412:17: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
412 | fname = tilde_expand (filename_res);
| ^
src/editor/editcmd.c:1928:9: warning: 2nd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
1928 | pipe_mail (&edit->buffer, mail_to, mail_subject, mail_cc);
| ^ ~~~~~~~
Found by Clang-19 Static Analyzer.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Make Static Analyzer happy.
src/filemanager/boxes.c:623:9: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
623 | g_free (time_out_new);
| ^ ~~~~~~~~~~~~
Found by Clang-19 Static Analyzer.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
quick.c:432:28: runtime error: member access within null pointer of type 'Widget' (aka 'struct Widget')
#0 in quick_dialog_skip lib/widget/quick.c:432:28
#1 in file_mask_dialog src/filemanager/filegui.c:1462:19
#2 in do_confirm_copy_move src/filemanager/file.c:1977:11
#3 in panel_operate src/filemanager/file.c:3536:16
#4 in copy_cmd src/filemanager/./cmd.h:111:5
#5 in midnight_execute_cmd src/filemanager/filemanager.c:1177:9
#6 in midnight_callback src/filemanager/filemanager.c
#7 in send_message lib/widget/../../lib/widget/widget-common.h:255:15
#8 in buttonbar_call lib/widget/buttonbar.c:157:15
#9 in buttonbar_callback lib/widget/buttonbar.c:174:42
#10 in send_message lib/widget/../../lib/widget/widget-common.h:255:15
#11 in group_handle_hotkey lib/widget/group.c:566:23
#12 in group_default_callback lib/widget/group.c:640:16
#13 in dlg_default_callback lib/widget/dialog.c:370:16
#14 in midnight_callback src/filemanager/filemanager.c:1615:16
#15 in send_message lib/widget/../../lib/widget/widget-common.h:255:15
#16 in group_handle_key lib/widget/group.c:503:15
#17 in group_default_callback lib/widget/group.c:637:16
#18 in dlg_key_event lib/widget/dialog.c:252:19
#19 in dlg_process_event lib/widget/dialog.c:539:9
#20 in frontend_dlg_run lib/widget/dialog.c:321:9
#21 in dlg_run lib/widget/dialog.c:573:5
#22 in do_nc src/filemanager/filemanager.c:1826:16
#23 in main src/main.c:469:21
#24 in <null> <null>
#25 in __libc_start_main <null>
#26 in _start <null>
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior quick.c:432:28.
Found by Clang-19 Static Analyzer.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Make Static Analyzer happy.
Bug Group Bug Type File Function/Method Line
Logic error Garbage return value src/filemanager/boxes.c cd_box 1236
Logic error Garbage return value lib/widget/wtools.c fg_input_dialog_help 198
Found by Clang-19 Static Analyzer.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* (bg_message): use query_dialog() instead of fg_message().
* (message): likewise.
* (fg_message): isn't used anymore. Remove.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
After move to the end of file, set the start positions to EOL
to make backward search starting directly from EOL.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Sync regex search way with mcedit: handle BOL (^) metacharacter.
* (WView::search_line_type): new member.
* (mcview_search_init): init WView::search_line_type.
* (mcview_find): sync with edit_find().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
* (mcview_search): move to search.c.
* (mcview_do_search): make static.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Refactoring.
* (mc_search_line_t): rename from edit_search_line_t and move to
lib/search.h.
* (mc_search_get_line_type): rename from edit_get_search_line_type()
and move to lib/search/regex.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
(file_eta_prepare_for_show): check if 'eta_secs' is too large to display
as integer. If yes, display "--".
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* 3205_eta: (29 commits)
Update po/*.po files.
doc: update EN and RU man pages.
Calculate pauses in file operations.
File copy/move: make ETA accurate.
(calc_copy_file_progress): clarify calculation of BPSes and ETAs.
(panel_operate): use intermediate variable for better indentation.
(copy_file_file): clarify handling of mc_open() errors.
(copy_file_file): fix handling of mc_open() error.
(calc_copy_file_progress): rename from copy_file_file_display_progress().
(file_progress_show_total): add 'tv_current' argument.
(file_progress_show_total): use 'copied_bytes' to show numeric value.
(file_progress_show_count): remove 'done' and 'total' arguments.
(erase_dir_iff_empty): remove 'count' argument.
(file_op_context_t): rename members.
(copy_file_file): reduce variable scope, change order of progress update.
(file_op_context_t): reorder members.
Move content of src/filemanager/fileopctx.[ch] to src/filemanager/filegui.[ch].
(file_op_total_context_t): remove. All members were moved to file_op_context_t.
(file_op_total_context_t): rename members.
(copy_file_file_display_progress): remove dead code.
...
* (progress_update_one): update total progress bytes counter. Update
progress info in the progress window only if file was processed
successfully. Don't check buttons here.
* (move_file_file): update progress info if file move wasn't aborted.
* (copy_file_file): update progress info if stat() or open() failed
(file size is unknown, but file counter shoud be updated). Modify
caclulation and display of byte counters.
* (panel_operate): simplify files processing loop. Remove action that
already done via operate_one_file() call.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>