mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
strutil.h: replaced iconv_t to GIConv in INVALID_CONV definition.
Removed <iconv.h> include. Add "global.h" include. Moved str_isutf8 function declaration under header guard. Formatting. view.c: used symbolic constant. Formatting.
This commit is contained in:
parent
9c713d2128
commit
6a638f25b3
@ -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 <iconv.h>
|
||||
|
||||
/* 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;
|
||||
@ -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*/
|
||||
|
10
src/view.c
10
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user