Skip to content

Commit 1543739

Browse files
committed
Merge branch '4674_charsets'
* 4674_charsets: Fix indentation. Rename m4.include/{mc-i18n.m4 => mc-encoding.m4}. Ticket #4674: remove --enable-charset/--disable-charset configuration option.
2 parents c7def7e + f0c0ccf commit 1543739

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+74
-879
lines changed

.github/workflows/ci-ubuntu.yml

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ jobs:
7272
--disable-largefile \
7373
--disable-nls \
7474
--disable-rpath \
75-
--disable-charset \
7675
--disable-mclib \
7776
--disable-assert \
7877
--disable-aspell \

acinclude.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ m4_include([m4.include/mc-glib.m4])
2626
m4_include([m4.include/mc-vfs.m4])
2727
m4_include([m4.include/mc-version.m4])
2828
m4_include([m4.include/mc-tests.m4])
29-
m4_include([m4.include/mc-i18n.m4])
29+
m4_include([m4.include/mc-encoding.m4])
3030
m4_include([m4.include/mc-assert.m4])

configure.ac

+1-3
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ AC_CHECK_FUNCS([setlocale])
341341
AM_GNU_GETTEXT([external], [need-ngettext])
342342
AM_GNU_GETTEXT_VERSION([0.18.2])
343343

344-
mc_I18N
344+
mc_ENCODING
345345

346346
dnl ############################################################################
347347
dnl OS specific stuff
@@ -561,7 +561,6 @@ AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
561561
AM_CONDITIONAL(USE_INTERNAL_EDIT, [test x"$use_internal_edit" = xyes ])
562562
AM_CONDITIONAL(USE_ASPELL, [test x"$enable_aspell" = xyes ])
563563
AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
564-
AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
565564
AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
566565
dnl Clarify do we really need GModule
567566
AM_CONDITIONAL([HAVE_GMODULE], [test -n "$g_module_supported" && \
@@ -748,7 +747,6 @@ Configuration:
748747
With ext2fs attributes support: ${ext2fs_attr_msg}
749748
Internal editor: ${edit_msg}
750749
Diff viewer: ${diff_msg}
751-
Support for charset: ${charset_msg}
752750
])
753751

754752
dnl option checking is disable by default due to AC_CONFIG_SUBDIRS

lib/Makefile.am

-2
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ if USE_MAINTAINER_MODE
5252
libmc_la_SOURCES += logging.c logging.h
5353
endif
5454
55-
if CHARSET
5655
libmc_la_SOURCES += charsets.c charsets.h
57-
endif
5856
5957
EXTRA_DIST = \
6058
stdckdint.in.h

lib/global.c

-5
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,8 @@ mc_global_t mc_global =
5959

6060
.profile_name = NULL,
6161

62-
#ifdef HAVE_CHARSET
6362
.source_codepage = -1,
6463
.display_codepage = -1,
65-
#else
66-
.eight_bit_clean = TRUE,
67-
.full_eight_bits = FALSE,
68-
#endif
6964
.utf8_display = FALSE,
7065

7166
.message_visible = TRUE,

lib/global.h

-10
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,9 @@ typedef struct
115115
mc_config_t *main_config;
116116
mc_config_t *panels_config;
117117

118-
#ifdef HAVE_CHARSET
119118
// Numbers of (file I/O) and (input/display) codepages. -1 if not selected
120119
int source_codepage;
121120
int display_codepage;
122-
#else
123-
// If true, allow characters in the range 160-255
124-
gboolean eight_bit_clean;
125-
/*
126-
* If true, also allow characters in the range 128-159.
127-
* This is reported to break on many terminals (xterm, qansi-m).
128-
*/
129-
gboolean full_eight_bits;
130-
#endif
131121
/*
132122
* If utf-8 terminal utf8_display = TRUE
133123
* Display bits set UTF-8

lib/keybind.c

-2
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ static name_keymap_t command_names[] = {
104104
ADD_KEYMAP_NAME (Shell),
105105
ADD_KEYMAP_NAME (Edit),
106106
ADD_KEYMAP_NAME (EditNew),
107-
#ifdef HAVE_CHARSET
108107
ADD_KEYMAP_NAME (SelectCodepage),
109-
#endif
110108
ADD_KEYMAP_NAME (EditorViewerHistory),
111109
ADD_KEYMAP_NAME (History),
112110
ADD_KEYMAP_NAME (HistoryNext),

lib/search.h

-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ typedef struct mc_search_struct
6666
{
6767
// public input data
6868

69-
#ifdef HAVE_CHARSET
7069
// search in all charsets
7170
gboolean is_all_charsets;
72-
#endif
7371

7472
// case sensitive search
7573
gboolean is_case_sensitive;
@@ -116,9 +114,7 @@ typedef struct mc_search_struct
116114
struct
117115
{
118116
GString *str;
119-
#ifdef HAVE_CHARSET
120117
gchar *charset;
121-
#endif
122118
} original;
123119

124120
// error code after search

lib/search/lib.c

+1-29
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333
#include "lib/global.h"
3434
#include "lib/strutil.h"
3535
#include "lib/search.h"
36-
#ifdef HAVE_CHARSET
3736
#include "lib/charsets.h"
38-
#endif
3937

4038
#include "internal.h"
4139

@@ -69,7 +67,6 @@ mc_search__change_case_str (const char *charset, const GString *str, case_conv_f
6967
gchar *dst_str;
7068
gchar *dst_ptr;
7169
gsize dst_len;
72-
#ifdef HAVE_CHARSET
7370
GString *converted_str;
7471

7572
if (charset == NULL)
@@ -90,20 +87,7 @@ mc_search__change_case_str (const char *charset, const GString *str, case_conv_f
9087

9188
ret = mc_search__recode_str (dst_str, dst_len, cp_display, charset);
9289
g_free (dst_str);
93-
#else
94-
(void) charset;
9590

96-
dst_len = str->len + 1; // +1 is required for str_toupper/str_tolower
97-
dst_str = g_malloc (dst_len);
98-
99-
for (src_ptr = str->str, dst_ptr = dst_str; case_conv (src_ptr, &dst_ptr, &dst_len);
100-
src_ptr += str_length_char (src_ptr))
101-
;
102-
*dst_ptr = '\0';
103-
104-
ret = g_string_new_len (dst_str, dst_len);
105-
g_free (dst_str);
106-
#endif
10791
return ret;
10892
}
10993

@@ -156,34 +140,22 @@ mc_search__get_one_symbol (const char *charset, const char *str, gsize str_len,
156140
GString *converted_str;
157141
const gchar *next_char;
158142

159-
#ifdef HAVE_CHARSET
160143
GString *converted_str2;
161144

162145
if (charset == NULL)
163146
charset = cp_source;
164147

165148
converted_str = mc_search__recode_str (str, str_len, charset, cp_display);
166-
#else
167-
(void) charset;
168-
169-
converted_str = g_string_new_len (str, str_len);
170-
#endif
171-
172149
next_char = str_cget_next_char (converted_str->str);
173150
g_string_set_size (converted_str, (gsize) (next_char - converted_str->str));
174151

175-
#ifdef HAVE_CHARSET
176152
converted_str2 =
177153
mc_search__recode_str (converted_str->str, converted_str->len, cp_display, charset);
178-
#endif
179154
if (just_letters != NULL)
180155
*just_letters = str_isalnum (converted_str->str) && !str_isdigit (converted_str->str);
181-
#ifdef HAVE_CHARSET
182156
g_string_free (converted_str, TRUE);
157+
183158
return converted_str2;
184-
#else
185-
return converted_str;
186-
#endif
187159
}
188160

189161
/* --------------------------------------------------------------------------------------------- */

lib/search/search.c

+1-14
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
#include "lib/strutil.h"
3636
#include "lib/search.h"
3737
#include "lib/util.h"
38-
#ifdef HAVE_CHARSET
3938
#include "lib/charsets.h"
40-
#endif
4139

4240
#include "internal.h"
4341

@@ -154,12 +152,8 @@ mc_search_new_len (const gchar *original, gsize original_len, const gchar *origi
154152

155153
lc_mc_search = g_new0 (mc_search_t, 1);
156154
lc_mc_search->original.str = g_string_new_len (original, original_len);
157-
#ifdef HAVE_CHARSET
158155
lc_mc_search->original.charset = g_strdup (
159156
original_charset != NULL && *original_charset != '\0' ? original_charset : cp_display);
160-
#else
161-
(void) original_charset;
162-
#endif
163157

164158
return lc_mc_search;
165159
}
@@ -173,9 +167,7 @@ mc_search_free (mc_search_t *lc_mc_search)
173167
return;
174168

175169
g_string_free (lc_mc_search->original.str, TRUE);
176-
#ifdef HAVE_CHARSET
177170
g_free (lc_mc_search->original.charset);
178-
#endif
179171
g_free (lc_mc_search->error_str);
180172

181173
if (lc_mc_search->prepared.conditions != NULL)
@@ -201,7 +193,6 @@ mc_search_prepare (mc_search_t *lc_mc_search)
201193
return lc_mc_search->prepared.result;
202194

203195
ret = g_ptr_array_new_with_free_func (mc_search__cond_struct_free);
204-
#ifdef HAVE_CHARSET
205196
if (!lc_mc_search->is_all_charsets)
206197
g_ptr_array_add (ret,
207198
mc_search__cond_struct_new (lc_mc_search, lc_mc_search->original.str,
@@ -232,11 +223,7 @@ mc_search_prepare (mc_search_t *lc_mc_search)
232223
}
233224
}
234225
}
235-
#else
236-
g_ptr_array_add (ret,
237-
mc_search__cond_struct_new (lc_mc_search, lc_mc_search->original.str,
238-
str_detect_termencoding ()));
239-
#endif
226+
240227
lc_mc_search->prepared.conditions = ret;
241228
lc_mc_search->prepared.result = (lc_mc_search->error == MC_SEARCH_E_OK);
242229

lib/util.c

+1-23
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,6 @@
8080
/*** file scope functions ************************************************************************/
8181
/* --------------------------------------------------------------------------------------------- */
8282

83-
#ifndef HAVE_CHARSET
84-
static inline int
85-
is_7bit_printable (unsigned char c)
86-
{
87-
return (c > 31 && c < 127);
88-
}
89-
#endif
90-
91-
/* --------------------------------------------------------------------------------------------- */
92-
9383
static inline int
9484
is_iso_printable (unsigned char c)
9585
{
@@ -228,21 +218,9 @@ mc_util_write_backup_content (const char *from_file_name, const char *to_file_na
228218
int
229219
is_printable (int c)
230220
{
231-
c &= 0xff;
232-
233-
#ifdef HAVE_CHARSET
234221
/* "Display bits" is ignored, since the user controls the output
235222
by setting the output codepage */
236-
return is_8bit_printable (c);
237-
#else
238-
if (!mc_global.eight_bit_clean)
239-
return is_7bit_printable (c);
240-
241-
if (mc_global.full_eight_bits)
242-
return is_8bit_printable (c);
243-
244-
return is_iso_printable (c);
245-
#endif
223+
return is_8bit_printable (c & 0xff);
246224
}
247225

248226
/* --------------------------------------------------------------------------------------------- */

lib/utilunix.c

-13
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@
6565
#include "lib/util.h"
6666
#include "lib/widget.h" // message()
6767
#include "lib/vfs/xdirentry.h"
68-
69-
#ifdef HAVE_CHARSET
7068
#include "lib/charsets.h"
71-
#endif
7269

7370
/*** global variables ****************************************************************************/
7471

@@ -903,9 +900,7 @@ canonicalize_pathname_custom (char *path, canon_path_flags_t flags)
903900
// Collapse "/.." with the previous part of path
904901
if ((flags & CANON_PATH_REMDOUBLEDOTS) != 0)
905902
{
906-
#ifdef HAVE_CHARSET
907903
const size_t enc_prefix_len = strlen (VFS_ENCODING_PREFIX);
908-
#endif
909904

910905
for (p = lpath; p[0] != '\0' && p[1] != '\0' && p[2] != '\0';)
911906
{
@@ -975,7 +970,6 @@ canonicalize_pathname_custom (char *path, canon_path_flags_t flags)
975970
else
976971
{
977972
// "token/../foo" -> "foo"
978-
#ifdef HAVE_CHARSET
979973
if (strncmp (s, VFS_ENCODING_PREFIX, enc_prefix_len) == 0)
980974
{
981975
char *enc;
@@ -991,7 +985,6 @@ canonicalize_pathname_custom (char *path, canon_path_flags_t flags)
991985
g_free (enc);
992986
}
993987
else
994-
#endif
995988
str_move (s, p + 4);
996989
}
997990

@@ -1012,7 +1005,6 @@ canonicalize_pathname_custom (char *path, canon_path_flags_t flags)
10121005
// "foo/token/.." -> "foo"
10131006
if (s == lpath + 1)
10141007
s[0] = '\0';
1015-
#ifdef HAVE_CHARSET
10161008
else if (strncmp (s, VFS_ENCODING_PREFIX, enc_prefix_len) == 0)
10171009
{
10181010
char *enc;
@@ -1038,12 +1030,9 @@ canonicalize_pathname_custom (char *path, canon_path_flags_t flags)
10381030
if (p >= lpath)
10391031
continue;
10401032
}
1041-
#endif
10421033
else
10431034
{
1044-
#ifdef HAVE_CHARSET
10451035
last:
1046-
#endif
10471036
if (s >= lpath + url_delim_len
10481037
&& strncmp (s - url_delim_len, VFS_PATH_URL_DELIMITER, url_delim_len) == 0)
10491038
*s = '\0';
@@ -1062,7 +1051,6 @@ canonicalize_pathname_custom (char *path, canon_path_flags_t flags)
10621051
char *
10631052
mc_realpath (const char *path, char *resolved_path)
10641053
{
1065-
#ifdef HAVE_CHARSET
10661054
const char *p = path;
10671055
gboolean absolute_path = FALSE;
10681056

@@ -1085,7 +1073,6 @@ mc_realpath (const char *path, char *resolved_path)
10851073
path = p;
10861074
}
10871075
}
1088-
#endif
10891076

10901077
#ifdef HAVE_REALPATH
10911078
return realpath (path, resolved_path);

lib/vfs/interface.c

-8
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,11 @@ mc_opendir (const vfs_path_t *vpath)
425425

426426
path_element->dir.info = info;
427427

428-
#ifdef HAVE_CHARSET
429428
path_element->dir.converter = (path_element->encoding != NULL)
430429
? str_crt_conv_from (path_element->encoding)
431430
: str_cnv_from_term;
432431
if (path_element->dir.converter == INVALID_CONV)
433432
path_element->dir.converter = str_cnv_from_term;
434-
#endif
435433

436434
handle = vfs_new_handle (path_element->class, vfs_path_element_clone (path_element));
437435

@@ -471,11 +469,7 @@ mc_readdir (DIR *dirp)
471469
return NULL;
472470

473471
g_string_set_size (vfs_str_buffer, 0);
474-
#ifdef HAVE_CHARSET
475472
str_vfs_convert_from (vfs_path_element->dir.converter, entry->d_name, vfs_str_buffer);
476-
#else
477-
g_string_append_len (vfs_str_buffer, entry->d_name, entry->d_len);
478-
#endif
479473
vfs_dirent_assign (mc_readdir_result, vfs_str_buffer->str, entry->d_ino);
480474
vfs_dirent_free (entry);
481475
}
@@ -504,13 +498,11 @@ mc_closedir (DIR *dirp)
504498
{
505499
vfs_path_element_t *vfs_path_element = (vfs_path_element_t *) fsinfo;
506500

507-
#ifdef HAVE_CHARSET
508501
if (vfs_path_element->dir.converter != str_cnv_from_term)
509502
{
510503
str_close_conv (vfs_path_element->dir.converter);
511504
vfs_path_element->dir.converter = INVALID_CONV;
512505
}
513-
#endif
514506

515507
result = vfs->closedir ? (*vfs->closedir) (vfs_path_element->dir.info) : -1;
516508
vfs_free_handle (handle);

0 commit comments

Comments
 (0)