From 9d855b325394602fd65bbf2031a07c7854462ffb Mon Sep 17 00:00:00 2001 From: Ilia Maslakov <il.smind@google.com> Date: Mon, 20 Apr 2009 05:51:32 +0000 Subject: [PATCH] fix: build without HAVE_CHARSET --- edit/edit.c | 3 ++- edit/editdraw.c | 11 ++++++++++- edit/editkeys.c | 4 ++++ src/cmd.c | 4 ++-- src/view.c | 5 +++-- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/edit/edit.c b/edit/edit.c index 7ef96c629..2e2a42443 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -277,9 +277,10 @@ edit_load_file_fast (WEdit *edit, const char *filename) edit->curs2 = edit->last_byte; buf2 = edit->curs2 >> S_EDIT_BUF_SIZE; edit->utf8 = 0; +#ifdef HAVE_CHARSET if ( get_codepage_id( source_codepage ) ) edit->utf8 = str_isutf8 (get_codepage_id( source_codepage )); - +#endif if ((file = mc_open (filename, O_RDONLY | O_BINARY)) == -1) { GString *errmsg = g_string_new(NULL); g_string_sprintf(errmsg, _(" Cannot open %s for reading "), filename); diff --git a/edit/editdraw.c b/edit/editdraw.c index 17e8cbdba..a4ad5775f 100644 --- a/edit/editdraw.c +++ b/edit/editdraw.c @@ -102,7 +102,7 @@ static void status_string (WEdit * edit, char *s, int w) /* The field lengths just prevent the status line from shortening too much */ g_snprintf (s, w, - "[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %s cp:%s", + "[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %s %s", edit->mark1 != edit->mark2 ? ( column_highlighting ? 'C' : 'B') : '-', edit->modified ? 'M' : '-', edit->macro_i < 0 ? '-' : 'R', @@ -117,7 +117,12 @@ static void status_string (WEdit * edit, char *s, int w) edit->curs1, edit->last_byte, byte_str, + +#ifdef HAVE_CHARSET get_codepage_id ( source_codepage ) +#else + "" +#endif ); } @@ -432,6 +437,7 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col, } /* fallthrough */ default: +#ifdef HAVE_CHARSET if ( utf8_display ) { if ( !edit->utf8 ) { c = convert_from_8bit_to_utf_c ((unsigned char) c); @@ -440,9 +446,12 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col, if ( edit->utf8 ) { c = convert_from_utf_to_current_c (c); } else { +#endif c = convert_to_display_c (c); +#ifdef HAVE_CHARSET } } +#endif /* Caret notation for control characters */ if (c < 32) { p->ch = '^'; diff --git a/edit/editkeys.c b/edit/editkeys.c index 1f68fc4ab..6b21c171f 100644 --- a/edit/editkeys.c +++ b/edit/editkeys.c @@ -247,6 +247,7 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch) /* an ordinary insertable character */ if (x_key < 256 && !extmod) { +#ifdef HAVE_CHARSET if ( edit->charpoint >= 4 ) { edit->charpoint = 0; edit->charbuf[edit->charpoint] = '\0'; @@ -260,11 +261,13 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch) if ( !utf8_display ) { /* source in 8-bit codeset */ if (!edit->utf8) { +#endif c = convert_from_input_c (x_key); if (is_printable (c)) { char_for_insertion = c; goto fin; } +#ifdef HAVE_CHARSET } else { //FIXME: need more think about //must be return multibyte char but this func return 8bit char @@ -317,6 +320,7 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch) } } } +#endif } /* Commands specific to the key emulation */ diff --git a/src/cmd.c b/src/cmd.c index 8d10f6e7c..5c9559d9b 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1423,10 +1423,10 @@ set_panel_encoding (WPanel *panel) char *encoding = NULL; char *cd_path; +#ifdef HAVE_CHARSET do_select_codepage (); - encoding = g_strdup( get_codepage_id ( source_codepage ) ); - +#endif if (encoding) { cd_path = add_encoding_to_path (panel->cwd, encoding); if (!do_panel_cd (MENU_PANEL, cd_path, 0)) diff --git a/src/view.c b/src/view.c index f2d66817c..7824151fb 100644 --- a/src/view.c +++ b/src/view.c @@ -3657,10 +3657,11 @@ view_select_encoding (WView *view) GIConv conv; struct cache_line *line; +#ifdef HAVE_CHARSET do_select_codepage (); - enc = g_strdup( get_codepage_id ( source_codepage ) ); - if (enc != NULL) { +#endif + if ( enc ) { conv = str_crt_conv_from (enc); if (conv != INVALID_CONV) { if (view->converter != str_cnv_from_term)