From fe48c9d66039fa258a3eae9b678cae21f472eccd Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Mon, 22 Jan 2007 23:34:12 +0200 Subject: [PATCH 01/67] Some more NEWS from Bugzilla. --- NEWS | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 736158c92..c3e872e84 100644 --- a/NEWS +++ b/NEWS @@ -67,7 +67,7 @@ roughly in decreasing order of importance. - (enhancement) Tell the user how to move bookmarks. - (bugfix) Fix crash when moving bookmarks out of a folder. - (bugfix) Fixed crash if XBEL bookmark has no title - - (bugfix 886) If the user edits or deletes a cookie, mark the + - (bugfix 886, 872) If the user edits or deletes a cookie, mark the cookie list as needing to be saved. - (enhancement 887) Save in cookie manager should save cookies even if unmodified. @@ -81,7 +81,7 @@ roughly in decreasing order of importance. - (new feature) Autocreate directories needed to download a file. - (new feature) Option ui.show_menu_bar_always - (new feature) Option ui.tabs moves the tab bar to the top. - - (bugfix) Fix searching in menus past unselectable items. + - (bugfix 24) Fix searching in menus past unselectable items. - (bugfix) Fix crash with empty File extensions menu. - (new feature) New actions: kill-word-back, move-backward-word, move-forward-word @@ -258,6 +258,9 @@ have already been considered. - (bugfix 826) too small table for double-cell characters - (bugfix 902) crash: "overflow detected realloc()" in realloc_line - (bugfix 912) wrong color in one cell of an HTML input field + - (bugfix 835) Text in textarea is unaffected by horizontal + scrolling of document in UTF-8 mode + - (bugfix 823) Big textarea is too slow with CONFIG_UTF8 * Reverted changes: - (new feature) document.write, reverted in 2c087e52e74528a720621186b91880463e039d50 From 99827ceee42f0c96ec9e73d29ecbee1661385cad Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Wed, 24 Jan 2007 00:48:29 +0200 Subject: [PATCH 02/67] NEWS: Changing colors in plain text has been reverted. Reported by Witek. --- NEWS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c3e872e84..90db5d144 100644 --- a/NEWS +++ b/NEWS @@ -135,8 +135,6 @@ roughly in decreasing order of importance. * Changes in parsing and rendering of non-HTML content-types - (new feature) If a mailcap entry indicates copiousoutput, ELinks itself acts as a pager. - - (new feature) Let plain text change colors with ESC [ 31 m or - similar control sequences. * Changes in the document viewer and tabs - (new feature) Highlight links as one enters link prefixes. - (new feature) Backspace backs out the last digit of the prefix. @@ -268,6 +266,9 @@ have already been considered. in 10d72cae7eafa6b90db1c8f303deb200555734c2 - (enhancement) wcwidth, reverted in d050cb67aa37390ab938b0a308c7541f19578506 + - (new feature) Let plain text change colors with ESC [ 31 m or + similar control sequences, reverted in + 2a6125e3d0407b588eb286d4d0ff5c98c23ebda9 * Unimportant changes: - (enhancement) If select fails, save its errno. From 448f1b55cdcfd0e3625f3e86c116960630d2b8b4 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Wed, 24 Jan 2007 23:08:25 +0200 Subject: [PATCH 03/67] Make some small arrays const. --- src/terminal/draw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/terminal/draw.c b/src/terminal/draw.c index 5e81e2b75..0a1452768 100644 --- a/src/terminal/draw.c +++ b/src/terminal/draw.c @@ -46,7 +46,7 @@ void draw_border_cross(struct terminal *term, int x, int y, enum border_cross_direction dir, struct color_pair *color) { - static unsigned char border_trans[2][4] = { + static const unsigned char border_trans[2][4] = { /* Used for BORDER_X_{RIGHT,LEFT}: */ { BORDER_SVLINE, BORDER_SRTEE, BORDER_SLTEE }, /* Used for BORDER_X_{DOWN,UP}: */ @@ -191,7 +191,7 @@ void draw_border(struct terminal *term, struct box *box, struct color_pair *color, int width) { - static enum border_char p1[] = { + static const enum border_char p1[] = { BORDER_SULCORNER, BORDER_SURCORNER, BORDER_SDLCORNER, @@ -199,7 +199,7 @@ draw_border(struct terminal *term, struct box *box, BORDER_SVLINE, BORDER_SHLINE, }; - static enum border_char p2[] = { + static const enum border_char p2[] = { BORDER_DULCORNER, BORDER_DURCORNER, BORDER_DDLCORNER, @@ -207,7 +207,7 @@ draw_border(struct terminal *term, struct box *box, BORDER_DVLINE, BORDER_DHLINE, }; - enum border_char *p = (width > 1) ? p2 : p1; + const enum border_char *p = (width > 1) ? p2 : p1; struct box borderbox; set_box(&borderbox, box->x - 1, box->y - 1, From 3b7c0212542acfc3208e97565150aa95d7e7ebf9 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Wed, 24 Jan 2007 23:11:17 +0200 Subject: [PATCH 04/67] Comment changes only (about charsets in terminals). --- src/terminal/draw.h | 2 ++ src/terminal/screen.c | 2 +- src/util/string.h | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/terminal/draw.h b/src/terminal/draw.h index c5fdfbcc9..7d3927cfd 100644 --- a/src/terminal/draw.h +++ b/src/terminal/draw.h @@ -31,6 +31,8 @@ enum screen_char_attr { /* One position in the terminal screen's image. */ struct screen_char { /* Contains either character value or frame data. + * If @attr includes SCREEN_ATTR_FRAME, then @data is enum + * border_char; otherwise, @data is a character value. * If CONFIG_UTF8 is defined, and UTF-8 I/O is enabled for the * terminal, then the character value is in UCS-4; otherwise, * it is in the charset of the terminal, and the charset is diff --git a/src/terminal/screen.c b/src/terminal/screen.c index 77b8fad5b..96f9e1774 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -112,7 +112,7 @@ struct screen_driver { #ifndef CONFIG_UTF8 /* Charsets when doing UTF8 I/O. */ /* [0] is the common charset and [1] is the frame charset. - * Test wether to use UTF8 I/O using the use_utf8_io() macro. */ + * Test whether to use UTF8 I/O using the use_utf8_io() macro. */ int charsets[2]; #endif /* CONFIG_UTF8 */ diff --git a/src/util/string.h b/src/util/string.h index d3a0320cf..748e71709 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -109,7 +109,9 @@ int elinks_strlcasecmp(const unsigned char *s1, size_t n1, #define isasciialnum(c) (isasciialpha(c) || isdigit(c)) #define isident(c) (isasciialnum(c) || (c) == '_' || (c) == '-') -/* Char is safe to write to the terminal screen */ +/* Char is safe to write to the terminal screen. Cannot test for C1 + * control characters (0x80 to 0x9F) because this is also used for + * non-ISO-8859 charsets. */ #define isscreensafe(c) ((c) >= ' ' && (c) != ASCII_DEL) From 34c636026d861ec9a5025d5a75a2b003c27123dc Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Wed, 24 Jan 2007 23:15:07 +0200 Subject: [PATCH 05/67] draw_line: Make it more obvious that line points into an array. --- src/terminal/draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/terminal/draw.c b/src/terminal/draw.c index 0a1452768..cf72dbffe 100644 --- a/src/terminal/draw.c +++ b/src/terminal/draw.c @@ -155,7 +155,7 @@ draw_line(struct terminal *term, int x, int y, int l, struct screen_char *line) if (term->utf8) { struct screen_char *sc; - if (line->data == UCS_NO_CHAR && x == 0) { + if (line[0].data == UCS_NO_CHAR && x == 0) { unicode_val_T data_save; sc = line; From 8dd400d49f6909b3b88bd57905183379b8db90be Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Thu, 25 Jan 2007 00:05:36 +0200 Subject: [PATCH 06/67] Make frame translation tables const. --- src/terminal/screen.c | 14 +++++++------- src/terminal/terminal.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/terminal/screen.c b/src/terminal/screen.c index 96f9e1774..072aaf224 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -28,12 +28,12 @@ /* TODO: We must use termcap/terminfo if available! --pasky */ -unsigned char frame_dumb[48] = " ||||++||++++++--|-+||++--|-+----++++++++ "; -static unsigned char frame_vt100[48] = "aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmllnnjla "; +const unsigned char frame_dumb[48] = " ||||++||++++++--|-+||++--|-+----++++++++ "; +static const unsigned char frame_vt100[48] = "aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmllnnjla "; #ifndef CONFIG_UTF8 /* For UTF8 I/O */ -static unsigned char frame_vt100_u[48] = { +static const unsigned char frame_vt100_u[48] = { 177, 177, 177, 179, 180, 180, 180, 191, 191, 180, 179, 191, 217, 217, 217, 191, 192, 193, 194, 195, 196, 197, 195, 195, @@ -43,7 +43,7 @@ static unsigned char frame_vt100_u[48] = { }; #endif /* CONFIG_UTF8 */ -static unsigned char frame_freebsd[48] = { +static const unsigned char frame_freebsd[48] = { 130, 138, 128, 153, 150, 150, 150, 140, 140, 150, 153, 140, 139, 139, 139, 140, 142, 151, 152, 149, 146, 143, 149, 149, @@ -52,7 +52,7 @@ static unsigned char frame_freebsd[48] = { 143, 139, 141, 128, 128, 128, 128, 128, }; -static unsigned char frame_koi[48] = { +static const unsigned char frame_koi[48] = { 144, 145, 146, 129, 135, 178, 180, 167, 166, 181, 161, 168, 174, 173, 172, 131, 132, 137, 136, 134, 128, 138, 175, 176, @@ -62,7 +62,7 @@ static unsigned char frame_koi[48] = { }; /* Most of this table is just 176 + . */ -static unsigned char frame_restrict[48] = { +static const unsigned char frame_restrict[48] = { 176, 177, 178, 179, 180, 179, 186, 186, 205, 185, 186, 187, 188, 186, 205, 191, 192, 193, 194, 195, 196, 197, 179, 186, @@ -117,7 +117,7 @@ struct screen_driver { #endif /* CONFIG_UTF8 */ /* The frame translation table. May be NULL. */ - unsigned char *frame; + const unsigned char *frame; /* The frame mode setup and teardown sequences. May be NULL. */ struct string *frame_seqs; diff --git a/src/terminal/terminal.h b/src/terminal/terminal.h index 9a609aace..b86a169e1 100644 --- a/src/terminal/terminal.h +++ b/src/terminal/terminal.h @@ -162,7 +162,7 @@ struct terminal { extern struct list_head terminals; -extern unsigned char frame_dumb[]; +extern const unsigned char frame_dumb[]; struct terminal *init_term(int, int); void destroy_terminal(struct terminal *); From c62e23c1610c6bb271209810b9882197e87382ee Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Thu, 25 Jan 2007 00:09:07 +0200 Subject: [PATCH 07/67] Make struct strings const in frame mode setup and teardown. --- src/terminal/screen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/terminal/screen.c b/src/terminal/screen.c index 072aaf224..710b91777 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -76,19 +76,19 @@ static const unsigned char frame_restrict[48] = { #define add_term_string(str, tstr) \ add_bytes_to_string(str, (tstr).source, (tstr).length) -static struct string m11_hack_frame_seqs[] = { +static const struct string m11_hack_frame_seqs[] = { /* end border: */ TERM_STRING("\033[10m"), /* begin border: */ TERM_STRING("\033[11m"), }; #ifdef CONFIG_UTF8 -static struct string utf8_linux_frame_seqs[] = { +static const struct string utf8_linux_frame_seqs[] = { /* end border: */ TERM_STRING("\033[10m\033%G"), /* begin border: */ TERM_STRING("\033%@\033[11m"), }; #endif /* CONFIG_UTF8 */ -static struct string vt100_frame_seqs[] = { +static const struct string vt100_frame_seqs[] = { /* end border: */ TERM_STRING("\x0f"), /* begin border: */ TERM_STRING("\x0e"), }; @@ -120,7 +120,7 @@ struct screen_driver { const unsigned char *frame; /* The frame mode setup and teardown sequences. May be NULL. */ - struct string *frame_seqs; + const struct string *frame_seqs; /* The underline mode setup and teardown sequences. May be NULL. */ struct string *underline; From 11006800b5250556285f930e445e46dcce6c4fd1 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Thu, 25 Jan 2007 00:11:38 +0200 Subject: [PATCH 08/67] Make struct strings const in underline mode setup and teardown. --- src/terminal/screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/terminal/screen.c b/src/terminal/screen.c index 710b91777..b04b83efe 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -93,7 +93,7 @@ static const struct string vt100_frame_seqs[] = { /* begin border: */ TERM_STRING("\x0e"), }; -static struct string underline_seqs[] = { +static const struct string underline_seqs[] = { /* begin underline: */ TERM_STRING("\033[24m"), /* end underline: */ TERM_STRING("\033[4m"), }; @@ -123,7 +123,7 @@ struct screen_driver { const struct string *frame_seqs; /* The underline mode setup and teardown sequences. May be NULL. */ - struct string *underline; + const struct string *underline; /* The color mode */ enum color_mode color_mode; From 61520b9040bdf3ba1d35170b6d49d16e875f4d4e Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Thu, 25 Jan 2007 00:21:45 +0200 Subject: [PATCH 09/67] Make inactive screen drivers const. --- src/terminal/screen.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/terminal/screen.c b/src/terminal/screen.c index b04b83efe..f91f747c2 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -140,7 +140,7 @@ struct screen_driver { unsigned char name[1]; /* XXX: Keep last! */ }; -static struct screen_driver dumb_screen_driver = { +static const struct screen_driver dumb_screen_driver = { NULL_LIST_HEAD, /* type: */ TERM_DUMB, #ifndef CONFIG_UTF8 @@ -156,7 +156,7 @@ static struct screen_driver dumb_screen_driver = { #endif /* CONFIG_UTF8 */ }; -static struct screen_driver vt100_screen_driver = { +static const struct screen_driver vt100_screen_driver = { NULL_LIST_HEAD, /* type: */ TERM_VT100, #ifndef CONFIG_UTF8 @@ -172,7 +172,7 @@ static struct screen_driver vt100_screen_driver = { #endif /* CONFIG_UTF8 */ }; -static struct screen_driver linux_screen_driver = { +static const struct screen_driver linux_screen_driver = { NULL_LIST_HEAD, /* type: */ TERM_LINUX, #ifndef CONFIG_UTF8 @@ -188,7 +188,7 @@ static struct screen_driver linux_screen_driver = { #endif /* CONFIG_UTF8 */ }; -static struct screen_driver koi8_screen_driver = { +static const struct screen_driver koi8_screen_driver = { NULL_LIST_HEAD, /* type: */ TERM_KOI8, #ifndef CONFIG_UTF8 @@ -204,7 +204,7 @@ static struct screen_driver koi8_screen_driver = { #endif /* CONFIG_UTF8 */ }; -static struct screen_driver freebsd_screen_driver = { +static const struct screen_driver freebsd_screen_driver = { NULL_LIST_HEAD, /* type: */ TERM_FREEBSD, #ifndef CONFIG_UTF8 @@ -221,7 +221,7 @@ static struct screen_driver freebsd_screen_driver = { }; /* XXX: Keep in sync with enum term_mode_type. */ -static struct screen_driver *screen_drivers[] = { +static const struct screen_driver *const screen_drivers[] = { /* TERM_DUMB: */ &dumb_screen_driver, /* TERM_VT100: */ &vt100_screen_driver, /* TERM_LINUX: */ &linux_screen_driver, From 649f470fe532660f898f15cadd660bf77b6f830f Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Thu, 25 Jan 2007 00:33:17 +0200 Subject: [PATCH 10/67] add_string_to_string: Make the "from" string const. --- src/util/string.c | 2 +- src/util/string.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/string.c b/src/util/string.c index d6a213463..504fd00e6 100644 --- a/src/util/string.c +++ b/src/util/string.c @@ -318,7 +318,7 @@ add_crlf_to_string(struct string *string) } inline struct string * -add_string_to_string(struct string *string, struct string *from) +add_string_to_string(struct string *string, const struct string *from) { assertm(string && from, "[add_string_to_string]"); if_assert_failed { return NULL; } diff --git a/src/util/string.h b/src/util/string.h index 748e71709..4396fdaf7 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -160,7 +160,7 @@ void done_string(struct string *string); struct string *add_to_string(struct string *string, const unsigned char *source); struct string *add_char_to_string(struct string *string, unsigned char character); -struct string *add_string_to_string(struct string *to, struct string *from); +struct string *add_string_to_string(struct string *to, const struct string *from); struct string *add_file_to_string(struct string *string, unsigned char *filename); struct string *add_crlf_to_string(struct string *string); From 5882ec0ce76023f5dbad533c050424ed14ba9c57 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Thu, 25 Jan 2007 01:04:19 +0200 Subject: [PATCH 11/67] Make color256_seqs and color_true_seqs const. --- src/terminal/screen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/terminal/screen.c b/src/terminal/screen.c index f91f747c2..5bab0b1fc 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -655,13 +655,13 @@ add_char16(struct string *screen, struct screen_driver *driver, } #if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) -static struct string color256_seqs[] = { +static const struct string color256_seqs[] = { /* foreground: */ TERM_STRING("\033[0;38;5;%dm"), /* background: */ TERM_STRING("\033[48;5;%dm"), }; static inline void -add_char_color(struct string *screen, struct string *seq, unsigned char color) +add_char_color(struct string *screen, const struct string *seq, unsigned char color) { unsigned char color_buf[3]; unsigned char *color_pos = color_buf; @@ -772,14 +772,14 @@ add_char256(struct string *screen, struct screen_driver *driver, #endif #ifdef CONFIG_TRUE_COLOR -static struct string color_true_seqs[] = { +static const struct string color_true_seqs[] = { /* foreground: */ TERM_STRING("\033[0;38;2"), /* background: */ TERM_STRING("\033[48;2"), }; #define add_true_background_color(str, seq, chr) add_char_true_color(str, &(seq)[1], &(chr)->color[3]) #define add_true_foreground_color(str, seq, chr) add_char_true_color(str, &(seq)[0], &(chr)->color[0]) static inline void -add_char_true_color(struct string *screen, struct string *seq, unsigned char *colors) +add_char_true_color(struct string *screen, const struct string *seq, unsigned char *colors) { unsigned char color_buf[3]; int i; From c88e6e38bc91c9f538190815caa8a2766b8ed007 Mon Sep 17 00:00:00 2001 From: Laurent MONIN Date: Thu, 25 Jan 2007 14:00:10 +0100 Subject: [PATCH 12/67] Minor fix. --- po/fr.po | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/po/fr.po b/po/fr.po index 003bf54c5..2f40e2865 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.12.GIT\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-01-10 09:16+0100\n" -"PO-Revision-Date: 2007-01-10 09:18+0100\n" +"POT-Creation-Date: 2007-01-25 13:58+0100\n" +"PO-Revision-Date: 2007-01-25 14:00+0100\n" "Last-Translator: Laurent Monin \n" "Language-Team: French \n" "MIME-Version: 1.0\n" @@ -33,7 +33,7 @@ msgstr "Pressez espace pour d #. accelerator_context(do_auth_dialog, do_edit_dialog, generic_external_protocol_handler, info_box, input_dialog, menu_add_ext, menu_keys, push_hierbox_info_button, python_info_box, refreshed_msg_box, resize_terminal_dialog, setup_first_session, src/config/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:push_add_server_button, src/scripting/lua/core.c:l_edit_bookmark_dialog, src/scripting/lua/core.c:l_xdialog, src/viewer/text/search.c:search_dlg_do, terminal_options, write_config_dialog) #: src/bfu/hierbox.c:441 src/bfu/inpfield.c:256 src/bfu/msgbox.c:173 #: src/bfu/msgbox.c:191 src/config/dialogs.c:58 src/config/dialogs.c:363 -#: src/cookies/dialogs.c:357 src/cookies/dialogs.c:455 src/dialogs/edit.c:98 +#: src/cookies/dialogs.c:359 src/cookies/dialogs.c:457 src/dialogs/edit.c:98 #: src/dialogs/info.c:134 src/dialogs/options.c:234 src/dialogs/options.c:315 #: src/mime/dialogs.c:131 src/protocol/auth/dialogs.c:115 #: src/protocol/protocol.c:236 src/scripting/lua/core.c:390 @@ -146,7 +146,7 @@ msgid "Search string '%s' not found" msgstr "Chaîne recherchée '%s' introuvable" #: src/bfu/hierbox.c:970 src/config/dialogs.c:139 src/config/dialogs.c:329 -#: src/config/dialogs.c:477 src/cookies/dialogs.c:34 src/cookies/dialogs.c:351 +#: src/config/dialogs.c:477 src/cookies/dialogs.c:34 src/cookies/dialogs.c:353 #: src/dialogs/edit.c:92 src/dialogs/edit.c:94 src/scripting/lua/core.c:386 #: src/scripting/lua/core.c:387 src/scripting/lua/core.c:468 msgid "Name" @@ -174,8 +174,8 @@ msgid "Empty string not allowed" msgstr "Chaîne vide non autorisée" #. accelerator_context(do_auth_dialog, do_edit_dialog, input_dialog, menu_add_ext, resize_terminal_dialog, src/config/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:push_add_server_button, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/scripting/lua/core.c:l_edit_bookmark_dialog, src/scripting/lua/core.c:l_xdialog, src/session/download.c:do_type_query, src/session/download.c:lookup_unique_name, src/viewer/text/search.c:search_dlg_do, terminal_options) -#: src/bfu/inpfield.c:256 src/config/dialogs.c:364 src/cookies/dialogs.c:358 -#: src/cookies/dialogs.c:456 src/dialogs/edit.c:102 src/dialogs/edit.c:105 +#: src/bfu/inpfield.c:256 src/config/dialogs.c:364 src/cookies/dialogs.c:360 +#: src/cookies/dialogs.c:458 src/dialogs/edit.c:102 src/dialogs/edit.c:105 #: src/dialogs/options.c:237 src/dialogs/options.c:316 src/mime/dialogs.c:132 #: src/protocol/auth/dialogs.c:116 src/protocol/bittorrent/dialogs.c:812 #: src/scripting/lua/core.c:391 src/scripting/lua/core.c:472 @@ -478,13 +478,13 @@ msgstr "A~ller #. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons) #: src/bookmarks/dialogs.c:488 src/config/dialogs.c:501 -#: src/cookies/dialogs.c:477 +#: src/cookies/dialogs.c:479 msgid "~Edit" msgstr "~Modifier" #. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/cache/dialogs.c:cache_buttons, src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/menu.c:ext_menu, src/formhist/dialogs.c:formhist_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons) #: src/bookmarks/dialogs.c:489 src/cache/dialogs.c:231 -#: src/config/dialogs.c:503 src/config/dialogs.c:930 src/cookies/dialogs.c:478 +#: src/config/dialogs.c:503 src/config/dialogs.c:930 src/cookies/dialogs.c:480 #: src/dialogs/menu.c:457 src/formhist/dialogs.c:211 #: src/globhist/dialogs.c:229 src/protocol/auth/dialogs.c:263 msgid "~Delete" @@ -492,7 +492,7 @@ msgstr "~Supprimer" #. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/menu.c:ext_menu) #: src/bookmarks/dialogs.c:490 src/config/dialogs.c:502 -#: src/config/dialogs.c:929 src/cookies/dialogs.c:475 src/dialogs/menu.c:455 +#: src/config/dialogs.c:929 src/cookies/dialogs.c:477 src/dialogs/menu.c:455 msgid "~Add" msgstr "~Ajouter" @@ -599,7 +599,7 @@ msgid "invalid" msgstr "invalide" #: src/cache/dialogs.c:125 src/cookies/dialogs.c:40 src/cookies/dialogs.c:44 -#: src/cookies/dialogs.c:354 +#: src/cookies/dialogs.c:356 msgid "Expires" msgstr "Expiration" @@ -645,7 +645,7 @@ msgid "Delete this cache entry?" msgstr "Supprimer cette entrée de cache ?" #. accelerator_context(display_download, src/cache/dialogs.c:cache_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/download.c:download_buttons, src/formhist/dialogs.c:formhist_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons) -#: src/cache/dialogs.c:229 src/config/dialogs.c:500 src/cookies/dialogs.c:474 +#: src/cache/dialogs.c:229 src/config/dialogs.c:500 src/cookies/dialogs.c:476 #: src/dialogs/download.c:255 src/dialogs/download.c:492 #: src/formhist/dialogs.c:210 src/globhist/dialogs.c:225 #: src/protocol/auth/dialogs.c:262 @@ -1827,7 +1827,7 @@ msgid "Type" msgstr "Type" #: src/config/dialogs.c:172 src/config/dialogs.c:359 src/cookies/dialogs.c:35 -#: src/cookies/dialogs.c:352 +#: src/cookies/dialogs.c:354 msgid "Value" msgstr "Valeur" @@ -1860,7 +1860,7 @@ msgstr "Erreur" msgid "Bad option value." msgstr "Mauvaise valeur." -#: src/config/dialogs.c:320 src/config/dialogs.c:388 src/cookies/dialogs.c:324 +#: src/config/dialogs.c:320 src/config/dialogs.c:388 src/cookies/dialogs.c:325 msgid "Edit" msgstr "Modifier" @@ -1890,7 +1890,7 @@ msgid "Cannot add an option here." msgstr "Impossible d'ajouter une option ici." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) -#: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:480 +#: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:482 #: src/dialogs/options.c:236 src/formhist/dialogs.c:214 #: src/protocol/bittorrent/dialogs.c:799 src/session/download.c:1227 msgid "Sa~ve" @@ -3705,7 +3705,7 @@ msgstr "" "1 mode 16 couleurs, utilise les couleurs ANSI\n" "2 mode 88 couleurs, utilise les codes RVB d'XTerm\n" "3 mode 256 couleurs, utilise les codes RVB d'XTerm\n" -"4 mode vraies couleurs, utilise les codes RVB de konsole." +"4 mode vraies couleurs, utilise les codes RVB de konsole" #: src/config/options.inc:876 src/dialogs/options.c:230 msgid "Transparency" @@ -4605,7 +4605,7 @@ msgstr "ELinks a msgid "ELinks was started with the -anonymous option." msgstr "ELinks a été démarré avec l'option -anonymous." -#: src/cookies/dialogs.c:36 src/cookies/dialogs.c:353 +#: src/cookies/dialogs.c:36 src/cookies/dialogs.c:355 msgid "Domain" msgstr "Domaine" @@ -4618,7 +4618,7 @@ msgstr "Chemin" msgid "at quit time" msgstr "au moment de quitter" -#: src/cookies/dialogs.c:49 src/cookies/dialogs.c:355 +#: src/cookies/dialogs.c:49 src/cookies/dialogs.c:357 msgid "Secure" msgstr "Sécurisé" @@ -4649,7 +4649,7 @@ msgstr "~Accepter" msgid "~Reject" msgstr "~Rejeter" -#: src/cookies/dialogs.c:149 src/cookies/dialogs.c:343 +#: src/cookies/dialogs.c:149 src/cookies/dialogs.c:345 #: src/dialogs/document.c:177 msgid "Server" msgstr "Serveur" @@ -4720,26 +4720,26 @@ msgstr "Effacer tous les cookies" msgid "Do you really want to remove all cookies?" msgstr "Êtes-vous sûr de vouloir effacer tous les cookies ?" -#: src/cookies/dialogs.c:449 +#: src/cookies/dialogs.c:451 msgid "Add server" msgstr "Ajouter un serveur" -#: src/cookies/dialogs.c:453 +#: src/cookies/dialogs.c:455 msgid "Server name" msgstr "Nom du serveur" #. accelerator_context(src/cookies/dialogs.c:cookie_buttons) -#: src/cookies/dialogs.c:476 +#: src/cookies/dialogs.c:478 msgid "Add ~server" msgstr "Ajouter un ser~veur" #. accelerator_context(do_edit_dialog, src/cookies/dialogs.c:cookie_buttons, src/dialogs/download.c:download_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons) -#: src/cookies/dialogs.c:479 src/dialogs/download.c:498 src/dialogs/edit.c:99 +#: src/cookies/dialogs.c:481 src/dialogs/download.c:498 src/dialogs/edit.c:99 #: src/globhist/dialogs.c:232 src/protocol/auth/dialogs.c:264 msgid "C~lear" msgstr "~Effacer" -#: src/cookies/dialogs.c:485 +#: src/cookies/dialogs.c:487 msgid "Cookie manager" msgstr "Gestionnaire de cookies" @@ -5957,7 +5957,7 @@ msgstr "" "1 afficher les titres des pages" #. name: -#: src/globhist/globhist.c:448 +#: src/globhist/globhist.c:449 msgid "Global History" msgstr "Historique Global" From 65645624b40c7450355ddafd5b84767e2c953ef4 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 09:58:18 +0200 Subject: [PATCH 13/67] cp1250, cp1257: Don't map undefined bytes to U+0000. --- Unicode/cp1250.cp | 10 +++++----- Unicode/cp1257.cp | 24 ++++++++++++------------ Unicode/gen-cp | 16 ++++++++++++++-- src/intl/codepage.inc | 34 +++++++++++++++++----------------- 4 files changed, 48 insertions(+), 36 deletions(-) diff --git a/Unicode/cp1250.cp b/Unicode/cp1250.cp index 9c77c7bdb..dee634715 100644 --- a/Unicode/cp1250.cp +++ b/Unicode/cp1250.cp @@ -147,14 +147,14 @@ Window$ 1250 0x7E 0x007E #TILDE 0x7F 0x007F #DELETE 0x80 0x20AC #EURO SIGN -0x81 0x0000 #UNDEFINED +0x81 #UNDEFINED 0x82 0x201A #SINGLE LOW-9 QUOTATION MARK -0x83 0x0000 #UNDEFINED +0x83 #UNDEFINED 0x84 0x201E #DOUBLE LOW-9 QUOTATION MARK 0x85 0x2026 #HORIZONTAL ELLIPSIS 0x86 0x2020 #DAGGER 0x87 0x2021 #DOUBLE DAGGER -0x88 0x0000 #UNDEFINED +0x88 #UNDEFINED 0x89 0x2030 #PER MILLE SIGN 0x8A 0x0160 #LATIN CAPITAL LETTER S WITH CARON 0x8B 0x2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK @@ -162,7 +162,7 @@ Window$ 1250 0x8D 0x0164 #LATIN CAPITAL LETTER T WITH CARON 0x8E 0x017D #LATIN CAPITAL LETTER Z WITH CARON 0x8F 0x0179 #LATIN CAPITAL LETTER Z WITH ACUTE -0x90 0x0000 #UNDEFINED +0x90 #UNDEFINED 0x91 0x2018 #LEFT SINGLE QUOTATION MARK 0x92 0x2019 #RIGHT SINGLE QUOTATION MARK 0x93 0x201C #LEFT DOUBLE QUOTATION MARK @@ -170,7 +170,7 @@ Window$ 1250 0x95 0x2022 #BULLET 0x96 0x2013 #EN DASH 0x97 0x2014 #EM DASH -0x98 0x0000 #UNDEFINED +0x98 #UNDEFINED 0x99 0x2122 #TRADE MARK SIGN 0x9A 0x0161 #LATIN SMALL LETTER S WITH CARON 0x9B 0x203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK diff --git a/Unicode/cp1257.cp b/Unicode/cp1257.cp index 39a5e162e..266f221e3 100644 --- a/Unicode/cp1257.cp +++ b/Unicode/cp1257.cp @@ -23,22 +23,22 @@ Window$ 1257 0x20-0x7e idem # 0x80 0x20AC #EURO SIGN -0x81 0x0000 #UNDEFINED +0x81 #UNDEFINED 0x82 0x201A #SINGLE LOW-9 QUOTATION MARK -0x83 0x0000 #UNDEFINED +0x83 #UNDEFINED 0x84 0x201E #DOUBLE LOW-9 QUOTATION MARK 0x85 0x2026 #HORIZONTAL ELLIPSIS 0x86 0x2020 #DAGGER 0x87 0x2021 #DOUBLE DAGGER -0x88 0x0000 #UNDEFINED +0x88 #UNDEFINED 0x89 0x2030 #PER MILLE SIGN -0x8A 0x0000 #UNDEFINED +0x8A #UNDEFINED 0x8B 0x2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK -0x8C 0x0000 #UNDEFINED +0x8C #UNDEFINED 0x8D 0x00A8 #DIAERESIS 0x8E 0x02C7 #CARON 0x8F 0x00B8 #CEDILLA -0x90 0x0000 #UNDEFINED +0x90 #UNDEFINED 0x91 0x2018 #LEFT SINGLE QUOTATION MARK 0x92 0x2019 #RIGHT SINGLE QUOTATION MARK 0x93 0x201C #LEFT DOUBLE QUOTATION MARK @@ -46,20 +46,20 @@ Window$ 1257 0x95 0x2022 #BULLET 0x96 0x2013 #EN DASH 0x97 0x2014 #EM DASH -0x98 0x0000 #UNDEFINED +0x98 #UNDEFINED 0x99 0x2122 #TRADE MARK SIGN -0x9A 0x0000 #UNDEFINED +0x9A #UNDEFINED 0x9B 0x203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -0x9C 0x0000 #UNDEFINED +0x9C #UNDEFINED 0x9D 0x00AF #MACRON 0x9E 0x02DB #OGONEK -0x9F 0x0000 #UNDEFINED +0x9F #UNDEFINED 0xA0 0x00A0 #NO-BREAK SPACE -0xA1 0x0000 #UNDEFINED +0xA1 #UNDEFINED 0xA2 0x00A2 #CENT SIGN 0xA3 0x00A3 #POUND SIGN 0xA4 0x00A4 #CURRENCY SIGN -0xA5 0x0000 #UNDEFINED +0xA5 #UNDEFINED 0xA6 0x00A6 #BROKEN BAR 0xA7 0x00A7 #SECTION SIGN 0xA8 0x00D8 #LATIN CAPITAL LETTER O WITH STROKE diff --git a/Unicode/gen-cp b/Unicode/gen-cp index b1e289b2a..83f8090d6 100755 --- a/Unicode/gen-cp +++ b/Unicode/gen-cp @@ -23,17 +23,29 @@ for i in $codepages; do echo "/*** $i ***/" echo - sed '1,2d + sed ' # Delete the name and aliases lines. + 1,2d + # Delete comment-only and blank lines. /^[ ]*\(#.*\)\{,1\}$/d + # Copy to the hold space. h + # Delete everything except the comment. s/^[^#]*// + # If there is a comment, change it to use /* */ delimiters. s!#[ ]*\(.*\)!/* \1 */! + # Exchange spaces; now hold space = comment and pattern space = all. x + # Delete the comment. s/#.*// + # Canonicalize case so the strings can be used as lookup keys. y/Xabcdef/xABCDEF/ + # Delete mappings of bytes 0x00...0x7F. ELinks assumes those match ASCII. /^0x[01234567]/d - /[^0x0123456789ABCDEF ]/d + # Delete lines that do not map the byte to exactly one character. + /^[ ]*0x[0123456789ABCDEF]\{2\}[ ]\{1,\}0x[0123456789ABCDEF]\{1,\}[ ]*$/!d + # Append a newline and the comment from the hold space. G + # Delete the newline added by the previous command. s/\n//' "$i.cp" | { for left in 8 9 A B C D E F; do for right in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do diff --git a/src/intl/codepage.inc b/src/intl/codepage.inc index afe53df4d..026d60424 100644 --- a/src/intl/codepage.inc +++ b/src/intl/codepage.inc @@ -2134,14 +2134,14 @@ unsigned char *const aliases_8859_16 [] = { const uint16_t highhalf_cp1250 [] = { /* 0x80 */ 0x20AC, /* EURO SIGN */ - /* 0x81 */ 0x0000, /* UNDEFINED */ + /* 0x81 */ 0xFFFF, /* 0x82 */ 0x201A, /* SINGLE LOW-9 QUOTATION MARK */ - /* 0x83 */ 0x0000, /* UNDEFINED */ + /* 0x83 */ 0xFFFF, /* 0x84 */ 0x201E, /* DOUBLE LOW-9 QUOTATION MARK */ /* 0x85 */ 0x2026, /* HORIZONTAL ELLIPSIS */ /* 0x86 */ 0x2020, /* DAGGER */ /* 0x87 */ 0x2021, /* DOUBLE DAGGER */ - /* 0x88 */ 0x0000, /* UNDEFINED */ + /* 0x88 */ 0xFFFF, /* 0x89 */ 0x2030, /* PER MILLE SIGN */ /* 0x8A */ 0x0160, /* LATIN CAPITAL LETTER S WITH CARON */ /* 0x8B */ 0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */ @@ -2149,7 +2149,7 @@ const uint16_t highhalf_cp1250 [] = { /* 0x8D */ 0x0164, /* LATIN CAPITAL LETTER T WITH CARON */ /* 0x8E */ 0x017D, /* LATIN CAPITAL LETTER Z WITH CARON */ /* 0x8F */ 0x0179, /* LATIN CAPITAL LETTER Z WITH ACUTE */ - /* 0x90 */ 0x0000, /* UNDEFINED */ + /* 0x90 */ 0xFFFF, /* 0x91 */ 0x2018, /* LEFT SINGLE QUOTATION MARK */ /* 0x92 */ 0x2019, /* RIGHT SINGLE QUOTATION MARK */ /* 0x93 */ 0x201C, /* LEFT DOUBLE QUOTATION MARK */ @@ -2157,7 +2157,7 @@ const uint16_t highhalf_cp1250 [] = { /* 0x95 */ 0x2022, /* BULLET */ /* 0x96 */ 0x2013, /* EN DASH */ /* 0x97 */ 0x2014, /* EM DASH */ - /* 0x98 */ 0x0000, /* UNDEFINED */ + /* 0x98 */ 0xFFFF, /* 0x99 */ 0x2122, /* TRADE MARK SIGN */ /* 0x9A */ 0x0161, /* LATIN SMALL LETTER S WITH CARON */ /* 0x9B */ 0x203A, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */ @@ -2710,22 +2710,22 @@ unsigned char *const aliases_cp1256 [] = { const uint16_t highhalf_cp1257 [] = { /* 0x80 */ 0x20AC, /* EURO SIGN */ - /* 0x81 */ 0x0000, /* UNDEFINED */ + /* 0x81 */ 0xFFFF, /* 0x82 */ 0x201A, /* SINGLE LOW-9 QUOTATION MARK */ - /* 0x83 */ 0x0000, /* UNDEFINED */ + /* 0x83 */ 0xFFFF, /* 0x84 */ 0x201E, /* DOUBLE LOW-9 QUOTATION MARK */ /* 0x85 */ 0x2026, /* HORIZONTAL ELLIPSIS */ /* 0x86 */ 0x2020, /* DAGGER */ /* 0x87 */ 0x2021, /* DOUBLE DAGGER */ - /* 0x88 */ 0x0000, /* UNDEFINED */ + /* 0x88 */ 0xFFFF, /* 0x89 */ 0x2030, /* PER MILLE SIGN */ - /* 0x8A */ 0x0000, /* UNDEFINED */ + /* 0x8A */ 0xFFFF, /* 0x8B */ 0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */ - /* 0x8C */ 0x0000, /* UNDEFINED */ + /* 0x8C */ 0xFFFF, /* 0x8D */ 0x00A8, /* DIAERESIS */ /* 0x8E */ 0x02C7, /* CARON */ /* 0x8F */ 0x00B8, /* CEDILLA */ - /* 0x90 */ 0x0000, /* UNDEFINED */ + /* 0x90 */ 0xFFFF, /* 0x91 */ 0x2018, /* LEFT SINGLE QUOTATION MARK */ /* 0x92 */ 0x2019, /* RIGHT SINGLE QUOTATION MARK */ /* 0x93 */ 0x201C, /* LEFT DOUBLE QUOTATION MARK */ @@ -2733,20 +2733,20 @@ const uint16_t highhalf_cp1257 [] = { /* 0x95 */ 0x2022, /* BULLET */ /* 0x96 */ 0x2013, /* EN DASH */ /* 0x97 */ 0x2014, /* EM DASH */ - /* 0x98 */ 0x0000, /* UNDEFINED */ + /* 0x98 */ 0xFFFF, /* 0x99 */ 0x2122, /* TRADE MARK SIGN */ - /* 0x9A */ 0x0000, /* UNDEFINED */ + /* 0x9A */ 0xFFFF, /* 0x9B */ 0x203A, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */ - /* 0x9C */ 0x0000, /* UNDEFINED */ + /* 0x9C */ 0xFFFF, /* 0x9D */ 0x00AF, /* MACRON */ /* 0x9E */ 0x02DB, /* OGONEK */ - /* 0x9F */ 0x0000, /* UNDEFINED */ + /* 0x9F */ 0xFFFF, /* 0xA0 */ 0x00A0, /* NO-BREAK SPACE */ - /* 0xA1 */ 0x0000, /* UNDEFINED */ + /* 0xA1 */ 0xFFFF, /* 0xA2 */ 0x00A2, /* CENT SIGN */ /* 0xA3 */ 0x00A3, /* POUND SIGN */ /* 0xA4 */ 0x00A4, /* CURRENCY SIGN */ - /* 0xA5 */ 0x0000, /* UNDEFINED */ + /* 0xA5 */ 0xFFFF, /* 0xA6 */ 0x00A6, /* BROKEN BAR */ /* 0xA7 */ 0x00A7, /* SECTION SIGN */ /* 0xA8 */ 0x00D8, /* LATIN CAPITAL LETTER O WITH STROKE */ From 564a6b96028e5691288306b115b91e25926125c8 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 10:25:51 +0200 Subject: [PATCH 14/67] Bug 882, add_char_data: Document the charsets being used. --- src/terminal/screen.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/terminal/screen.c b/src/terminal/screen.c index 5bab0b1fc..371f55a6c 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -532,6 +532,18 @@ add_char_data(struct string *screen, struct screen_driver *driver, unsigned char data, unsigned char border) #endif /* CONFIG_UTF8 */ { + /* CONFIG_UTF8 use_utf8_io border data add_to_string + * ----------- ----------- ------ ---------------- ---------------- + * not defined 0 0 terminal unibyte terminal unibyte + * not defined 0 1 enum border_char border unibyte + * not defined 1 0 terminal unibyte UTF-8 + * not defined 1 1 enum border_char UTF-8 + * defined 0 0 terminal unibyte terminal unibyte + * defined 0 1 enum border_char border unibyte + * defined 1 0 UTF-32 UTF-8 + * defined 1 1 enum border_char border unibyte + */ + if (!isscreensafe(data)) { add_char_to_string(screen, ' '); return; From f4709c3794c8bb101c188b4f9e2cbcf3c427bcea Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 11:12:22 +0200 Subject: [PATCH 15/67] Bug 882: Replace C1 controls with spaces in UTF-8 to the terminal. --- src/intl/charsets.h | 4 ++++ src/terminal/screen.c | 28 ++++++++++++++++------------ src/util/string.h | 3 +++ src/viewer/dump/dump.c | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/intl/charsets.h b/src/intl/charsets.h index e6dbe707d..69fb3cb96 100644 --- a/src/intl/charsets.h +++ b/src/intl/charsets.h @@ -3,6 +3,10 @@ typedef uint32_t unicode_val_T; +/* U+0020 SPACE. Normally the same as ' ' or L' ' but perhaps ELinks + * shouldn't rely on that. */ +#define UCS_SPACE ((unicode_val_T) 0x0020) + /* U+FFFD REPLACEMENT CHARACTER. Used when no Unicode mapping is * known for a byte in a codepage, or when invalid UTF-8 is received * from a terminal. After generating the character, ELinks then diff --git a/src/terminal/screen.c b/src/terminal/screen.c index 371f55a6c..f0f096ff6 100644 --- a/src/terminal/screen.c +++ b/src/terminal/screen.c @@ -542,13 +542,10 @@ add_char_data(struct string *screen, struct screen_driver *driver, * defined 0 1 enum border_char border unibyte * defined 1 0 UTF-32 UTF-8 * defined 1 1 enum border_char border unibyte + * + * For "UTF-32" above, the data can also be UCS_NO_CHAR. */ - if (!isscreensafe(data)) { - add_char_to_string(screen, ' '); - return; - } - if (border && driver->frame && data >= 176 && data < 224) data = driver->frame[data - 176]; @@ -556,18 +553,25 @@ add_char_data(struct string *screen, struct screen_driver *driver, #ifdef CONFIG_UTF8 if (border) add_char_to_string(screen, (unsigned char)data); - else - if (data != UCS_NO_CHAR) - add_to_string(screen, encode_utf8(data)); + else if (data != UCS_NO_CHAR) { + if (!isscreensafe_ucs(data)) + data = UCS_SPACE; + add_to_string(screen, encode_utf8(data)); + } #else int charset = driver->charsets[!!border]; - add_to_string(screen, cp2utf8(charset, data)); + if (border || isscreensafe(data)) + add_to_string(screen, cp2utf8(charset, data)); + else /* UCS_SPACE <= 0x7F and so fits in one UTF-8 byte */ + add_char_to_string(screen, UCS_SPACE); #endif /* CONFIG_UTF8 */ - return; + } else { + if (border || isscreensafe(data)) + add_char_to_string(screen, (unsigned char)data); + else + add_char_to_string(screen, ' '); } - - add_char_to_string(screen, (unsigned char)data); } /* Time critical section. */ diff --git a/src/util/string.h b/src/util/string.h index 4396fdaf7..a66d7479c 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -114,6 +114,9 @@ int elinks_strlcasecmp(const unsigned char *s1, size_t n1, * non-ISO-8859 charsets. */ #define isscreensafe(c) ((c) >= ' ' && (c) != ASCII_DEL) +/* Like isscreensafe but takes Unicode values and so can check for C1. */ +#define isscreensafe_ucs(c) (((c) >= 0x20 && (c) <= 0x7E) || (c) >= 0xA0) + /* String debugging using magic number, it may catch some errors. */ #ifdef CONFIG_DEBUG diff --git a/src/viewer/dump/dump.c b/src/viewer/dump/dump.c index ab3c170d3..63b2bf1f5 100644 --- a/src/viewer/dump/dump.c +++ b/src/viewer/dump/dump.c @@ -405,7 +405,7 @@ utf8: unicode_val_T data = pos->data; unsigned int frame = (pos->attr & SCREEN_ATTR_FRAME); - if (!isscreensafe(data)) { + if (!isscreensafe_ucs(data)) { white++; continue; } else { From ba5f683dcbb8f4ba7dbc882f3a9ebd2eaffaca21 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 18:41:57 +0200 Subject: [PATCH 16/67] l_set_option: Use option_changed() instead of inline code. --- src/scripting/lua/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index 96b96d8f0..c50d43e53 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -491,7 +491,7 @@ static int l_set_option(LS) { int nargs; - struct option *opt, *current; + struct option *opt; const char *name; nargs = lua_gettop(S); @@ -536,11 +536,8 @@ l_set_option(LS) goto lua_error; } - opt->flags |= OPT_TOUCHED; - /* Call hook */ - current = opt; - call_change_hooks(lua_ses, current, opt); + option_changed(lua_ses, opt, opt); return 1; lua_error: From 22f746801334368630ba993bbb569e756d615430 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 19:00:47 +0200 Subject: [PATCH 17/67] Make arrays of option change hooks const. --- src/bookmarks/bookmarks.c | 2 +- src/config/options.c | 6 +++--- src/config/options.h | 2 +- src/config/timer.c | 2 +- src/document/css/css.c | 2 +- src/mime/backend/mailcap.c | 2 +- src/mime/backend/mimetypes.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bookmarks/bookmarks.c b/src/bookmarks/bookmarks.c index e1722094b..f9e9a45ea 100644 --- a/src/bookmarks/bookmarks.c +++ b/src/bookmarks/bookmarks.c @@ -135,7 +135,7 @@ change_hook_folder_state(struct session *ses, struct option *current, static void init_bookmarks(struct module *module) { - struct change_hook_info bookmarks_change_hooks[] = { + static const struct change_hook_info bookmarks_change_hooks[] = { { "bookmarks.folder_state", change_hook_folder_state }, { NULL, NULL }, }; diff --git a/src/config/options.c b/src/config/options.c index d98549861..12174b943 100644 --- a/src/config/options.c +++ b/src/config/options.c @@ -680,7 +680,7 @@ register_autocreated_options(void) static struct option_info config_options_info[]; extern struct option_info cmdline_options_info[]; -static struct change_hook_info change_hooks[]; +static const struct change_hook_info change_hooks[]; void init_options(void) @@ -716,7 +716,7 @@ done_options(void) } void -register_change_hooks(struct change_hook_info *change_hooks) +register_change_hooks(const struct change_hook_info *change_hooks) { int i; @@ -976,7 +976,7 @@ change_hook_language(struct session *ses, struct option *current, struct option return 0; } -static struct change_hook_info change_hooks[] = { +static const struct change_hook_info change_hooks[] = { { "config.show_template", change_hook_stemplate }, { "connection", change_hook_connection }, { "document.browse", change_hook_html }, diff --git a/src/config/options.h b/src/config/options.h index 8123bc964..8c8c1987c 100644 --- a/src/config/options.h +++ b/src/config/options.h @@ -145,7 +145,7 @@ struct change_hook_info { change_hook_T change_hook; }; -extern void register_change_hooks(struct change_hook_info *change_hooks); +extern void register_change_hooks(const struct change_hook_info *change_hooks); extern struct list_head *init_options_tree(void); diff --git a/src/config/timer.c b/src/config/timer.c index 0a7a9ceca..0a36d00e2 100644 --- a/src/config/timer.c +++ b/src/config/timer.c @@ -63,7 +63,7 @@ periodic_save_change_hook(struct session *ses, struct option *current, static void init_timer(struct module *module) { - struct change_hook_info timer_change_hooks[] = { + static const struct change_hook_info timer_change_hooks[] = { { "infofiles.save_interval", periodic_save_change_hook }, { NULL, NULL }, }; diff --git a/src/document/css/css.c b/src/document/css/css.c index 42c9ef353..48a376233 100644 --- a/src/document/css/css.c +++ b/src/document/css/css.c @@ -135,7 +135,7 @@ change_hook_css(struct session *ses, struct option *current, struct option *chan static void init_css(struct module *module) { - struct change_hook_info css_change_hooks[] = { + static const struct change_hook_info css_change_hooks[] = { { "document.css", change_hook_css }, { NULL, NULL }, }; diff --git a/src/mime/backend/mailcap.c b/src/mime/backend/mailcap.c index 772d10a55..3bdd2ca19 100644 --- a/src/mime/backend/mailcap.c +++ b/src/mime/backend/mailcap.c @@ -456,7 +456,7 @@ change_hook_mailcap(struct session *ses, struct option *current, struct option * static void init_mailcap(struct module *module) { - struct change_hook_info mimetypes_change_hooks[] = { + static const struct change_hook_info mimetypes_change_hooks[] = { { "mime.mailcap", change_hook_mailcap }, { NULL, NULL }, }; diff --git a/src/mime/backend/mimetypes.c b/src/mime/backend/mimetypes.c index d1edcf117..2b4d8ba62 100644 --- a/src/mime/backend/mimetypes.c +++ b/src/mime/backend/mimetypes.c @@ -221,7 +221,7 @@ change_hook_mimetypes(struct session *ses, struct option *current, struct option static void init_mimetypes(struct module *module) { - struct change_hook_info mimetypes_change_hooks[] = { + static const struct change_hook_info mimetypes_change_hooks[] = { { "mime.mimetypes", change_hook_mimetypes }, { NULL, NULL }, }; From 7bfd9703d9981736ef465557c1816390273fb64a Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 19:49:19 +0200 Subject: [PATCH 18/67] toggle_option: Remove an obsolete comment. option_changed already calls the change hooks so there's no need to have a TODO comment about calling them. --- src/config/options.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/config/options.c b/src/config/options.c index 12174b943..d8f658185 100644 --- a/src/config/options.c +++ b/src/config/options.c @@ -955,7 +955,6 @@ toggle_option(struct session *ses, struct option *option) assert(option->type == OPT_BOOL || option->type == OPT_INT); assert(option->max); - /* TODO: call change hooks. --jonas */ option->value.number = (number <= option->max) ? number : option->min; option_changed(ses, option, option); } From 2e5488ba3d389169c727f4d562cba1ae32f4b3db Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 19:52:49 +0200 Subject: [PATCH 19/67] option_changed: Merge the 2nd and 3rd parameter. All callers were passing the same value for both. --- src/config/dialogs.c | 4 +--- src/config/options.c | 6 +++--- src/config/options.h | 3 +-- src/session/session.c | 2 +- src/viewer/text/search.c | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/config/dialogs.c b/src/config/dialogs.c index e06e4a54f..058789539 100644 --- a/src/config/dialogs.c +++ b/src/config/dialogs.c @@ -275,9 +275,7 @@ check_valid_option(struct dialog_data *dlg_data, struct widget_data *widget_data if (chinon) { if (option_types[option->type].set && option_types[option->type].set(option, chinon)) { - struct option *current = option; - - option_changed(ses, current, option); + option_changed(ses, option); commandline = 0; mem_free(chinon); diff --git a/src/config/options.c b/src/config/options.c index d8f658185..f152438d1 100644 --- a/src/config/options.c +++ b/src/config/options.c @@ -956,7 +956,7 @@ toggle_option(struct session *ses, struct option *option) assert(option->max); option->value.number = (number <= option->max) ? number : option->min; - option_changed(ses, option, option); + option_changed(ses, option); } static int @@ -1011,11 +1011,11 @@ call_change_hooks(struct session *ses, struct option *current, struct option *op } void -option_changed(struct session *ses, struct option *current, struct option *option) +option_changed(struct session *ses, struct option *option) { option->flags |= OPT_TOUCHED; /* Notify everyone out there! */ - call_change_hooks(ses, current, option); + call_change_hooks(ses, option, option); } int diff --git a/src/config/options.h b/src/config/options.h index 8c8c1987c..340af5ebb 100644 --- a/src/config/options.h +++ b/src/config/options.h @@ -180,8 +180,7 @@ void call_change_hooks(struct session *ses, struct option *current, /* Do proper bookkeeping after an option has changed - call this every time * you change an option value. */ -void option_changed(struct session *ses, struct option *current, - struct option *option); +void option_changed(struct session *ses, struct option *option); extern int commit_option_values(struct option_resolver *resolvers, struct option *root, diff --git a/src/session/session.c b/src/session/session.c index 06377bc9b..83810fc2f 100644 --- a/src/session/session.c +++ b/src/session/session.c @@ -775,7 +775,7 @@ setup_first_session(struct session *ses, struct uri *uri) if (!get_opt_bool("config.saving_style_w")) { struct option *opt = get_opt_rec(config_options, "config.saving_style_w"); opt->value.number = 1; - option_changed(ses, opt, opt); + option_changed(ses, opt); if (get_opt_int("config.saving_style") != 3) { info_box(term, 0, N_("Warning"), ALIGN_CENTER, diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index d492a0742..5fc924a09 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -1400,7 +1400,7 @@ text_typeahead_handler(struct input_line *line, int action_id) opt->value.number = (opt->value.number + 1) % (opt->max + 1); - option_changed(ses, opt, opt); + option_changed(ses, opt); } /* Fall thru */ From 6a1d21441e9a6dfd725eafd5b67b2c99a0b6a405 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 20:31:15 +0200 Subject: [PATCH 20/67] Document the parameters of change_hook_T. --- src/config/options.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/config/options.h b/src/config/options.h index 340af5ebb..7ffb54247 100644 --- a/src/config/options.h +++ b/src/config/options.h @@ -105,7 +105,19 @@ union option_value { unsigned char *string; }; -typedef int (*change_hook_T)(struct session *, struct option *current, + +/* @session is the session via which the user changed the options, + * or NULL if not known. Because the options are currently not + * session-specific, it is best to ignore this parameter. In a future + * version of ELinks, this parameter might mean the session to which + * the changed options apply. + * + * @current is the option whose change hook is being called. It is + * never NULL. + * + * @changed is the option that was changed, or NULL if multiple + * descendants of @current may have been changed. */ +typedef int (*change_hook_T)(struct session *session, struct option *current, struct option *changed); struct option { From 90f1fc5a627c367d24958bb12afdffe9c280abb3 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 21:03:09 +0200 Subject: [PATCH 21/67] src/Makefile: Add a TAGS target. --- src/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Makefile b/src/Makefile index 5ec013241..2585b7a69 100644 --- a/src/Makefile +++ b/src/Makefile @@ -38,6 +38,13 @@ vernum.o: $(LIB_O_NAME) elinks: $(LIB_O_NAME) vernum.o $(call cmd,link) +TAGS: + find $(srcdir). -name "*.[ch]" -print \ + | etags --regex='{c}/INIT_LIST_HEAD(\([[:alnum:]_]+\))/\1/' \ + --regex='{c}/struct_hierbox_browser(\n[ \t]*\([[:alnum:]_]+\),/\1/m' \ + - +.PHONY: TAGS + PROGS = elinks CLEAN = vernum.o From 233c59b9c27c8b31d3533abebccb6b8f9ae04b82 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 22:31:47 +0200 Subject: [PATCH 22/67] l_set_option: Correct the args to option_changed(). Should have been in commit 2e5488ba3d389169c727f4d562cba1ae32f4b3db. --- src/scripting/lua/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index c50d43e53..469bf4e25 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -537,7 +537,7 @@ l_set_option(LS) } /* Call hook */ - option_changed(lua_ses, opt, opt); + option_changed(lua_ses, opt); return 1; lua_error: From 4adcae682fd26ac5f2664722150987d355956110 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 27 Jan 2007 22:33:02 +0200 Subject: [PATCH 23/67] change_hook_css: Don't use the ses parameter. It might be NULL. --- src/document/css/css.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/document/css/css.c b/src/document/css/css.c index 48a376233..cf6cf084e 100644 --- a/src/document/css/css.c +++ b/src/document/css/css.c @@ -19,6 +19,7 @@ #include "main/module.h" #include "network/connection.h" #include "protocol/uri.h" +#include "session/session.h" #include "util/error.h" #include "util/memory.h" #include "viewer/text/draw.h" @@ -127,7 +128,10 @@ change_hook_css(struct session *ses, struct option *current, struct option *chan import_default_css(); } - draw_formatted(ses, 1); + /* Instead of using the value of the @ses parameter, iterate + * through the @sessions list. The parameter may be NULL and + * anyway we don't support session-specific options yet. */ + foreach (ses, sessions) draw_formatted(ses, 1); return 0; } From add2a5d1b5d0351ae83118b54d8c27e588991a27 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 00:20:59 +0200 Subject: [PATCH 24/67] add_quoted_to_string: Make the src parameter point to const. --- src/util/conv.c | 2 +- src/util/conv.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/conv.c b/src/util/conv.c index 248f52dde..cc800a16c 100644 --- a/src/util/conv.c +++ b/src/util/conv.c @@ -295,7 +295,7 @@ add_html_to_string(struct string *string, unsigned char *src, int len) /* TODO Optimize later --pasky */ struct string * -add_quoted_to_string(struct string *string, unsigned char *src, int len) +add_quoted_to_string(struct string *string, const unsigned char *src, int len) { for (; len; len--, src++) { if (isquote(*src) || *src == '\\') diff --git a/src/util/conv.h b/src/util/conv.h index 494a36bba..25c499683 100644 --- a/src/util/conv.h +++ b/src/util/conv.h @@ -80,7 +80,7 @@ add_string_replace(struct string *string, unsigned char *src, int len, struct string *add_html_to_string(struct string *string, unsigned char *html, int htmllen); /* Escapes \ and " with a \ */ -struct string *add_quoted_to_string(struct string *string, unsigned char *q, int qlen); +struct string *add_quoted_to_string(struct string *string, const unsigned char *q, int qlen); /* Adds ', |len| bytes of |src| with all single-quotes converted to '\'', * and ' to |string|. */ From 0484f68b693744b4c15963edf8f9384b2fd3ad9d Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 00:52:21 +0200 Subject: [PATCH 25/67] get_color_string: Return a pointer to const. --- src/config/opttypes.c | 4 ++-- src/scripting/lua/core.c | 2 +- src/util/color.c | 4 ++-- src/util/color.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/config/opttypes.c b/src/config/opttypes.c index 5f49ebb3d..db8b7b7dc 100644 --- a/src/config/opttypes.c +++ b/src/config/opttypes.c @@ -166,7 +166,7 @@ redir_add(struct option *opt, unsigned char *str) /* Support functions for config file parsing. */ static void -add_optstring_to_string(struct string *s, unsigned char *q, int qlen) +add_optstring_to_string(struct string *s, const unsigned char *q, int qlen) { if (!commandline) add_char_to_string(s, '"'); add_quoted_to_string(s, q, qlen); @@ -364,7 +364,7 @@ color_wr(struct option *opt, struct string *str) { color_T color = opt->value.color; unsigned char hexcolor[8]; - unsigned char *strcolor = get_color_string(color, hexcolor); + const unsigned char *strcolor = get_color_string(color, hexcolor); add_optstring_to_string(str, strcolor, strlen(strcolor)); } diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index 469bf4e25..b3b47bfcc 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -599,7 +599,7 @@ l_get_option(LS) { color_T color; unsigned char hexcolor[8]; - unsigned char *strcolor; + const unsigned char *strcolor; color = opt->value.color; strcolor = get_color_string(color, hexcolor); diff --git a/src/util/color.c b/src/util/color.c index 92abadb1e..33d41122a 100644 --- a/src/util/color.c +++ b/src/util/color.c @@ -18,7 +18,7 @@ #include "util/string.h" struct color_spec { - char *name; + const char *name; color_T rgb; }; @@ -135,7 +135,7 @@ decode_hex_color: return -1; /* Not found */ } -unsigned char * +const unsigned char * get_color_string(color_T color, unsigned char hexcolor[8]) { struct color_spec *cs; diff --git a/src/util/color.h b/src/util/color.h index 5e0240c82..7fb6c46e9 100644 --- a/src/util/color.h +++ b/src/util/color.h @@ -17,7 +17,7 @@ int decode_color(unsigned char *str, int slen, color_T *color); /* Returns a string containing the color info. If no ``English'' name can be * found the hex color (#rrggbb) is returned in the given buffer. */ -unsigned char *get_color_string(color_T color, unsigned char hexcolor[8]); +const unsigned char *get_color_string(color_T color, unsigned char hexcolor[8]); /* Translate rgb color to string in #rrggbb format. str should be a pointer to * a 8 bytes memory space. */ From ada38583727a538cde60acf1bc70e0172f145b20 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 01:13:53 +0200 Subject: [PATCH 26/67] color_specs: Make const. --- src/util/color.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/color.c b/src/util/color.c index 33d41122a..8aa0b01c6 100644 --- a/src/util/color.c +++ b/src/util/color.c @@ -22,7 +22,7 @@ struct color_spec { color_T rgb; }; -static struct color_spec color_specs[] = { +static const struct color_spec color_specs[] = { #include "util/color_s.inc" #ifndef CONFIG_SMALL #include "util/color.inc" @@ -32,7 +32,7 @@ static struct color_spec color_specs[] = { #ifdef USE_FASTFIND -static struct color_spec *internal_pointer; +static const struct color_spec *internal_pointer; static void colors_list_reset(void) @@ -52,7 +52,7 @@ colors_list_next(void) if (!internal_pointer->name) return NULL; kv.key = (unsigned char *) internal_pointer->name; - kv.data = internal_pointer; + kv.data = (void *) internal_pointer; /* cast away const */ internal_pointer++; @@ -107,7 +107,7 @@ decode_hex_color: return 0; } } else { - struct color_spec *cs; + const struct color_spec *cs; #ifndef USE_FASTFIND for (cs = color_specs; cs->name; cs++) @@ -138,7 +138,7 @@ decode_hex_color: const unsigned char * get_color_string(color_T color, unsigned char hexcolor[8]) { - struct color_spec *cs; + const struct color_spec *cs; for (cs = color_specs; cs->name; cs++) if (cs->rgb == color) From ac339cf5e58eae8957233fa54ab65e6768f76165 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 01:28:44 +0200 Subject: [PATCH 27/67] elinks_ulongcat: Make the static strings const. And simplify an expression to avoid a cast. --- src/util/conv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/conv.c b/src/util/conv.c index cc800a16c..77cd102c2 100644 --- a/src/util/conv.c +++ b/src/util/conv.c @@ -52,9 +52,9 @@ elinks_ulongcat(unsigned char *s, unsigned int *slen, unsigned char fillchar, unsigned int base, unsigned int upper) { - static unsigned char unum[]= "0123456789ABCDEF"; - static unsigned char lnum[]= "0123456789abcdef"; - unsigned char *to_num = (unsigned char *) (upper ? &unum : &lnum); + static const unsigned char unum[]= "0123456789ABCDEF"; + static const unsigned char lnum[]= "0123456789abcdef"; + const unsigned char *to_num = (upper ? unum : lnum); unsigned int start = slen ? *slen : 0; unsigned int nlen = 1; /* '0' is one char, we can't have less. */ unsigned int pos = start; /* starting position of the number */ From 03ccf0b2b148a8bc0887511ee52082fa3618aa00 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 01:39:45 +0200 Subject: [PATCH 28/67] add_to_strn: Let the src parameter point to const. --- src/util/string.c | 2 +- src/util/string.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/string.c b/src/util/string.c index 504fd00e6..26b4bef18 100644 --- a/src/util/string.c +++ b/src/util/string.c @@ -97,7 +97,7 @@ stracpy(const unsigned char *src) void -add_to_strn(unsigned char **dst, unsigned char *src) +add_to_strn(unsigned char **dst, const unsigned char *src) { unsigned char *newdst; int dstlen; diff --git a/src/util/string.h b/src/util/string.h index a66d7479c..e60e26556 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -43,7 +43,7 @@ unsigned char *debug_stracpy(const unsigned char *, int, const unsigned char *); /* Concatenates @src to @str. */ /* If reallocation of @str fails @str is not touched. */ -void add_to_strn(unsigned char **str, unsigned char *src); +void add_to_strn(unsigned char **str, const unsigned char *src); /* Inserts @seqlen chars from @seq at position @pos in the @dst string. */ /* If reallocation of @dst fails it is not touched and NULL is returned. */ From 0ee76a0ef31117afc7523c024b2cb7889100d678 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 01:42:08 +0200 Subject: [PATCH 29/67] straconcat: Assume all arguments point to const. --- src/util/string.c | 6 +++--- src/util/string.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/string.c b/src/util/string.c index 26b4bef18..3c7ed54cd 100644 --- a/src/util/string.c +++ b/src/util/string.c @@ -132,10 +132,10 @@ insert_in_string(unsigned char **dst, int pos, } unsigned char * -straconcat(unsigned char *str, ...) +straconcat(const unsigned char *str, ...) { va_list ap; - unsigned char *a; + const unsigned char *a; unsigned char *s; unsigned int len; @@ -149,7 +149,7 @@ straconcat(unsigned char *str, ...) if (len) memcpy(s, str, len); va_start(ap, str); - while ((a = va_arg(ap, unsigned char *))) { + while ((a = va_arg(ap, const unsigned char *))) { unsigned int l = strlen(a); unsigned char *ns; diff --git a/src/util/string.h b/src/util/string.h index e60e26556..7f83c8db2 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -58,7 +58,7 @@ unsigned char *insert_in_string(unsigned char **dst, int pos, * if (abc) return; * printf("%s", abc); -> print "ABC" * mem_free(abc); -> free memory used by @abc */ -unsigned char *straconcat(unsigned char *str, ...); +unsigned char *straconcat(const unsigned char *str, ...); /* Misc. utility string functions. */ From 0ba497b0d40eb07ac9a771915d9ed9c77798ee5a Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 01:43:49 +0200 Subject: [PATCH 30/67] xstrcmp: Make both parameters point to const. --- src/util/string.c | 2 +- src/util/string.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/string.c b/src/util/string.c index 3c7ed54cd..63bed2755 100644 --- a/src/util/string.c +++ b/src/util/string.c @@ -173,7 +173,7 @@ straconcat(const unsigned char *str, ...) } int -xstrcmp(unsigned char *s1, unsigned char *s2) +xstrcmp(const unsigned char *s1, const unsigned char *s2) { if (!s1) return -!!s2; if (!s2) return 1; diff --git a/src/util/string.h b/src/util/string.h index 7f83c8db2..13ad95bbc 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -64,7 +64,7 @@ unsigned char *straconcat(const unsigned char *str, ...); /* Misc. utility string functions. */ /* Compare two strings, handling correctly @s1 or @s2 being NULL. */ -int xstrcmp(unsigned char *s1, unsigned char *s2); +int xstrcmp(const unsigned char *s1, const unsigned char *s2); /* Copies at most @len chars into @dst. Ensures null termination of @dst. */ unsigned char *safe_strncpy(unsigned char *dst, const unsigned char *src, size_t len); From f47bdd76d6fc18b33bd61bfdd7849434ae056904 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 01:46:30 +0200 Subject: [PATCH 31/67] init_string__: Let the file parameter point to const. --- src/util/string.c | 2 +- src/util/string.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/string.c b/src/util/string.c index 63bed2755..c6d1a9077 100644 --- a/src/util/string.c +++ b/src/util/string.c @@ -245,7 +245,7 @@ elinks_strlcasecmp(const unsigned char *s1, size_t n1, inline struct string * #ifdef DEBUG_MEMLEAK -init_string__(unsigned char *file, int line, struct string *string) +init_string__(const unsigned char *file, int line, struct string *string) #else init_string(struct string *string) #endif diff --git a/src/util/string.h b/src/util/string.h index 13ad95bbc..155f0f93d 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -150,7 +150,7 @@ struct string { /* Initializes the passed string struct by preallocating the @source member. */ #ifdef DEBUG_MEMLEAK -struct string *init_string__(unsigned char *file, int line, struct string *string); +struct string *init_string__(const unsigned char *file, int line, struct string *string); #define init_string(string) init_string__(__FILE__, __LINE__, string) #else struct string *init_string(struct string *string); From 66614acbc044515f2062212e0fa82e4372d1a86a Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 01:50:06 +0200 Subject: [PATCH 32/67] add_file_to_string: Let filename point to const. --- src/util/string.c | 2 +- src/util/string.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/string.c b/src/util/string.c index c6d1a9077..088374aa0 100644 --- a/src/util/string.c +++ b/src/util/string.c @@ -332,7 +332,7 @@ add_string_to_string(struct string *string, const struct string *from) } struct string * -add_file_to_string(struct string *string, unsigned char *filename) +add_file_to_string(struct string *string, const unsigned char *filename) { FILE *file; off_t filelen; diff --git a/src/util/string.h b/src/util/string.h index 155f0f93d..c96fb2de2 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -164,7 +164,7 @@ struct string *add_to_string(struct string *string, const unsigned char *source); struct string *add_char_to_string(struct string *string, unsigned char character); struct string *add_string_to_string(struct string *to, const struct string *from); -struct string *add_file_to_string(struct string *string, unsigned char *filename); +struct string *add_file_to_string(struct string *string, const unsigned char *filename); struct string *add_crlf_to_string(struct string *string); /* Adds each C string to @string until a terminating NULL is met. */ From a4293ed6064326f191f56eb35598fe432436ac2a Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 02:04:00 +0200 Subject: [PATCH 33/67] string_concat: Assume all variadic arguments point to const. --- src/util/string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/string.c b/src/util/string.c index 088374aa0..06f563c97 100644 --- a/src/util/string.c +++ b/src/util/string.c @@ -375,7 +375,7 @@ struct string * string_concat(struct string *string, ...) { va_list ap; - unsigned char *source; + const unsigned char *source; assertm(string, "[string_concat]"); if_assert_failed { return NULL; } @@ -383,7 +383,7 @@ string_concat(struct string *string, ...) check_string_magic(string); va_start(ap, string); - while ((source = va_arg(ap, unsigned char *))) + while ((source = va_arg(ap, const unsigned char *))) if (*source) add_to_string(string, source); From fd27919f91df1b87c81cb77365865d7a2e630799 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 02:05:52 +0200 Subject: [PATCH 34/67] add_format_to_string: Let format point to const. --- src/util/string.c | 2 +- src/util/string.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/string.c b/src/util/string.c index 06f563c97..4a436ccff 100644 --- a/src/util/string.c +++ b/src/util/string.c @@ -434,7 +434,7 @@ add_xchar_to_string(struct string *string, unsigned char character, int times) /* Add printf-like format string to @string. */ struct string * -add_format_to_string(struct string *string, unsigned char *format, ...) +add_format_to_string(struct string *string, const unsigned char *format, ...) { int newlength; int width; diff --git a/src/util/string.h b/src/util/string.h index c96fb2de2..059a8c191 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -174,7 +174,7 @@ struct string *string_concat(struct string *string, ...); struct string *add_xchar_to_string(struct string *string, unsigned char character, int times); /* Add printf-style format string to @string. */ -struct string *add_format_to_string(struct string *string, unsigned char *format, ...); +struct string *add_format_to_string(struct string *string, const unsigned char *format, ...); /* Get a regular newly allocated stream of bytes from @string. */ static unsigned char *squeezastring(struct string *string); From 536720970274a83c0aa1c72a108621248586f878 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 02:12:39 +0200 Subject: [PATCH 35/67] mem_align_alloc__, add_bytes_to_string__: Let file point to const. --- src/util/memory.h | 2 +- src/util/string.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/memory.h b/src/util/memory.h index 87cf2cc40..9fab2fd44 100644 --- a/src/util/memory.h +++ b/src/util/memory.h @@ -124,7 +124,7 @@ void *mem_realloc(void *, size_t); static inline void * mem_align_alloc__( #ifdef DEBUG_MEMLEAK - unsigned char *file, int line, + const unsigned char *file, int line, #endif void **ptr, size_t old, size_t new, size_t objsize, size_t mask) { diff --git a/src/util/string.h b/src/util/string.h index 059a8c191..21432fcd1 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -214,7 +214,7 @@ squeezastring(struct string *string) static inline struct string * add_bytes_to_string__( #ifdef DEBUG_MEMLEAK - unsigned char *file, int line, + const unsigned char *file, int line, #endif struct string *string, const unsigned char *bytes, int length) From ff4c103a78e7806aefb438279af617aa549fb46d Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 13:54:41 +0200 Subject: [PATCH 36/67] Bug 827, display_codepage: Call option_changed. This change allows screen_driver_change_hook to detect that the charset has been changed to UTF-8 and set screen_driver.utf8 = 1. redraw_screen then calls get_screen_driver, which propagates the flag to terminal.utf8. That in turn avoids an assertion failure in handle_interlink_event. --- src/dialogs/options.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/dialogs/options.c b/src/dialogs/options.c index 93ca7afb9..06ddeb2a6 100644 --- a/src/dialogs/options.c +++ b/src/dialogs/options.c @@ -37,9 +37,7 @@ display_codepage(struct terminal *term, void *name_, void *xxx) if (opt->value.number != index) { opt->value.number = index; - /* TODO: option_changed() (we need to review the hooks - * to handle NULL ses or properly document that stuff). */ - opt->flags |= OPT_TOUCHED; + option_changed(NULL, opt); } cls_redraw_all_terminals(); From 33b2db70531ef1dd492da1b48934e7164e0f96d7 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 13:48:19 +0200 Subject: [PATCH 37/67] toggle_success_msgbox: Call option_changed; was a TODO. This change assumes that option change hooks allow a NULL session. The only one that did not was change_hook_css, which I fixed in commit 4adcae682fd26ac5f2664722150987d355956110. --- src/config/dialogs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/config/dialogs.c b/src/config/dialogs.c index 058789539..a56709ced 100644 --- a/src/config/dialogs.c +++ b/src/config/dialogs.c @@ -34,9 +34,8 @@ static void toggle_success_msgbox(void *dummy) { - /* TODO: option_changed() */ get_opt_bool("ui.success_msgbox") = !get_opt_bool("ui.success_msgbox"); - get_opt_rec(config_options, "ui.success_msgbox")->flags |= OPT_TOUCHED; + option_changed(NULL, get_opt_rec(config_options, "ui.success_msgbox")); } void From 3756bec9e03a2930d26a0d209d42781d191debad Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 14:01:24 +0200 Subject: [PATCH 38/67] get_opt_rec, get_opt_rec_real: Let name point to const. --- src/config/options.c | 4 ++-- src/config/options.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config/options.c b/src/config/options.c index f152438d1..7c20e11fc 100644 --- a/src/config/options.c +++ b/src/config/options.c @@ -159,7 +159,7 @@ static int no_autocreate = 0; /* Get record of option of given name, or NULL if there's no such option. */ struct option * -get_opt_rec(struct option *tree, unsigned char *name_) +get_opt_rec(struct option *tree, const unsigned char *name_) { struct option *option; unsigned char *aname = stracpy(name_); @@ -231,7 +231,7 @@ get_opt_rec(struct option *tree, unsigned char *name_) * do not create the option if it doesn't exist and there's autocreation * enabled. */ struct option * -get_opt_rec_real(struct option *tree, unsigned char *name) +get_opt_rec_real(struct option *tree, const unsigned char *name) { struct option *opt; diff --git a/src/config/options.h b/src/config/options.h index 7ffb54247..77e2a1572 100644 --- a/src/config/options.h +++ b/src/config/options.h @@ -208,8 +208,8 @@ extern void checkout_option_values(struct option_resolver *resolvers, * use get_opt_type() and add_opt_type(). For command line options, you want to * use get_opt_type_tree(cmdline_options, "option"). */ -extern struct option *get_opt_rec(struct option *, unsigned char *); -extern struct option *get_opt_rec_real(struct option *, unsigned char *); +extern struct option *get_opt_rec(struct option *, const unsigned char *); +extern struct option *get_opt_rec_real(struct option *, const unsigned char *); #ifdef CONFIG_DEBUG extern union option_value *get_opt_(unsigned char *, int, enum option_type, struct option *, unsigned char *); #define get_opt(tree, name, type) get_opt_(__FILE__, __LINE__, type, tree, name) From d40cccef0fe2baec17ae45a1221a683a93214ff4 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 14:38:53 +0200 Subject: [PATCH 39/67] Make widget.ops point to const. --- src/bfu/dialog.c | 2 +- src/bfu/widget.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bfu/dialog.c b/src/bfu/dialog.c index 62048ef3c..3bdc574b7 100644 --- a/src/bfu/dialog.c +++ b/src/bfu/dialog.c @@ -344,7 +344,7 @@ static void dialog_ev_kbd(struct dialog_data *dlg_data) { struct widget_data *widget_data = selected_widget(dlg_data); - struct widget_ops *ops = widget_data->widget->ops; + const struct widget_ops *ops = widget_data->widget->ops; /* XXX: KEYMAP_EDIT ? --pasky */ enum menu_action action_id; struct term_event *ev = dlg_data->term_event; diff --git a/src/bfu/widget.h b/src/bfu/widget.h index d54695cb0..ec1b42815 100644 --- a/src/bfu/widget.h +++ b/src/bfu/widget.h @@ -30,7 +30,7 @@ struct widget_ops { }; struct widget { - struct widget_ops *ops; + const struct widget_ops *ops; unsigned char *text; From be9660f7d037f3e2d687e8b816c28dd6a511ec73 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 14:41:40 +0200 Subject: [PATCH 40/67] Make all instances of struct widget_ops const. And widget_type_to_ops[] too. --- src/bfu/button.c | 2 +- src/bfu/button.h | 2 +- src/bfu/checkbox.c | 2 +- src/bfu/checkbox.h | 2 +- src/bfu/dialog.c | 2 +- src/bfu/inpfield.c | 4 ++-- src/bfu/inpfield.h | 4 ++-- src/bfu/listbox.c | 2 +- src/bfu/listbox.h | 2 +- src/bfu/text.c | 2 +- src/bfu/text.h | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/bfu/button.c b/src/bfu/button.c index 8b84110a1..b7ead27a2 100644 --- a/src/bfu/button.c +++ b/src/bfu/button.c @@ -331,7 +331,7 @@ select_button(struct dialog_data *dlg_data, struct widget_data *widget_data) return widget_data->widget->handler(dlg_data, widget_data); } -struct widget_ops button_ops = { +const struct widget_ops button_ops = { display_button, NULL, mouse_button, diff --git a/src/bfu/button.h b/src/bfu/button.h index 90dba05f0..06c1d9210 100644 --- a/src/bfu/button.h +++ b/src/bfu/button.h @@ -47,7 +47,7 @@ void add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, widge add_dlg_button_do(dlg, text, flags, handler, data, NULL, NULL) #endif -extern struct widget_ops button_ops; +extern const struct widget_ops button_ops; void dlg_format_buttons(struct terminal *, struct widget_data *, int, int, int *, int, int *, enum format_align, int); #endif diff --git a/src/bfu/checkbox.c b/src/bfu/checkbox.c index 8fa6c6360..7ed97e0b2 100644 --- a/src/bfu/checkbox.c +++ b/src/bfu/checkbox.c @@ -164,7 +164,7 @@ select_checkbox(struct dialog_data *dlg_data, struct widget_data *widget_data) return EVENT_PROCESSED; } -struct widget_ops checkbox_ops = { +const struct widget_ops checkbox_ops = { display_checkbox, init_checkbox, mouse_checkbox, diff --git a/src/bfu/checkbox.h b/src/bfu/checkbox.h index 627be5724..573f1d2fd 100644 --- a/src/bfu/checkbox.h +++ b/src/bfu/checkbox.h @@ -27,7 +27,7 @@ void add_dlg_radio_do(struct dialog *dlg, unsigned char *text, int groupid, int #define add_dlg_checkbox(dlg, text, data) \ add_dlg_radio_do(dlg, text, 0, 0, data) -extern struct widget_ops checkbox_ops; +extern const struct widget_ops checkbox_ops; void dlg_format_checkbox(struct terminal *term, diff --git a/src/bfu/dialog.c b/src/bfu/dialog.c index 3bdc574b7..335c4ec6d 100644 --- a/src/bfu/dialog.c +++ b/src/bfu/dialog.c @@ -140,7 +140,7 @@ select_dlg_item(struct dialog_data *dlg_data, struct widget_data *widget_data) widget_data->widget->ops->select(dlg_data, widget_data); } -static struct widget_ops *widget_type_to_ops[] = { +static const struct widget_ops *const widget_type_to_ops[] = { &checkbox_ops, &field_ops, &field_pass_ops, diff --git a/src/bfu/inpfield.c b/src/bfu/inpfield.c index 7edd838c4..76104081d 100644 --- a/src/bfu/inpfield.c +++ b/src/bfu/inpfield.c @@ -744,7 +744,7 @@ clear_field(struct dialog_data *dlg_data, struct widget_data *widget_data) return EVENT_PROCESSED; } -struct widget_ops field_ops = { +const struct widget_ops field_ops = { display_field, init_field, mouse_field, @@ -753,7 +753,7 @@ struct widget_ops field_ops = { clear_field, }; -struct widget_ops field_pass_ops = { +const struct widget_ops field_pass_ops = { display_field_pass, init_field, mouse_field, diff --git a/src/bfu/inpfield.h b/src/bfu/inpfield.h index 5bd47da4b..2829eb707 100644 --- a/src/bfu/inpfield.h +++ b/src/bfu/inpfield.h @@ -56,8 +56,8 @@ add_dlg_field_do(struct dialog *dlg, enum widget_type type, unsigned char *label add_dlg_field_do(dlg, WIDGET_FIELD_PASS, label, min, max, handler, len, field, NULL, INPFIELD_FLOAT) -extern struct widget_ops field_ops; -extern struct widget_ops field_pass_ops; +extern const struct widget_ops field_ops; +extern const struct widget_ops field_pass_ops; widget_handler_status_T check_number(struct dialog_data *, struct widget_data *); widget_handler_status_T check_nonempty(struct dialog_data *, struct widget_data *); diff --git a/src/bfu/listbox.c b/src/bfu/listbox.c index f59fbef86..f0da43827 100644 --- a/src/bfu/listbox.c +++ b/src/bfu/listbox.c @@ -735,7 +735,7 @@ kbd_listbox(struct dialog_data *dlg_data, struct widget_data *widget_data) return EVENT_NOT_PROCESSED; } -struct widget_ops listbox_ops = { +const struct widget_ops listbox_ops = { display_listbox, init_listbox, mouse_listbox, diff --git a/src/bfu/listbox.h b/src/bfu/listbox.h index 9aadbd95b..46c3184ba 100644 --- a/src/bfu/listbox.h +++ b/src/bfu/listbox.h @@ -131,7 +131,7 @@ struct listbox_item { void *udata; }; -extern struct widget_ops listbox_ops; +extern const struct widget_ops listbox_ops; void dlg_format_listbox(struct terminal *, struct widget_data *, int, int *, int, int, int *, enum format_align, int format_only); diff --git a/src/bfu/text.c b/src/bfu/text.c index 2fa4c1d23..8adf0c96a 100644 --- a/src/bfu/text.c +++ b/src/bfu/text.c @@ -542,7 +542,7 @@ mouse_text(struct dialog_data *dlg_data, struct widget_data *widget_data) } -struct widget_ops text_ops = { +const struct widget_ops text_ops = { display_text, NULL, mouse_text, diff --git a/src/bfu/text.h b/src/bfu/text.h index 408c7ce30..8dd33652d 100644 --- a/src/bfu/text.h +++ b/src/bfu/text.h @@ -44,7 +44,7 @@ struct widget_data_info_text { void add_dlg_text(struct dialog *dlg, unsigned char *text, enum format_align align, int bottom_pad); -extern struct widget_ops text_ops; +extern const struct widget_ops text_ops; void dlg_format_text_do(struct terminal *term, unsigned char *text, int x, int *y, int w, int *rw, struct color_pair *scolor, enum format_align align, int format_only); From da759b10f027c6273acc59f4873e7ab8d0b99696 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 14:44:24 +0200 Subject: [PATCH 41/67] add_dlg_button_do: Let file point to const. --- src/bfu/button.c | 2 +- src/bfu/button.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bfu/button.c b/src/bfu/button.c index b7ead27a2..e175c0e52 100644 --- a/src/bfu/button.c +++ b/src/bfu/button.c @@ -36,7 +36,7 @@ #ifdef DEBUG_BUTTON_HOTKEY void -add_dlg_button_do(unsigned char *file, int line, +add_dlg_button_do(const unsigned char *file, int line, struct dialog *dlg, unsigned char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data) diff --git a/src/bfu/button.h b/src/bfu/button.h index 06c1d9210..ca7b3d655 100644 --- a/src/bfu/button.h +++ b/src/bfu/button.h @@ -30,7 +30,7 @@ struct widget_info_button { #ifdef DEBUG_BUTTON_HOTKEY -void add_dlg_button_do(unsigned char *file, int line, struct dialog *dlg, unsigned char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data); +void add_dlg_button_do(const unsigned char *file, int line, struct dialog *dlg, unsigned char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data); #define add_dlg_ok_button(dlg, text, flags, done, data) \ add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, ok_dialog, NULL, done, data) From 5b6dbcc879e6d63d609f89ce3d2e0e61a7d3fc4d Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 14:52:09 +0200 Subject: [PATCH 42/67] default_listbox_ops_messages: Make static and const. --- src/bfu/hierbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bfu/hierbox.c b/src/bfu/hierbox.c index 86f4f3bbe..40416d36e 100644 --- a/src/bfu/hierbox.c +++ b/src/bfu/hierbox.c @@ -547,7 +547,7 @@ enum delete_error { DELETE_ERRORS, }; -struct listbox_ops_messages default_listbox_ops_messages = { +static const struct listbox_ops_messages default_listbox_ops_messages = { /* cant_delete_item */ N_("Sorry, but the item \"%s\" cannot be deleted."), From 7185e926e632f0d4da8b74296a17bd7ffab7b2ac Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 16:14:10 +0200 Subject: [PATCH 43/67] "Do not show anymore" resets ui.success_msgbox, instead of toggling it. Normally, the success msgbox is shown only if the ui.success_msgbox option is set as 1, and clicking "Do not show anymore" would then toggle the option to 0, and no more such msgboxes would appear. However, if there already are two success msgboxes being displayed (most likely in different terminals), then clicking "Do not show anymore" in the first of them would reset the option to 0, but doing the same in the second of them would toggle the option back to 1. Rename toggle_success_msgbox to disable_success_msgbox, and make it always reset the option to 0, regardless of the previous value. --- src/config/dialogs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config/dialogs.c b/src/config/dialogs.c index a56709ced..fffecabe4 100644 --- a/src/config/dialogs.c +++ b/src/config/dialogs.c @@ -32,9 +32,9 @@ static void -toggle_success_msgbox(void *dummy) +disable_success_msgbox(void *dummy) { - get_opt_bool("ui.success_msgbox") = !get_opt_bool("ui.success_msgbox"); + get_opt_bool("ui.success_msgbox") = 0; option_changed(NULL, get_opt_rec(config_options, "ui.success_msgbox")); } @@ -55,7 +55,7 @@ write_config_dialog(struct terminal *term, unsigned char *config_file, config_file), NULL, 2, N_("~OK"), NULL, B_ENTER | B_ESC, - N_("~Do not show anymore"), toggle_success_msgbox, 0); + N_("~Do not show anymore"), disable_success_msgbox, 0); return; } From b81bcd83076251a3674c559e4c9cd7dc3b05768e Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 8 Jan 2007 11:38:34 +0100 Subject: [PATCH 44/67] Removed the buggy code. --- src/terminal/terminal.c | 40 ---------------------------------------- src/terminal/terminal.h | 3 --- 2 files changed, 43 deletions(-) diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 265f93812..ccbe30ef1 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -41,28 +41,6 @@ INIT_LIST_HEAD(terminals); static void check_if_no_terminal(void); -#if 0 -static int -was_utf8(int in, int out) -{ - /* Taken from setedit. - * Set cursor in the up left corner. Write "\357\200\240" == U+F020. - * Read cursor position. For UTF-8 x will be 2. - * For normal mode it will be 4. */ - static unsigned char *str = "\033[1;1H\357\200\240\033[6n"; - unsigned char buf[20]; - int x, y; - - hard_write(out, str, strlen(str)); - buf[0] = '\0'; - read(in, buf, 6); - if (sscanf(buf,"\033[%d;%dR",&y,&x)==2) { - if (x > 2) return 0; - } - return 1; -} -#endif - void redraw_terminal(struct terminal *term) { @@ -118,13 +96,6 @@ init_term(int fdin, int fdout) term->spec = get_opt_rec(config_options, name); object_lock(term->spec); -#if 0 - /* The hack to restore console in the right mode */ - if (get_opt_int_tree(term->spec, "type") == TERM_LINUX) { - term->linux_was_utf8 = was_utf8(get_input_handle(), term->fdout); - } -#endif - add_to_list(terminals, term); set_handlers(fdin, (select_handler_T) in_term, NULL, @@ -172,17 +143,6 @@ destroy_terminal(struct terminal *term) del_from_list(term); close(term->fdin); -#if 0 - /* This code doesn't work with slave terminals. */ - if (get_opt_int_tree(term->spec, "type") == TERM_LINUX) { - if (term->linux_was_utf8) { - hard_write(term->fdout, "\033%G", 3); - } else { - hard_write(term->fdout, "\033%@", 3); - } - } -#endif - if (term->fdout != 1) { if (term->fdout != term->fdin) close(term->fdout); } else { diff --git a/src/terminal/terminal.h b/src/terminal/terminal.h index b86a169e1..ee92de9b1 100644 --- a/src/terminal/terminal.h +++ b/src/terminal/terminal.h @@ -132,9 +132,6 @@ struct terminal { unsigned int utf8:1; #endif /* CONFIG_UTF8 */ - /* Indicates whether Linux console was in UTF-8 mode on startup */ - unsigned int linux_was_utf8:1; - /* The current tab number. */ int current_tab; From 5c51b0a2ae1186afefcb58840f9002257a407866 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 11 Dec 2006 21:35:21 +0100 Subject: [PATCH 45/67] Removed outdated entries. --- SITES | 4 ---- 1 file changed, 4 deletions(-) diff --git a/SITES b/SITES index d729f03af..1f5ce17ff 100644 --- a/SITES +++ b/SITES @@ -10,8 +10,6 @@ DEBs: RPMs: http://rpmfind.net/linux/rpm2html/search.php?query=elinks - http://ftp.nest.pld-linux.org/pool/e/elinks/ - http://ftp.pld-linux.org/pool/e/elinks/ RISC OS binaries: http://www.riscos.info/unix/indexes/browser.html @@ -43,6 +41,4 @@ DEBs: RPMs: http://rpmfind.net/linux/rpm2html/search.php?query=links - http://ftp.nest.pld-linux.org/pool/l/links/ - http://ftp.pld-linux.org/pool/l/links/ From f2a3983389b2d344455647967fa7c9981d6c16b6 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 31 Dec 2006 16:49:52 +0100 Subject: [PATCH 46/67] Limit the timeout to one second only under Windows. --- src/util/time.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/time.c b/src/util/time.c index 19bd2cafa..d7691a14d 100644 --- a/src/util/time.c +++ b/src/util/time.c @@ -206,8 +206,10 @@ timeval_limit_to_zero_or_one(timeval_T *t) { if (t->sec < 0) t->sec = 0; if (t->usec < 0) t->usec = 0; +#ifdef CONFIG_OS_WIN32 /* Under Windows I got 300 seconds timeout, so 1 second should not hurt --witekfl */ if (t->sec > 1) t->sec = 1; +#endif } /* Returns 1 if t1 > t2 From ae5fe801005cb561afdff2bfe2f76e0c9c756ed5 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Mon, 29 Jan 2007 20:57:37 +0200 Subject: [PATCH 47/67] Document that NBSP_CHAR is not used in UTF-8 strings. --- src/intl/charsets.c | 3 ++- src/intl/charsets.h | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/intl/charsets.c b/src/intl/charsets.c index b51a61894..c8702927f 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -183,7 +183,8 @@ u2cp_(unicode_val_T u, int to, enum nbsp_mode nbsp_mode) return encode_utf8(u); #endif /* CONFIG_UTF8 */ - /* To mark non breaking spaces, we use a special char NBSP_CHAR. */ + /* To mark non breaking spaces in non-UTF-8 strings, we use a + * special char NBSP_CHAR. */ if (u == 0xa0) { if (nbsp_mode == NBSP_MODE_HACK) return NBSP_CHAR_STRING; else /* NBSP_MODE_ASCII */ return " "; diff --git a/src/intl/charsets.h b/src/intl/charsets.h index 69fb3cb96..66768b7e0 100644 --- a/src/intl/charsets.h +++ b/src/intl/charsets.h @@ -31,7 +31,8 @@ typedef uint32_t unicode_val_T; * We should fix that if we ever change the value. */ #define UCS_ORPHAN_CELL ((unicode_val_T) 0x20) -/*   replacement character. See u2cp(). */ +/*   replacement character. See u2cp(). + * UTF-8 strings should use the encoding of U+00A0 instead. */ #define NBSP_CHAR ((unsigned char) 1) #define NBSP_CHAR_STRING "\001" @@ -64,7 +65,8 @@ enum convert_string_mode { CSM_NONE, /* Convert nothing. */ }; -/* How to translate non-breaking spaces. */ +/* How to translate U+00A0 NO-BREAK SPACE. If u2cp_ is converting to + * UTF-8, it ignores this choice and just encodes the U+00A0. */ enum nbsp_mode { /* Convert to NBSP_CHAR. This lets the HTML renderer * recognize nbsp even if the codepage doesn't support From 419857dce6fc99e9f8cfa787f239ec74cb521325 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Mon, 29 Jan 2007 21:07:13 +0200 Subject: [PATCH 48/67] set_hline: Add some comments. --- src/document/html/renderer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index 61ec3b92b..90ad9313d 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -505,7 +505,7 @@ good_char: } copy_screen_chars(&POS(x, y), schar, 1); } - } else { + } else { /* not UTF-8 */ for (; charslen > 0; charslen--, x++, chars++) { part->char_width[x] = 1; if (*chars == NBSP_CHAR) { @@ -517,8 +517,8 @@ good_char: } copy_screen_chars(&POS(x, y), schar, 1); } + } /* end of UTF-8 check */ - } /* Assert that we haven't written past the end of the * LINE(y).chars array. @x here is one greater than * the last one used in POS(x, y). Instead of this, @@ -530,11 +530,11 @@ good_char: * for line-wrapping decisions. It may currently be too * large because it was allocated above based on @charslen * which is the number of bytes, not the number of cells. - * Change the length to the correct size, but dont let it + * Change the length to the correct size, but don't let it * get smaller than it was on entry to this function. */ LINE(y).length = int_max(orig_length, X(x)); len = x - x2; - } else { + } else { /* part->document == NULL */ if (utf8) { unsigned char *end; @@ -555,13 +555,13 @@ good_char: } } len = x - x2; - } else { + } else { /* not UTF-8 */ for (; charslen > 0; charslen--, x++, chars++) { part->spaces[x] = (*chars == ' '); part->char_width[x] = 1; } } - } + } /* end of part->document check */ return len; } #else From ebf549ba773762342474a29997b2635617368245 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Tue, 30 Jan 2007 10:21:12 +0200 Subject: [PATCH 49/67] Fix document.html.wrap_nbsp in UTF-8 terminals. !CONFIG_UTF8, ISO-8859-1 doc, ASCII terminal, UTF-8 or unibyte I/O:   ok,   ok,   ok, A0 ok !CONFIG_UTF8, ISO-8859-1 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:   ok,   ok,   ok, A0 ok !CONFIG_UTF8, UTF-8 doc, ASCII terminal, UTF-8 or unibyte I/O:   ok,   ok,   ok, C2 A0 fail (drawn as "\001"). !CONFIG_UTF8, UTF-8 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:   ok,   ok,   ok, C2 A0 fail (not wrapped). CONFIG_UTF8, ISO-8859-1 doc, ASCII terminal, UTF-8 or unibyte I/O:   ok,   ok,   ok, A0 ok CONFIG_UTF8, ISO-8859-1 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:   ok,   ok,   ok, A0 ok CONFIG_UTF8, ISO-8859-1 doc, UTF-8 terminal, UTF-8 I/O: all fail (not wrapped); after patch all ok. CONFIG_UTF8, UTF-8 doc, ASCII terminal, UTF-8 or unibyte I/O:   ok,   ok,   ok, C2 A0 fail (drawn as "\001"). CONFIG_UTF8, UTF-8 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:   ok,   ok,   ok, C2 A0 fail (not wrapped) CONFIG_UTF8, UTF-8 doc, UTF-8 terminal, UTF-8 I/O: all fail (not wrapped); after patch all ok. --- src/document/html/renderer.c | 17 ++++++++++------- src/intl/charsets.h | 3 +++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index 90ad9313d..9a83f916b 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -460,15 +460,14 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen, } for (; chars < end; x++) { - if (*chars == NBSP_CHAR) { - schar->data = ' '; - part->spaces[x] = html_context->options->wrap_nbsp; - part->char_width[x] = 1; - chars++; - } else { - part->spaces[x] = (*chars == ' '); + /* ELinks does not use NBSP_CHAR in UTF-8. */ + + /* The following is temporarily indented + * just to make the diff easier to read. */ + { data = utf8_to_unicode(&chars, end); if (data == UCS_NO_CHAR) { + part->spaces[x] = 0; if (charslen == 1) { /* HR */ unsigned char attr = schar->attr; @@ -490,6 +489,10 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen, } } else { good_char: + if (data == UCS_NO_BREAK_SPACE + && html_context->options->wrap_nbsp) + data = UCS_SPACE; + part->spaces[x] = (data == UCS_SPACE); if (unicode_to_cell(data) == 2) { schar->data = (unicode_val_T)data; part->char_width[x] = 2; diff --git a/src/intl/charsets.h b/src/intl/charsets.h index 66768b7e0..6445b0948 100644 --- a/src/intl/charsets.h +++ b/src/intl/charsets.h @@ -7,6 +7,9 @@ typedef uint32_t unicode_val_T; * shouldn't rely on that. */ #define UCS_SPACE ((unicode_val_T) 0x0020) +/* U+00A0 NO-BREAK SPACE. */ +#define UCS_NO_BREAK_SPACE ((unicode_val_T) 0x00A0) + /* U+FFFD REPLACEMENT CHARACTER. Used when no Unicode mapping is * known for a byte in a codepage, or when invalid UTF-8 is received * from a terminal. After generating the character, ELinks then From 408d86f2b111e9d4fe5d7eb88c76f100fce4ef91 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Tue, 30 Jan 2007 10:27:57 +0200 Subject: [PATCH 50/67] Remove temporary indentation left in the previous commit. --- src/document/html/renderer.c | 74 +++++++++++++++++------------------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index 9a83f916b..b65351744 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -462,48 +462,44 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen, for (; chars < end; x++) { /* ELinks does not use NBSP_CHAR in UTF-8. */ - /* The following is temporarily indented - * just to make the diff easier to read. */ - { - data = utf8_to_unicode(&chars, end); - if (data == UCS_NO_CHAR) { - part->spaces[x] = 0; - if (charslen == 1) { - /* HR */ - unsigned char attr = schar->attr; + data = utf8_to_unicode(&chars, end); + if (data == UCS_NO_CHAR) { + part->spaces[x] = 0; + if (charslen == 1) { + /* HR */ + unsigned char attr = schar->attr; - schar->data = *chars++; - schar->attr = SCREEN_ATTR_FRAME; - copy_screen_chars(&POS(x, y), schar, 1); - schar->attr = attr; - part->char_width[x] = 0; - continue; - } else { - unsigned char i; - - for (i = 0; chars < end;i++) { - part->document->buf[i] = *chars++; - } - part->document->buf_length = i; - break; - } + schar->data = *chars++; + schar->attr = SCREEN_ATTR_FRAME; + copy_screen_chars(&POS(x, y), schar, 1); + schar->attr = attr; + part->char_width[x] = 0; + continue; } else { -good_char: - if (data == UCS_NO_BREAK_SPACE - && html_context->options->wrap_nbsp) - data = UCS_SPACE; - part->spaces[x] = (data == UCS_SPACE); - if (unicode_to_cell(data) == 2) { - schar->data = (unicode_val_T)data; - part->char_width[x] = 2; - copy_screen_chars(&POS(x++, y), schar, 1); - schar->data = UCS_NO_CHAR; - part->spaces[x] = 0; - part->char_width[x] = 0; - } else { - part->char_width[x] = unicode_to_cell(data); - schar->data = (unicode_val_T)data; + unsigned char i; + + for (i = 0; chars < end;i++) { + part->document->buf[i] = *chars++; } + part->document->buf_length = i; + break; + } + } else { +good_char: + if (data == UCS_NO_BREAK_SPACE + && html_context->options->wrap_nbsp) + data = UCS_SPACE; + part->spaces[x] = (data == UCS_SPACE); + if (unicode_to_cell(data) == 2) { + schar->data = (unicode_val_T)data; + part->char_width[x] = 2; + copy_screen_chars(&POS(x++, y), schar, 1); + schar->data = UCS_NO_CHAR; + part->spaces[x] = 0; + part->char_width[x] = 0; + } else { + part->char_width[x] = unicode_to_cell(data); + schar->data = (unicode_val_T)data; } } copy_screen_chars(&POS(x, y), schar, 1); From 974a5cdffd09910fb4ff83b63501f5c4e9ff8ff7 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 3 Feb 2007 19:51:45 +0200 Subject: [PATCH 51/67] Make entities[] static const. Inspired by bug 381. --- Unicode/gen-ent | 2 +- src/intl/entity.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Unicode/gen-ent b/Unicode/gen-ent index 1fdf1ffe3..e1f2d3182 100755 --- a/Unicode/gen-ent +++ b/Unicode/gen-ent @@ -16,7 +16,7 @@ N=`cat tmp | wc -l` cat > ../src/intl/entity.inc < Date: Sat, 3 Feb 2007 23:25:16 +0200 Subject: [PATCH 52/67] Make unicode_7b[] static const. The .data section of src/intl/charsets.o is only 40 bytes now. Inspired by bug 381. --- Unicode/gen-7b | 2 +- src/intl/uni_7b.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Unicode/gen-7b b/Unicode/gen-7b index 41a746d53..de3876ce7 100755 --- a/Unicode/gen-7b +++ b/Unicode/gen-7b @@ -8,7 +8,7 @@ N=`cat tmp | wc -l` echo '/* Automatically generated by gen-7b */' echo '/* DO NOT EDIT THIS FILE! EDIT Unicode/7bitrepl.lnx INSTEAD! */' echo -echo 'struct { unicode_val_T x; unsigned char *s; } unicode_7b ['`expr $N + 1`'] = {' +echo 'static const struct { unicode_val_T x; unsigned char *s; } unicode_7b ['`expr $N + 1`'] = {' sort tmp | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | sed 's/^/ {/' | sed 's/:/, "/' | sed 's/$/"},/' echo ' {-1, NULL}' echo '};' diff --git a/src/intl/uni_7b.inc b/src/intl/uni_7b.inc index e8491ed05..44f525b43 100644 --- a/src/intl/uni_7b.inc +++ b/src/intl/uni_7b.inc @@ -1,7 +1,7 @@ /* Automatically generated by gen-7b */ /* DO NOT EDIT THIS FILE! EDIT Unicode/7bitrepl.lnx INSTEAD! */ -struct { unicode_val_T x; unsigned char *s; } unicode_7b [2453] = { +static const struct { unicode_val_T x; unsigned char *s; } unicode_7b [2453] = { {0x00000000, "NUL"}, {0x00000001, "SH"}, {0x00000002, "SX"}, From 68b069a657d61bfc6612a733d78ee0b6e12d5ec8 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 4 Feb 2007 13:34:48 +0200 Subject: [PATCH 53/67] Make MIME backend metadata const. --- src/mime/backend/common.c | 6 +++--- src/mime/backend/default.c | 2 +- src/mime/backend/default.h | 2 +- src/mime/backend/mailcap.c | 2 +- src/mime/backend/mailcap.h | 2 +- src/mime/backend/mimetypes.c | 2 +- src/mime/backend/mimetypes.h | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mime/backend/common.c b/src/mime/backend/common.c index 33ae01e79..a103c1994 100644 --- a/src/mime/backend/common.c +++ b/src/mime/backend/common.c @@ -24,7 +24,7 @@ #include "mime/backend/mailcap.h" #include "mime/backend/mimetypes.h" -static struct mime_backend *mime_backends[] = { +static const struct mime_backend *const mime_backends[] = { &default_mime_backend, #ifdef CONFIG_MAILCAP &mailcap_mime_backend, @@ -39,7 +39,7 @@ static struct mime_backend *mime_backends[] = { unsigned char * get_content_type_backends(unsigned char *extension) { - struct mime_backend *backend; + const struct mime_backend *backend; int i; foreach_module (backend, mime_backends, i) { @@ -57,7 +57,7 @@ get_content_type_backends(unsigned char *extension) struct mime_handler * get_mime_handler_backends(unsigned char *ctype, int have_x) { - struct mime_backend *backend; + const struct mime_backend *backend; int i; foreach_module (backend, mime_backends, i) { diff --git a/src/mime/backend/default.c b/src/mime/backend/default.c index 3cbc7852c..30f273194 100644 --- a/src/mime/backend/default.c +++ b/src/mime/backend/default.c @@ -206,7 +206,7 @@ get_mime_handler_default(unsigned char *type, int have_x) } -struct mime_backend default_mime_backend = { +const struct mime_backend default_mime_backend = { /* get_content_type: */ get_content_type_default, /* get_mime_handler: */ get_mime_handler_default, }; diff --git a/src/mime/backend/default.h b/src/mime/backend/default.h index 041f9799a..734531073 100644 --- a/src/mime/backend/default.h +++ b/src/mime/backend/default.h @@ -5,7 +5,7 @@ #include "main/module.h" #include "mime/backend/common.h" -extern struct mime_backend default_mime_backend; +extern const struct mime_backend default_mime_backend; extern struct module default_mime_module; #endif diff --git a/src/mime/backend/mailcap.c b/src/mime/backend/mailcap.c index 3bdd2ca19..aaa17b3fb 100644 --- a/src/mime/backend/mailcap.c +++ b/src/mime/backend/mailcap.c @@ -661,7 +661,7 @@ get_mime_handler_mailcap(unsigned char *type, int options) } -struct mime_backend mailcap_mime_backend = { +const struct mime_backend mailcap_mime_backend = { /* get_content_type: */ NULL, /* get_mime_handler: */ get_mime_handler_mailcap, }; diff --git a/src/mime/backend/mailcap.h b/src/mime/backend/mailcap.h index ce5762498..bf81fd37d 100644 --- a/src/mime/backend/mailcap.h +++ b/src/mime/backend/mailcap.h @@ -5,7 +5,7 @@ #include "main/module.h" #include "mime/backend/common.h" -extern struct mime_backend mailcap_mime_backend; +extern const struct mime_backend mailcap_mime_backend; extern struct module mailcap_mime_module; #endif diff --git a/src/mime/backend/mimetypes.c b/src/mime/backend/mimetypes.c index 2b4d8ba62..b9e0b59ca 100644 --- a/src/mime/backend/mimetypes.c +++ b/src/mime/backend/mimetypes.c @@ -270,7 +270,7 @@ get_content_type_mimetypes(unsigned char *extension) return NULL; } -struct mime_backend mimetypes_mime_backend = { +const struct mime_backend mimetypes_mime_backend = { /* get_content_type: */ get_content_type_mimetypes, /* get_mime_handler: */ NULL, }; diff --git a/src/mime/backend/mimetypes.h b/src/mime/backend/mimetypes.h index c5b9eebb4..f6a188c5d 100644 --- a/src/mime/backend/mimetypes.h +++ b/src/mime/backend/mimetypes.h @@ -5,7 +5,7 @@ #include "main/module.h" #include "mime/backend/common.h" -extern struct mime_backend mimetypes_mime_backend; +extern const struct mime_backend mimetypes_mime_backend; extern struct module mimetypes_mime_module; #endif From 543b0f6768ea85885083571eb4bd650518bdabf8 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 4 Feb 2007 13:40:46 +0200 Subject: [PATCH 54/67] Make msg_dsc[] static const. --- src/network/state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/state.c b/src/network/state.c index 1d94d32b1..5b0f5a21a 100644 --- a/src/network/state.c +++ b/src/network/state.c @@ -22,7 +22,8 @@ struct s_msg_dsc { int n; unsigned char *msg; -} msg_dsc[] = { +}; +static const struct s_msg_dsc msg_dsc[] = { {S_WAIT, N_("Waiting in queue")}, {S_DNS, N_("Looking up host")}, {S_CONN, N_("Making connection")}, From 31dc108c7324eee05c251fc626030ed77e15367f Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 4 Feb 2007 13:46:45 +0200 Subject: [PATCH 55/67] end_with_known_tld: Make tld[] const. --- src/protocol/uri.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol/uri.c b/src/protocol/uri.c index d33ddf3cc..dd5cb0907 100644 --- a/src/protocol/uri.c +++ b/src/protocol/uri.c @@ -93,7 +93,7 @@ int end_with_known_tld(unsigned char *s, int slen) { int i; - static const unsigned char *tld[] = + static const unsigned char *const tld[] = { "com", "edu", "net", "org", "gov", "mil", "int", "biz", "arpa", From a5e321cb2baef39e90bc251b6ca5a75c3744443f Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 4 Feb 2007 13:54:07 +0200 Subject: [PATCH 56/67] Make instances of struct hierbox_browser_button const. And explicitly disable the "Save" buttons in anonymous mode, even though they are currently inside #if 0. --- src/bfu/hierbox.c | 2 +- src/bfu/hierbox.h | 2 +- src/bookmarks/dialogs.c | 4 ++-- src/cache/dialogs.c | 2 +- src/config/dialogs.c | 4 ++-- src/cookies/dialogs.c | 2 +- src/dialogs/download.c | 2 +- src/formhist/dialogs.c | 2 +- src/globhist/dialogs.c | 4 ++-- src/protocol/auth/dialogs.c | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/bfu/hierbox.c b/src/bfu/hierbox.c index 40416d36e..618830def 100644 --- a/src/bfu/hierbox.c +++ b/src/bfu/hierbox.c @@ -318,7 +318,7 @@ hierbox_browser(struct hierbox_browser *browser, struct session *ses) add_dlg_listbox(dlg, listbox_data); for (button = 0; button < browser->buttons_size; button++) { - struct hierbox_browser_button *but = &browser->buttons[button]; + const struct hierbox_browser_button *but = &browser->buttons[button]; /* Skip buttons that should not be displayed in anonymous mode */ if (anonymous && !but->anonymous) { diff --git a/src/bfu/hierbox.h b/src/bfu/hierbox.h index b98300de9..b4a354b95 100644 --- a/src/bfu/hierbox.h +++ b/src/bfu/hierbox.h @@ -18,7 +18,7 @@ struct hierbox_browser_button { struct hierbox_browser { unsigned char *title; void (*expansion_callback)(void); - struct hierbox_browser_button *buttons; + const struct hierbox_browser_button *buttons; size_t buttons_size; struct list_head boxes; diff --git a/src/bookmarks/dialogs.c b/src/bookmarks/dialogs.c index ed17ecc78..a7e3cea96 100644 --- a/src/bookmarks/dialogs.c +++ b/src/bookmarks/dialogs.c @@ -482,7 +482,7 @@ push_move_button(struct dialog_data *dlg_data, /**** MANAGEMENT *****************************************************/ -static struct hierbox_browser_button bookmark_buttons[] = { +static const struct hierbox_browser_button bookmark_buttons[] = { /* [gettext_accelerator_context(.bookmark_buttons)] */ { N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Edit"), push_edit_button, 0 }, @@ -498,7 +498,7 @@ static struct hierbox_browser_button bookmark_buttons[] = { { N_("Clear"), push_hierbox_clear_button, 0 }, /* TODO: Would this be useful? --jonas */ - { N_("Save"), push_save_button }, + { N_("Save"), push_save_button, 0 }, #endif }; diff --git a/src/cache/dialogs.c b/src/cache/dialogs.c index 5a2dc985d..839d6ba2a 100644 --- a/src/cache/dialogs.c +++ b/src/cache/dialogs.c @@ -224,7 +224,7 @@ static struct listbox_ops cache_entry_listbox_ops = { &cache_messages, }; -static struct hierbox_browser_button cache_buttons[] = { +static const struct hierbox_browser_button cache_buttons[] = { /* [gettext_accelerator_context(.cache_buttons)] */ { N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Goto"), push_hierbox_goto_button, 1 }, diff --git a/src/config/dialogs.c b/src/config/dialogs.c index fffecabe4..cff11a7fc 100644 --- a/src/config/dialogs.c +++ b/src/config/dialogs.c @@ -492,7 +492,7 @@ push_save_button(struct dialog_data *dlg_data, } -static struct hierbox_browser_button option_buttons[] = { +static const struct hierbox_browser_button option_buttons[] = { /* [gettext_accelerator_context(.option_buttons)] */ { N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Edit"), push_edit_button, 0 }, @@ -921,7 +921,7 @@ push_kbdbind_save_button(struct dialog_data *dlg_data, static INIT_LIST_HEAD(keybinding_dialog_list); -static struct hierbox_browser_button keybinding_buttons[] = { +static const struct hierbox_browser_button keybinding_buttons[] = { /* [gettext_accelerator_context(.keybinding_buttons)] */ { N_("~Add"), push_kbdbind_add_button, 0 }, { N_("~Delete"), push_hierbox_delete_button, 0 }, diff --git a/src/cookies/dialogs.c b/src/cookies/dialogs.c index d80407b06..b859bc9d4 100644 --- a/src/cookies/dialogs.c +++ b/src/cookies/dialogs.c @@ -471,7 +471,7 @@ push_save_button(struct dialog_data *dlg_data, struct widget_data *button) return EVENT_PROCESSED; } -static struct hierbox_browser_button cookie_buttons[] = { +static const struct hierbox_browser_button cookie_buttons[] = { /* [gettext_accelerator_context(.cookie_buttons)] */ { N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Add"), push_add_button, 1 }, diff --git a/src/dialogs/download.c b/src/dialogs/download.c index a9369962e..931169f0e 100644 --- a/src/dialogs/download.c +++ b/src/dialogs/download.c @@ -487,7 +487,7 @@ push_info_button(struct dialog_data *dlg_data, struct widget_data *button) * - Open button that can be used to set file_download->prog. * - Toggle notify button */ -static struct hierbox_browser_button download_buttons[] = { +static const struct hierbox_browser_button download_buttons[] = { /* [gettext_accelerator_context(.download_buttons)] */ { N_("~Info"), push_info_button }, { N_("~Abort"), push_hierbox_delete_button }, diff --git a/src/formhist/dialogs.c b/src/formhist/dialogs.c index 9eb5fec5c..2727e7032 100644 --- a/src/formhist/dialogs.c +++ b/src/formhist/dialogs.c @@ -204,7 +204,7 @@ push_save_button(struct dialog_data *dlg_data, struct widget_data *button) return EVENT_PROCESSED; } -static struct hierbox_browser_button formhist_buttons[] = { +static const struct hierbox_browser_button formhist_buttons[] = { /* [gettext_accelerator_context(.formhist_buttons)] */ { N_("~Login"), push_login_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 }, diff --git a/src/globhist/dialogs.c b/src/globhist/dialogs.c index 9d93f5d5d..896263dea 100644 --- a/src/globhist/dialogs.c +++ b/src/globhist/dialogs.c @@ -219,7 +219,7 @@ push_bookmark_button(struct dialog_data *dlg_data, /* The global history manager: */ -static struct hierbox_browser_button globhist_buttons[] = { +static const struct hierbox_browser_button globhist_buttons[] = { /* [gettext_accelerator_context(.globhist_buttons)] */ { N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 }, @@ -232,7 +232,7 @@ static struct hierbox_browser_button globhist_buttons[] = { { N_("C~lear"), push_hierbox_clear_button, 0 }, #if 0 /* TODO: Would this be useful? --jonas */ - { N_("Save"), push_save_button }, + { N_("Save"), push_save_button, 0 }, #endif }; diff --git a/src/protocol/auth/dialogs.c b/src/protocol/auth/dialogs.c index 0722df16f..ce39da6b5 100644 --- a/src/protocol/auth/dialogs.c +++ b/src/protocol/auth/dialogs.c @@ -256,7 +256,7 @@ static struct listbox_ops auth_listbox_ops = { &http_auth_messages, }; -static struct hierbox_browser_button auth_buttons[] = { +static const struct hierbox_browser_button auth_buttons[] = { /* [gettext_accelerator_context(.auth_buttons)] */ { N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 }, From d7e4b571463fad83f6b67f5e22e25483cb571b52 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 4 Feb 2007 15:17:49 +0200 Subject: [PATCH 57/67] Make instances of struct listbox_ops const. --- src/bfu/hierbox.c | 10 +++++----- src/bfu/hierbox.h | 2 +- src/bfu/listbox.c | 2 +- src/bfu/listbox.h | 2 +- src/bookmarks/dialogs.c | 2 +- src/cache/dialogs.c | 2 +- src/config/dialogs.c | 4 ++-- src/cookies/dialogs.c | 2 +- src/dialogs/download.c | 2 +- src/formhist/dialogs.c | 2 +- src/globhist/dialogs.c | 2 +- src/protocol/auth/dialogs.c | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/bfu/hierbox.c b/src/bfu/hierbox.c index 618830def..751d4c574 100644 --- a/src/bfu/hierbox.c +++ b/src/bfu/hierbox.c @@ -592,7 +592,7 @@ static const struct listbox_ops_messages default_listbox_ops_messages = { static void print_delete_error(struct listbox_item *item, struct terminal *term, - struct listbox_ops *ops, enum delete_error err) + const struct listbox_ops *ops, enum delete_error err) { struct string msg; unsigned char *errmsg; @@ -647,7 +647,7 @@ static void do_delete_item(struct listbox_item *item, struct listbox_context *info, int last) { - struct listbox_ops *ops = info->box->ops; + const struct listbox_ops *ops = info->box->ops; assert(item); @@ -720,7 +720,7 @@ query_delete_selected_item(void *context_) struct listbox_context *context, *oldcontext = context_; struct terminal *term = oldcontext->term; struct listbox_data *box = oldcontext->box; - struct listbox_ops *ops = box->ops; + const struct listbox_ops *ops = box->ops; struct listbox_item *item = box->sel; unsigned char *text; enum delete_error delete; @@ -779,7 +779,7 @@ push_hierbox_delete_button(struct dialog_data *dlg_data, /* [gettext_accelerator_context(push_hierbox_delete_button)] */ struct terminal *term = dlg_data->win->term; struct listbox_data *box = get_dlg_listbox_data(dlg_data); - struct listbox_ops *ops = box->ops; + const struct listbox_ops *ops = box->ops; struct listbox_item *item = box->sel; struct listbox_context *context; @@ -842,7 +842,7 @@ push_hierbox_clear_button(struct dialog_data *dlg_data, { /* [gettext_accelerator_context(push_hierbox_clear_button)] */ struct listbox_data *box = get_dlg_listbox_data(dlg_data); - struct listbox_ops *ops = box->ops; + const struct listbox_ops *ops = box->ops; struct terminal *term = dlg_data->win->term; struct listbox_context *context; diff --git a/src/bfu/hierbox.h b/src/bfu/hierbox.h index b4a354b95..513d09748 100644 --- a/src/bfu/hierbox.h +++ b/src/bfu/hierbox.h @@ -24,7 +24,7 @@ struct hierbox_browser { struct list_head boxes; struct list_head dialogs; struct listbox_item root; - struct listbox_ops *ops; + const struct listbox_ops *ops; /* For saving state */ unsigned int do_not_save_state:1; diff --git a/src/bfu/listbox.c b/src/bfu/listbox.c index f0da43827..0ad32a987 100644 --- a/src/bfu/listbox.c +++ b/src/bfu/listbox.c @@ -452,7 +452,7 @@ display_listbox_item(struct listbox_item *item, void *data_, int *offset) } else { unsigned char *text; - struct listbox_ops *ops = data->box->ops; + const struct listbox_ops *ops = data->box->ops; int len_bytes; assert(ops && ops->get_info); diff --git a/src/bfu/listbox.h b/src/bfu/listbox.h index 46c3184ba..bca2a2662 100644 --- a/src/bfu/listbox.h +++ b/src/bfu/listbox.h @@ -100,7 +100,7 @@ struct listbox_ops { struct listbox_data { LIST_HEAD(struct listbox_data); - struct listbox_ops *ops; /* Backend-provided operations */ + const struct listbox_ops *ops; /* Backend-provided operations */ struct listbox_item *sel; /* Item currently selected */ struct listbox_item *top; /* Item which is on the top line of the box */ diff --git a/src/bookmarks/dialogs.c b/src/bookmarks/dialogs.c index a7e3cea96..bb6fa4481 100644 --- a/src/bookmarks/dialogs.c +++ b/src/bookmarks/dialogs.c @@ -139,7 +139,7 @@ static struct listbox_ops_messages bookmarks_messages = { N_("Do you really want to remove all bookmarks?"), }; -static struct listbox_ops bookmarks_listbox_ops = { +static const struct listbox_ops bookmarks_listbox_ops = { lock_bookmark, unlock_bookmark, is_bookmark_used, diff --git a/src/cache/dialogs.c b/src/cache/dialogs.c index 839d6ba2a..b0a33b346 100644 --- a/src/cache/dialogs.c +++ b/src/cache/dialogs.c @@ -209,7 +209,7 @@ static struct listbox_ops_messages cache_messages = { NULL, }; -static struct listbox_ops cache_entry_listbox_ops = { +static const struct listbox_ops cache_entry_listbox_ops = { lock_cache_entry, unlock_cache_entry, is_cache_entry_used, diff --git a/src/config/dialogs.c b/src/config/dialogs.c index cff11a7fc..35d893c48 100644 --- a/src/config/dialogs.c +++ b/src/config/dialogs.c @@ -242,7 +242,7 @@ delete_option_item(struct listbox_item *item, int last) mark_option_as_deleted(option); } -static struct listbox_ops options_listbox_ops = { +static const struct listbox_ops options_listbox_ops = { lock_option, unlock_option, is_option_used, @@ -727,7 +727,7 @@ delete_keybinding_item(struct listbox_item *item, int last) free_keybinding(keybinding); } -static struct listbox_ops keybinding_listbox_ops = { +static const struct listbox_ops keybinding_listbox_ops = { lock_keybinding, unlock_keybinding, is_keybinding_used, diff --git a/src/cookies/dialogs.c b/src/cookies/dialogs.c index b859bc9d4..1b8101668 100644 --- a/src/cookies/dialogs.c +++ b/src/cookies/dialogs.c @@ -219,7 +219,7 @@ static struct listbox_ops_messages cookies_messages = { N_("Do you really want to remove all cookies?"), }; -static struct listbox_ops cookies_listbox_ops = { +static const struct listbox_ops cookies_listbox_ops = { lock_cookie, unlock_cookie, is_cookie_used, diff --git a/src/dialogs/download.c b/src/dialogs/download.c index 931169f0e..63c1a055e 100644 --- a/src/dialogs/download.c +++ b/src/dialogs/download.c @@ -445,7 +445,7 @@ static struct listbox_ops_messages download_messages = { N_("Do you really want to interrupt all downloads?"), }; -static struct listbox_ops downloads_listbox_ops = { +static const struct listbox_ops downloads_listbox_ops = { lock_file_download, unlock_file_download, is_file_download_used, diff --git a/src/formhist/dialogs.c b/src/formhist/dialogs.c index 2727e7032..c4a65ddad 100644 --- a/src/formhist/dialogs.c +++ b/src/formhist/dialogs.c @@ -142,7 +142,7 @@ static struct listbox_ops_messages formhist_messages = { N_("Do you really want to remove all forms?"), }; -static struct listbox_ops formhist_listbox_ops = { +static const struct listbox_ops formhist_listbox_ops = { lock_formhist_data, unlock_formhist_data, is_formhist_data_used, diff --git a/src/globhist/dialogs.c b/src/globhist/dialogs.c index 896263dea..b8dc26a52 100644 --- a/src/globhist/dialogs.c +++ b/src/globhist/dialogs.c @@ -127,7 +127,7 @@ static struct listbox_ops_messages globhist_messages = { N_("Do you really want to remove all history entries?"), }; -static struct listbox_ops gh_listbox_ops = { +static const struct listbox_ops gh_listbox_ops = { lock_globhist_item, unlock_globhist_item, is_globhist_item_used, diff --git a/src/protocol/auth/dialogs.c b/src/protocol/auth/dialogs.c index ce39da6b5..784135e4b 100644 --- a/src/protocol/auth/dialogs.c +++ b/src/protocol/auth/dialogs.c @@ -241,7 +241,7 @@ static struct listbox_ops_messages http_auth_messages = { N_("Do you really want to remove all auth entries?"), }; -static struct listbox_ops auth_listbox_ops = { +static const struct listbox_ops auth_listbox_ops = { lock_auth_entry, unlock_auth_entry, is_auth_entry_used, From c8a57c562f9cc7f5c460425095996a45de2b0a23 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 4 Feb 2007 15:18:45 +0200 Subject: [PATCH 58/67] Make http_code[] const; make http_code[].str point to const. --- src/protocol/http/codes.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/protocol/http/codes.c b/src/protocol/http/codes.c index bdc59dd4b..2fd716d24 100644 --- a/src/protocol/http/codes.c +++ b/src/protocol/http/codes.c @@ -25,11 +25,11 @@ struct http_code { int num; - unsigned char *str; + const unsigned char *str; }; /* Source: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html */ -static struct http_code http_code[] = { +static const struct http_code http_code[] = { { 100, "Continue" }, { 101, "Switching Protocols" }, { 200, "OK" }, @@ -77,18 +77,19 @@ static int compare_http_codes(const void *key, const void *element) { int first = (long) key; - int second = ((struct http_code *) element)->num; + int second = ((const struct http_code *) element)->num; return first - second; } -static unsigned char * +static const unsigned char * http_code_to_string(int code) { - struct http_code *element = bsearch((void *) (long) code, http_code, - sizeof_array(http_code), - sizeof(*element), - compare_http_codes); + const struct http_code *element + = bsearch((void *) (long) code, http_code, + sizeof_array(http_code), + sizeof(*element), + compare_http_codes); if (element) return element->str; @@ -100,7 +101,7 @@ http_code_to_string(int code) static unsigned char * get_http_error_document(struct terminal *term, struct uri *uri, int code) { - unsigned char *codestr = http_code_to_string(code); + const unsigned char *codestr = http_code_to_string(code); unsigned char *title = asprintfa(_("HTTP error %03d", term), code); struct string string; From c62e9f9eaef592fea118ac39d3479cbe717dccfa Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 4 Feb 2007 15:21:57 +0200 Subject: [PATCH 59/67] check_http_server_bugs: Make buggy_servers[] const. --- src/protocol/http/http.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/protocol/http/http.c b/src/protocol/http/http.c index 00c7bfbea..31370255a 100644 --- a/src/protocol/http/http.c +++ b/src/protocol/http/http.c @@ -440,8 +440,9 @@ static int check_http_server_bugs(struct uri *uri, struct http_connection_info *http, unsigned char *head) { - unsigned char *server, **s; - static unsigned char *buggy_servers[] = { + unsigned char *server; + const unsigned char *const *s; + static const unsigned char *const buggy_servers[] = { "mod_czech/3.1.0", "Purveyor", "Netscape-Enterprise", From a565365a8dc571074962ac7e938ad4c32d99f9d1 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 4 Feb 2007 15:32:35 +0200 Subject: [PATCH 60/67] do_type_query: Make known_types[] const. --- src/session/download.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/session/download.c b/src/session/download.c index 00ffbabbc..ee9917024 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -1265,7 +1265,7 @@ do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_hand struct { unsigned char *type; unsigned int plain:1; -} static known_types[] = { +} static const known_types[] = { { "text/html", 0 }, { "text/plain", 1 }, { "application/xhtml+xml", 0 }, /* RFC 3236 */ From 93aea42b96464b174e9381915d3ab9fff082289e Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Sun, 4 Feb 2007 23:13:39 +0000 Subject: [PATCH 61/67] Unhighlight previously selected link when using goto-mark In goto_mark, copy the current_link of the old view state to the old_current_link of the new view state so that clear_link will properly clear the highlight for that link. This fixes a bug introduced with the removal of link_bg in commit c91c763d49bc7cd01aa06c0dabbd15fecc97da80. --- src/viewer/text/marks.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/viewer/text/marks.c b/src/viewer/text/marks.c index eafdcc886..7aaeb0ab5 100644 --- a/src/viewer/text/marks.c +++ b/src/viewer/text/marks.c @@ -71,6 +71,7 @@ index_from_char(unsigned char mark) void goto_mark(unsigned char mark, struct view_state *vs) { + int old_current_link; #ifdef CONFIG_ECMASCRIPT struct ecmascript_interpreter *ecmascript; int ecmascript_fragile; @@ -88,6 +89,7 @@ goto_mark(unsigned char mark, struct view_state *vs) if (!marks[i] || !compare_uri(marks[i]->uri, vs->uri, 0)) return; + old_current_link = vs->current_link; #ifdef CONFIG_ECMASCRIPT ecmascript = vs->ecmascript; ecmascript_fragile = vs->ecmascript_fragile; @@ -103,6 +105,7 @@ goto_mark(unsigned char mark, struct view_state *vs) vs->ecmascript = ecmascript; vs->ecmascript_fragile = ecmascript_fragile; #endif + vs->old_current_link = old_current_link; } static void From aa40452a680ca9ae96da966b2610d322894c309b Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 11 Feb 2007 01:27:49 +0200 Subject: [PATCH 62/67] Add some bug numbers to NEWS. --- NEWS | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 90db5d144..04ed78f5a 100644 --- a/NEWS +++ b/NEWS @@ -92,8 +92,8 @@ roughly in decreasing order of importance. - (bugfix 396) Never show empty filename in the what-to-do dialog * Changes in support for URI schemes, protocols, caching, and encodings - (workaround 841) SMB is now disabled because of CVE-2006-5925. - - (new feature) Native FSP protocol support (replaces CGI program in - contrib/fsp/) + - (new feature 630) Native FSP protocol support (replaces CGI + program in contrib/fsp/) - (new feature) Local CGI - (experimental, bugfix) Gopher changes, including crash fixes - (enhancement) FTP handler parses file sizes better @@ -139,7 +139,7 @@ roughly in decreasing order of importance. - (new feature) Highlight links as one enters link prefixes. - (new feature) Backspace backs out the last digit of the prefix. - (bugfix) Tabs opened by -remote now go behind existing dialogs. - - (new feature) -dump-color-mode + - (new feature 622) -dump-color-mode - (bugfix) Fix accesskeys so that they work when priority is 0 - (enhancement) Text type-ahead searching: don't follow current link on enter @@ -237,7 +237,7 @@ have already been considered. - (bugfix) Fix a crash when adding a server in the cookie manager. - (bugfix) cookies: "Add Server" ignores "cookies.accept_policy". - (bugfix) Fix data: protocol. - - (bugfix) Properly deselect the main menu instead of crashing + - (bugfix 747) Properly deselect the main menu instead of crashing - (bugfix 778) ELinks crashes on binary files when document.plain.display_links is set - (bugfix 784) UTF-8 mode misconverts non-ASCII entity in Latin-1 @@ -259,6 +259,7 @@ have already been considered. - (bugfix 835) Text in textarea is unaffected by horizontal scrolling of document in UTF-8 mode - (bugfix 823) Big textarea is too slow with CONFIG_UTF8 + - (bugfix 754) Pressing ESC do not pop up main menu anymore. * Reverted changes: - (new feature) document.write, reverted in 2c087e52e74528a720621186b91880463e039d50 From cd608eb03e781bc44abd1a8f6a361a8677dec215 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 11 Feb 2007 01:35:34 +0200 Subject: [PATCH 63/67] Revive #lua-scripting and #ecmascript links in installation.html. installation.html built from installation.txt does not include the sections about LUA scripting and ECMAScript, but installation.txt tries to link to them via fragment identifiers. Point those links to manual.html instead; not manual.html-chunked because the file names there might not remain stable. Alternatively, installation.txt could be changed to include lua-scripting.txt and ecmascript.txt into installation.html. --- doc/installation.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/installation.txt b/doc/installation.txt index b8e076e73..efabb1447 100644 --- a/doc/installation.txt +++ b/doc/installation.txt @@ -34,7 +34,12 @@ have the following libraries and programs installed: Dependency Description ----------------------------------------------------------------------------- Lua or Guile Makes it possible to write scripting plugins. \ +ifdef::installation-webpage[] + See link:manual.html#lua-scripting[the Elinks - Lua interface] \ +endif::installation-webpage[] +ifndef::installation-webpage[] See <> \ +endif::installation-webpage[] for more info. GNU zip For handling compressed documents both locally and \ sent from server. @@ -50,7 +55,12 @@ xterm with 256 colors Program atleast patch level 179 or rxvt program \ libidn For internationalized domain names. SpiderMonkey Mozilla's JavaScript engine for getting \ JavaScript/ECMAScript support in ELinks. \ +ifdef::installation-webpage[] + See also link:manual.html#ecmascript[notes on ECMAScript support]. +endif::installation-webpage[] +ifndef::installation-webpage[] See also <>. +endif::installation-webpage[] ----------------------------------------------------------------------------- When compiling, you also need the header files for the libraries. Most OS From 3caec64c51e0a8291ff07145f746632385352db3 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 11 Feb 2007 20:55:58 +0200 Subject: [PATCH 64/67] doc: Ctrl-Alt- keystrokes can be bound too. --- doc/elinkskeys.5.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/elinkskeys.5.txt b/doc/elinkskeys.5.txt index a59c15835..30715ee16 100644 --- a/doc/elinkskeys.5.txt +++ b/doc/elinkskeys.5.txt @@ -32,9 +32,9 @@ where: :: - is a case sensitive key, which you can prefix with 'Ctrl-' or 'Alt-'. - 'Ctrl-' must be followed by an uppercase key. See below for a list of - valid keys. + is a case sensitive key, which you can prefix with 'Ctrl-', 'Alt-', + or both. 'Ctrl-' must be followed by an uppercase key. See below for + a list of valid keys. :: From 763f03f146cc1391b303c8074556f0ddea1e3c7a Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 11 Feb 2007 20:56:41 +0200 Subject: [PATCH 65/67] get_clipboard_text: Disable pasting from GNU Screen's clipboard. --- NEWS | 4 ++-- src/osdep/osdep.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 04ed78f5a..9e3c349bf 100644 --- a/NEWS +++ b/NEWS @@ -34,7 +34,6 @@ roughly in decreasing order of importance. - (enhancement) Reject invalid UTF-8 input from documents and terminals. * Changes in terminal support - - (new feature) Support for pasting from GNU screen clipboard - (enhancement) Make ELinks FreeBSD friendly. Defined keys used on FreeBSD console - (enhancement) Mouse wheel support on BSD via moused -z 4 @@ -72,7 +71,7 @@ roughly in decreasing order of importance. - (enhancement 887) Save in cookie manager should save cookies even if unmodified. * Changes in the user interface - - (new feature) Internal clipboard support + - (new feature 145) Internal clipboard support - (enhancement) Place the cursor on the current listbox item, to help screen readers - (enhancement) Localization updates @@ -270,6 +269,7 @@ have already been considered. - (new feature) Let plain text change colors with ESC [ 31 m or similar control sequences, reverted in 2a6125e3d0407b588eb286d4d0ff5c98c23ebda9 + - (enhancement) Support for pasting from GNU screen clipboard * Unimportant changes: - (enhancement) If select fails, save its errno. diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c index ea36824a4..d7705bed9 100644 --- a/src/osdep/osdep.c +++ b/src/osdep/osdep.c @@ -349,6 +349,26 @@ static unsigned char *clipboard; unsigned char * get_clipboard_text(void) { + /* The following support for GNU Screen's clipboard is + * disabled for two reasons: + * + * 1. It does not actually return the string from that + * clipboard, but rather causes the clipboard contents to + * appear in stdin. get_clipboard_text is normally called + * because the user pressed a Paste key in an input field, + * so the characters end up being inserted in that field; + * but if there are newlines in the clipboard, then the + * field may lose focus, in which case the remaining + * characters may trigger arbitrary actions in ELinks. + * + * 2. It pastes from both GNU Screen's clipboard and the ELinks + * internal clipboard. Because set_clipboard_text also sets + * them both, the same text would typically get pasted twice. + * + * Users can instead use the GNU Screen key bindings to run the + * paste command. This method still suffers from problem 1 but + * any user of GNU Screen should know that already. */ +#if 0 /* GNU Screen's clipboard */ if (is_gnuscreen()) { struct string str; @@ -359,6 +379,7 @@ get_clipboard_text(void) if (str.length) exe(str.source); if (str.source) done_string(&str); } +#endif return stracpy(empty_string_or_(clipboard)); } From 315f4e0342ce420a1e3327e381e89b90fd3f6d41 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 11 Feb 2007 23:34:44 +0200 Subject: [PATCH 66/67] doc: cut-clipboard does not merely delete text from clipboard. --- src/config/actions-edit.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/actions-edit.inc b/src/config/actions-edit.inc index 058674bec..a6ded8592 100644 --- a/src/config/actions-edit.inc +++ b/src/config/actions-edit.inc @@ -11,7 +11,7 @@ ACTION_(EDIT, "backspace", BACKSPACE, N__("Delete character in front of the curs ACTION_(EDIT, "beginning-of-buffer", BEGINNING_OF_BUFFER, N__("Go to the first line of the buffer"), 0), ACTION_(EDIT, "cancel", CANCEL, N__("Cancel current state"), 0), ACTION_(EDIT, "copy-clipboard", COPY_CLIPBOARD, N__("Copy text to clipboard"), 0), -ACTION_(EDIT, "cut-clipboard", CUT_CLIPBOARD, N__("Delete text from clipboard"), 0), +ACTION_(EDIT, "cut-clipboard", CUT_CLIPBOARD, N__("Cut text to clipboard"), 0), ACTION_(EDIT, "delete", DELETE, N__("Delete character under cursor"), 0), ACTION_(EDIT, "down", DOWN, N__("Move cursor downwards"), 0), ACTION_(EDIT, "end", END, N__("Go to the end of the page/line"), 0), From c64f1c84dcbf1494b9cee903b7dd26f8ffb5b032 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Mon, 12 Feb 2007 01:12:03 +0200 Subject: [PATCH 67/67] NEWS: Temporarily mention bug 794. --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 9e3c349bf..fb9ec5e53 100644 --- a/NEWS +++ b/NEWS @@ -259,6 +259,7 @@ have already been considered. scrolling of document in UTF-8 mode - (bugfix 823) Big textarea is too slow with CONFIG_UTF8 - (bugfix 754) Pressing ESC do not pop up main menu anymore. + - (bugfix 794) tab-close-all-but-current crashes * Reverted changes: - (new feature) document.write, reverted in 2c087e52e74528a720621186b91880463e039d50