diff --git a/src/strutil.h b/src/strutil.h index b9a6afb66..e76518546 100644 --- a/src/strutil.h +++ b/src/strutil.h @@ -1,6 +1,8 @@ #ifndef MC_STRUTIL_H #define MC_STRUTIL_H +#include "global.h" /* include glib.h */ + /* Header file for strutil.c, strutilascii.c, strutil8bit.c, strutilutf8.c. * There are two sort of functions: * 1. functions for working with growing strings and conversion strings between @@ -33,7 +35,6 @@ * prefix in second string. However, str_prefix return number of characters in * decompose form. (used in do_search (screen.c)) */ -#include /* errors for conversion function: * problem means, that not every characters was successfully converted (They are @@ -59,13 +60,12 @@ #define HIDE_FIT(x) ((x) & 0x000f) // fit alignment, if string is to long, is truncated with '~' -#define J_LEFT_FIT 0x11 -#define J_RIGHT_FIT 0x12 -#define J_CENTER_FIT 0x13 -#define J_CENTER_LEFT_FIT 0x14 +#define J_LEFT_FIT 0x11 +#define J_RIGHT_FIT 0x12 +#define J_CENTER_FIT 0x13 +#define J_CENTER_LEFT_FIT 0x14 -// redefinition of iconv_t, so is not needed include iconv.h in other files. -#define INVALID_CONV ((iconv_t) (-1)) +#define INVALID_CONV ((GIConv) (-1)) // standard convertors extern GIConv str_cnv_to_term; @@ -160,7 +160,7 @@ int str_nconvert (GIConv, char *, int, GString *); * original string. (so no replace with questionmark) * if coder is str_cnv_from_term or str_cnv_not_convert, string is only copied, * so is possible to show file, that is not valid in terminal encoding - */ + */ int str_vfs_convert_from (GIConv, char *, GString *); /* if coder is str_cnv_to_term or str_cnv_not_convert, string is only copied, @@ -486,9 +486,9 @@ int str_key_collate (const char *t1, const char *t2, int case_sen); */ void str_release_key (char *key, int case_sen); -#endif - /* return 1 if codeset_name is utf8 or utf-8 * I */ int str_isutf8 (const char *codeset_name); + +#endif /* MC_STRUTIL_H*/ diff --git a/src/view.c b/src/view.c index 91af2fbec..f2d66817c 100644 --- a/src/view.c +++ b/src/view.c @@ -2008,7 +2008,8 @@ view_load (WView *view, const char *command, const char *file, enc = vfs_get_encoding (canon_fname); if (enc != NULL) { view->converter = str_crt_conv_from (enc); - if (view->converter == (iconv_t) (-1)) view->converter = str_cnv_from_term; + if (view->converter == INVALID_CONV) + view->converter = str_cnv_from_term; } g_free (canon_fname); } @@ -3661,14 +3662,15 @@ view_select_encoding (WView *view) enc = g_strdup( get_codepage_id ( source_codepage ) ); if (enc != NULL) { conv = str_crt_conv_from (enc); - if (conv != (iconv_t)(-1)) { - if (view->converter != str_cnv_from_term) str_close_conv (view->converter); + if (conv != INVALID_CONV) { + if (view->converter != str_cnv_from_term) + str_close_conv (view->converter); view->converter = conv; view_reset_cache_lines (view); line = view_offset_to_line (view, view->dpy_start); view_set_first_showed (view, line); } - g_free(enc); + g_free(enc); } }