mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 04:22:34 +03:00
Refactoring: use define DEFAULT_CHARSET for "ASCII" charset.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
941a1eac1d
commit
0b0f7e3975
@ -220,7 +220,7 @@ load_codepages_list (void)
|
||||
fprintf (stderr, "%s\n", _("Warning: cannot load codepages list"));
|
||||
|
||||
codepages = g_ptr_array_new ();
|
||||
g_ptr_array_add (codepages, new_codepage_desc ("ASCII", _("7-bit ASCII")));
|
||||
g_ptr_array_add (codepages, new_codepage_desc (DEFAULT_CHARSET, _("7-bit ASCII")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ mc_fhl_parse_get_regexp (mc_fhl_t * fhl, const gchar * group_name)
|
||||
|
||||
mc_filter = g_new0 (mc_fhl_filter_t, 1);
|
||||
mc_filter->type = MC_FLHGH_T_FREGEXP;
|
||||
mc_filter->search_condition = mc_search_new (regexp, -1, "ASCII");
|
||||
mc_filter->search_condition = mc_search_new (regexp, -1, DEFAULT_CHARSET);
|
||||
mc_filter->search_condition->is_case_sensitive = TRUE;
|
||||
mc_filter->search_condition->search_type = MC_SEARCH_T_REGEX;
|
||||
|
||||
@ -162,7 +162,7 @@ mc_fhl_parse_get_extensions (mc_fhl_t * fhl, const gchar * group_name)
|
||||
|
||||
mc_filter = g_new0 (mc_fhl_filter_t, 1);
|
||||
mc_filter->type = MC_FLHGH_T_FREGEXP;
|
||||
mc_filter->search_condition = mc_search_new (buf->str, buf->len, "ASCII");
|
||||
mc_filter->search_condition = mc_search_new (buf->str, buf->len, DEFAULT_CHARSET);
|
||||
mc_filter->search_condition->is_case_sensitive =
|
||||
mc_config_get_bool (fhl->config, group_name, "extensions_case", TRUE);
|
||||
mc_filter->search_condition->search_type = MC_SEARCH_T_REGEX;
|
||||
|
@ -155,6 +155,8 @@
|
||||
|
||||
#define MC_ERROR g_quark_from_static_string (PACKAGE)
|
||||
|
||||
#define DEFAULT_CHARSET "ASCII"
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
/* run mode and params */
|
||||
|
@ -370,7 +370,7 @@ str_init_strings (const char *termenc)
|
||||
if (str_cnv_not_convert == INVALID_CONV)
|
||||
{
|
||||
g_free (codeset);
|
||||
codeset = g_strdup ("ASCII");
|
||||
codeset = g_strdup (DEFAULT_CHARSET);
|
||||
str_cnv_not_convert = g_iconv_open (codeset, codeset);
|
||||
}
|
||||
}
|
||||
|
@ -1314,12 +1314,12 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
|
||||
/* 3: auto-detect rule set from regular expressions */
|
||||
int q;
|
||||
|
||||
q = mc_search (args[1], "ASCII", editor_file, MC_SEARCH_T_REGEX);
|
||||
q = mc_search (args[1], DEFAULT_CHARSET, editor_file, MC_SEARCH_T_REGEX);
|
||||
/* does filename match arg 1 ? */
|
||||
if (!q && args[3])
|
||||
{
|
||||
/* does first line match arg 3 ? */
|
||||
q = mc_search (args[3], "ASCII", first_line, MC_SEARCH_T_REGEX);
|
||||
q = mc_search (args[3], DEFAULT_CHARSET, first_line, MC_SEARCH_T_REGEX);
|
||||
}
|
||||
if (q)
|
||||
{
|
||||
|
@ -726,7 +726,7 @@ regex_check_type (const vfs_path_t * filename_vpath, const char *ptr, gboolean c
|
||||
{
|
||||
mc_search_t *search;
|
||||
|
||||
search = mc_search_new (ptr, -1, "ASCII");
|
||||
search = mc_search_new (ptr, -1, DEFAULT_CHARSET);
|
||||
if (search != NULL)
|
||||
{
|
||||
search->search_type = MC_SEARCH_T_REGEX;
|
||||
@ -917,7 +917,7 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
|
||||
if (case_insense)
|
||||
p += 2;
|
||||
|
||||
search = mc_search_new (p, -1, "ASCII");
|
||||
search = mc_search_new (p, -1, DEFAULT_CHARSET);
|
||||
if (search != NULL)
|
||||
{
|
||||
search->search_type = MC_SEARCH_T_REGEX;
|
||||
@ -930,7 +930,7 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
|
||||
else if (strncmp (p, "directory/", 10) == 0)
|
||||
{
|
||||
if (S_ISDIR (mystat.st_mode)
|
||||
&& mc_search (p + 10, "ASCII", vfs_path_as_str (filename_vpath),
|
||||
&& mc_search (p + 10, DEFAULT_CHARSET, vfs_path_as_str (filename_vpath),
|
||||
MC_SEARCH_T_REGEX))
|
||||
found = TRUE;
|
||||
}
|
||||
|
@ -247,13 +247,13 @@ test_condition (WEdit * edit_widget, char *p, int *condition)
|
||||
char *edit_filename;
|
||||
|
||||
edit_filename = edit_get_file_name (edit_widget);
|
||||
*condition = mc_search (arg, "ASCII", edit_filename, search_type) ? 1 : 0;
|
||||
*condition = mc_search (arg, DEFAULT_CHARSET, edit_filename, search_type) ? 1 : 0;
|
||||
g_free (edit_filename);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
*condition = panel != NULL &&
|
||||
mc_search (arg, "ASCII", panel->dir.list[panel->selected].fname,
|
||||
mc_search (arg, DEFAULT_CHARSET, panel->dir.list[panel->selected].fname,
|
||||
search_type) ? 1 : 0;
|
||||
break;
|
||||
case 'y': /* syntax pattern */
|
||||
@ -264,7 +264,8 @@ test_condition (WEdit * edit_widget, char *p, int *condition)
|
||||
if (syntax_type != NULL)
|
||||
{
|
||||
p = extract_arg (p, arg, sizeof (arg));
|
||||
*condition = mc_search (arg, "ASCII", syntax_type, MC_SEARCH_T_NORMAL) ? 1 : 0;
|
||||
*condition =
|
||||
mc_search (arg, DEFAULT_CHARSET, syntax_type, MC_SEARCH_T_NORMAL) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -272,7 +273,7 @@ test_condition (WEdit * edit_widget, char *p, int *condition)
|
||||
case 'd':
|
||||
p = extract_arg (p, arg, sizeof (arg));
|
||||
*condition = panel != NULL
|
||||
&& mc_search (arg, "ASCII", vfs_path_as_str (panel->cwd_vpath),
|
||||
&& mc_search (arg, DEFAULT_CHARSET, vfs_path_as_str (panel->cwd_vpath),
|
||||
search_type) ? 1 : 0;
|
||||
break;
|
||||
case 't':
|
||||
@ -641,7 +642,7 @@ check_format_view (const char *p)
|
||||
{
|
||||
for (q++; *q && *q != '}'; q++)
|
||||
{
|
||||
if (!strncmp (q, "ascii", 5))
|
||||
if (!strncmp (q, DEFAULT_CHARSET, 5))
|
||||
{
|
||||
mcview_default_hex_mode = 0;
|
||||
q += 4;
|
||||
|
@ -210,7 +210,7 @@ sftpfs_fill_config_entity_from_config (FILE * ssh_config_handler,
|
||||
gboolean pattern_block_hit = FALSE;
|
||||
mc_search_t *host_regexp;
|
||||
|
||||
host_regexp = mc_search_new ("^\\s*host\\s+(.*)$", -1, "ASCII");
|
||||
host_regexp = mc_search_new ("^\\s*host\\s+(.*)$", -1, DEFAULT_CHARSET);
|
||||
host_regexp->search_type = MC_SEARCH_T_REGEX;
|
||||
host_regexp->is_case_sensitive = FALSE;
|
||||
|
||||
@ -254,7 +254,7 @@ sftpfs_fill_config_entity_from_config (FILE * ssh_config_handler,
|
||||
mc_search_t *pattern_regexp;
|
||||
|
||||
pattern_block_hit = FALSE;
|
||||
pattern_regexp = mc_search_new (host_pattern, -1, "ASCII");
|
||||
pattern_regexp = mc_search_new (host_pattern, -1, DEFAULT_CHARSET);
|
||||
pattern_regexp->search_type = MC_SEARCH_T_GLOB;
|
||||
pattern_regexp->is_case_sensitive = FALSE;
|
||||
pattern_regexp->is_entire_line = TRUE;
|
||||
@ -398,7 +398,7 @@ sftpfs_init_config_variables_patterns (void)
|
||||
for (i = 0; config_variables[i].pattern != NULL; i++)
|
||||
{
|
||||
config_variables[i].pattern_regexp =
|
||||
mc_search_new (config_variables[i].pattern, -1, "ASCII");
|
||||
mc_search_new (config_variables[i].pattern, -1, DEFAULT_CHARSET);
|
||||
config_variables[i].pattern_regexp->search_type = MC_SEARCH_T_REGEX;
|
||||
config_variables[i].pattern_regexp->is_case_sensitive = FALSE;
|
||||
config_variables[i].offset = structure_offsets[i];
|
||||
|
Loading…
Reference in New Issue
Block a user