Commit: c4818512161150dd614e9637ab533de459cbe857
Parent: 5eef003d2e415985fe4fe2dbb97ad24013b037f9
Author: opask
Date: Tue, 26 Mar 2019 22:44:01 -0600
delete some (more) useless code related to charsets
Diffstat:
4 files changed, 7 insertions(+), 32 deletions(-)
diff --git a/charsets.c b/charsets.c
@@ -52,22 +52,8 @@ static const unsigned char strings[256][2] = {
static const unsigned char no_str[] = "*";
-static int is_nbsp(int u)
-{
- return u == 0xa0 || u == 0x202f;
-}
-
unsigned char *u2cp(int u)
{
- if (u < 0)
- return (unsigned char *)"";
- if (u < 128)
- return (unsigned char *)strings[u];
- if (is_nbsp(u))
- return (unsigned char *)strings[1];
- if (u == 0xad)
- return (unsigned char *)strings[0];
-
return encode_utf_8(u);
}
@@ -402,8 +388,6 @@ unsigned char *get_cp_name(int index)
unsigned char *get_cp_mime_name(int index)
{
- if (index < 0)
- return (unsigned char *)"none";
if (!codepages[index].aliases)
return NULL;
return (unsigned char *)codepages[index].aliases[0];
diff --git a/default.c b/default.c
@@ -541,7 +541,7 @@ static unsigned char *cp_rd(struct option *o, unsigned char *c)
static void cp_wr(struct option *o, unsigned char **s, int *l)
{
- unsigned char *n = get_cp_mime_name(*(int *)o->ptr);
+ unsigned char *n = get_cp_mime_name(0);
add_nm(o, s, l);
add_to_str(s, l, n);
}
diff --git a/links.h b/links.h
@@ -115,9 +115,9 @@ extern int F;
} \
void die(const char *, ...);
+void usage(void);
void *xmalloc(size_t);
void *xrealloc(void *, size_t);
-void usage(void);
#define internal die
#define error die
#define fatal_exit die
@@ -1474,7 +1474,6 @@ struct terminal {
chr *screen;
chr *last_screen;
struct term_spec *spec;
- int default_character_set;
int cx;
int cy;
int lcx;
@@ -1531,9 +1530,7 @@ extern struct list_head terminals;
static inline int term_charset(struct terminal *term)
{
- if (term->spec->character_set >= 0)
- return term->spec->character_set;
- return term->default_character_set;
+ return 0;
}
int hard_write(int, const unsigned char *, int);
@@ -2862,10 +2859,7 @@ static inline int utf8chrlen(unsigned char c)
static inline unsigned GET_TERM_CHAR(struct terminal *term, unsigned char **str)
{
unsigned ch;
- if (!term_charset(term))
- GET_UTF_8(*str, ch);
- else
- ch = *(*str)++;
+ GET_UTF_8(*str, ch);
return ch;
}
diff --git a/terminal.c b/terminal.c
@@ -481,7 +481,7 @@ struct terminal *init_term(int fdin, int fdout, void (*root_window)(struct windo
static int process_utf_8(struct terminal *term, struct links_event *ev)
{
if (ev->ev == EV_KBD) {
- if ((!F && !term_charset(term))
+ if (!F
#ifdef G
|| (F && !(drv->flags & GD_UNICODE_KEYS) && !g_kbd_codepage(drv))
#endif
@@ -540,7 +540,6 @@ struct terminal *init_gfx_term(void (*root_window)(struct window *, struct links
term->environment = !(drv->flags & GD_ONLY_1_WINDOW) ? ENV_G : 0;
if (!casestrcmp(drv->name, cast_uchar "x")) term->environment |= ENV_XWIN;
term->spec = &gfx_term;
- term->default_character_set = 0;
safe_strncpy(term->cwd, cwd, MAX_CWD_LEN);
gfx_term.character_set = 0;
if (gfx_term.character_set == -1) gfx_term.character_set = 0;
@@ -694,7 +693,6 @@ static void in_term(void *term_)
memcpy(term->cwd, iq + sizeof(struct links_event) + MAX_TERM_LEN, MAX_CWD_LEN);
term->cwd[MAX_CWD_LEN - 1] = 0;
term->environment = *(int *)(iq + sizeof(struct links_event) + MAX_TERM_LEN + MAX_CWD_LEN);
- term->default_character_set = *(int *)(iq + sizeof(struct links_event) + MAX_TERM_LEN + MAX_CWD_LEN + sizeof(int));
ev->b = (long)(iq + sizeof(struct links_event) + MAX_TERM_LEN + MAX_CWD_LEN + 2 * sizeof(int));
r = (int)sizeof(struct links_event) + MAX_TERM_LEN + MAX_CWD_LEN + 3 * (int)sizeof(int) + init_len;
sync_term_specs();
@@ -804,9 +802,8 @@ static unsigned char frame_vt100[49] = "aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmlln
if (attrib & 0100) add_to_str(&a, &l, cast_uchar ";1"); \
add_to_str(&a, &l, cast_uchar "m"); \
} \
- if (c >= ' ' && c != 127 && (c != 155 || \
- (term_charset(term) && cp2u(155, term_charset(term)) != -1))) {\
- if (c < 128 || frm || term_charset(term)) { \
+ if (c >= ' ' && c != 127 && c != 155) { \
+ if (c < 128 || frm) { \
add_chr_to_str(&a, &l, (unsigned char)c); \
} else { \
/* \