mirror of
https://github.com/rkd77/elinks.git
synced 2025-05-18 00:48:57 -04:00
Make u2cp and u2cp_no_nbsp return a pointer to const.
This commit is contained in:
parent
712803bbeb
commit
ef96caad01
@ -195,7 +195,7 @@ print_xml_entities(struct secure_save_info *ssi, const unsigned char *str)
|
|||||||
secure_fprintf(ssi, "&#%i;", (int) *str);
|
secure_fprintf(ssi, "&#%i;", (int) *str);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unsigned char *s = u2cp_no_nbsp(*str, cp);
|
const unsigned char *s = u2cp_no_nbsp(*str, cp);
|
||||||
|
|
||||||
if (s) print_xml_entities(ssi, s);
|
if (s) print_xml_entities(ssi, s);
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ static const unicode_val_T strange_chars[32] = {
|
|||||||
#define SYSTEM_CHARSET_FLAG 128
|
#define SYSTEM_CHARSET_FLAG 128
|
||||||
#define is_cp_ptr_utf8(cp_ptr) ((cp_ptr)->aliases == aliases_utf8)
|
#define is_cp_ptr_utf8(cp_ptr) ((cp_ptr)->aliases == aliases_utf8)
|
||||||
|
|
||||||
unsigned char *
|
const unsigned char *
|
||||||
u2cp_(unicode_val_T u, int to, enum nbsp_mode nbsp_mode)
|
u2cp_(unicode_val_T u, int to, enum nbsp_mode nbsp_mode)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
@ -928,7 +928,7 @@ get_translation_table(int from, int to)
|
|||||||
|
|
||||||
for (i = 128; i < 256; i++) {
|
for (i = 128; i < 256; i++) {
|
||||||
if (codepages[from].highhalf[i - 0x80] != 0xFFFF) {
|
if (codepages[from].highhalf[i - 0x80] != 0xFFFF) {
|
||||||
unsigned char *u;
|
const unsigned char *u;
|
||||||
|
|
||||||
u = u2cp(codepages[from].highhalf[i - 0x80], to);
|
u = u2cp(codepages[from].highhalf[i - 0x80], to);
|
||||||
if (u) table[i].u.str = u;
|
if (u) table[i].u.str = u;
|
||||||
|
@ -138,7 +138,7 @@ unicode_val_T cp_to_unicode(int, unsigned char **, unsigned char *);
|
|||||||
unicode_val_T cp2u(int, unsigned char);
|
unicode_val_T cp2u(int, unsigned char);
|
||||||
unsigned char *cp2utf8(int, int);
|
unsigned char *cp2utf8(int, int);
|
||||||
|
|
||||||
unsigned char *u2cp_(unicode_val_T, int, enum nbsp_mode);
|
const unsigned char *u2cp_(unicode_val_T, int, enum nbsp_mode);
|
||||||
#define u2cp(u, to) u2cp_(u, to, NBSP_MODE_HACK)
|
#define u2cp(u, to) u2cp_(u, to, NBSP_MODE_HACK)
|
||||||
#define u2cp_no_nbsp(u, to) u2cp_(u, to, NBSP_MODE_ASCII)
|
#define u2cp_no_nbsp(u, to) u2cp_(u, to, NBSP_MODE_ASCII)
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ term_send_ucs(struct terminal *term, unicode_val_T u,
|
|||||||
term_send_event(term, &ev);
|
term_send_event(term, &ev);
|
||||||
#else /* !CONFIG_UTF8 */
|
#else /* !CONFIG_UTF8 */
|
||||||
struct term_event ev;
|
struct term_event ev;
|
||||||
unsigned char *recoded;
|
const unsigned char *recoded;
|
||||||
|
|
||||||
set_kbd_term_event(&ev, KBD_UNDEF, modifier);
|
set_kbd_term_event(&ev, KBD_UNDEF, modifier);
|
||||||
recoded = u2cp_no_nbsp(u, get_opt_codepage_tree(term->spec, "charset"));
|
recoded = u2cp_no_nbsp(u, get_opt_codepage_tree(term->spec, "charset"));
|
||||||
|
@ -1355,6 +1355,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
|||||||
struct form_state *fs;
|
struct form_state *fs;
|
||||||
enum edit_action action_id;
|
enum edit_action action_id;
|
||||||
unsigned char *text;
|
unsigned char *text;
|
||||||
|
const unsigned char *ctext;
|
||||||
int length;
|
int length;
|
||||||
enum frame_event_status status = FRAME_EVENT_REFRESH;
|
enum frame_event_status status = FRAME_EVENT_REFRESH;
|
||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
@ -1748,19 +1749,19 @@ field_op(struct session *ses, struct document_view *doc_view,
|
|||||||
if (ses->tab->term->utf8) {
|
if (ses->tab->term->utf8) {
|
||||||
/* fs->value is in UTF-8 regardless of
|
/* fs->value is in UTF-8 regardless of
|
||||||
* the charset of the terminal. */
|
* the charset of the terminal. */
|
||||||
text = encode_utf8(get_kbd_key(ev));
|
ctext = encode_utf8(get_kbd_key(ev));
|
||||||
} else {
|
} else {
|
||||||
/* fs->value is in the charset of the
|
/* fs->value is in the charset of the
|
||||||
* terminal. */
|
* terminal. */
|
||||||
int cp = get_opt_codepage_tree(ses->tab->term->spec,
|
int cp = get_opt_codepage_tree(ses->tab->term->spec,
|
||||||
"charset");
|
"charset");
|
||||||
|
|
||||||
text = u2cp_no_nbsp(get_kbd_key(ev), cp);
|
ctext = u2cp_no_nbsp(get_kbd_key(ev), cp);
|
||||||
}
|
}
|
||||||
length = strlen(text);
|
length = strlen(ctext);
|
||||||
|
|
||||||
if (strlen(fs->value) + length > fc->maxlength
|
if (strlen(fs->value) + length > fc->maxlength
|
||||||
|| !insert_in_string(&fs->value, fs->state, text, length)) {
|
|| !insert_in_string(&fs->value, fs->state, ctext, length)) {
|
||||||
status = FRAME_EVENT_OK;
|
status = FRAME_EVENT_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user