Commit Graph

13739 Commits

Author SHA1 Message Date
Andrew Borodin
92b7acf7bf Merge branch '3694_hex_pattern_parsing'
* 3694_hex_pattern_parsing:
  (mc_search__hex_translate_to_regex): remove explicit handling of 0x prefixes.
  (mc_search__hex_translate_to_regex): rename variables.
  (mc_search__hex_translate_to_regex): avoid string duplication.
  (mc_search__hex_translate_to_regex): clean up handling of 0x prefixes.
  Fix quotes handling.
  Handle invalid characters.
  Fix trailing whitespace problem.
  Report errors to the user.
  Ticket #3694: fix hex pattern parsing.
2016-12-04 09:56:20 +03:00
Mooffie
eff4d74743 (mc_search__hex_translate_to_regex): remove explicit handling of 0x prefixes.
scanf("%x") knows to eat up this prefix[1][2], so we don't need to do this
ourselves.

[1] K&R's "The C Programming Language" documents "%x" as "hexadecimal
    integer (with or without leading 0x or 0X)"
[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/scanf.html

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
f96b11cf66 (mc_search__hex_translate_to_regex): rename variables.
Now that the string isn't duplicated there's nothing "temporary" about it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
b2cbddb534 (mc_search__hex_translate_to_regex): avoid string duplication.
We can read from the source string directly, as we no longer modify it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
78994224ce (mc_search__hex_translate_to_regex): clean up handling of 0x prefixes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
7be9334e45 Fix quotes handling.
Note: considering that this feature hasn't worked, we may consider removing it
entirely or partially (e.g., escaping) in order to simplify the code, as nobody
has grown used to it. It seems, based on the "hex mode" mentioned in the manual
page, that in the past there was no "normal" search in hex mode, and quoted
strings were the only easy way to look for text. This is no longer the case
nowadays.

Note: the characters in the quoted string are copied out as-is to the regexp.
No regexp-quoting is currently done. We may want to revisit this issue when we
work on ticket #3695.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
64e6ccef7f Handle invalid characters.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
cc8fcdcfc0 Fix trailing whitespace problem.
sscanf() returns EOF when it reaches the end of the string. Our code
erroneously interprets this as if a number was read. The fix: we test for an
explicit '1'.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie
b25af93874 Report errors to the user.
Instead of silently accepting invalid patterns, we notify the user of errors.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:26 +03:00
Mooffie
3332d1ebe4 Ticket #3694: fix hex pattern parsing.
Add test for mc_search__hex_translate_to_regex().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:54:43 +03:00
Andrew Borodin
4095a04a92 Merge branch '3687_hotlist_in_data_dir'
* 3687_hotlist_in_data_dir:
  Ticket #3687: store the 'hotlist' file in data dir, not config dir.
2016-12-04 09:48:52 +03:00
Mooffie
306b30ed30 Ticket #3687: store the 'hotlist' file in data dir, not config dir.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:48:02 +03:00
Andrew Borodin
61c681de94 Merge branch '3684_mc_profile_root'
* 3684_mc_profile_root:
  (mc_config_init_config_paths): minor optimization.
  Rename mc_config_get_profile_root() to mc_get_profile_root()
  Fix manual pages.
  Ticket #3684: replace $MC_HOME with $MC_PROFILE_ROOT, a better "profile" mechanism.
2016-12-04 09:41:23 +03:00
Andrew Borodin
8002e52293 (mc_config_init_config_paths): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:37:50 +03:00
Andrew Borodin
496abc0e1f Rename mc_config_get_profile_root() to mc_get_profile_root()
...and move it out from lib/mcconfig.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:37:50 +03:00
Andrew Borodin
d1ad225177 Fix manual pages.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-29 11:19:05 +03:00
Mooffie
239a8d0117 Ticket #3684: replace $MC_HOME with $MC_PROFILE_ROOT, a better "profile" mechanism.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-29 11:10:19 +03:00
Andrew Borodin
84433f43c2 Merge branch '3716_checkbox_response'
* 3716_checkbox_response:
  Ticket #3716: various checkboxes not responding.
2016-11-24 10:30:15 +03:00
Mooffie
b4d5ed514d Ticket #3716: various checkboxes not responding.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-24 10:23:53 +03:00
Andrew Borodin
3c8e9b389d Merge branch '3718_radio_notify'
* 3718_radio_notify:
  Ticket #3718: Options/Layout/Equal split gets reverted.
2016-11-24 09:59:23 +03:00
Mooffie
e68f105e0e Ticket #3718: Options/Layout/Equal split gets reverted.
WRadio sends MSG_NOTIFY with MSG_KEY as parameter to it's owner
when selected item is changed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-24 09:41:07 +03:00
Sergey Sharybin
0fe1eca733 Ticket #3690: initial support of OpenCL syntax highlighting.
Based on opencl-mode from Emacs with some own tweaks.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 14:30:20 +03:00
Sergey Sharybin
97430c1fa4 Ticket #3691: mcedit: disassociate .cl file extension from LISP syntax.
According to the LISP users this file extension can only be
seen in old projects and nowadays it's much more common in
the computer graphics applications for the OpenCL programs.

This is a part of work related on adding OpenCL syntax highlight
to mcedit. See tocket #3690 for the details.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 14:26:01 +03:00
Andrew Borodin
24a16003a8 Merge branch '3693_cleanup'
* 3693_cleanup: (31 commits)
  Update po/*.po files.
  src/filemanager/mountlist.c: clarify comments.
  (mc_search_run): document the return value.
  NULL-ize some variables to make unit tests happy.
  Use g_assert() instead of assert(3).
  doc/NEWS: cosmetics.
  Ticket #3703: fix potential NULL dereference.
  Sync with gnulib 5159ac54e0c73df4432a681e2e267df4ffcc04e4.
  MSG_INIT is handled by default.
  Clarify startup.
  (panel_callback) [MSG_FOCUS]: don't redraw panel here.
  (setup_panels): fix location of right panel.
  Add -Wformat-signedness option.
  (my_systemv): cleanup unreachable-code warning.
  (vfs_die): cleanup no attribute noreturn warning.
  (my_exit): cleanup no attribute noreturn warning.
  (edit_move_block_to_left): reduce variable scope.
  (edit_move_block_to_left): cleanup -Wunsafe-loop-optimizations.
  lib/serialize.c: cleanup -Wformat-signedness warning.
  (vfs_path_deserialize): refactoring.
  ...
2016-11-21 13:22:56 +03:00
Andrew Borodin
8bf8079139 Update po/*.po files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:22:27 +03:00
Boruch Baum
98f0c3faba src/filemanager/mountlist.c: clarify comments.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Mooffie
7f81194304 (mc_search_run): document the return value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
2356acc26d NULL-ize some variables to make unit tests happy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
9a39e35dc3 Use g_assert() instead of assert(3).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
f64e8b99d4 doc/NEWS: cosmetics.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
eec71bccff Ticket #3703: fix potential NULL dereference.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
1aefd27a2a Sync with gnulib 5159ac54e0c73df4432a681e2e267df4ffcc04e4.
Simplify "configure: checking ..." messages.

  * m4.include/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Update copyright
years. Use AC_MSG_CHECKING instead of AC_MSG_NOTICE.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
0e2833e398 MSG_INIT is handled by default.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
9e226f130f Clarify startup.
If mc isn't run as file manager, don't resolve the "other_dir" panel
option.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
bea83a1189 (panel_callback) [MSG_FOCUS]: don't redraw panel here.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
c1cf7e81b9 (setup_panels): fix location of right panel.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
40b00b5800 Add -Wformat-signedness option.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
9c43890f0d (my_systemv): cleanup unreachable-code warning.
Compiler with my_exit() 'noreturn' knowledge will complain about
never reachable break statement.

Reported by clang compiler.

(Maybe there is a better code sequence)

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
7e689e8e43 (vfs_die): cleanup no attribute noreturn warning.
utilvfs.c: In function 'vfs_die':
utilvfs.c:354:1: warning: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn]
 vfs_die (const char *m)
 ^~~~~~~

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
b91ab44b43 (my_exit): cleanup no attribute noreturn warning.
utilunix.c:360:1: error: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn]

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
c0cc0546d1 (edit_move_block_to_left): reduce variable scope.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
c5efd8a1e1 (edit_move_block_to_left): cleanup -Wunsafe-loop-optimizations.
edit.c: In function 'edit_move_block_to_left':
edit.c:1652:13: warning: cannot optimize possibly infinite loops [-Wunsafe-loop-optimizations]
             for (i = 1; i <= del_tab_width; i++)
             ^~~

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andreas Mohr
38fc00669d lib/serialize.c: cleanup -Wformat-signedness warning.
serialize.c: In function 'mc_serialize_str':
serialize.c:116:34: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
     return g_strdup_printf ("%c%zd" SRLZ_DELIM_S "%s", prefix, strlen (data), data);
                                  ^
serialize.c:130:19: error: format '%zd' expects argument of type 'signed size_t', but argument 5 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_serialize_str()"
                   ^
serialize.c:175:22: note: in expansion of macro 'FUNC_NAME'
                      FUNC_NAME
                      ^~~~~~~~~
serialize.c:130:19: error: format '%zd' expects argument of type 'signed size_t', but argument 6 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_serialize_str()"
                   ^
serialize.c:175:22: note: in expansion of macro 'FUNC_NAME'
                      FUNC_NAME
                      ^~~~~~~~~
serialize.c: In function 'mc_deserialize_config':
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_deserialize_config()"
                   ^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
     prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
                                   ^~~~~~~~~
serialize.c:301:17: note: in expansion of macro 'prepend_error_and_exit'
                 prepend_error_and_exit ();
                 ^~~~~~~~~~~~~~~~~~~~~~
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_deserialize_config()"
                   ^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
     prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
                                   ^~~~~~~~~
serialize.c:313:17: note: in expansion of macro 'prepend_error_and_exit'
                 prepend_error_and_exit ();
                 ^~~~~~~~~~~~~~~~~~~~~~
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_deserialize_config()"
                   ^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
     prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
                                   ^~~~~~~~~
serialize.c:325:17: note: in expansion of macro 'prepend_error_and_exit'
                 prepend_error_and_exit ();
                 ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andrew Borodin
9df8bc2d12 (vfs_path_deserialize): refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andrew Borodin
de0e960de5 (vfs_path_serialize): get rid of dynamic string allocation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andreas Mohr
3b1183571a (quit_cmd_internal): cleanup -Wformat-signedness warning.
midnight.c: In function 'quit_cmd_internal':
midnight.c:1027:31: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type 'size_t {aka long unsigned int}' [-Werror=format=]
                               "You have %zd opened screens. Quit anyway?", n), n);
                               ^
midnight.c:1026:31: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type 'size_t {aka long unsigned int}' [-Werror=format=]
                     ngettext ("You have %zd opened screen. Quit anyway?",
                               ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andreas Mohr
2b265834ab (info_show_info): cleanup -Wformat-signedness warning.
info.c: In function 'info_show_info':
info.c:193:29: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int' [-Werror=format=]
             tty_printf (" (%Xh)", myfs_stats.type);
                             ^

info.c:239:51: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'long unsigned int' [-Werror=format=]
             tty_printf (ngettext (" (%ld block)", " (%ld blocks)",
                                                   ^
info.c:239:35: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'long unsigned int' [-Werror=format=]
             tty_printf (ngettext (" (%ld block)", " (%ld blocks)",
                                   ^

info.c:259:23: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int' [-Werror=format=]
         tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                       ^
info.c:259:21: note: in expansion of macro '_'
         tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                     ^
info.c:259:23: error: format '%X' expects argument of type 'unsigned int', but argument 3 has type 'int' [-Werror=format=]
         tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                       ^
info.c:259:21: note: in expansion of macro '_'
         tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                     ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andrew Borodin
82497824f4 Hex patterns: fix Russian manual page.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Mooffie
f9385f5a43 Hex patterns: fix manual page.
* Decimal and octal numerals aren't supported(!).
* Negative numbers are no longer supported.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andreas Mohr
31b0bcd584 (mc_search__hex_translate_to_regex): cleanup -Wformat-signedness warning.
hex.c: In function 'mc_search__hex_translate_to_regex':
hex.c:79:39: error: format '%x' expects argument of type 'unsigned int *', but argument 3 has type 'int *' [-Wformat=]
         if (sscanf (tmp_str + loop, "%x%n", &val, &ptr))
                                                ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00