Commit: da5ac4618a044e26f10a79db1ccc5050d69bd822
Parent: dd1fc9fa7b59544de38144d7c8626810f81726bc
Author: 0x766F6964
Date: Sat, 2 Nov 2019 09:56:17 -0600
charsets.c: remove cp2u()
Diffstat:
5 files changed, 2 insertions(+), 19 deletions(-)
diff --git a/bfu.c b/bfu.c
@@ -1516,8 +1516,6 @@ void dialog_func(struct window *win, struct links_event *ev, int fwd)
if (ev->x >= ' ' && !(ev->y & (KBD_CTRL | KBD_ALT))) {
unsigned char *u;
unsigned char p[2] = { 0, 0 };
- if (cp2u(ev->x, term_charset(term)) == -1)
- break;
if (!is_utf_8(term)) {
p[0] = (unsigned char)ev->x;
u = p;
diff --git a/charsets.c b/charsets.c
@@ -57,15 +57,6 @@ unsigned char *u2cp(int u)
return encode_utf_8(u);
}
-int cp2u(unsigned ch, int from)
-{
- if (!from)
- return ch;
- if (from < 0 || ch < 0x80)
- return ch;
- return -1;
-}
-
static unsigned char utf_buffer[7];
unsigned char *encode_utf_8(int u)
diff --git a/html.c b/html.c
@@ -224,11 +224,8 @@ static unsigned char *get_url_val(unsigned char *e, unsigned char *name)
need_convert:
c = init_str();
l = 0;
- for (p = a; *p; p++) {
- int u = cp2u(*p, d_opt->real_cp);
- unsigned char *us = encode_utf_8(u);
- add_to_str(&c, &l, us);
- }
+ for (p = a; *p; p++)
+ add_to_str(&c, &l, encode_utf_8(*p));
free(a);
return c;
}
diff --git a/links.h b/links.h
@@ -2855,7 +2855,6 @@ unsigned char *get_cp_mime_name(int);
void free_conv_table(void);
unsigned char *encode_utf_8(int);
unsigned char *u2cp(int u);
-int cp2u(unsigned, int);
unsigned uni_locase(unsigned);
unsigned charset_upcase(unsigned, int);
diff --git a/view.c b/view.c
@@ -2115,8 +2115,6 @@ int field_op(struct session *ses, struct f_data_c *f, struct link *l, struct lin
if (!fs->string) return 0;
if (ev->ev == EV_KBD) {
if (!(ev->y & (KBD_CTRL | KBD_ALT)) && ev->x >= ' ') {
- if (cp2u(ev->x, term_charset(ses->term)) == -1)
- goto done;
set_br_pos(f, l);
if (!form->ro && strlen((char *)fs->string) < form->maxlength) {
unsigned char *v;