mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05: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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ static const unicode_val_T strange_chars[32] = {
|
||||
#define SYSTEM_CHARSET_FLAG 128
|
||||
#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)
|
||||
{
|
||||
int j;
|
||||
@ -928,7 +928,7 @@ get_translation_table(int from, int to)
|
||||
|
||||
for (i = 128; i < 256; i++) {
|
||||
if (codepages[from].highhalf[i - 0x80] != 0xFFFF) {
|
||||
unsigned char *u;
|
||||
const unsigned char *u;
|
||||
|
||||
u = u2cp(codepages[from].highhalf[i - 0x80], to);
|
||||
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);
|
||||
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_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);
|
||||
#else /* !CONFIG_UTF8 */
|
||||
struct term_event ev;
|
||||
unsigned char *recoded;
|
||||
const unsigned char *recoded;
|
||||
|
||||
set_kbd_term_event(&ev, KBD_UNDEF, modifier);
|
||||
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;
|
||||
enum edit_action action_id;
|
||||
unsigned char *text;
|
||||
const unsigned char *ctext;
|
||||
int length;
|
||||
enum frame_event_status status = FRAME_EVENT_REFRESH;
|
||||
#ifdef CONFIG_UTF8
|
||||
@ -1748,19 +1749,19 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
if (ses->tab->term->utf8) {
|
||||
/* fs->value is in UTF-8 regardless of
|
||||
* the charset of the terminal. */
|
||||
text = encode_utf8(get_kbd_key(ev));
|
||||
ctext = encode_utf8(get_kbd_key(ev));
|
||||
} else {
|
||||
/* fs->value is in the charset of the
|
||||
* terminal. */
|
||||
int cp = get_opt_codepage_tree(ses->tab->term->spec,
|
||||
"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
|
||||
|| !insert_in_string(&fs->value, fs->state, text, length)) {
|
||||
|| !insert_in_string(&fs->value, fs->state, ctext, length)) {
|
||||
status = FRAME_EVENT_OK;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user