diff --git a/src/bookmarks/backend/xbel.c b/src/bookmarks/backend/xbel.c index 25ef2cbd6..f7042792c 100644 --- a/src/bookmarks/backend/xbel.c +++ b/src/bookmarks/backend/xbel.c @@ -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); } diff --git a/src/intl/charsets.c b/src/intl/charsets.c index 4e13819d1..c8f350d9d 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -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; diff --git a/src/intl/charsets.h b/src/intl/charsets.h index db123a240..bee9d14e5 100644 --- a/src/intl/charsets.h +++ b/src/intl/charsets.h @@ -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) diff --git a/src/terminal/event.c b/src/terminal/event.c index 49913aaba..6d5dc40c7 100644 --- a/src/terminal/event.c +++ b/src/terminal/event.c @@ -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")); diff --git a/src/viewer/text/form.c b/src/viewer/text/form.c index 83d904f4f..483931f68 100644 --- a/src/viewer/text/form.c +++ b/src/viewer/text/form.c @@ -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; }