Commit Graph

15933 Commits

Author SHA1 Message Date
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
Andrew Borodin e1ee8a4da2 ydiff.c: refactror loops: replace 'while' with 'for' where reasonably.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 6a10d8e932 (scan_diff): eliminate 'continue', use 'else' instead. 2023-11-06 21:06:14 +03:00
Andrew Borodin c2e7bb9336 ydiff.c (fill_by_space): new helper function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin b05c1731fc ydiff.c: rename functions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin bee7d2aa39 ydiff.c: use g_array_set_clear_func().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 56f31e03ff Bump minimum GLib requirenment to 2.32.0.
This is required for g_array_set_clear_func().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin f373af88b7 (hdiff_multi): g_array_new() doesn't return NULL.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin c3bc39814e (redo_diff): g_array_new() doesn't return NULL.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 5cb55be2a3 (redo_diff): g_ptr_array_new() doesn't return NULL.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 92cc9b053d WDiff::display_symbols: change type from int to gboolean. Related changes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:14 +03:00
Andrew Borodin 313b06034e ydiff.c: fix coding style.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:13 +03:00
Andrew Borodin 1821e0e2f8 (vfs_path_build_url_params_str): return NULL instead of an empty string.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:13 +03:00
Andrew Borodin 5d8399befb tty: refactoring of color pairs deallocation.
* (tty_color_free_all_tmp): rename to tty_color_free_temp and call
    g_hash_table_foreach_remove().
  * (tty_color_free_all_non_tmp): rename to tty_color_free_all and call
    g_hash_table_remove_all().
  * (tty_color_free_all): remove.
  * (tty_color_free_condition_cb): rename to tty_color_free_temp_cb and
    simplify.
  * (mc_skin_deinit): use changed API.
  * (edit_free_syntax_rules): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:13 +03:00
Andrew Borodin 2d6d8a477e tty: color-related API changes
* (tty_try_alloc_color_pair): remove.
  * (tty_try_alloc_color_pair2): rename to tty_try_alloc_color_pair,
  change arguments.
  * (tty_color_set_defaults): changes arguments.
  * (this_try_alloc_color_pair): likewise.
  * lib/skin/color.c: related changes.
  * src/editor/syntax.c: likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:13 +03:00
Andrew Borodin c76c6820e6 lib/tty/color.c: use variable of tty_color_pair_t type for default color pair.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:13 +03:00
Andrew Borodin 4a116608d4 tty: refactoring of color pairs definition.
Rename structure mc_skin_color_t -> tty_color_pair_t and move to lib/tty/color.h.
Rename members.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:13 +03:00
Andrew Borodin 2c01bd53cb Ticket #4490: code cleanup before 4.8.31 release.
tty: refactoring of color pairs definition.

Rename structure tty_color_pair_t -> tty_color_lib_pair_t. Rename members.
Rename tty_color_try_alloc_pair_lib() -> tty_color_try_alloc_lib_pair().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:13 +03:00
Andrew Borodin cf7846cd62 Merge branch '4506_sftpfs_hashed_hostname'
* 4506_sftpfs_hashed_hostname:
  sftpfs: don't set preferred hostkey methods too restrictively.
2023-10-22 18:06:01 +03:00