Ticket #1831: fixed compilation warings of --disable-nls and --disable-charset options.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Andrew Borodin 2009-11-20 12:11:31 +03:00
parent 0b8b237d2b
commit a193e2e56f
14 changed files with 43 additions and 29 deletions

View File

@ -1577,7 +1577,6 @@ long edit_move_forward3 (WEdit * edit, long current, int cols, long upto)
{
long p, q;
int col = 0;
int cw = 1;
if (upto) {
q = upto;
cols = -10;
@ -1587,7 +1586,7 @@ long edit_move_forward3 (WEdit * edit, long current, int cols, long upto)
while (p < q) {
int c;
#ifdef HAVE_CHARSET
cw = 1;
int cw = 1;
#endif
if (cols != -10) {
if (col == cols)
@ -1596,14 +1595,12 @@ long edit_move_forward3 (WEdit * edit, long current, int cols, long upto)
return p - 1;
}
#ifdef HAVE_CHARSET
if (!edit->utf8) {
#endif
if (!edit->utf8)
c = edit_get_byte (edit, p);
#ifdef HAVE_CHARSET
} else {
cw = 1;
else
c = edit_get_utf (edit, p, &cw);
}
#else
c = edit_get_byte (edit, p);
#endif
if (c == '\t')
col += TAB_SIZE - col % TAB_SIZE;

View File

@ -2539,7 +2539,6 @@ edit_complete_word_cmd (WEdit *edit)
/* release memory before return */
for (i = 0; i < num_compl; i++)
g_free (compl[i].text);
}
void
@ -2561,13 +2560,14 @@ edit_select_codepage_cmd (WEdit *edit)
}
}
if (cp_id != NULL)
edit->utf8 = str_isutf8 (cp_id);
}
edit->force = REDRAW_COMPLETELY;
edit_refresh_cmd (edit);
#else
(void) edit;
#endif
}

View File

@ -560,12 +560,9 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
col += 2;
break;
}
#ifndef HAVE_CHARSET
int utf8_display = 0;
#endif
if (!edit->utf8) {
if ( ( utf8_display && g_unichar_isprint (c) ) ||
( utf8_display == 0 && is_printable (c) ) ) {
( !utf8_display && is_printable (c) ) ) {
p->ch = c;
p++;
} else {

View File

@ -49,6 +49,7 @@ static const char *wrap_str[] =
NULL
};
#ifdef ENABLE_NLS
static void
i18n_translate_array (const char *array[])
{
@ -57,6 +58,7 @@ i18n_translate_array (const char *array[])
array++;
}
}
#endif /* ENABLE_NLS */
void
edit_options_dialog (void)
@ -116,7 +118,7 @@ edit_options_dialog (void)
i18n_translate_array (wrap_str);
i18n_flag = TRUE;
}
#endif
#endif /* ENABLE_NLS */
g_snprintf (wrap_length, sizeof (wrap_length), "%d",
option_word_wrap_line_length);

View File

@ -420,9 +420,10 @@ mc_args_handle(int *argc, char ***argv, const gchar *translation_domain)
GError *error = NULL;
const gchar *_system_codepage = str_detect_termencoding();
if ( !str_isutf8 (_system_codepage))
#ifdef ENABLE_NLS
if (!str_isutf8 (_system_codepage))
bind_textdomain_codeset ("mc", "UTF-8");
#endif
context = g_option_context_new (mc_args_add_usage_info());
@ -482,8 +483,10 @@ mc_args_handle(int *argc, char ***argv, const gchar *translation_domain)
g_option_context_free (context);
mc_args_clean_temp_help_strings();
if ( !str_isutf8 (_system_codepage))
#ifdef ENABLE_NLS
if (!str_isutf8 (_system_codepage))
bind_textdomain_codeset ("mc", _system_codepage);
#endif
return mc_args_process();
}

View File

@ -1706,7 +1706,6 @@ panel_operate_generate_prompt (const WPanel *panel, const int operation,
const struct stat *src_stat)
{
const char *sp, *cp;
int i;
char format_string[BUF_MEDIUM];
char *dp = format_string;
gboolean build_question = FALSE;
@ -1714,6 +1713,8 @@ panel_operate_generate_prompt (const WPanel *panel, const int operation,
#ifdef ENABLE_NLS
static gboolean i18n_flag = FALSE;
if (!i18n_flag) {
int i;
for (i = sizeof (op_names1) / sizeof (op_names1[0]); i--;)
op_names1[i] = Q_(op_names1[i]);

View File

@ -923,8 +923,6 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation,
i18n = TRUE;
}
fmd_xlen = max (FMDX, (size_t) COLS * 2/3);
/* buttons */
for (i = 0; i <= 2 - OFFSET; i++)
fmd_widgets[i].u.button.text = _(fmd_widgets[i].u.button.text);
@ -935,6 +933,8 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation,
fmd_widgets[i].u.checkbox.text = _(fmd_widgets[i].u.checkbox.text);
#endif /* !ENABLE_NLS */
fmd_xlen = max (FMDX, (size_t) COLS * 2/3);
len = str_term_width1 (fmd_widgets[6 - OFFSET].u.checkbox.text)
+ str_term_width1 (fmd_widgets[4 - OFFSET].u.checkbox.text) + 15;
fmd_xlen = max (fmd_xlen, len);

View File

@ -281,14 +281,18 @@ find_parameters (char **start_dir, char **pattern, char **content)
const char *file_pattern_label = N_("&Using shell patterns");
const char *file_recurs_label = N_("&Find recursively");
const char *file_skip_hidden_label = N_("S&kip hidden");
#ifdef HAVE_CHARSET
const char *file_all_charsets_label = N_("&All charsets");
#endif
/* file content */
const char *content_case_label = N_("Case sens&itive");
const char *content_regexp_label = N_("Re&gular expression");
const char *content_first_hit_label = N_("Fir&st hit");
const char *content_whole_words_label = N_("&Whole words");
#ifdef HAVE_CHARSET
const char *content_all_charsets_label = N_("All cha&rsets");
#endif
const char *buts[] = { N_("&OK"), N_("&Cancel"), N_("&Tree") };
@ -304,12 +308,14 @@ find_parameters (char **start_dir, char **pattern, char **content)
file_pattern_label = _(file_pattern_label);
file_recurs_label = _(file_recurs_label);
file_skip_hidden_label = _(file_skip_hidden_label);
#ifdef HAVE_CHARSET
file_all_charsets_label = _(file_all_charsets_label);
content_all_charsets_label = _(content_all_charsets_label);
#endif
content_case_label = _(content_case_label);
content_regexp_label = _(content_regexp_label);
content_first_hit_label = _(content_first_hit_label);
content_whole_words_label = _(content_whole_words_label);
content_all_charsets_label = _(content_all_charsets_label);
}
#endif /* ENABLE_NLS */

View File

@ -232,7 +232,7 @@ static void
init_learn (void)
{
int x, y, i, j;
key_code_name_t *key;
const key_code_name_t *key;
char buffer[BUF_TINY];
#ifdef ENABLE_NLS
@ -264,7 +264,9 @@ init_learn (void)
x = UX;
y = UY;
for (key = key_name_conv_tab, j = 0;
key->name != NULL && strcmp (key->name, "kpleft"); key++, j++);
key->name != NULL && strcmp (key->name, "kpleft");
key++, j++)
;
learnkeys = g_new (learnkey, j);
x += ((j - 1) / ROWS) * COLSHIFT;
y += (j - 1) % ROWS;

View File

@ -94,6 +94,8 @@ mc_search__get_one_symbol (const char *charset, const char *str, gsize str_len,
converted_str = mc_search__recode_str (str, str_len, charset, cp_display, &converted_str_len);
#else
(void) charset;
converted_str = g_strndup (str, str_len);
#endif
@ -175,6 +177,8 @@ mc_search__tolower_case_str (const char *charset, const char *str, gsize str_len
gchar *converted_str, *tmp_str2;
gsize converted_str_len = str_len + 1;
(void) charset;
tmp_str2 = converted_str = g_strndup (str, str_len);
while (str_tolower (tmp_str1, &tmp_str2, &converted_str_len))
@ -224,10 +228,13 @@ mc_search__toupper_case_str (const char *charset, const char *str, gsize str_len
g_free (tmp_str2);
return ret;
#else
const gchar *tmp_str1 = str;
gchar *converted_str, *tmp_str2;
gsize converted_str_len = str_len + 1;
(void) charset;
tmp_str2 = converted_str = g_strndup (str, str_len);
while (str_toupper (tmp_str1, &tmp_str2, &converted_str_len))

View File

@ -72,7 +72,6 @@ static enum ruler_type {
static void
mcview_set_buttonbar (mcview_t *view)
{
const char *text;
Dlg_head *h = view->widget.parent;
WButtonBar *b = find_buttonbar (h);
const global_keymap_t *keymap = view->hex_mode ? view->hex_map : view->plain_map;

View File

@ -92,9 +92,7 @@ mcview_display_hex (mcview_t * view)
mark_t boldflag = MARK_NORMAL;
struct hexedit_change_node *curr = view->change_list;
size_t i;
int cw = 1;
int ch = 0;
gboolean read_res = TRUE;
char hex_buff[10]; /* A temporary buffer for sprintf and mvwaddstr */
int bytes; /* Number of bytes already printed on the line */
@ -126,6 +124,8 @@ mcview_display_hex (mcview_t * view)
#ifdef HAVE_CHARSET
if (view->utf8) {
int cw = 1;
gboolean read_res = TRUE;
ch = mcview_get_utf (view, from, &cw, &read_res);
if (!read_res)
break;

View File

@ -72,7 +72,6 @@ mcview_display_nroff (mcview_t * view)
int c;
int c_prev = 0;
int c_next = 0;
gboolean read_res = TRUE;
struct hexedit_change_node *curr = view->change_list;
mcview_display_clean (view);
@ -88,6 +87,7 @@ mcview_display_nroff (mcview_t * view)
for (row = 0, col = 0; row < height;) {
#ifdef HAVE_CHARSET
if (view->utf8) {
gboolean read_res = TRUE;
c = mcview_get_utf (view, from, &cw, &read_res);
if (!read_res)
break;

View File

@ -69,7 +69,6 @@ mcview_display_text (mcview_t * view)
off_t from;
int cw = 1;
int c, prev_ch = 0;
gboolean read_res = TRUE;
struct hexedit_change_node *curr = view->change_list;
mcview_display_clean (view);
@ -85,6 +84,7 @@ mcview_display_text (mcview_t * view)
for (row = 0, col = 0; row < height;) {
#ifdef HAVE_CHARSET
if (view->utf8) {
gboolean read_res = TRUE;
c = mcview_get_utf (view, from, &cw, &read_res);
if (!read_res)
break;