Commit Graph

15901 Commits

Author SHA1 Message Date
Andrew Borodin 57342e54f4 (mcview_execute_cmd): don't handle CK_Help here.
Use default handler via dlg_execute_cmd().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-31 19:28:44 +03:00
Andrew Borodin 8f9593d2d5 (move_to_top): fix a 14-years error in condition.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-31 19:28:44 +03:00
Andrew Borodin 8cebe41b9a src/help.c: reduce variable scopes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-31 19:28:44 +03:00
Andrew Borodin 22131dbd71 src/help.c: refactor loops.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-31 19:28:44 +03:00
Andrew Borodin f8c0adec73 src/help.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-31 19:28:44 +03:00
Andrew Borodin d450911558 doc/ru/mc.1: various fixups.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-31 19:28:36 +03:00
Andrew Borodin 7feb865c88 (eval_marks): move from editcmd.c to edit.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-31 19:27:24 +03:00
Andrew Borodin e2e34d82ab (edit_block_delete_cmd): return boolean.
(edit_block_delete): likewize.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-31 19:27:24 +03:00
Andrew Borodin f29c5a35f7 Ticket #4490: code cleanup before 4.8.31 release.
(mcdiffview_dialog_search): indentation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-31 19:27:24 +03:00
Andrew Borodin 6abea9976b Merge branch '3761_mcedit_delete_vertical_block'
* 3761_mcedit_delete_vertical_block:
  Tricket #3761: mcedit: wrong deletion of marked column.
2023-12-31 19:21:10 +03:00
Andrew Borodin b50470f067 Tricket #3761: mcedit: wrong deletion of marked column.
If mark column (Shitf+F3) and select the column from left to right, from
up to down, it can be properly deleted later with F8.
But if select it from right to left, from up to down, erasing with F8
keeps the first line of the selected block.

Solution: don't call eval_marks() several times while deleting vertical
block.

  * (edit_block_delete_cmd): calculate mark positions here and pass them...
  * (edit_block_delete): ...through here...
  * (edit_delete_column_of_text): ...to here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-31 19:19:50 +03:00
Andrew Borodin 15419524e8 Merge branch '4433_edit_nonprintable_color'
* 4433_edit_nonprintable_color:
  Ticket #4433: skins: add color for non-printable characters in editor.
2023-12-10 17:49:13 +03:00
Andrew Borodin 1b3684e0e1 Ticket #4433: skins: add color for non-printable characters in editor.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-10 17:47:07 +03:00
Andrew Borodin ea6bd1866e Merge branch '4324_s3_python3'
* 4324_s3_python3:
  Ticket 4324: EXTFS: s3+: port to Python3.
2023-12-10 17:43:04 +03:00
Balló György b750e70920 Ticket 4324: EXTFS: s3+: port to Python3.
Closes MidnightCommander/mc#149.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-10 17:42:41 +03:00
Andrew Borodin 95958bce85 (extfs_cmd): fix build of extfs command if localname is empty.
Fix d4e59aa022.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-12-04 21:00:53 +03:00
Andrew Borodin f2166c264c Merge branch '4511_uc1541'
* 4511_uc1541:
  Ticket #4511: update uc1541 unit of EXTFS VFS.
2023-12-01 19:59:47 +03:00
Roman 'gryf' Dobosz 9aa5974fdc Ticket #4511: update uc1541 unit of EXTFS VFS.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-28 21:08:28 +03:00
Andrew Borodin cede013095 Merge branch '4509_lzo'
* 4509_lzo:
  Ticket #4509: support for lzo/lzop compression format.
2023-11-26 17:28:03 +03:00
TobiasW f78f9b2eda Ticket #4509: support for lzo/lzop compression format.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-26 17:27:11 +03:00
Andrew Borodin 1d5931a90d Merge branch '4490_cleanup'
* 4490_cleanup: (46 commits)
  Update po/*.po files.
  (mc_config_history_save): remove check because condition is always true here.
  (mc_config_history_get_recent_item): new API.
  Fix comments of history and panels.ini files location.
  lib/mcconfig/history.c: fix comments.
  src/editor/edit.c: fix coding style.
  (edit_insert_file): change variable type from int to gboolean.
  (edit_user_menu): avoid inverse logic.
  mcedit: rename user_menu() to edit_user_menu().
  mcedit: minor optimization.
  (edit_cursor_to_eol): reduce variable scope.
  (edit_execute_cmd): refactor loop.
  (insert_spaces_tab): refactor loop.
  Refactoring: avoid create an empty strings.
  (expand_format): remove intermediate variable.
  (strip_ext): refactor loop.
  mc.ext.ini.in: support webp images.
  tar: type accuracy.
  (oldgnu_get_sparse_info) fix conditional-uninitialized warning.
  (edit_print_string): refactor loop.
  ...
2023-11-06 21:15:20 +03:00
Andrew Borodin 5ff8599d43 Update po/*.po files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:14:51 +03:00
Andrew Borodin 7459861f58 (mc_config_history_save): remove check because condition is always true here.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin a74d638155 (mc_config_history_get_recent_item): new API.
* (edit_search_cmd): use mc_config_history_get_recent_item().
  * (mcview_continue_search_cmd): likewise.

mc_config_history_get_recent_item() is not implemented optimally yet.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin 018687b12f Fix comments of history and panels.ini files location.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin 6b274f7034 lib/mcconfig/history.c: fix comments.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin 6735c4803a src/editor/edit.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin 433f792b53 (edit_insert_file): change variable type from int to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin 719422746a (edit_user_menu): avoid inverse logic.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin 6ad4f04626 mcedit: rename user_menu() to edit_user_menu().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 2949eabd33 mcedit: minor optimization.
* (edit_left_word_move): break the loop as fast as possible.
  * (edit_right_word_move): likewise.
  * (edit_left_delete_word): likewise.
  * (edit_right_delete_word): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 1fe2d902b8 (edit_cursor_to_eol): reduce variable scope.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin c3bc294bb3 (edit_execute_cmd): refactor loop.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 442af62c07 (insert_spaces_tab): refactor loop.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin d4e59aa022 Refactoring: avoid create an empty strings.
* (name_quote): return NULL instead of an empty string.
  * (fake_name_quote): likewise.
  * (expand_format): likewise.
  * Related changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 44b5accbf7 (expand_format): remove intermediate variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin daaea80895 (strip_ext): refactor loop.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Guy Stalnaker cd60a2907a mc.ext.ini.in: support webp images.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 657090aa1f tar: type accuracy.
* (oldgnu_get_sparse_info): change type for boolean variable from int
    to gboolean.
  * (star_get_sparse_info): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andreas Mohr e87e0524a8 (oldgnu_get_sparse_info) fix conditional-uninitialized warning.
tar-sparse.c:563:55: warning: variable 'rc' may be uninitialized when used here [-Wconditional-uninitialized]
    for (ext_p = h->oldgnu_header.isextended ? 1 : 0; rc == add_ok && ext_p != 0;
                                                      ^~
tar-sparse.c:551:5: note: variable 'rc' is declared here
    enum oldgnu_add_status rc;
    ^

Found by clang-16.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 9a964edea9 (edit_print_string): refactor loop.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 293fdafaa7 (str_8bit_casecmp, str_8bit_ncasecmp): refactor loops.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 771f6911a0 (str_8bit_casecmp, str_8bit_ncasecmp): reduce variable scope.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andreas Mohr 43a398d76f (do_background): fix leak of file descriptors.
background.c: In function 'do_background':
background.c:587:1: error: leak of file descriptor 'comm[0]' []8;;https://cwe.mitre.org/data/definitions/775.htmlCWE-775]8;;] []8;;https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-leak-Werror=analyzer-fd-leak]8;;]
  587 | }
      | ^
  'do_background': events 1-12
    |
    |  527 |     if (pipe (comm) == -1)
    |      |        ~^~~~~~~~~~~
    |      |        ||
    |      |        |(1) opened here as read-write
    |      |        |(2) when 'pipe' succeeds
    |      |        (3) following 'false' branch...
    |......
    |  530 |     if (pipe (back_comm) == -1)
    |      |     ~~ ~~~~~~~~~~~~~~~~~
    |      |     |  ||
    |      |     |  |(5) when 'pipe' succeeds
    |      |     |  (6) following 'false' branch...
    |      |     (4) ...to here
    |......
    |  538 |     pid = fork ();
    |      |     ~~~
    |      |     |
    |      |     (7) ...to here
    |  539 |     if (pid == -1)
    |      |        ~
    |      |        |
    |      |        (8) following 'false' branch (when 'pid != -1')...
    |......
    |  552 |     if (pid == 0)
    |      |     ~~ ~
    |      |     |  |
    |      |     |  (10) following 'true' branch (when 'pid == 0')...
    |      |     (9) ...to here
    |  553 |     {
    |  554 |         int nullfd;
    |      |         ~~~
    |      |         |
    |      |         (11) ...to here
    |......
    |  587 | }
    |      | ~
    |      | |
    |      | (12) 'comm[0]' leaks here
    |
background.c:587:1: error: leak of file descriptor 'back_comm[1]' []8;;https://cwe.mitre.org/data/definitions/775.htmlCWE-775]8;;] []8;;https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-leak-Werror=analyzer-fd-leak]8;;]
  587 | }
      | ^
  'do_background': events 1-12
    |
    |  527 |     if (pipe (comm) == -1)
    |      |        ~^~~~~~~~~~~
    |      |        ||
    |      |        |(1) when 'pipe' succeeds
    |      |        (2) following 'false' branch...
    |......
    |  530 |     if (pipe (back_comm) == -1)
    |      |     ~~ ~~~~~~~~~~~~~~~~~
    |      |     |  ||
    |      |     |  |(4) opened here as read-write
    |      |     |  |(5) when 'pipe' succeeds
    |      |     |  (6) following 'false' branch...
    |      |     (3) ...to here
    |......
    |  538 |     pid = fork ();
    |      |     ~~~
    |      |     |
    |      |     (7) ...to here
    |  539 |     if (pid == -1)
    |      |        ~
    |      |        |
    |      |        (8) following 'false' branch (when 'pid != -1')...
    |......
    |  552 |     if (pid == 0)
    |      |     ~~ ~
    |      |     |  |
    |      |     |  (10) following 'true' branch (when 'pid == 0')...
    |      |     (9) ...to here
    |  553 |     {
    |  554 |         int nullfd;
    |      |         ~~~
    |      |         |
    |      |         (11) ...to here
    |......
    |  587 | }
    |      | ~
    |      | |
    |      | (12) 'back_comm[1]' leaks here
    |
background.c:587:1: error: leak of file descriptor 'comm[1]' []8;;https://cwe.mitre.org/data/definitions/775.htmlCWE-775]8;;] []8;;https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-leak-Werror=analyzer-fd-leak]8;;]
  587 | }
      | ^
  'do_background': events 1-12
    |
    |  527 |     if (pipe (comm) == -1)
    |      |        ~^~~~~~~~~~~
    |      |        ||
    |      |        |(1) opened here as read-write
    |      |        |(2) when 'pipe' succeeds
    |      |        (3) following 'false' branch...
    |......
    |  530 |     if (pipe (back_comm) == -1)
    |      |     ~~ ~~~~~~~~~~~~~~~~~
    |      |     |  ||
    |      |     |  |(5) when 'pipe' succeeds
    |      |     |  (6) following 'false' branch...
    |      |     (4) ...to here
    |......
    |  538 |     pid = fork ();
    |      |     ~~~
    |      |     |
    |      |     (7) ...to here
    |  539 |     if (pid == -1)
    |      |        ~
    |      |        |
    |      |        (8) following 'false' branch (when 'pid != -1')...
    |......
    |  552 |     if (pid == 0)
    |      |     ~~ ~
    |      |     |  |
    |      |     |  (10) following 'false' branch (when 'pid != 0')...
    |      |     (9) ...to here
    |......
    |  583 |         ctx->pid = pid;
    |      |         ~~~
    |      |         |
    |      |         (11) ...to here
    |......
    |  587 | }
    |      | ~
    |      | |
    |      | (12) 'comm[1]' leaks here
    |
background.c:587:1: error: leak of file descriptor 'back_comm[0]' []8;;https://cwe.mitre.org/data/definitions/775.htmlCWE-775]8;;] []8;;https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-leak-Werror=analyzer-fd-leak]8;;]
  587 | }
      | ^
  'do_background': events 1-12
    |
    |  527 |     if (pipe (comm) == -1)
    |      |        ~^~~~~~~~~~~
    |      |        ||
    |      |        |(1) when 'pipe' succeeds
    |      |        (2) following 'false' branch...
    |......
    |  530 |     if (pipe (back_comm) == -1)
    |      |     ~~ ~~~~~~~~~~~~~~~~~
    |      |     |  ||
    |      |     |  |(4) opened here as read-write
    |      |     |  |(5) when 'pipe' succeeds
    |      |     |  (6) following 'false' branch...
    |      |     (3) ...to here
    |......
    |  538 |     pid = fork ();
    |      |     ~~~
    |      |     |
    |      |     (7) ...to here
    |  539 |     if (pid == -1)
    |      |        ~
    |      |        |
    |      |        (8) following 'false' branch (when 'pid != -1')...
    |......
    |  552 |     if (pid == 0)
    |      |     ~~ ~
    |      |     |  |
    |      |     |  (10) following 'false' branch (when 'pid != 0')...
    |      |     (9) ...to here
    |......
    |  583 |         ctx->pid = pid;
    |      |         ~~~
    |      |         |
    |      |         (11) ...to here
    |......
    |  587 | }
    |      | ~
    |      | |
    |      | (12) 'back_comm[0]' leaks here
    |

Found by gcc-13 (-fanalyzer-fd-leak).

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 2edbf44dc0 (tty_color_get_name_by_index): fix format overflow.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andreas Mohr 2c49acf868 tar (uintmax_from_header): remove unused function and macro.
Found by clang-16.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 1cada10e14 tar: parse in a more locale-independent way.
Use g_ascii_isspace() rather than isspace().

Sync with GNU tar 01f986b921d988ae51de6c937cc374b50a8b23b0.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 16d9f23161 tar: use single is_octal_digit function.
Sync with GNU tar 05fcfaafb648cb7e9bd01004593ce016b8fb1f32.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 1c81987cf6 (load_codepages_list_from_file): fix memory leak in free_codepages_list().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 4077522b2b (dff_reparse): get rif of code duplication.
Move diff displaying to separate function.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00